4 include $(TOP)/mk/boilerplate.mk
6 # -----------------------------------------------------------------------------
7 # Compile GMP only if we don't have it already
9 # We use GMP's own configuration stuff, because it's all rather hairy
10 # and not worth re-implementing in our Makefile framework.
12 ifneq "$(HaveLibGmp)" "YES"
13 ifneq "$(HaveFrameworkGMP)" "YES"
15 PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
19 # set -o igncr; export SHELLOPTS
20 # here as otherwise checking the size of limbs
21 # makes the build fall over on Cygwin. See the thread
22 # http://www.cygwin.com/ml/cygwin/2006-12/msg00011.html
28 # isn't sufficient to stop cygwin using symlinks the mingw gcc can't
29 # follow, as it isn't used consistently. Instead we put an ln.bat in
30 # path that always fails.
32 GMP_TARBALL := $(firstword $(wildcard gmp*.tar.gz))
33 GMP_DIR := $(subst .tar.gz,,$(GMP_TARBALL))
34 BMP_BUILD_DIR := build
36 ifeq "$(findstring dyn, $(GhcRTSWays))" "dyn"
42 boot :: stamp.gmp.static
45 INSTALL_LIBS += libgmp.a
47 ifeq "$(BUILD_SHARED)" "yes"
48 boot :: stamp.gmp.shared
49 all :: libgmp-3.dll libgmp.dll.a
50 install :: libgmp-3.dll libgmp.dll.a
51 INSTALL_LIBS += libgmp.dll.a
52 INSTALL_PROGS += libgmp-3.dll
56 $(RM) -rf $(GMP_DIR) gmpbuild
57 $(TAR) -zxf $(GMP_TARBALL)
58 mv $(GMP_DIR) gmpbuild
60 set -o igncr; export SHELLOPTS; \
61 export PATH=`pwd`:$$PATH; \
63 CC=$(WhatGccIsCalled) $(SHELL) configure \
64 --enable-shared=no --host=$(PLATFORM) --build=$(PLATFORM)
68 $(RM) -rf $(GMP_DIR) gmpbuild-shared
69 $(TAR) -zxf $(GMP_TARBALL)
70 mv $(GMP_DIR) gmpbuild-shared
72 set -o igncr; export SHELLOPTS; \
73 export PATH=`pwd`:$$PATH; \
74 cd gmpbuild-shared && \
75 CC=$(WhatGccIsCalled) $(SHELL) configure \
76 --enable-shared=yes --disable-static --host=$(PLATFORM) --build=$(PLATFORM)
79 libgmp.a: stamp.gmp.static
80 $(MAKE) -C gmpbuild MAKEFLAGS=
81 $(CP) gmpbuild/.libs/libgmp.a .
84 libgmp-3.dll: stamp.gmp.shared
85 $(MAKE) -C gmpbuild-shared MAKEFLAGS=
86 $(CP) gmpbuild-shared/.libs/libgmp-3.dll .
88 libgmp.dll.a: libgmp-3.dll
89 $(CP) gmpbuild-shared/.libs/libgmp.dll.a .
93 clean distclean maintainer-clean ::
94 $(RM) -f stamp.gmp.static stamp.gmp.shared
96 $(RM) -rf gmpbuild-shared
98 #-----------------------------------------------------------------------------
102 include $(TOP)/mk/target.mk
106 ifneq "$(HaveLibGmp)" "YES"
107 ifneq "$(HaveFrameworkGMP)" "YES"
108 $(INSTALL_DIR) $(BIN_DIST_DIR)/gmp
109 touch $(BIN_DIST_DIR)/gmp/$(GMP_TARBALL)
110 $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/gmp/
111 ifneq "$(INSTALL_PROGS)" ""
112 $(INSTALL_DATA) $(INSTALL_PROGS) $(BIN_DIST_DIR)/gmp/
114 ifneq "$(INSTALL_LIBS)" ""
115 $(INSTALL_DATA) $(INSTALL_LIBS) $(BIN_DIST_DIR)/gmp/