mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-19 01:51:09 +00:00
This project now uses the makefile factory too.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12938 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6b55050ba0
commit
28fc83d068
5 changed files with 43 additions and 220 deletions
|
@ -9,11 +9,14 @@
|
|||
#
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Subprojects
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bundle
|
||||
#
|
||||
|
@ -23,15 +26,15 @@ BUNDLE_NAME=PCToolProj
|
|||
BUNDLE_EXTENSION=.bundle
|
||||
BUNDLE_INSTALL_DIR=$(GNUSTEP_SYSTEM_ROOT)/Library/ProjectCenter
|
||||
PCToolProj_PRINCIPAL_CLASS=PCToolProj
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Additional libraries
|
||||
#
|
||||
|
||||
PCToolProj_LIBRARIES_DEPEND_UPON += -lProjectCenter
|
||||
|
||||
#
|
||||
|
||||
# Resource files
|
||||
#
|
||||
|
||||
|
@ -41,27 +44,22 @@ PC.proj \
|
|||
main.m
|
||||
|
||||
#
|
||||
|
||||
# Header files
|
||||
#
|
||||
|
||||
PCToolProj_HEADERS= \
|
||||
PCToolMakefileFactory.h \
|
||||
PCToolProj.h \
|
||||
PCToolProject.h
|
||||
|
||||
#
|
||||
|
||||
# Class files
|
||||
#
|
||||
|
||||
PCToolProj_OBJC_FILES= \
|
||||
PCToolMakefileFactory.m \
|
||||
PCToolProj.m \
|
||||
PCToolProject.m
|
||||
|
||||
#
|
||||
|
||||
# C files
|
||||
#
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org
|
||||
|
||||
Copyright (C) 2001 Free Software Foundation
|
||||
|
||||
Author: Philippe C.D. Robert <phr@3dkit.org>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
|
||||
@interface PCToolMakefileFactory : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
+ (PCToolMakefileFactory *)sharedFactory;
|
||||
|
||||
- (NSData *)makefileForProject:(PCProject *)aProject;
|
||||
|
||||
@end
|
|
@ -1,159 +0,0 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org
|
||||
|
||||
Copyright (C) 2001 Free Software Foundation
|
||||
|
||||
Author: Philippe C.D. Robert <phr@3dkit.org>
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#import "PCToolMakefileFactory.h"
|
||||
|
||||
@implementation PCToolMakefileFactory
|
||||
|
||||
static PCToolMakefileFactory *_factory = nil;
|
||||
|
||||
+ (PCToolMakefileFactory *)sharedFactory
|
||||
{
|
||||
if (!_factory) {
|
||||
_factory = [[[self class] alloc] init];
|
||||
}
|
||||
return _factory;
|
||||
}
|
||||
|
||||
- (NSData *)makefileForProject:(PCProject *)aProject;
|
||||
{
|
||||
NSMutableString *string = [NSMutableString string];
|
||||
NSString *prName = [aProject projectName];
|
||||
NSDictionary *prDict = [aProject projectDict];
|
||||
NSString *tmp;
|
||||
NSEnumerator *enumerator;
|
||||
int i;
|
||||
|
||||
// Header information
|
||||
[string appendString:@"#\n"];
|
||||
[string appendString:@"# GNUmakefile - Generated by ProjectCenter\n"];
|
||||
[string appendString:@"# Written by Philippe C.D. Robert <phr@3dkit.org>\n"];
|
||||
[string appendString:@"#\n"];
|
||||
[string appendString:@"# NOTE: Do NOT change this file -- ProjectCenter maintains it!\n"];
|
||||
[string appendString:@"#\n"];
|
||||
[string appendString:@"# Put all of your customisations in GNUmakefile.preamble and\n"];
|
||||
[string appendString:@"# GNUmakefile.postamble\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
// The 'real' thing
|
||||
[string appendString:@"include $(GNUSTEP_MAKEFILES)/common.make\n"];
|
||||
|
||||
[string appendString:@"#\n\n"];
|
||||
[string appendString:@"# Subprojects\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
if ([[aProject subprojects] count]) {
|
||||
enumerator = [[prDict objectForKey:PCSubprojects] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
|
||||
[string appendString:@"#\n"];
|
||||
[string appendString:@"# Tool\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"PACKAGE_NAME=%@\n",prName]];
|
||||
[string appendString:[NSString stringWithFormat:@"TOOL_NAME=%@\n",prName]];
|
||||
[string appendString:[NSString stringWithFormat:@"GNUSTEP_INSTALLATION_DIR=% @\n",[prDict objectForKey:PCInstallDir]]];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_TOOL_ICON=%@\n",prName, [prDict objectForKey:PCToolIcon]]];
|
||||
|
||||
[string appendString:@"#\n\n"];
|
||||
[string appendString:@"# Additional libraries\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_TOOL_LIBS += ",prName]];
|
||||
|
||||
if ([[prDict objectForKey:PCLibraries] count]) {
|
||||
enumerator = [[prDict objectForKey:PCLibraries] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
if (![tmp isEqualToString:@"gnustep-base"]) {
|
||||
[string appendString:[NSString stringWithFormat:@"-l%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n#\n\n"];
|
||||
[string appendString:@"# Resource files\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_RESOURCE_FILES= ",prName]];
|
||||
|
||||
for (i=0;i<[[aProject resourceFileKeys] count];i++) {
|
||||
NSString *k = [[aProject resourceFileKeys] objectAtIndex:i];
|
||||
|
||||
enumerator = [[prDict objectForKey:k] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n#\n\n"];
|
||||
[string appendString:@"# Header files\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_HEADERS= ",prName]];
|
||||
|
||||
enumerator = [[prDict objectForKey:PCHeaders] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n#\n\n"];
|
||||
[string appendString:@"# Class files\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_OBJC_FILES= ",prName]];
|
||||
|
||||
enumerator = [[prDict objectForKey:PCClasses] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n#\n\n"];
|
||||
[string appendString:@"# C files\n"];
|
||||
[string appendString:@"#\n\n"];
|
||||
|
||||
[string appendString:[NSString stringWithFormat:@"%@_C_FILES= ",prName]];
|
||||
|
||||
enumerator = [[prDict objectForKey:PCOtherSources] objectEnumerator];
|
||||
while (tmp = [enumerator nextObject]) {
|
||||
[string appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
}
|
||||
|
||||
[string appendString:@"\n\n"];
|
||||
|
||||
[string appendString:@"-include GNUmakefile.preamble\n"];
|
||||
[string appendString:@"-include GNUmakefile.local\n"];
|
||||
[string appendString:@"include $(GNUSTEP_MAKEFILES)/aggregate.make\n"];
|
||||
[string appendString:@"include $(GNUSTEP_MAKEFILES)/tool.make\n"];
|
||||
[string appendString:@"-include GNUmakefile.postamble\n"];
|
||||
|
||||
return [string dataUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
}
|
||||
|
||||
@end
|
|
@ -4,7 +4,6 @@
|
|||
APPLICATIONICON = "";
|
||||
BUILDTOOL = "/usr/bin/make";
|
||||
CLASS_FILES = (
|
||||
PCToolMakefileFactory.m,
|
||||
PCToolProj.m,
|
||||
PCToolProject.m
|
||||
);
|
||||
|
@ -16,7 +15,6 @@
|
|||
FRAMEWORKS = (
|
||||
);
|
||||
HEADER_FILES = (
|
||||
PCToolMakefileFactory.h,
|
||||
PCToolProj.h,
|
||||
PCToolProject.h
|
||||
);
|
||||
|
|
|
@ -26,13 +26,7 @@
|
|||
|
||||
#import "PCToolProject.h"
|
||||
#import "PCToolProj.h"
|
||||
#import "PCToolMakefileFactory.h"
|
||||
|
||||
#import <ProjectCenter/ProjectCenter.h>
|
||||
|
||||
#if defined(GNUSTEP)
|
||||
#import <AppKit/IMLoading.h>
|
||||
#endif
|
||||
#import "PCMakefileFactory.h"
|
||||
|
||||
@interface PCToolProject (CreateUI)
|
||||
|
||||
|
@ -93,19 +87,49 @@
|
|||
|
||||
- (BOOL)writeMakefile
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSData *mfd;
|
||||
NSString *mf = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
|
||||
NSString *mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
|
||||
int i;
|
||||
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
|
||||
NSDictionary *dict = [self projectDict];
|
||||
|
||||
// Save the project file
|
||||
[super writeMakefile];
|
||||
|
||||
if (mfd = [[PCToolMakefileFactory sharedFactory] makefileForProject:self]) {
|
||||
if ([mfd writeToFile:mf atomically:YES]) {
|
||||
// Create the new file
|
||||
[mf createMakefileForProject:[self projectName]];
|
||||
|
||||
[mf appendString:@"include $(GNUSTEP_MAKEFILES)/common.make\n"];
|
||||
[mf appendSubprojects:[dict objectForKey:PCSubprojects]];
|
||||
|
||||
[mf appendTool];
|
||||
[mf appendInstallDir:[dict objectForKey:PCInstallDir]];
|
||||
[mf appendToolIcon:[dict objectForKey:PCToolIcon]];
|
||||
|
||||
[mf appendToolLibraries:[dict objectForKey:PCLibraries]];
|
||||
|
||||
[mf appendResources];
|
||||
for (i=0;i<[[self resourceFileKeys] count];i++)
|
||||
{
|
||||
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
|
||||
[mf appendResourceItems:[dict objectForKey:k]];
|
||||
}
|
||||
|
||||
[mf appendHeaders:[dict objectForKey:PCHeaders]];
|
||||
[mf appendClasses:[dict objectForKey:PCClasses]];
|
||||
[mf appendCFiles:[dict objectForKey:PCOtherSources]];
|
||||
|
||||
[mf appendTailForTool];
|
||||
|
||||
// Write the new file to disc!
|
||||
if (mfd = [mf encodedMakefile])
|
||||
{
|
||||
if ([mfd writeToFile:mfl atomically:YES])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue