From 4f117135673b36816c343bc11efcbb8396160c75 Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Mon, 2 Mar 2020 10:57:56 +0100 Subject: Make: refactor GMP rules Document and use simpler rules for the ghc-gmp.h header. --- libraries/integer-gmp/gmp/ghc.mk | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'libraries') diff --git a/libraries/integer-gmp/gmp/ghc.mk b/libraries/integer-gmp/gmp/ghc.mk index 4272e86924..9fb13ecb79 100644 --- a/libraries/integer-gmp/gmp/ghc.mk +++ b/libraries/integer-gmp/gmp/ghc.mk @@ -43,8 +43,6 @@ ifeq "$(GMP_PREFER_FRAMEWORK)" "YES" libraries/integer-gmp_CONFIGURE_OPTS += --with-gmp-framework-preferred endif -ifeq "$(phase)" "final" - ifneq "$(CLEANING)" "YES" # Hack. The file config.mk doesn't exist yet after running ./configure in # the toplevel (ghc) directory. To let some toplevel make commands such as @@ -85,20 +83,24 @@ UseIntreeGmp = YES endif endif +# wrappers.c includes "ghc-gmp.h" +libraries/integer-gmp/cbits/wrappers.c: libraries/integer-gmp/include/ghc-gmp.h + ifeq "$(UseIntreeGmp)" "YES" -$(libraries/integer-gmp_dist-install_depfile_c_asm): libraries/integer-gmp/gmp/gmp.h libraries/integer-gmp/include/ghc-gmp.h +# Copy header from in-tree build (gmp.h => ghc-gmp.h) libraries/integer-gmp/include/ghc-gmp.h: libraries/integer-gmp/gmp/gmp.h $(CP) $< $@ -gmp_CC_OPTS += -Ilibraries/integer-gmp/gmp - +# Link in-tree GMP objects libraries/integer-gmp_dist-install_EXTRA_OBJS += libraries/integer-gmp/gmp/objs/*.o + else -$(libraries/integer-gmp_dist-install_depfile_c_asm): libraries/integer-gmp/include/ghc-gmp.h +# Copy header from source tree libraries/integer-gmp/include/ghc-gmp.h: libraries/integer-gmp/gmp/ghc-gmp.h $(CP) $< $@ + endif libraries/integer-gmp_dist-install_EXTRA_CC_OPTS += $(gmp_CC_OPTS) @@ -135,4 +137,3 @@ libraries/integer-gmp/gmp/libgmp.a libraries/integer-gmp/gmp/gmp.h: $(RANLIB_CMD) libraries/integer-gmp/gmp/libgmp.a endif # CLEANING -endif # phase -- cgit v1.2.1