summaryrefslogtreecommitdiff
path: root/ext/ffi_c/libffi.darwin.mk
diff options
context:
space:
mode:
authorWayne Meissner <wmeissner@gmail.com>2009-04-13 17:01:59 +1000
committerWayne Meissner <wmeissner@gmail.com>2009-04-13 17:01:59 +1000
commitd938ca857c9014bbb97d8d579b967cfe3c8028a6 (patch)
tree04da45b19323fa63d76d3434d1ff54d654a83911 /ext/ffi_c/libffi.darwin.mk
parenta63bc14bedffa0cdff513a9f8f05b76169cb6d33 (diff)
downloadffi-d938ca857c9014bbb97d8d579b967cfe3c8028a6.tar.gz
Add untested BSD makefiles and minor cleanups to gnu makefiles
Diffstat (limited to 'ext/ffi_c/libffi.darwin.mk')
-rw-r--r--ext/ffi_c/libffi.darwin.mk19
1 files changed, 13 insertions, 6 deletions
diff --git a/ext/ffi_c/libffi.darwin.mk b/ext/ffi_c/libffi.darwin.mk
index 7986a6e..c6f471d 100644
--- a/ext/ffi_c/libffi.darwin.mk
+++ b/ext/ffi_c/libffi.darwin.mk
@@ -1,12 +1,21 @@
# -*- makefile -*-
-ARCHES :=
+include libffi.gnu.mk
+
CCACHE := $(shell type -p ccache)
+BUILD_DIR := $(shell pwd)
+
+INCFLAGS += -I${BUILD_DIR}
+
+# Work out which arches we need to compile the lib for
+ARCHES :=
ifneq ($(findstring -arch ppc,$(CFLAGS)),)
ARCHES += ppc
endif
+
ifneq ($(findstring -arch i386,$(CFLAGS)),)
ARCHES += i386
endif
+
ifneq ($(findstring -arch x86_64,$(CFLAGS)),)
ARCHES += x86_64
endif
@@ -19,14 +28,13 @@ build_ffi = \
(if [ ! -f $(BUILD_DIR)/libffi-$(1)/Makefile ]; then \
echo "Configuring libffi for $(1)"; \
cd $(BUILD_DIR)/libffi-$(1) && \
- env CC="$(CCACHE) $(CC)" CFLAGS="-arch $(1) $(FFI_CFLAGS)" LDFLAGS="-arch $(1)" \
+ env CC="$(CCACHE) $(CC)" CFLAGS="-arch $(1) $(LIBFFI_CFLAGS)" LDFLAGS="-arch $(1)" \
$(FFI_CONFIGURE) --host=$(1)-apple-darwin > /dev/null; \
fi); \
env MACOSX_DEPLOYMENT_TARGET=10.4 $(MAKE) -C $(BUILD_DIR)/libffi-$(1)
-
+
$(LIBFFI):
- @for arch in $(ARCHES); do $(call build_ffi,$$arch);done
-
+ @for arch in $(ARCHES); do $(call build_ffi,$$arch);done
# Assemble into a FAT (i386, ppc) library
@mkdir -p $(BUILD_DIR)/libffi/.libs
env MACOSX_DEPLOYMENT_TARGET=10.4 /usr/bin/libtool -static -o $@ \
@@ -51,5 +59,4 @@ $(LIBFFI):
printf "#include \"libffi-ppc/include/ffitarget.h\"\n";\
printf "#endif\n";\
) > $(LIBFFI_BUILD_DIR)/include/ffitarget.h
-