1 #-----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.27 1999/11/25 10:38:59 simonpj 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
23 INSTALLED_SCRIPT_PROG = ghc-$(ProjectVersion)
24 INPLACE_SCRIPT_PROG = ghc-inplace
26 ifeq "$(INSTALLING)" "1"
28 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
31 TOP_PWD := $(FPTOOLS_TOP_ABS)
32 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
40 # The driver needs to know the options and names for
41 # all possible ways, so we magically generate the
42 # the make variable names for them here.
45 USER_WAY_NAMES = $(foreach way,$(USER_WAYS),WAY_$(way)_NAME)
46 USER_WAY_OPTS = $(foreach way,$(USER_WAYS),WAY_$(way)_REAL_OPTS)
48 SCRIPT_SUBST_VARS := \
50 ProjectName ProjectVersion ProjectVersionInt \
51 HscMajorVersion HscMinorVersion CcMajorVersion CcMinorVersion \
52 CURRENT_DIR HOSTPLATFORM TARGETPLATFORM \
53 GHC_LIB_DIR GHC_RUNTIME_DIR GHC_INCLUDE_DIR \
54 GHC_OPT_HILEV_ASM GhcWithNativeCodeGen LeadingUnderscore\
55 GHC_UNLIT GHC_HSCPP GHC_MKDEPENDHS GHC_HSC GHC_SYSMAN EnableWin32DLLs \
56 CP RM CONTEXT_DIFF LibGmp GhcWithRegisterised \
57 $(USER_WAY_NAMES) $(USER_WAY_OPTS)
60 # When creating a binary distribution, we prefix the driver script
61 # with a short msg about what variables need to be set to get the
65 ifeq "$(BIN_DIST)" "1"
66 SCRIPT_PREFIX_FILES=prefix.txt
68 SCRIPT_SUBST_VARS += libdir libexecdir datadir bindir TMPDIR TOP_PWD
71 all :: $(DYN_LOADABLE_BITS)
73 # don't recurse on 'make install'
75 ifeq "$(INSTALLING)" "1"
76 all clean veryclean maintainer-clean ::
77 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
82 # the driver goes in $(bindir), the perl script helpers
85 # ToDo: allow different install name for driver?
87 INSTALL_SCRIPTS += $(SCRIPT_PROG)
88 INSTALL_LIBS += $(DYN_LOADABLE_BITS)
91 # depend setup: other directories need the driver script to compute
92 # their dependencies, so `depend' is simply an alias for `all' here.
98 CLEAN_FILES += $(SCRIPT_OBJS) $(SCRIPT_LINK) $(DYN_LOADABLE_BITS) ghc-[0-9].*
101 # Source distribution
103 SRC_DEST_FILES=$(patsubst %.prl,%.lprl,$(DYN_LOADABLE_BITS)) ghc.lprl ordering-passes test_mangler
105 include $(TOP)/mk/target.mk
107 ghc.prl : $(TOP)/mk/version.mk
110 # Another hack (hmm..I can see a pattern developing here :-)
111 # In ghc/driver, we create a symlink from ghc-<whatever-version> to
112 # ghc, but we don't want this included in a source distribution.
113 # We `solve' this by removing `ghc' from the dist tree here.
115 @echo "Patching dist tree: removing $(SRC_DIST_DIR)/ghc symlink"
116 $(RM) $(SRC_DIST_DIR)/ghc