Commit b547f2e2 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Fix parallel make for libffi.

I didn't realise make can invoke the same action multiple
times in parallel if the rule has multiple targets. So go
back to using a build stamp file.
parent 31796c5c
......@@ -58,8 +58,10 @@ PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
ifeq "$(BuildSharedLibs)" "YES"
libffi_STAMP_CONFIGURE = libffi/stamp.ffi.configure-shared
libffi_STAMP_BUILD = libffi/
libffi_STAMP_CONFIGURE = libffi/stamp.ffi.configure
libffi_STAMP_BUILD = libffi/
BINDIST_STAMPS = libffi/ libfii/stamp.ffi.configure
......@@ -139,20 +141,12 @@ $(libffi_STAMP_CONFIGURE):
libffi/ffi.h: $(libffi_STAMP_CONFIGURE)
$(CP) libffi/build/include/ffi.h $@
# All the libs that libffi's own build will generate
libffi_ALL_LIBS = $(libffi_STATIC_LIB)
ifeq "$(BuildSharedLibs)" "YES"
libffi_ALL_LIBS += $(libffi_DYNAMIC_LIBS)
ifeq "$(Windows)" "YES"
libffi_ALL_LIBS += libffi/libffi.dll.a $(libffi_HS_DYN_LIB).a
$(libffi_ALL_LIBS): $(libffi_STAMP_CONFIGURE)
$(libffi_STAMP_BUILD): $(libffi_STAMP_CONFIGURE)
cd libffi && \
$(MAKE) -C build MAKEFLAGS=; \
(cd build; ./libtool --mode=install cp $(TOP)/libffi)
$(libffi_STATIC_LIB): $(libffi_STAMP_BUILD)
# Rename libffi.a to libHSffi.a
libffi/libHSffi.a libffi/libHSffi_p.a: $(libffi_STATIC_LIB)
$(CP) $(libffi_STATIC_LIB) libffi/libHSffi.a
......@@ -174,6 +168,7 @@ $(eval $(call all-target,libffi,libffi/HSffi.o))
ifeq "$(BuildSharedLibs)" "YES"
ifeq "$(Windows)" "YES"
libffi/libffi.dll.a $(libffi_HS_DYN_LIB): $(libffi_STAMP_BUILD)
# Windows libtool creates <soname>.dll, and as we already patched that
# there is no need to copy from libffi.dll to libHSffi...dll.
# However, the renaming is still required for the import library
......@@ -184,6 +179,7 @@ $(libffi_HS_DYN_LIB).a: libffi/libffi.dll.a
$(eval $(call all-target,libffi,$(libffi_HS_DYN_LIB).a))
$(libffi_DYNAMIC_LIBS): $(libffi_STAMP_BUILD)
# Rename to
$(libffi_HS_DYN_LIB): $(libffi_DYNAMIC_LIBS)
$(CP) $(word 1,$(libffi_DYNAMIC_LIBS)) $(libffi_HS_DYN_LIB)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment