X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=libffi%2FMakefile;h=d76ad52eef2ad921db17d12aace46ed990e1adf8;hb=911a3e09ad48ff8dac5ee1399fe9294edf58d30c;hp=3a7cb693f7b0ee2cdd40af6d73722a1547565654;hpb=e0fcf61dca4dfac99cb5417e1bc4cbee18822cf2;p=ghc-hetmet.git diff --git a/libffi/Makefile b/libffi/Makefile index 3a7cb69..d76ad52 100644 --- a/libffi/Makefile +++ b/libffi/Makefile @@ -33,72 +33,70 @@ PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g') LIBFFI_TARBALL := $(firstword $(wildcard libffi*.tar.gz)) LIBFFI_DIR := $(subst .tar.gz,,$(LIBFFI_TARBALL)) -ifeq "$(findstring dyn, $(GhcRTSWays))" "dyn" -BUILD_SHARED=yes +BINDIST_STAMPS = stamp.ffi +INSTALL_HEADERS += ffi.h +STATIC_LIB = libffi.a +INSTALL_LIBS += $(STATIC_LIB) + +# We have to add the GHC version to the name of our dynamic libs, because +# they will be residing in the system location along with dynamic libs from +# other GHC installations. +ifeq "$(BuildSharedLibs)" "YES" +ifeq "$(Windows)" "YES" +DYNAMIC_PROG = libffi.dll.a +DYNAMIC_LIBS = libffi-3.dll +RENAME_LIBS = else -BUILD_SHARED=no +DYNAMIC_PROG = +DYNAMIC_LIBS = libffi.so libffi.so.5 libffi.so.5.0.5 +endif +else +DYNAMIC_PROG = +DYNAMIC_LIBS = endif -boot :: stamp.ffi.static -BINDIST_STAMPS = stamp.ffi.static -INSTALL_HEADERS += ffi.h -INSTALL_LIBS += libffi.a - -ifeq "$(BUILD_SHARED)" "yes" -boot :: stamp.ffi.shared -BINDIST_STAMPS += stamp.ffi.shared -INSTALL_LIBS += libffi.dll.a -INSTALL_PROGS += libffi-3.dll +ifeq "$(BuildSharedLibs)" "YES" +EnableShared=yes +else +EnableShared=no endif +INSTALL_LIBS += $(DYNAMIC_LIBS) +INSTALL_PROGS += $(DYNAMIC_PROGS) + install all :: $(INSTALL_HEADERS) $(INSTALL_LIBS) $(INSTALL_PROGS) -stamp.ffi.static: +# We have to fake a non-working ln for configure, so that the fallback +# option (cp -p) gets used instead. Otherwise the libffi build system +# will use cygwin symbolic linkks which cannot be read by mingw gcc. +# The same trick is played by the GMP build in ../gmp. + +stamp.ffi: $(RM) -rf $(LIBFFI_DIR) build $(TAR) -zxf $(LIBFFI_TARBALL) mv $(LIBFFI_DIR) build -# chmod +x ln + chmod +x ln (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \ PATH=`pwd`:$$PATH; \ export PATH; \ cd build && \ CC=$(WhatGccIsCalled) $(SHELL) configure \ - --enable-shared=no --host=$(PLATFORM) --build=$(PLATFORM) + --enable-static=yes \ + --enable-shared=$(EnableShared) \ + --host=$(PLATFORM) --build=$(PLATFORM) touch $@ -stamp.ffi.shared: - $(RM) -rf $(LIBFFI_DIR) build-shared - $(TAR) -zxf $(LIBFFI_TARBALL) - mv $(LIBFFI_DIR) build-shared -# chmod +x ln - (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \ - PATH=`pwd`:$$PATH; \ - export PATH; \ - cd build-shared && \ - CC=$(WhatGccIsCalled) $(SHELL) configure \ - --enable-shared=yes --disable-static --host=$(PLATFORM) --build=$(PLATFORM) - touch $@ - -ffi.h: stamp.ffi.static +ffi.h: stamp.ffi $(CP) build/include/ffi.h . -libffi.a: stamp.ffi.static +$(STATIC_LIB) $(DYNAMIC_LIBS) $(DYNAMIC_PROG) : stamp.ffi $(MAKE) -C build MAKEFLAGS= - $(CP) build/.libs/libffi.a . - $(RANLIB) libffi.a - -libffi-3.dll: stamp.ffi.shared - $(MAKE) -C build-shared MAKEFLAGS= - $(CP) build-shared/.libs/libffi-3.dll . - -libffi.dll.a: libffi-3.dll - $(CP) build-shared/.libs/libffi.dll.a . + (cd build; ./libtool --mode=install cp libffi.la $(FPTOOLS_TOP_ABS)/libffi) clean distclean maintainer-clean :: - $(RM) -f stamp.ffi.static stamp.ffi.shared ffi.h - $(RM) -f libffi.a libffi-3.dll libffi.dll.a + $(RM) -f stamp.ffi ffi.h + $(RM) -f libffi.a libffi.la $(DYNAMIC_PROG) $(DYNAMIC_LIBS) $(ORIG_DYNAMIC_LIBS) $(RM) -rf build - $(RM) -rf build-shared #----------------------------------------------------------------------------- #