Subversion Repositories Programming Utils

Compare Revisions

Ignore whitespace Rev 46 → Rev 47

/trunk/C-CPP-utils/supermakemake/MakefileObject.cpp
86,6 → 86,10
 
while( theFile.good() ){
theFile.getline( buffer, 300 );
if( theFile.gcount() >= 300 ){
cerr << "ERROR: More than 300 characters in a single line of your Makefile. Split the lines up!" << endl;
}
 
if( memcmp( buffer, "CPP_FILES", 9 ) == 0 ){
parseFileList( buffer, &cpp_files );
}
107,7 → 111,7
}
 
if( memcmp( buffer, "CPPFLAGS", 8 ) == 0 ){
//cpp_flags = parseList( buffer );
cpp_flags = parseList( buffer );
}
 
if( memcmp( buffer, "CFLAGS", 6 ) == 0 ){
137,6 → 141,10
if( memcmp( buffer, "CXX =", 5 ) == 0 ){
config["cpp_compiler"] = parseList( buffer );
}
 
printf("BUFFER IS |%s|\n", buffer );
fflush(stdout);
}
 
free( buffer );
610,64 → 618,54
cout << "# Shared Object Targets\n";
cout << "#\n";
}
*/
 
void Write::write_install_targets( DirList &dirlist ){
void Makefile::write_install_targets( ){
cout << "#\n";
cout << "# Installation Targets\n";
cout << "#\n";
 
const char* extension = "";
#ifdef WINDOWS
extension = ".exe";
#endif
 
//First, write out our dependencies
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 ";
cout << FileListInserter( cpp_main, extension );
if( !cpp_main.empty() ) {
cout << " ";
}
 
cout << FileListInserter( c_main, extension );
if( !c_main.empty() ) {
cout << " ";
}
 
cout << FileListInserter( s_main, extension );
cout << "\n";
 
//Now, write out the actual install command
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 << FileListInserter( cpp_main, extension );
if( !cpp_main.empty() ) {
cout << " ";
}
 
cout << (*configuration)["prefix"];
cout << "\n\n" ;
cout << FileListInserter( c_main, extension );
if( !c_main.empty() ) {
cout << " ";
}
 
cout << FileListInserter( s_main, extension );
 
cout << (*configuration)["prefix"];
cout << "\n\n" ;
}
 
/*
void Write::write_trailer( DirList &dirlist, bool useGCC ){
cout << "#\n";
cout << "# Housekeeping\n";
733,3 → 731,34
cout << endl; // to flush buffer
}
*/
 
void Makefile::findMainPrograms(){
 
//First, let's check all of our C files
for( set<string>::iterator it = c_files.begin(); it != c_files.end(); it++ ){
if( DirList::hasMainFunction( (*it) ) ){
c_main.insert( *it );
}else{
c_other.insert( *it );
}
}
 
//Now, all of our CPP files
for( set<string>::iterator it = cpp_files.begin(); it != cpp_files.end(); it++ ){
if( DirList::hasMainFunction( (*it) ) ){
cpp_main.insert( *it );
}else{
cpp_other.insert( *it );
}
}
 
//Finally, all of our assembly files
for( set<string>::iterator it = s_files.begin(); it != s_files.end(); it++ ){
if( DirList::hasMainLabel( (*it) ) ){
s_main.insert( *it );
}else{
s_other.insert( *it );
}
}
 
}
/trunk/C-CPP-utils/supermakemake/MakefileObject.h
40,6 → 40,10
 
void doFork(int);
 
void findMainPrograms();
 
void write_install_targets();
 
private:
 
//Lists of files
/trunk/C-CPP-utils/supermakemake/dirlist.cpp
39,11 → 39,23
if( it != ins.files.begin() ) { // don't put space before first item
os << " ";
}
 
if( ins.suffix ) {
if( ( DirList::basename( *it ).size() + os.tellp() ) >= 80 ){
//if this would put us over 80 characters on the line,
//put a newline
os << "\n";
}
os << DirList::basename( *it ) << ins.suffix;
} else {
if( ( ( *it ).size() + os.tellp() ) >= 80 ){
//if this would put us over 80 characters on the line,
//put a newline
os << "\n";
}
os << *it;
}
 
}
return os;
}