Cleaning fixes, and other build system tweaks; part of #7941
authorIan Lynagh <ian@well-typed.com>
Fri, 14 Jun 2013 12:56:17 +0000 (13:56 +0100)
committerIan Lynagh <ian@well-typed.com>
Fri, 14 Jun 2013 13:40:08 +0000 (14:40 +0100)
ghc.mk
mk/config.mk.in
rts/ghc.mk
rules/bindist.mk
rules/manual-package-config.mk

diff --git a/ghc.mk b/ghc.mk
index 18c0f57..e337ddd 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -528,7 +528,7 @@ utils/runghc/dist-install/package-data.mk: compiler/stage2/package-data.mk
 utils/mkUserGuidePart/dist/package-data.mk: compiler/stage2/package-data.mk
 
 # add the final package.conf dependency: ghc-prim depends on RTS
-libraries/ghc-prim/dist-install/package-data.mk : rts/package.conf.inplace
+libraries/ghc-prim/dist-install/package-data.mk : rts/dist/package.conf.inplace
 endif
 
 # --------------------------------
@@ -895,7 +895,7 @@ INSTALL_DISTDIR_compiler = stage2
 
 # Now we can do the installation
 install_packages: install_libexecs
-install_packages: rts/package.conf.install
+install_packages: rts/dist/package.conf.install
        $(call INSTALL_DIR,"$(DESTDIR)$(topdir)")
        $(call removeTrees,"$(INSTALLED_PACKAGE_CONF)")
        $(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)")
@@ -912,7 +912,7 @@ install_packages: rts/package.conf.install
                                          '$(prefix)'                 \
                                          '$(ghclibdir)'              \
                                          '$(docdir)/html/libraries'))
-       "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install
+       "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/dist/package.conf.install
        $(foreach p, $(INSTALL_PACKAGES),                             \
            $(call make-command,                                      \
                   "$(ghc-cabal_INPLACE)" register                    \
@@ -1006,7 +1006,7 @@ unix-binary-dist-prep:
        $(call removeFiles,$(BIN_DIST_PREP_TAR))
 # h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
 # tree then we want to include the real file, not a symlink to it
-       cd bindistprep && "$(TAR_CMD)" hcf - -T ../$(BIN_DIST_LIST) | bzip2 -c > ../$(BIN_DIST_PREP_TAR_BZ2)
+       cd bindistprep && "$(TAR_CMD)" hcf - -T ../bindist-list | bzip2 -c > ../$(BIN_DIST_PREP_TAR_BZ2)
 
 windows-binary-dist-prep:
        $(call removeTrees,bindistprep/)
@@ -1254,15 +1254,22 @@ distclean : clean
 
 # Clean the *Config.h files generated by library configure scripts
        $(call removeFiles,libraries/base/include/HsBaseConfig.h)
+       $(call removeFiles,libraries/base/include/EventConfig.h)
        $(call removeFiles,libraries/directory/include/HsDirectoryConfig.h)
        $(call removeFiles,libraries/process/include/HsProcessConfig.h)
        $(call removeFiles,libraries/unix/include/HsUnixConfig.h)
+       $(call removeFiles,libraries/time/include/HsTimeConfig.h)
+       $(call removeFiles,libraries/time/include/HsTimeConfig.h.in)
        $(call removeFiles,libraries/old-time/include/HsTimeConfig.h)
 
 # The library configure scripts also like creating autom4te.cache
 # directories, so clean them all up.
        $(call removeTrees,$(patsubst %, libraries/%/autom4te.cache, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
 
+# We make these when making or testing bindists
+       $(call removeFiles,bindist-list)
+       $(call removeTrees,bindisttest/a)
+
 # Not sure why this is being cleaned here.
        $(call removeTrees,includes/dist-derivedconstants)
 
index f70718c..9a6ab56 100644 (file)
@@ -389,7 +389,6 @@ BIN_DIST_PREP_DIR     = bindistprep/$(BIN_DIST_NAME)
 BIN_DIST_PREP_TAR     = bindistprep/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
 BIN_DIST_PREP_TAR_BZ2 = $(BIN_DIST_PREP_TAR).bz2
 BIN_DIST_TAR_BZ2      = $(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.bz2
-BIN_DIST_LIST         = bindist-list
 
 # -----------------------------------------------------------------------------
 # Utilities programs: flags 
index 30f6c08..22ca596 100644 (file)
@@ -71,7 +71,7 @@ endif
 # collect the -l and -L flags that we need to link the rts dyn lib.
 # Note that, as sed on OS X doesn't handle \+, we use [^ ][^ ]* rather
 # than [^ ]\+
-rts/libs.depend : $$(ghc-pkg_INPLACE)
+rts/dist/libs.depend : $$(ghc-pkg_INPLACE) | $$(dir $$@)/.
        "$(ghc-pkg_INPLACE)" --simple-output field rts extra-libraries \
          | sed -e 's/\([^ ][^ ]*\)/-l\1/g' > $@
        "$(ghc-pkg_INPLACE)" --simple-output field rts library-dirs \
@@ -182,11 +182,11 @@ endif
 # Making a shared library for the RTS.
 ifneq "$$(findstring dyn, $1)" ""
 ifeq "$$(HostOS_CPP)" "mingw32" 
-$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend rts/dist/build/$$(LIBFFI_DLL)
+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/dist/libs.depend rts/dist/build/$$(LIBFFI_DLL)
        "$$(RM)" $$(RM_OPTS) $$@
        "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
          -no-auto-link-packages -Lrts/dist/build -l$$(LIBFFI_NAME) \
-         `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
+         `cat rts/dist/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
 else
 ifneq "$$(UseSystemLibFFI)" "YES"
 LIBFFI_LIBS = -Lrts/dist/build -l$$(LIBFFI_NAME)
@@ -195,13 +195,13 @@ LIBFFI_LIBS += -optl-Wl,-rpath -optl-Wl,'$$$$ORIGIN' -optl-Wl,-z -optl-Wl,origin
 endif
 
 else
-# flags will be taken care of in rts/libs.depend
+# flags will be taken care of in rts/dist/libs.depend
 LIBFFI_LIBS =
 endif
-$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend $$(rts_dist_FFI_SO)
+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/dist/libs.depend $$(rts_dist_FFI_SO)
        "$$(RM)" $$(RM_OPTS) $$@
        "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
-         -no-auto-link-packages $$(LIBFFI_LIBS) `cat rts/libs.depend` $$(rts_$1_OBJS) \
+         -no-auto-link-packages $$(LIBFFI_LIBS) `cat rts/dist/libs.depend` $$(rts_$1_OBJS) \
          $$(rts_$1_DTRACE_OBJS) -o $$@
 endif
 else
index cf49c69..ee73053 100644 (file)
@@ -25,7 +25,7 @@ bindist: bindist_$1
 bindist_$1:
        $(foreach i,$2,\
            $(call make-command,\
-               for f in $i; do echo $(BIN_DIST_NAME)/$$$$f >> $(BIN_DIST_LIST); done \
+               for f in $i; do echo $(BIN_DIST_NAME)/$$$$f >> bindist-list; done \
            ) \
            )
 endef
index da6b3b6..08a1076 100644 (file)
@@ -15,7 +15,7 @@ define manual-package-config # args: $1 = dir
 $(call trace, manual-package-config($1))
 $(call profStart, manual-package-config($1))
 
-$1/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE)
+$1/dist/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) | $$$$(dir $$$$@)/.
        $$(CPP) $$(RAWCPP_FLAGS) -P \
                -DTOP='"$$(TOP)"' \
                $$($1_PACKAGE_CPP_OPTS) \
@@ -27,8 +27,8 @@ $1/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE)
 
 # This is actually a real file, but we need to recreate it on every
 # "make install", so we declare it as phony
-.PHONY: $1/package.conf.install
-$1/package.conf.install:
+.PHONY: $1/dist/package.conf.install
+$1/dist/package.conf.install: | $$$$(dir $$$$@)/.
        $$(CPP) $$(RAWCPP_FLAGS) -P \
                -DINSTALLING \
                -DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))"' \
@@ -38,10 +38,5 @@ $1/package.conf.install:
        grep -v '^#pragma GCC' $$@.raw | \
            sed -e 's/""//g' -e 's/:[   ]*,/: /g' >$$@
 
-distclean : clean_$1_package.conf
-.PHONY: clean_$1_package.conf
-clean_$1_package.conf :
-       $$(call removeFiles,$1/package.conf.install $1/package.conf.inplace)
-
 $(call profEnd, manual-package-config($1))
 endef