2 # Compile GMP only if we don't have it already
4 # We use GMP's own configuration stuff, because it's all rather hairy
5 # and not worth re-implementing in our Makefile framework.
7 ifeq "$(findstring dyn, $(GhcRTSWays))" "dyn"
13 # In a bindist, we don't want to know whether /this/ machine has gmp,
14 # but whether the machine the bindist was built on had gmp.
15 ifeq "$(BINDIST)" "YES"
16 ifeq "$(wildcard gmp/libgmp.a)" ""
18 HaveFrameworkGMP = YES
25 ifneq "$(HaveLibGmp)" "YES"
26 ifneq "$(HaveFrameworkGMP)" "YES"
28 INSTALL_LIBS += gmp/libgmp.a
30 $(eval $(call all-target,gmp_dynamic,gmp/libgmp.a))
32 ifeq "$(BUILD_SHARED)" "yes"
33 $(eval $(call all-target,gmp_dynamic,gmp/libgmp.dll.a gmp/libgmp-3.dll))
39 PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
43 # is not a valid command on non-Cygwin-systems.
44 # Let it fail silently instead of aborting the build.
48 # set -o igncr; export SHELLOPTS
49 # here as otherwise checking the size of limbs
50 # makes the build fall over on Cygwin. See the thread
51 # http://www.cygwin.com/ml/cygwin/2006-12/msg00011.html
57 # isn't sufficient to stop cygwin using symlinks the mingw gcc can't
58 # follow, as it isn't used consistently. Instead we put an ln.bat in
59 # path that always fails.
61 # We use a tarball like gmp-4.2.4-nodoc.tar.bz2, which is
62 # gmp-4.2.4.tar.bz2 repacked without the doc/ directory contents.
63 # That's because the doc/ directory contents are under the GFDL,
64 # which causes problems for Debian.
66 GMP_TARBALL := $(wildcard gmp/tarball/gmp*.tar.bz2)
67 GMP_DIR := $(patsubst gmp/tarball/%-nodoc.tar.bz2,%,$(GMP_TARBALL))
69 # XXX INSTALL_HEADERS += gmp.h
72 $(RM) -rf $(GMP_DIR) gmp/gmpbuild
73 cd gmp && $(TAR) -jxf ../$(GMP_TARBALL)
74 mv gmp/$(GMP_DIR) gmp/gmpbuild
76 cd gmp; (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
80 CC=$(WhatGccIsCalled) $(SHELL) configure \
81 --enable-shared=no --host=$(PLATFORM) --build=$(PLATFORM)
82 $(MAKE) -C gmp/gmpbuild MAKEFLAGS=
83 $(CP) gmp/gmpbuild/.libs/libgmp.a gmp/
84 $(RANLIB) gmp/libgmp.a
86 $(eval $(call clean-target,gmp,,\
87 gmp/libgmp.a gmp/gmpbuild gmp/$(GMP_DIR)))
91 # $(RM) -rf $(GMP_DIR) gmpbuild-shared
92 # $(TAR) -zxf $(GMP_TARBALL)
93 # mv $(GMP_DIR) gmpbuild-shared
95 # (set -o igncr 2>/dev/null) && set -o igncr; export SHELLOPTS; \
96 # PATH=`pwd`:$$PATH; \
98 # cd gmpbuild-shared && \
99 # CC=$(WhatGccIsCalled) $(SHELL) configure \
100 # --enable-shared=yes --disable-static --host=$(PLATFORM) --build=$(PLATFORM)
103 #gmp.h: stamp.gmp.static
104 # $(CP) gmpbuild/gmp.h .
106 #libgmp.a: stamp.gmp.static
108 #libgmp-3.dll: stamp.gmp.shared
109 # $(MAKE) -C gmpbuild-shared MAKEFLAGS=
110 # $(CP) gmpbuild-shared/.libs/libgmp-3.dll .
112 #libgmp.dll.a: libgmp-3.dll
113 # $(CP) gmpbuild-shared/.libs/libgmp.dll.a .
115 ## GMP takes a long time to build, but changes rarely. Hence we don't
116 ## bother cleaning it before validating, because that adds a
117 ## significant overhead to validation.
118 #ifeq "$(Validating)" "NO"
119 #clean distclean maintainer-clean ::
120 # $(RM) -f stamp.gmp.static stamp.gmp.shared
122 # $(RM) -rf gmpbuild-shared