diff options
author | Ian Lynagh <igloo@earth.li> | 2007-06-05 13:39:56 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2007-06-05 13:39:56 +0000 |
commit | 094f9feafaf83190891736ddd8d1d7213f4293c4 (patch) | |
tree | eef84f7271f9122703bda3f463f813708b75ac5f | |
parent | db39fbf447d14801fe8ee4555bf51990944865c4 (diff) | |
download | haskell-094f9feafaf83190891736ddd8d1d7213f4293c4.tar.gz |
Install the RTS from a bindist correctly
-rw-r--r-- | Makefile | 42 | ||||
-rw-r--r-- | compiler/Makefile | 29 | ||||
-rw-r--r-- | distrib/Makefile | 29 | ||||
-rw-r--r-- | distrib/Makefile-bin-vars.in | 5 | ||||
-rw-r--r-- | distrib/configure-bin.ac | 5 | ||||
-rw-r--r-- | includes/Makefile | 23 | ||||
-rw-r--r-- | mk/package.mk | 39 | ||||
-rw-r--r-- | mk/target.mk | 5 | ||||
-rw-r--r-- | rts/Makefile | 22 |
9 files changed, 119 insertions, 80 deletions
@@ -59,12 +59,12 @@ include $(TOP)/mk/boilerplate.mk # We can't 'make boot' in libraries until stage1 is built ifeq "$(BootingFromHc)" "YES" -SUBDIRS_NOLIB = includes rts compat compiler docs utils driver +SUBDIRS_BUILD = includes rts compat compiler docs utils driver else -SUBDIRS_NOLIB = includes compat utils driver docs compiler rts +SUBDIRS_BUILD = includes compat utils driver docs compiler rts endif -SUBDIRS = $(SUBDIRS_NOLIB) libraries +SUBDIRS_INSTALL = includes compat utils driver docs rts libraries compiler # Sanity check that all the core libraries are in the tree, to catch # failure to run darcs-all. @@ -85,7 +85,7 @@ check-packages : stage1 : check-packages $(MAKE) -C utils/mkdependC boot @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \ - for i in $(SUBDIRS_NOLIB); do \ + for i in $(SUBDIRS_BUILD); do \ echo "------------------------------------------------------------------------"; \ echo "== $(MAKE) boot $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ @@ -93,7 +93,7 @@ stage1 : check-packages $(MAKE) --no-print-directory -C $$i $(MFLAGS) boot; \ if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \ done; \ - for i in $(SUBDIRS_NOLIB); do \ + for i in $(SUBDIRS_BUILD); do \ echo "------------------------------------------------------------------------"; \ echo "== $(MAKE) all $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ @@ -137,7 +137,7 @@ endif install :: check-packages $(INSTALL_DIR) $(bindir) @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \ - for i in $(SUBDIRS); do \ + for i in $(SUBDIRS_INSTALL); do \ echo "------------------------------------------------------------------------"; \ echo "== $(MAKE) $@ $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ @@ -179,7 +179,7 @@ endif install-docs :: @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \ - for i in $(SUBDIRS); do \ + for i in $(SUBDIRS_INSTALL); do \ echo "------------------------------------------------------------------------"; \ echo "== $(MAKE) $@ $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ @@ -232,9 +232,7 @@ endif .PHONY: binary-dist-pre% binary-dist binary-pack -BINARY_DIST_PRE_RULES=$(foreach d,$(BinDistDirs),binary-dist-pre-$d) - -binary-dist:: binary-dist-pre $(BINARY_DIST_PRE_RULES) +binary-dist:: binary-dist-pre binary-dist-pre:: -rm -rf $(BIN_DIST_DIR) @@ -244,23 +242,19 @@ binary-dist-pre:: echo 'include $$(TOP)/mk/install.mk' > $(BIN_DIST_DIR)/mk/target.mk echo 'include $$(TOP)/mk/recurse.mk' >> $(BIN_DIST_DIR)/mk/target.mk echo '' > $(BIN_DIST_DIR)/mk/compat.mk + cp mk/package.mk $(BIN_DIST_DIR)/mk/ cp mk/install.mk $(BIN_DIST_DIR)/mk/ cp mk/recurse.mk $(BIN_DIST_DIR)/mk/ $(MKDIRHIER) $(BIN_DIST_DIR)/lib/$(TARGETPLATFORM) $(MKDIRHIER) $(BIN_DIST_DIR)/share -$(BINARY_DIST_PRE_RULES): binary-dist-pre-%: - $(MAKE) -C $* $(MFLAGS) $(INSTALL_STAGE) install \ - prefix=$(BIN_DIST_DIR) \ - exec_prefix=$(BIN_DIST_DIR) \ - bindir=$(BIN_DIST_DIR)/bin/$(TARGETPLATFORM) \ - libdir=$(BIN_DIST_DIR)/lib/$(TARGETPLATFORM) \ - libexecdir=$(BIN_DIST_DIR)/lib/$(TARGETPLATFORM) \ - datadir=$(BIN_DIST_DIR)/share - binary-dist:: - $(MAKE) -C driver binary-dist DOING_BIN_DIST=YES - $(MAKE) -C utils binary-dist DOING_BIN_DIST=YES + $(MAKE) -C includes binary-dist DOING_BIN_DIST=YES + $(MAKE) -C compiler binary-dist DOING_BIN_DIST=YES $(INSTALL_STAGE) + # XXX $(MAKE) -C docs binary-dist DOING_BIN_DIST=YES + $(MAKE) -C rts binary-dist DOING_BIN_DIST=YES + $(MAKE) -C driver binary-dist DOING_BIN_DIST=YES + $(MAKE) -C utils binary-dist DOING_BIN_DIST=YES VARFILE=$(BIN_DIST_DIR)/Makefile-vars.in @@ -276,6 +270,8 @@ binary-dist:: echo "package = ghc" >> $(VARFILE) echo "version = $(ProjectVersion)" >> $(VARFILE) echo "ProjectVersion = $(ProjectVersion)" >> $(VARFILE) + echo "HaveLibGmp = $(HaveLibGmp)" >> $(VARFILE) + echo "GhcLibsWithUnix = $(GhcLibsWithUnix)" >> $(VARFILE) cat distrib/Makefile-bin-vars.in >> $(VARFILE) @echo "Generating a shippable configure script.." $(MV) $(BIN_DIST_DIR)/configure-bin.ac $(BIN_DIST_DIR)/configure.ac @@ -354,7 +350,7 @@ endif fiddle-binary-dist: cd $(BIN_DIST_DIR) && ../distrib/prep-bin-dist-mingw # Tar up the distribution and build a manifest -binary-dist :: tar-binary-dist +# XXX binary-dist :: tar-binary-dist .PHONY: tar-binary-dist tar-binary-dist: @@ -427,7 +423,7 @@ SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME) # # Files to include in source distributions # -SRC_DIST_DIRS += mk docs distrib $(filter-out docs distrib,$(SUBDIRS)) +SRC_DIST_DIRS += mk docs distrib $(filter-out docs distrib,$(SUBDIRS_INSTALL)) SRC_DIST_FILES += \ configure.ac config.guess config.sub configure \ aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \ diff --git a/compiler/Makefile b/compiler/Makefile index 19fba4e1cc..6c53f492db 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -894,17 +894,45 @@ else GhcLibraryName=libHS$(PACKAGE)$(_way).a endif +ifneq "$(DOING_BIN_DIST)" "YES" $(GHC_PROG) : $(GhcLibraryName) main/Main.hs $(RM) package.conf.inplace $(RM) $(STAMP_PKG_CONF) $(MAKE) $(STAMP_PKG_CONF) $(MAKE) -f Makefile.ghcbin $(MFLAGS) HS_PROG=$(GHC_PROG) $@ +endif # Propagate standard targets to Makefile.ghcbin docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt:: $(MAKE) -f Makefile.ghcbin $(MFLAGS) $@ endif +include $(TOP)/mk/package.mk + +#----------------------------------------------------------------------------- +# binary-dist + +# $(error Q$(INSTALL_PROGS)W) +foo: + echo Q$(INSTALL_PROGS)W$(GHC_PROG)E + echo Q$(INSTALL_LIBEXECS)W$(GHC_PROG)E + +binary-dist: + $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler + $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/stage$(stage) + echo "stage=$(stage)" > $(BIN_DIST_DIR)/compiler/Makefile + cat Makefile >> $(BIN_DIST_DIR)/compiler/Makefile + $(INSTALL_DATA) package.conf.in $(BIN_DIST_DIR)/compiler/ +ifneq "$(INSTALL_LIBS)" "" + set -e; for f in $(INSTALL_LIBS); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done +endif +ifneq "$(INSTALL_PROGS)" "" + set -e; for f in $(INSTALL_PROGS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done +endif +ifneq "$(INSTALL_LIBEXECS)" "" + set -e; for f in $(INSTALL_LIBEXECS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done +endif + #----------------------------------------------------------------------------- # clean @@ -930,7 +958,6 @@ EXTRA_SRCS += parser/Parser.y TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS))) - include $(TOP)/mk/target.mk # ----------------------------------------------------------------------------- diff --git a/distrib/Makefile b/distrib/Makefile index 2b6cdca0c1..d60e1117f6 100644 --- a/distrib/Makefile +++ b/distrib/Makefile @@ -12,14 +12,22 @@ in-place :: fi @echo "Finished configuring..to use, add `pwd`/bin/$(platform) to your PATH." -install-dirs :: +install :: $(INSTALL_DIR) $(bindir) (cd lib/$(platform); find . -type d -exec sh -c '$(INSTALL_DIR) $$0 $(libdir)/$$0' {} \; ) (cd share; find . -type d -exec sh -c '$(INSTALL_DIR) $(datadir)/$$0' {} \; ) -install :: install-dirs install-driver install-utils install-libs install-datas install-docs postinstall denounce +install:: + $(MAKE) -C includes install DOING_BIN_DIST=YES + $(MAKE) -C driver install DOING_BIN_DIST=YES + $(MAKE) -C utils install DOING_BIN_DIST=YES + $(MAKE) -C rts install DOING_BIN_DIST=YES + $(MAKE) -C libraries install DOING_BIN_DIST=YES + $(MAKE) -C compiler install DOING_BIN_DIST=YES + +install :: install-docs postinstall denounce -.PHONY: install-libs install-utils install-datas postinstall denounce +.PHONY: postinstall denounce denounce: @echo @@ -44,21 +52,6 @@ postinstall: echo "Done" ; \ fi -install-libs: - (cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; ) - $(MAKE) -C libraries install DOING_BIN_DIST=YES - -install-driver: - $(MAKE) -C driver install DOING_BIN_DIST=YES - -install-utils: - $(MAKE) -C utils install DOING_BIN_DIST=YES - -install-datas: - set -e; for i in `(cd share; find . -type f )`; do \ - $(INSTALL_DATA) share/$$i $(datadir)/$$i; \ - done - show-install-setup: @echo "Install setup..." @echo "bindir = $(bindir)" diff --git a/distrib/Makefile-bin-vars.in b/distrib/Makefile-bin-vars.in index 0a4fdb98d1..5a54cbfbb6 100644 --- a/distrib/Makefile-bin-vars.in +++ b/distrib/Makefile-bin-vars.in @@ -27,8 +27,11 @@ LN_S = @LN_S@ CHMOD = chmod INSTALL = @INSTALL@ exeext = @exeext@ -SED = @SedCmd@ +SED = @SedCmd@ DEFAULT_TMPDIR = /tmp +RANLIB = @RANLIB@ + +RAWCPP_FLAGS = -undef -traditional #----------end of user-serviceable parts------------ # diff --git a/distrib/configure-bin.ac b/distrib/configure-bin.ac index fd8c2f15d9..0d01388e80 100644 --- a/distrib/configure-bin.ac +++ b/distrib/configure-bin.ac @@ -132,6 +132,11 @@ dnl ** how to do symlinks ** AC_PROG_LN_S() # +dnl ** how to invoke `ar' and `ranlib' +# +FP_PROG_AR_NEEDS_RANLIB + +# dnl ** Find the path to sed ** # AC_PATH_PROG(SedCmd,sed) diff --git a/includes/Makefile b/includes/Makefile index cfb2a48446..4b89d52c39 100644 --- a/includes/Makefile +++ b/includes/Makefile @@ -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 gmp.h $(H_CONFIG) $(H_PLATFORM),$(wildcard *.h)) gmp.h + +ifneq "$(DOING_BIN_DIST)" "YES" # # Options @@ -25,12 +33,6 @@ 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) @@ -160,6 +162,8 @@ endif CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h +endif + # --------------------------------------------------------------------------- # boot setup: # @@ -175,6 +179,11 @@ CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h 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: # diff --git a/mk/package.mk b/mk/package.mk index 6c22535dbd..00e3ea20e7 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -10,9 +10,7 @@ ifneq "$(PACKAGE)" "" # to the compiler, and spliced into package.conf in place of $topdir at # runtime. # -# On Unix, we only use absolute paths in package.conf, except that when -# building a binary distribution we use $libdir and $datadir in package.conf -# which are then replaced by the correct values at install time. +# On Unix, we only use absolute paths in package.conf. # ifeq "$(Windows)" "YES" @@ -22,8 +20,8 @@ PKG_DATADIR = $$topdir else -PKG_LIBDIR = $$libdir -PKG_DATADIR = $$datadir +PKG_LIBDIR = $(libdir) +PKG_DATADIR = $(datadir) endif # Unix @@ -74,17 +72,19 @@ package.conf.inplace : package.conf.in grep -v '^#pragma GCC' | \ sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$@ -package.conf.installed : package.conf.in +install:: $(CPP) $(RAWCPP_FLAGS) -P -DINSTALLING \ - -DIMPORT_DIR='"$(IMPORT_DIR_INSTALLED)"' \ - -DLIB_DIR='"$(LIB_DIR_INSTALLED)"' \ - -DINCLUDE_DIR='"$(INCLUDE_DIR_INSTALLED)"' \ - -DDATA_DIR='"$(DATA_DIR_INSTALLED)"' \ - -DHTML_DIR='"$(HTML_DIR_INSTALLED)"' \ - -DHADDOCK_IFACE='"$(HADDOCK_IFACE_INSTALLED)"' \ - -x c $(PACKAGE_CPP_OPTS) $< | \ - grep -v '^#pragma GCC' | \ - sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$@ + -DIMPORT_DIR='"$(IMPORT_DIR_INSTALLED)"' \ + -DLIB_DIR='"$(LIB_DIR_INSTALLED)"' \ + -DINCLUDE_DIR='"$(INCLUDE_DIR_INSTALLED)"' \ + -DDATA_DIR='"$(DATA_DIR_INSTALLED)"' \ + -DHTML_DIR='"$(HTML_DIR_INSTALLED)"' \ + -DHADDOCK_IFACE='"$(HADDOCK_IFACE_INSTALLED)"' \ + -I../includes \ + -x c $(PACKAGE_CPP_OPTS) package.conf.in \ + | grep -v '^#pragma GCC' \ + | sed -e 's/""//g' -e 's/:[ ]*,/: /g' \ + | $(bindir)/ghc-pkg update - --force # we could be more accurate here and add a dependency on # driver/package.conf, but that doesn't work too well because of @@ -105,12 +105,11 @@ ifneq "$(BootingFromHc)" "YES" boot all :: $(STAMP_PKG_CONF) endif -$(STAMP_PKG_CONF) : package.conf.inplace package.conf.installed +$(STAMP_PKG_CONF) : package.conf.inplace $(GHC_PKG_INPLACE) update - --force-files <package.conf.inplace - $(GHC_PKG_INPLACE) update - -f $(GHC_DRIVER_DIR)/package.conf --force-files <package.conf.installed @touch $(STAMP_PKG_CONF) -CLEAN_FILES += package.conf.installed package.conf.inplace +CLEAN_FILES += package.conf.inplace endif # $(way) == "" @@ -231,10 +230,6 @@ ifndef GHCI_LIBRARY GHCI_LIBRARY = $(patsubst lib%.a,%.o,$(LIBRARY)) endif -ifneq "$(NO_INSTALL_LIBRARY)" "YES" -INSTALL_LIBS += $(GHCI_LIBRARY) -endif - CLEAN_FILES += $(GHCI_LIBRARY) all :: $(GHCI_LIBRARY) diff --git a/mk/target.mk b/mk/target.mk index 513b0dc02e..8a9e5b5b43 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -39,11 +39,6 @@ PRE_SRCS := $(ALL_SRCS) -################################################################## -# Include package building machinery - -include $(TOP)/mk/package.mk - ################################################################### # Suffix rules for Haskell, C and literate diff --git a/rts/Makefile b/rts/Makefile index 184a8440cc..1eebfd6c40 100644 --- a/rts/Makefile +++ b/rts/Makefile @@ -383,17 +383,33 @@ ifneq "$(BootingFromHc)" "YES" $(HC) $(HC_OPTS) -S $< -o $@ endif +include $(TOP)/mk/package.mk + #----------------------------------------------------------------------------- # # Files to install # # Just libHSrts is installed uniformly across ways # -INSTALL_LIBS += $(LIBRARY) ifeq "$(DLLized)" "YES" -INSTALL_PROGS += $(DLL_NAME) gmp/gmp.dll -INSTALL_LIBS += $(patsubst %.a,%_imp.a,$(LIBARY)) +INSTALL_PROGS += gmp/gmp.dll INSTALL_LIBS += gmp/libgmp_imp.a Main.dll_o endif +#----------------------------------------------------------------------------- +# +# binary-dist + +binary-dist: + $(INSTALL_DIR) $(BIN_DIST_DIR)/rts + $(INSTALL_DIR) $(BIN_DIST_DIR)/rts/gmp + $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/rts/ + $(INSTALL_DATA) package.conf.in $(BIN_DIST_DIR)/rts/ +ifneq "$(INSTALL_LIBS)" "" + $(INSTALL_DATA) $(INSTALL_LIBS) $(BIN_DIST_DIR)/rts/ +endif +ifneq "$(INSTALL_LIBEXECS)" "" + $(INSTALL_PROGRAM) $(INSTALL_LIBEXECS) $(BIN_DIST_DIR)/rts/ +endif + include $(TOP)/mk/target.mk |