Update the in-tree GMP; fixes trac #832
[ghc-hetmet.git] / includes / Makefile
index 4e4a82b..e7292cd 100644 (file)
@@ -4,9 +4,17 @@ TOP = ..
 include $(TOP)/mk/boilerplate.mk
 
 #
+# Header files built from the configure script's findings
+#
+H_CONFIG   = ghcautoconf.h
+H_PLATFORM = ghcplatform.h
+
+#
 # All header files
 #
-H_FILES = $(filter-out gmp.h,$(wildcard *.h)) gmp.h
+H_FILES = $(filter-out $(H_CONFIG) $(H_PLATFORM),$(wildcard *.h))
+
+ifneq "$(DOING_BIN_DIST)" "YES"
 
 #
 # Options
@@ -19,26 +27,14 @@ ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
 SRC_CC_OPTS += -DTABLES_NEXT_TO_CODE
 endif
 
-SRC_CC_OPTS += -I. -I../rts
+SRC_CC_OPTS += -I. -I../rts -I../gmp/gmpbuild
 
 ifneq "$(GhcWithSMP)" "YES"
 SRC_CC_OPTS += -DNOSMP
 endif
 
-#
-# Header file built from the configure script's findings
-#
-H_CONFIG   = ghcautoconf.h
-H_PLATFORM = ghcplatform.h
-
-boot :: gmp.h
-
 all :: $(H_CONFIG) $(H_PLATFORM)
 
-# gmp.h is copied from the GMP directory
-gmp.h : $(FPTOOLS_TOP)/rts/gmp/gmp.h
-       $(CP) $< $@
-
 # The fptools configure script creates the configuration header file and puts it
 # in fptools/mk/config.h. We copy it down to here (without any PACKAGE_FOO
 # definitions to avoid clashes), prepending some make variables specifying cpp
@@ -55,6 +51,7 @@ else
 $(H_CONFIG) : $(FPTOOLS_TOP)/mk/config.h $(FPTOOLS_TOP)/mk/config.mk
 
 $(H_CONFIG) : Makefile
+       @echo "Creating $@..."
        @echo "#ifndef __GHCAUTOCONF_H__"  >$@
        @echo "#define __GHCAUTOCONF_H__" >>$@
 #      Turn '#define PACKAGE_FOO "blah"' into '/* #undef PACKAGE_FOO */'.
@@ -159,13 +156,11 @@ endif
 
 CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h
 
+endif
+
 # ---------------------------------------------------------------------------
 # boot setup:
 #
-# Need config.h to make dependencies in the runtime system source.
-#
-boot :: all
-
 #
 # Install all header files
 #
@@ -178,6 +173,11 @@ boot :: all
 override datadir:=$(libdir)/include
 INSTALL_DATAS += $(H_FILES) $(H_CONFIG) $(H_PLATFORM)
 
+binary-dist:
+       $(INSTALL_DIR)                   $(BIN_DIST_DIR)/includes
+       $(INSTALL_DATA) Makefile         $(BIN_DIST_DIR)/includes/
+       $(INSTALL_DATA) $(INSTALL_DATAS) $(BIN_DIST_DIR)/includes/
+
 #
 # `make clean' settings:
 #
@@ -187,3 +187,14 @@ CLEAN_FILES += $(H_CONFIG) $(H_PLATFORM)
 # Finally, slurp in the standard targets.
 #
 include $(TOP)/mk/target.mk
+
+# We need DerivedConstants.h in order to make dependencies in the RTS
+# sources, so 'make boot' here should behave like 'make all'.
+#
+# However, note that we should do this only *after* 'make boot' has
+# created .depend in here; otherwise an out-of-date .depend file can
+# prevent 'make boot' from working, requiring manual removal of
+# .depend (see #1095).  This is why the following target comes *after*
+# target.mk is included above (target.mk contains "boot :: depend").
+#
+boot :: all