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 boot :: stamp.gmp.static
17 PLATFORM := $(shell echo $(HOSTPLATFORM) | sed 's/i[567]86/i486/g')
21 # set -o igncr; export SHELLOPTS
22 # here as otherwise checking the size of limbs
23 # makes the build fall over on Cygwin. See the thread
24 # http://www.cygwin.com/ml/cygwin/2006-12/msg00011.html
30 # isn't sufficient to stop cygwin using symlinks the mingw gcc can't
31 # follow, as it isn't used consistently. Instead we put an ln.bat in
32 # path that always fails.
34 GMP_TARBALL := $(firstword $(wildcard gmp*.tar.gz))
35 GMP_DIR := $(subst .tar.gz,,$(GMP_TARBALL))
36 BMP_BUILD_DIR := build
38 ifeq "$(findstring dyn, $(GhcRTSWays))" "dyn"
45 $(RM) -rf $(GMP_DIR) gmpbuild
46 $(TAR) -zxf $(GMP_TARBALL)
47 mv $(GMP_DIR) gmpbuild
49 set -o igncr; export SHELLOPTS; \
50 export PATH=`pwd`:$$PATH; \
52 CC=$(WhatGccIsCalled) $(SHELL) configure \
53 --enable-shared=no --host=$(PLATFORM) --build=$(PLATFORM)
57 $(RM) -rf $(GMP_DIR) gmpbuild-shared
58 $(TAR) -zxf $(GMP_TARBALL)
59 mv $(GMP_DIR) gmpbuild-shared
61 set -o igncr; export SHELLOPTS; \
62 export PATH=`pwd`:$$PATH; \
63 cd gmpbuild-shared && \
64 CC=$(WhatGccIsCalled) $(SHELL) configure \
65 --enable-shared=yes --disable-static --host=$(PLATFORM) --build=$(PLATFORM)
68 libgmp.a: stamp.gmp.static
69 $(MAKE) -C gmpbuild MAKEFLAGS=
70 $(CP) gmpbuild/.libs/libgmp.a .
77 INSTALL_LIBS += libgmp.a
79 ifeq "$(BUILD_SHARED)" "yes"
80 libgmp-3.dll: stamp.gmp.shared
81 $(MAKE) -C gmpbuild-shared MAKEFLAGS=
82 $(CP) gmpbuild-shared/.libs/libgmp-3.dll .
84 libgmp.dll.a: libgmp-3.dll
85 $(CP) gmpbuild-shared/.libs/libgmp.dll.a .
87 all :: libgmp-3.dll libgmp.dll.a
89 install :: libgmp-3.dll libgmp.dll.a
91 INSTALL_LIBS += libgmp.dll.a
92 INSTALL_PROGS += libgmp-3.dll
97 clean distclean maintainer-clean ::
98 $(RM) -f stamp.gmp.static stamp.gmp.shared
100 $(RM) -rf gmpbuild-shared
102 #-----------------------------------------------------------------------------
106 include $(TOP)/mk/target.mk
110 ifneq "$(HaveLibGmp)" "YES"
111 ifneq "$(HaveFrameworkGMP)" "YES"
112 $(INSTALL_DIR) $(BIN_DIST_DIR)/gmp
113 touch $(BIN_DIST_DIR)/gmp/$(GMP_TARBALL)
114 $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/gmp/
115 ifneq "$(INSTALL_PROGS)" ""
116 $(INSTALL_DATA) $(INSTALL_PROGS) $(BIN_DIST_DIR)/gmp/
118 ifneq "$(INSTALL_LIBS)" ""
119 $(INSTALL_DATA) $(INSTALL_LIBS) $(BIN_DIST_DIR)/gmp/