# 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.
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"; \
$(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"; \
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"; \
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"; \
.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)
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
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
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:
#
# 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 \
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
TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
-
include $(TOP)/mk/target.mk
# -----------------------------------------------------------------------------
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
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)"
CHMOD = chmod
INSTALL = @INSTALL@
exeext = @exeext@
-SED = @SedCmd@
+SED = @SedCmd@
DEFAULT_TMPDIR = /tmp
+RANLIB = @RANLIB@
+
+RAWCPP_FLAGS = -undef -traditional
#----------end of user-serviceable parts------------
#
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)
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
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)
CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h
+endif
+
# ---------------------------------------------------------------------------
# boot setup:
#
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:
#
# 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"
else
-PKG_LIBDIR = $$libdir
-PKG_DATADIR = $$datadir
+PKG_LIBDIR = $(libdir)
+PKG_DATADIR = $(datadir)
endif # Unix
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
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) == ""
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)
PRE_SRCS := $(ALL_SRCS)
-##################################################################
-# Include package building machinery
-
-include $(TOP)/mk/package.mk
-
###################################################################
# Suffix rules for Haskell, C and literate
$(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