From f28542b9b45f83250a6d01bc062b65244d166a1c Mon Sep 17 00:00:00 2001
From: Matthias Benkard <code@mail.matthias.benkard.de>
Date: Thu, 18 Oct 2007 12:24:17 +0200
Subject: Support building on Mac OS X without gnustep-make.

darcs-hash:fd214e0244570e27679db980171f866332808a56
---
 GNUmakefile             | 14 +++++++++++++-
 Objective-C/GNUmakefile | 25 +++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 67bb44b..ca8ebf2 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -15,7 +15,7 @@
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-include $(GNUSTEP_MAKEFILES)/common.make
+-include $(GNUSTEP_MAKEFILES)/common.make
 
 include version.make
 
@@ -24,4 +24,16 @@ RPM_DISABLE_RELOCATABLE = YES
 
 SUBPROJECTS = Objective-C
 
+ifneq ($(COMMON_MAKE_LOADED),)
 include $(GNUSTEP_MAKEFILES)/aggregate.make
+else  # Mac OS X
+all:
+	make -C Objective-C all
+
+clean:
+	make -C Objective-C clean
+
+install:
+	make -C Objective-C install
+endif
+
diff --git a/Objective-C/GNUmakefile b/Objective-C/GNUmakefile
index 31b0db0..72ad050 100644
--- a/Objective-C/GNUmakefile
+++ b/Objective-C/GNUmakefile
@@ -15,7 +15,7 @@
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-include $(GNUSTEP_MAKEFILES)/common.make
+-include $(GNUSTEP_MAKEFILES)/common.make
 
 include ../version.make
 
@@ -35,4 +35,25 @@ ADDITIONAL_OBJCFLAGS += -DUSE_LIBFFI
 libobjcl_OBJC_FILES += libffi_support.m
 endif
 
-include $(GNUSTEP_MAKEFILES)/library.make
+ifneq ($(COMMON_MAKE_LOADED),)
+-include $(GNUSTEP_MAKEFILES)/library.make
+else  # Mac OS X
+libobjcl_OBJ_FILES = $(patsubst %.m,obj/%.o,$(libobjcl_OBJC_FILES))
+
+all: obj/libobjcl.dylib
+
+clean:
+	rm -f obj/libobjcl.dylib obj/libobjcl.dylib.$(VERSION) $(libobjcl_OBJ_FILES)
+
+obj/libobjcl.dylib: obj/libobjcl.dylib.$(VERSION)
+	ln -s libobjcl.dylib.$(VERSION) $@
+
+obj/libobjcl.dylib.$(VERSION): $(libobjcl_OBJ_FILES)
+	make -p obj
+	gcc -dynamiclib -current_version $(VERSION) -flat_namespace -undefined warning -install_name libobjcl.dylib.$(VERSION) -o $@ $(libobjcl_OBJ_FILES) -fnext-runtime -framework AppKit -framework Foundation -lm $(ADDITIONAL_LDFLAGS) $(ADDITIONAL_OBJCFLAGS)
+
+obj/%.o: %.m
+	mkdir -p obj
+	gcc -o $@ -c $< -MMD -MP -DNeXT_Foundation_LIBRARY=1 -DNeXT_GUI_LIBRARY=1 -DNeXT_RUNTIME=1 -dynamic -fno-common -fno-omit-frame-pointer -Wno-import -fno-strict-aliasing -fnext-runtime -I. $(ADDITIONAL_OBJCFLAGS)
+endif
+
-- 
cgit v1.2.3