From 88f0f2e8b97f0990d6ecd71d920eec25b1b968c0 Mon Sep 17 00:00:00 2001 From: Adam Fedor Date: Tue, 29 Apr 2003 04:33:39 +0000 Subject: [PATCH] Change appendCFiles to appendOtherSources git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@16580 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 16 +++ PCAppProj/PCAppProject.m | 5 +- PCBundleProj/PCBundleProject.m | 6 +- PCGormProj/PCGormProject.m | 5 +- PCLib/PCMakefileFactory.h | 4 +- PCLib/PCMakefileFactory.m | 157 ++++++++++++----------- PCLib/PCProject.m | 4 +- PCLibProj/PCLibProject.m | 5 +- PCRenaissanceProj/PCRenaissanceProject.m | 2 +- PCToolProj/PCToolProject.m | 5 +- 10 files changed, 118 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef22c78..8679c5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2003-04-28 Adam Fedor + + * PCLib/PCMakefileFactory.m (-appendOtherSources): Changed from + appendCFiles. + (-appendHeaders:forTarget:, -appendClasses:forTarget:, + -appendOtherSources:forTarget): New. + (-appendHeaders:, -appendClasses:, -appendOtherSources:, + -appendLibraryHeaders:, appendLibraryClasses:, + appendLibraryOtherSources:): Use them. + * PCLib/PCProject.m (-fileExtensionsForCategory): Add .m to + PCOtherSources. + * PCAppProj/PCAppProject.m (-writeMakefile): Use appendOtherSources: + * PCBundleProj/PCBundleProject.m, PCGormProj/PCGormProject.m, + PCLibProj/PCLibProject.m, PCRenaissanceProj/PCRenaissanceProject.m, + PCToolProj/PCToolProject.m: Idem. + 2003-04-27 Adam Fedor * PCAppProj/PCAppProj.pcproj, PCBaseFileTypes/PCBaseFileTypes.pcproj, diff --git a/PCAppProj/PCAppProject.m b/PCAppProj/PCAppProject.m index f93befd..fb99ca8 100644 --- a/PCAppProj/PCAppProject.m +++ b/PCAppProj/PCAppProject.m @@ -190,12 +190,12 @@ [mf appendHeaders:[dict objectForKey:PCHeaders]]; [mf appendClasses:[dict objectForKey:PCClasses]]; - [mf appendCFiles:[dict objectForKey:PCOtherSources]]; + [mf appendOtherSources:[dict objectForKey:PCOtherSources]]; [mf appendTailForApp]; // Write the new file to disc! - if (mfd = [mf encodedMakefile]) + if ((mfd = [mf encodedMakefile])) { if ([mfd writeToFile:mfl atomically:YES]) { @@ -223,6 +223,7 @@ - (NSArray *)buildTargets { + return nil; } - (NSString *)projectDescription diff --git a/PCBundleProj/PCBundleProject.m b/PCBundleProj/PCBundleProject.m index b42e6dc..b88c530 100644 --- a/PCBundleProj/PCBundleProject.m +++ b/PCBundleProj/PCBundleProject.m @@ -47,7 +47,6 @@ { NSTextField *textField; NSRect frame = {{84,120}, {80, 80}}; - NSBox *box; [super _initUI]; @@ -168,12 +167,12 @@ [mf appendHeaders:[dict objectForKey:PCHeaders]]; [mf appendClasses:[dict objectForKey:PCClasses]]; - [mf appendCFiles:[dict objectForKey:PCOtherSources]]; + [mf appendOtherSources:[dict objectForKey:PCOtherSources]]; [mf appendTailForBundle]; // Write the new file to disc! - if (mfd = [mf encodedMakefile]) + if ((mfd = [mf encodedMakefile])) { if ([mfd writeToFile:mfl atomically:YES]) { @@ -201,6 +200,7 @@ - (NSArray *)buildTargets { + return nil; } - (NSString *)projectDescription diff --git a/PCGormProj/PCGormProject.m b/PCGormProj/PCGormProject.m index fa3e8ce..7cbabef 100644 --- a/PCGormProj/PCGormProject.m +++ b/PCGormProj/PCGormProject.m @@ -191,12 +191,12 @@ [mf appendHeaders:[dict objectForKey:PCHeaders]]; [mf appendClasses:[dict objectForKey:PCClasses]]; - [mf appendCFiles:[dict objectForKey:PCOtherSources]]; + [mf appendOtherSources:[dict objectForKey:PCOtherSources]]; [mf appendTailForApp]; // Write the new file to disc! - if (mfd = [mf encodedMakefile]) + if ((mfd = [mf encodedMakefile])) { if ([mfd writeToFile:mfl atomically:YES]) { @@ -224,6 +224,7 @@ - (NSArray *)buildTargets { + return nil; } - (NSString *)projectDescription diff --git a/PCLib/PCMakefileFactory.h b/PCLib/PCMakefileFactory.h index a42dc61..a68f587 100644 --- a/PCLib/PCMakefileFactory.h +++ b/PCLib/PCMakefileFactory.h @@ -27,7 +27,7 @@ - (void)appendHeaders:(NSArray *)array; - (void)appendClasses:(NSArray *)array; -- (void)appendCFiles:(NSArray *)array; +- (void)appendOtherSources:(NSArray *)array; - (void)appendInstallDir:(NSString*)dir; @@ -70,7 +70,7 @@ - (void)appendLibraryLibraries:(NSArray*)array; - (void)appendLibraryHeaders:(NSArray*)array; - (void)appendLibraryClasses:(NSArray *)array; -- (void)appendLibraryCFiles:(NSArray *)array; +- (void)appendLibraryOtherSources:(NSArray *)array; @end diff --git a/PCLib/PCMakefileFactory.m b/PCLib/PCMakefileFactory.m index 4013642..5c4b63c 100644 --- a/PCLib/PCMakefileFactory.m +++ b/PCLib/PCMakefileFactory.m @@ -22,6 +22,12 @@ #define COMMENT_LIBRARY @"\n\n#\n# Library\n#\n\n" #define COMMENT_TOOL @"\n\n#\n# Tool\n#\n\n" +@interface PCMakefileFactory (Private) +- (void)appendHeaders:(NSArray *)array forTarget: (NSString *)target; +- (void)appendClasses:(NSArray *)array forTarget: (NSString *)target; +- (void)appendOtherSources:(NSArray *)array forTarget: (NSString *)target; +@end + @implementation PCMakefileFactory static PCMakefileFactory *_factory = nil; @@ -69,17 +75,40 @@ static PCMakefileFactory *_factory = nil; [mfile appendString:aString]; } -- (void)appendHeaders:(NSArray *)array +- (void)appendHeaders:(NSArray *)array forTarget: (NSString *)target { [self appendString:COMMENT_HEADERS]; - [self appendString:[NSString stringWithFormat:@"%@_HEADERS= ",pnme]]; + [self appendString:[NSString stringWithFormat:@"%@_HEADER_FILES= ", + target]]; if( array && [array count] ) { NSString *tmp; NSEnumerator *enumerator = [array objectEnumerator]; - while (tmp = [enumerator nextObject]) + while ( (tmp = [enumerator nextObject]) ) + { + [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; + } + } +} + +- (void)appendHeaders:(NSArray *)array +{ + [self appendHeaders: array forTarget: pnme]; +} + +- (void)appendClasses:(NSArray *)array forTarget: (NSString *)target +{ + [self appendString:COMMENT_CLASSES]; + [self appendString:[NSString stringWithFormat:@"%@_OBJC_FILES= ", target]]; + + if( array && [array count] ) + { + NSString *tmp; + NSEnumerator *enumerator = [array objectEnumerator]; + + while ( (tmp = [enumerator nextObject] )) { [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; } @@ -88,36 +117,53 @@ static PCMakefileFactory *_factory = nil; - (void)appendClasses:(NSArray *)array { - [self appendString:COMMENT_CLASSES]; - [self appendString:[NSString stringWithFormat:@"%@_OBJC_FILES= ",pnme]]; + [self appendClasses: array forTarget: pnme]; +} - if( array && [array count] ) +- (void)appendOtherSources:(NSArray *)array forTarget: (NSString *)target +{ + NSMutableArray *marray = nil; + NSEnumerator *oenum; + NSString *file; + + [self appendString:COMMENT_CFILES]; + [self appendString:[NSString stringWithFormat:@"%@_C_FILES= ", target]]; + if ( array == nil || [array count] == 0) + return; + + /* Other Sources can have both m files and c files (possibly others?). */ + oenum = [array objectEnumerator]; + while ((file = [oenum nextObject])) { - NSString *tmp; - NSEnumerator *enumerator = [array objectEnumerator]; + if ([file hasSuffix: @".m"]) + { + if (marray == nil) + marray = [NSMutableArray arrayWithCapacity: 2]; + [marray addObject: file]; + } + else /* if ([f hasSuffix: @".c"]) */ + { + [self appendString:[NSString stringWithFormat:@"\\\n%@ ",file]]; + } + } - while (tmp = [enumerator nextObject]) - { - [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; + [self appendString: @"\n"]; + [self appendString:[NSString stringWithFormat:@"%@_OBJC_FILES += ",pnme]]; + if ( marray ) + { + NSString *file; + NSEnumerator *enumerator = [marray objectEnumerator]; + + while ( (file = [enumerator nextObject]) ) + { + [self appendString:[NSString stringWithFormat:@"\\\n%@ ", file]]; } } } -- (void)appendCFiles:(NSArray *)array +- (void)appendOtherSources:(NSArray *)array { - [self appendString:COMMENT_CFILES]; - [self appendString:[NSString stringWithFormat:@"%@_C_FILES= ",pnme]]; - - if( array && [array count] ) - { - NSString *tmp; - NSEnumerator *enumerator = [array objectEnumerator]; - - while (tmp = [enumerator nextObject]) - { - [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; - } - } + [self appendOtherSources: array forTarget: pnme]; } - (void)appendInstallDir:(NSString*)dir @@ -137,7 +183,7 @@ static PCMakefileFactory *_factory = nil; NSString *tmp; NSEnumerator *enumerator = [array objectEnumerator]; - while (tmp = [enumerator nextObject]) { + while ((tmp = [enumerator nextObject])) { [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; } } @@ -151,7 +197,7 @@ static PCMakefileFactory *_factory = nil; NSString *tmp; NSEnumerator *enumerator = [array objectEnumerator]; - while (tmp = [enumerator nextObject]) { + while ((tmp = [enumerator nextObject])) { [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; } } @@ -246,7 +292,7 @@ static PCMakefileFactory *_factory = nil; NSString *tmp; NSEnumerator *enumerator = [array objectEnumerator]; - while (tmp = [enumerator nextObject]) + while ((tmp = [enumerator nextObject])) { if (![tmp isEqualToString:@"gnustep-base"] && ![tmp isEqualToString:@"gnustep-gui"]) @@ -296,7 +342,7 @@ static PCMakefileFactory *_factory = nil; NSString *tmp; NSEnumerator *enumerator = [array objectEnumerator]; - while (tmp = [enumerator nextObject]) + while ((tmp = [enumerator nextObject])) { if (![tmp isEqualToString:@"gnustep-base"] && ![tmp isEqualToString:@"gnustep-gui"]) @@ -350,7 +396,7 @@ static PCMakefileFactory *_factory = nil; NSString *tmp; NSEnumerator *enumerator = [array objectEnumerator]; - while (tmp = [enumerator nextObject]) + while ((tmp = [enumerator nextObject])) { if (![tmp isEqualToString:@"gnustep-base"]) { @@ -363,58 +409,19 @@ static PCMakefileFactory *_factory = nil; - (void)appendLibraryHeaders:(NSArray*)array { NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme]; - - [self appendString:COMMENT_HEADERS]; - [self appendString:[NSString stringWithFormat:@"%@_HEADER_FILES= ",libnme]]; - - if( array && [array count] ) - { - NSString *tmp; - NSEnumerator *enumerator = [array objectEnumerator]; - - while (tmp = [enumerator nextObject]) - { - [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; - } - } + [self appendHeaders: array forTarget: libnme]; } - (void)appendLibraryClasses:(NSArray *)array { NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme]; - - [self appendString:COMMENT_CLASSES]; - [self appendString:[NSString stringWithFormat:@"%@_OBJC_FILES= ",libnme]]; - - if( array && [array count] ) - { - NSString *tmp; - NSEnumerator *enumerator = [array objectEnumerator]; - - while (tmp = [enumerator nextObject]) - { - [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; - } - } + [self appendClasses: array forTarget: libnme]; } -- (void)appendLibraryCFiles:(NSArray *)array +- (void)appendLibraryOtherSources:(NSArray *)array { - NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme]; - - [self appendString:COMMENT_CFILES]; - [self appendString:[NSString stringWithFormat:@"%@_C_FILES= ",libnme]]; - - if( array && [array count] ) - { - NSString *tmp; - NSEnumerator *enumerator = [array objectEnumerator]; - - while (tmp = [enumerator nextObject]) - { - [self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]]; - } - } + NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme]; + [self appendOtherSources: array forTarget: libnme]; } @end @@ -447,7 +454,7 @@ static PCMakefileFactory *_factory = nil; NSString *tmp; NSEnumerator *enumerator = [array objectEnumerator]; - while (tmp = [enumerator nextObject]) + while ((tmp = [enumerator nextObject]) ) { if (![tmp isEqualToString:@"gnustep-base"]) { diff --git a/PCLib/PCProject.m b/PCLib/PCProject.m index d6ca59f..bdabbd4 100644 --- a/PCLib/PCProject.m +++ b/PCLib/PCProject.m @@ -148,7 +148,7 @@ return [NSArray arrayWithObjects:@"h",nil]; } else if ([key isEqualToString:PCOtherSources]) { - return [NSArray arrayWithObjects:@"c",@"C",@"M",nil]; + return [NSArray arrayWithObjects:@"c",@"C",@"m",@"M",nil]; } else if ([key isEqualToString:PCLibraries]) { return [NSArray arrayWithObjects:@"so",@"a",@"lib",nil]; @@ -724,7 +724,7 @@ keys = [origin allKeys]; enumerator = [keys objectEnumerator]; - while( key = [enumerator nextObject] ) + while( (key = [enumerator nextObject]) ) { if( [projectDict objectForKey:key] == nil ) { diff --git a/PCLibProj/PCLibProject.m b/PCLibProj/PCLibProject.m index bc5615e..8af12f0 100644 --- a/PCLibProj/PCLibProject.m +++ b/PCLibProj/PCLibProject.m @@ -106,12 +106,12 @@ [mf appendLibraryHeaders:[dict objectForKey:PCHeaders]]; [mf appendLibraryClasses:[dict objectForKey:PCClasses]]; - [mf appendLibraryCFiles:[dict objectForKey:PCOtherSources]]; + [mf appendLibraryOtherSources:[dict objectForKey:PCOtherSources]]; [mf appendTailForLibrary]; // Write the new file to disc! - if (mfd = [mf encodedMakefile]) + if ((mfd = [mf encodedMakefile])) { if ([mfd writeToFile:mfl atomically:YES]) { @@ -139,6 +139,7 @@ - (NSArray *)buildTargets { + return nil; } - (NSString *)projectDescription diff --git a/PCRenaissanceProj/PCRenaissanceProject.m b/PCRenaissanceProj/PCRenaissanceProject.m index a542d5a..baee102 100644 --- a/PCRenaissanceProj/PCRenaissanceProject.m +++ b/PCRenaissanceProj/PCRenaissanceProject.m @@ -190,7 +190,7 @@ [mf appendHeaders:[dict objectForKey:PCHeaders]]; [mf appendClasses:[dict objectForKey:PCClasses]]; - [mf appendCFiles:[dict objectForKey:PCOtherSources]]; + [mf appendOtherSources:[dict objectForKey:PCOtherSources]]; [mf appendTailForApp]; diff --git a/PCToolProj/PCToolProject.m b/PCToolProj/PCToolProject.m index 22eb99b..3846680 100644 --- a/PCToolProj/PCToolProject.m +++ b/PCToolProj/PCToolProject.m @@ -118,12 +118,12 @@ [mf appendHeaders:[dict objectForKey:PCHeaders]]; [mf appendClasses:[dict objectForKey:PCClasses]]; - [mf appendCFiles:[dict objectForKey:PCOtherSources]]; + [mf appendOtherSources:[dict objectForKey:PCOtherSources]]; [mf appendTailForTool]; // Write the new file to disc! - if (mfd = [mf encodedMakefile]) + if ((mfd = [mf encodedMakefile])) { if ([mfd writeToFile:mfl atomically:YES]) { @@ -151,6 +151,7 @@ - (NSArray *)buildTargets { + return nil; } - (NSString *)projectDescription