/C-CPP-utils/supermakemake/write.h |
---|
28,8 → 28,8 |
/* Class that writes the makefile |
* |
* Default configuration settings: |
* config["c_compiler"] = gcc //the C compiler to use |
* config["cpp_compiler"] = g++ // the C++ compiler to use |
* config["c_compiler"] = cc //the C compiler to use |
* config["cpp_compiler"] = CC // the C++ compiler to use |
* config["no_debug"] = false //if true, do not output debugging information |
* config["header_file"] = header.mak //file to read in to re-define some standard flags |
* config["program_file"] = programs.mak //file to be read in to override dependency generation |
49,7 → 49,7 |
private: // Helper functions |
void write_header(); |
void write_header( void ); |
void write_lists( DirList &dirlist ); |
void write_main_targets( DirList &dirlist ); |
void write_main_target_list( const set<string> &list, |
57,6 → 57,9 |
string local_libs ); |
void write_dependencies( DirList &dirlist ); |
void write_dependency_list( const set<string> &list, DirList &dirlist ); |
void write_archive_targets( void ); |
void write_shared_obj_targets( void ); |
void write_install_targets( DirList &dirlist ); |
void write_trailer( DirList &dirlist, bool useGCC ); |
private: // Private variables |
/C-CPP-utils/supermakemake/write.cpp |
---|
39,6 → 39,8 |
write_main_targets( dirlist ); |
write_dependencies( dirlist ); |
write_install_targets( dirlist ); |
bool useGCC = (*configuration)["c_compiler"] == "gcc"; |
write_trailer( dirlist, useGCC ); |
} |
72,7 → 74,7 |
cout << "# Created by makemake (" ; |
}*/ |
cout << "# Created by " << (*configuration)["executable"]; |
cout << " " << PLATFORM << " " << __DATE__ ") on " << ctime( &now ); |
cout << " " << PLATFORM << " (" << __DATE__ ") on " << ctime( &now ); |
cout << "#\n"; |
cout << "\n"; |
cout << "#\n"; |
395,6 → 397,75 |
} |
} |
void Write::write_archive_targets( ){ |
cout << "#\n"; |
cout << "# Archive Targets\n"; |
cout << "#\n"; |
} |
void Write::write_shared_obj_targets( ){ |
cout << "#\n"; |
cout << "# Shared Object Targets\n"; |
cout << "#\n"; |
} |
void Write::write_install_targets( DirList &dirlist ){ |
cout << "#\n"; |
cout << "# Installation Targets\n"; |
cout << "#\n"; |
cout << "\n"; |
cout << "install: "; |
#ifdef WINDOWS |
cout << FileListInserter( dirlist.cpp_main, ".exe" ); |
#else |
cout << FileListInserter( dirlist.cpp_main, "" ); |
#endif |
if( !dirlist.cpp_main.empty() ) { |
cout << " "; |
} |
#ifdef WINDOWS |
cout << FileListInserter( dirlist.c_main, ".exe" ); |
#else |
cout << FileListInserter( dirlist.c_main, "" ); |
#endif |
if( !dirlist.c_main.empty() ) { |
cout << " "; |
} |
#ifdef WINDOWS |
cout << FileListInserter( dirlist.ass_main, ".exe" ); |
#else |
cout << FileListInserter( dirlist.ass_main, "" ); |
#endif |
cout << "\n"; |
cout << "\t/usr/bin/install "; |
#ifdef WINDOWS |
cout << FileListInserter( dirlist.cpp_main, ".exe" ); |
#else |
cout << FileListInserter( dirlist.cpp_main, "" ); |
#endif |
if( !dirlist.cpp_main.empty() ) { |
cout << " "; |
} |
#ifdef WINDOWS |
cout << FileListInserter( dirlist.c_main, ".exe" ); |
#else |
cout << FileListInserter( dirlist.c_main, "" ); |
#endif |
if( !dirlist.c_main.empty() ) { |
cout << " "; |
} |
#ifdef WINDOWS |
cout << FileListInserter( dirlist.ass_main, ".exe" ); |
#else |
cout << FileListInserter( dirlist.ass_main, "" ); |
#endif |
cout << (*configuration)["prefix"]; |
cout << "\n\n" ; |
} |
void Write::write_trailer( DirList &dirlist, bool useGCC ){ |
cout << "#\n"; |
cout << "# Housekeeping\n"; |
/C-CPP-utils/supermakemake/makemake.cpp |
---|
55,17 → 55,11 |
} |
int main( int argc, char **argv ){ |
char* progName; |
string header_file( "header.mak" ); |
string programs_file( "programs.mak" ); |
char* progName; |
// Flag indicates whether the CCFLAGS and CFLAGS output should |
// have -g debugging option omitted |
bool noDebugFlag( false ); |
map<string, string> config; |
config["c_compiler"] = "gcc"; |
config["cpp_compiler"] = "g++"; |
config["c_compiler"] = "cc"; |
config["cpp_compiler"] = "CC"; |
config["no_debug"] = "false"; |
config["header_file"] = "header.mak"; |
config["program_file"] = "programs.mak"; |
77,9 → 71,6 |
config["prefix"] = "/usr/bin"; |
config["dirs"] = "."; |
// Flag indicates using gnu compiler |
bool useGCC = false; |
// check gnu compiler make or sun compiler make |
// if first letter of executable is 'g' then gnu otherwise sun |
92,7 → 83,9 |
} |
} |
if(argv[0][0] == 'g') { |
useGCC = true; |
//useGCC = true; |
config["c_compiler"] = "gcc"; |
config["cpp_compiler"] = "g++"; |
} |
progName = argv[0]; |
config["executable"] = string( progName ); |
102,17 → 95,17 |
// |
while( argc--, *++argv != NULL && **argv == '-' ){ |
if( strcmp( *argv, "-header" ) == 0 && argv[ 1 ] != NULL ){ |
header_file = *++argv; |
config["header_file"] = *++argv; |
argc--; |
} else if( strcmp( *argv, "-no-header" ) == 0 ){ |
header_file = "//"; |
config["header_file"] = "//"; |
} else if( strcmp( *argv, "-programs" ) == 0 && argv[ 1 ] != NULL ){ |
programs_file = *++argv; |
config["programs_file"] = *++argv; |
argc--; |
} else if( strcmp( *argv, "-no-programs" ) == 0 ){ |
programs_file = "//"; |
config["header_file"] = "//"; |
} else if(strcmp("-no-debug",*argv) == 0){ |
noDebugFlag = true; |
config["no-debug"] = "true"; |
} else if( strcmp("--help", *argv) == 0 ){ |
printHelp( progName ); |
return 0; |
125,9 → 118,13 |
} else if( strcmp("-so", *argv) == 0 ){ |
cout << "make shared object file NOT YET IMPLEMENTED" << endl; |
} else if( strcmp("-install", *argv) == 0 ){ |
config["install"] = "true"; |
} else if( strcmp("-prefix", *argv) == 0 ){ |
if( argc != 0 ){ |
config["install"] = "true"; |
config["prefix"] = *++argv; |
argc--; |
} |
} else if( strcmp("-dirs", *argv) == 0 ){ |
cout << "DIRS NOT YET IMPLEMENTED" << endl; |
//} else if( strcmp("-update", *argv) == 0 ){ |
144,6 → 141,10 |
} |
} |
} |
map<string, string>::iterator it; |
for ( it=config.begin() ; it != config.end(); it++ ) |
cout << (*it).first << " => " << (*it).second << endl; |
// |
// Read the current directory (and cmd line arguments) to find |