1. 以下是你的Objective-C源文件 (hello.m)
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = hello
hello_OBJC_FILES = hello.m
include $(GNUSTEP_MAKEFILES)/tool.make
2. 准備如下makefile,並命名為GNUmakefile
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog (@"hello world");
[pool drain];
return 0;
}
3. 編譯
$ make
This is gnustep-make 2.6.1. Type 'make print-gnustep-make-help' for help.
Making all for tool hello...
Compiling file hello.m ...
Linking tool hello ...
4. 執行
$ ./first
Welcome to Objective-C