1 #-----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.31 2000/05/25 13:11:17 panne Exp $
4 # We create two driver scripts:
5 # - one to run in-place in the build tree for building libraries
6 # - one wired to the install locations for later installation
8 # the installation script is built first, and we invoke make recursively
9 # to build the in-place version.
12 CURRENT_DIR=ghc/driver
13 include $(TOP)/mk/boilerplate.mk
22 INSTALLED_SCRIPT_PROG = ghc-$(ProjectVersion)
23 INPLACE_SCRIPT_PROG = ghc-inplace
25 ifeq "$(INSTALLING)" "1"
27 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
30 TOP_PWD := $(FPTOOLS_TOP_ABS)
31 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
39 # The driver needs to know the options and names for
40 # all possible ways, so we magically generate the
41 # the make variable names for them here.
44 USER_WAY_NAMES = $(foreach way,$(USER_WAYS),WAY_$(way)_NAME)
45 USER_WAY_OPTS = $(foreach way,$(USER_WAYS),WAY_$(way)_REAL_OPTS)
47 SCRIPT_SUBST_VARS := \
49 ProjectName ProjectVersion ProjectVersionInt \
50 HscMajorVersion HscMinorVersion CcMajorVersion CcMinorVersion \
51 CURRENT_DIR HOSTPLATFORM TARGETPLATFORM \
52 GHC_LIB_DIR GHC_RUNTIME_DIR GHC_INCLUDE_DIR \
53 GHC_OPT_HILEV_ASM GhcWithNativeCodeGen LeadingUnderscore\
54 GHC_UNLIT GHC_HSCPP GHC_MKDEPENDHS GHC_HSC GHC_SYSMAN EnableWin32DLLs \
55 CP RM CONTEXT_DIFF LibGmp GhcWithRegisterised LibsReadline \
56 $(USER_WAY_NAMES) $(USER_WAY_OPTS)
59 # When creating a binary distribution, we prefix the driver script
60 # with a short msg about what variables need to be set to get the
64 ifeq "$(BIN_DIST)" "1"
65 SCRIPT_PREFIX_FILES=prefix.txt
67 SCRIPT_SUBST_VARS += libdir includedir libexecdir datadir bindir TMPDIR TOP_PWD
70 all :: $(DYN_LOADABLE_BITS)
72 # don't recurse on 'make install'
74 ifeq "$(INSTALLING)" "1"
75 all clean distclean mostlyclean maintainer-clean ::
76 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
81 # the driver goes in $(bindir), the perl script helpers
84 # ToDo: allow different install name for driver?
86 INSTALL_SCRIPTS += $(SCRIPT_PROG)
87 INSTALL_LIBS += $(DYN_LOADABLE_BITS)
90 # depend setup: other directories need the driver script to compute
91 # their dependencies, so `depend' is simply an alias for `all' here.
97 CLEAN_FILES += $(SCRIPT_OBJS) $(SCRIPT_LINK) $(DYN_LOADABLE_BITS) ghc-[0-9].*
100 # Source distribution
102 SRC_DEST_FILES=$(patsubst %.prl,%.lprl,$(DYN_LOADABLE_BITS)) ghc.lprl ordering-passes test_mangler
104 include $(TOP)/mk/target.mk
106 ghc.prl : $(TOP)/mk/version.mk
109 # Another hack (hmm..I can see a pattern developing here :-)
110 # In ghc/driver, we create a symlink from ghc-<whatever-version> to
111 # ghc, but we don't want this included in a source distribution.
112 # We `solve' this by removing `ghc' from the dist tree here.
114 @echo "Patching dist tree: removing $(SRC_DIST_DIR)/ghc symlink"
115 $(RM) $(SRC_DIST_DIR)/ghc