[project @ 1999-10-27 09:43:25 by simonmar]
[ghc-hetmet.git] / ghc / driver / Makefile
1 #-----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.25 1999/10/27 09:43:25 simonmar Exp $
3
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
7 #
8 # the installation script is built first, and we invoke make recursively
9 # to build the in-place version.
10
11 TOP=..
12 CURRENT_DIR=ghc/driver
13 include $(TOP)/mk/boilerplate.mk
14
15 INSTALLING=1
16
17 DYN_LOADABLE_BITS = \
18         ghc-asm.prl \
19         ghc-iface.prl \
20         ghc-consist.prl \
21         ghc-split.prl
22
23 INSTALLED_SCRIPT_PROG  = ghc-$(ProjectVersion)
24 INPLACE_SCRIPT_PROG    = ghc-inplace
25
26 ifeq "$(INSTALLING)" "1"
27 TOP_PWD         := $(prefix)
28 SCRIPT_PROG     =  $(INSTALLED_SCRIPT_PROG)
29 SCRIPT_LINK     =  ghc
30 else
31 TOP_PWD         := $(FPTOOLS_TOP_ABS)
32 SCRIPT_PROG     =  $(INPLACE_SCRIPT_PROG)
33 endif
34
35 SCRIPT_OBJS = ghc.prl
36  
37 INTERP=perl
38
39 SCRIPT_SUBST_VARS := \
40   INSTALLING \
41   ProjectName ProjectVersion ProjectVersionInt \
42   HscMajorVersion HscMinorVersion CcMajorVersion CcMinorVersion \
43   CURRENT_DIR HOSTPLATFORM TARGETPLATFORM \
44   GHC_LIB_DIR GHC_RUNTIME_DIR GHC_INCLUDE_DIR \
45   GHC_OPT_HILEV_ASM GhcWithNativeCodeGen LeadingUnderscore\
46   GHC_UNLIT GHC_HSCPP GHC_MKDEPENDHS GHC_HSC GHC_SYSMAN EnableWin32DLLs \
47   CP RM CONTEXT_DIFF LibGmp GhcWithRegisterised
48
49 #
50 # When creating a binary distribution, we prefix the driver script
51 # with a short msg about what variables need to be set to get the
52 # script going. 
53 #
54
55 ifeq "$(BIN_DIST)" "1"
56 SCRIPT_PREFIX_FILES=prefix.txt
57 else
58 SCRIPT_SUBST_VARS += libdir libexecdir datadir bindir TMPDIR TOP_PWD
59 endif
60
61 all :: $(DYN_LOADABLE_BITS)
62
63 # don't recurse on 'make install'
64 #
65 ifeq "$(INSTALLING)" "1"
66 all clean veryclean maintainer-clean ::
67         $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
68 endif
69
70 #
71 # Install setup:
72 #   the driver goes in $(bindir), the perl script helpers
73 #   in $(libdir)
74 #
75 # ToDo: allow different install name for driver?
76 #
77 INSTALL_SCRIPTS += $(SCRIPT_PROG)
78 INSTALL_LIBS    += $(DYN_LOADABLE_BITS)
79
80 #
81 # depend setup: other directories need the driver script to compute
82 # their dependencies, so `depend' is simply an alias for `all' here.
83 depend :: all
84
85 #
86 # Clean up
87 #
88 CLEAN_FILES += $(SCRIPT_OBJS) $(SCRIPT_LINK) $(DYN_LOADABLE_BITS) ghc-[0-9].*
89
90 #
91 # Source distribution
92 #
93 SRC_DEST_FILES=$(patsubst %.prl,%.lprl,$(DYN_LOADABLE_BITS)) ghc.lprl ordering-passes test_mangler
94
95 include $(TOP)/mk/target.mk
96
97 ghc.prl : $(TOP)/mk/version.mk
98
99 #
100 # Another hack (hmm..I can see a pattern developing here :-)
101 # In ghc/driver, we create a symlink from ghc-<whatever-version> to
102 # ghc, but we don't want this included in a source distribution.
103 # We `solve' this by removing `ghc' from the dist tree here.
104 dist ::
105         @echo "Patching dist tree: removing $(SRC_DIST_DIR)/ghc symlink"
106         $(RM) $(SRC_DIST_DIR)/ghc