[project @ 1997-03-14 07:52:06 by simonpj]
[ghc-hetmet.git] / ghc / driver / Makefile
1 #-----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.3 1997/03/14 07:59:40 simonpj Exp $
3
4 TOP=..
5 CURRENT_DIR=ghc/driver
6 include $(TOP)/mk/boilerplate.mk
7
8 #
9 # The ways setup doesn't apply to the driver
10 #
11 WAYS=
12
13 INSTALLING=0
14
15 DYN_LOADABLE_BITS = \
16         ghc-asm.prl \
17         ghc-recomp.prl \
18         ghc-iface.prl \
19         ghc-consist.prl \
20         ghc-split.prl
21
22 SCRIPT_PROG = ghc
23 SCRIPT_OBJS = ghc.prl
24  
25 INTERP  = $(PERL)
26
27 #
28 # The driver needs to know the options and names for 
29 # all possible ways, so we magically generate the
30 # the make variable names for them here.
31 #
32
33 WAY_NAMES = $(foreach way,$(ALL_WAYS),WAY_$(way)_NAME)
34 WAY_OPTS  = $(foreach way,$(ALL_WAYS),WAY_$(way)_HC_OPTS)
35
36 ifeq "$(INSTALLING)" "1"
37 TOP_PWD := $(prefix)
38 else
39 TOP_PWD := $(FPTOOLS_TOP_ABS)
40 endif
41
42 SCRIPT_SUBST_VARS := \
43   INSTALLING \
44   PROJECTNAME PROJECTVERSION PROJECTPATCHLEVEL \
45   CURRENT_DIR TMPDIR HOSTPLATFORM TARGETPLATFORM \
46   GHC_LIB_DIR GHC_RUNTIME_DIR GHC_UTILS_DIR GHC_INCLUDE_DIR \
47   GHC_OPT_HILEV_ASM GhcWithNativeCodeGen LeadingUnderscore\
48   GHC_UNLIT GHC_HSCPP GHC_HSC GHC_SYSMAN \
49   CP RM PERL CONTEXT_DIFF \
50   $(WAY_NAMES) $(WAY_OPTS)
51
52 #
53 # When creating a binary distribution, we prefix the driver script
54 # with a short msg about what variables need to be set to get the
55 # script going. 
56 #
57
58 ifeq "$(BIN_DIST)" "1"
59 SCRIPT_PREFIX_FILES=prefix.txt
60 else
61 SCRIPT_SUBST_VARS += TOP_PWD INSTLIBDIR_GHC INSTDATADIR_GHC PERL
62 endif
63
64 all :: $(DYN_LOADABLE_BITS)
65
66 #
67 # Install setup:
68 #   the driver goes in $(bindir), the perl script helpers
69 #   in $(libdir)
70 #
71 # ToDo: allow different install name for driver?
72 #
73 INSTALL_PROGS += $(SCRIPT_PROG)
74 INSTALL_LIBS  += $(DYN_LOADABLE_BITS)
75
76 #
77 # Before really installing the driver, we have to
78 # reconfigure it such that the paths it refers to,
79 # point to the installed utils.
80 #
81 install ::
82         @$(RM) $(SCRIPT_PROG)
83         @$(MAKE) $(MFLAGS) INSTALLING=1 $(SCRIPT_PROG)
84
85 #
86 # depend setup: other directories need the driver script to compute
87 # their dependencies, so `depend' is simply an alias for `all' here.
88 depend :: all
89
90 #
91 # Clean up
92 #
93 CLEAN_FILES += $(SCRIPT_OBJS) $(DYN_LOADABLE_BITS)
94
95 #
96 # Source distribution
97 #
98 SRC_DEST_FILES=$(patsubst %.prl,%.lprl,$(DYN_LOADABLE_BITS)) ghc.lprl ordering-passes test_mangler
99
100 include $(TOP)/mk/target.mk
101
102 # Hack to re-create the in-situ build tree driver script after 
103 # having installed it.
104 #
105 install ::
106         @$(RM) $(SCRIPT_PROG)
107         @$(MAKE) $(MFLAGS) BIN_DIST=0 $(SCRIPT_PROG)
108
109
110 #
111 # Option vars for the special ways
112 #
113
114 # Way p:
115 WAY_p_NAME=profiling
116 WAY_p_HC_OPTS+=-fscc-profiling -DPROFILING -optc-DPROFILING
117
118 # Way t:
119 WAY_t_NAME+=ticky-ticky profiling
120 WAY_t_HC_OPTS=-fticky-ticky -DTICKY_TICKY -optc-DTICKY_TICKY
121
122 # Way `u':
123 WAY_u_NAME=unregisterized (using portable C only)
124 WAY_u_HC_OPTS=
125
126 # Way `mc': concurrent
127 WAY_mc_NAME=concurrent
128 WAY_mc_HC_OPTS+=-fstack-check -fconcurrent -D__CONCURRENT_HASKELL__ -DCONCURRENT -optcpp-D__CONCURRENT_HASKELL__ -optcpp-DCONCURRENT
129
130 # Way `mr': 
131 WAY_mr_NAME=profiled concurrent
132 WAY_mr_HC_OPTS+=-fstack-check -fconcurrent -fscc-profiling -D__CONCURRENT_HASKELL__ -DCONCURRENT -DPROFILING -optcpp-D__CONCURRENT_HASKELL__ -optcpp-DCONCURRENT -optcpp-DPROFILING
133
134 # Way `mt': 
135 WAY_mt_NAME=ticky-ticky concurrent
136 WAY_mt_HC_OPTS+=-fstack-check -fconcurrent -fticky-ticky -D__CONCURRENT_HASKELL__ -DCONCURRENT -DTICKY-TICKY -optc-D__CONCURRENT_HASKELL__ -optc-DCONCURRENT -optc-DTICKY_TICKY
137
138 # Way `mp': 
139 WAY_mp_NAME=parallel
140 WAY_mp_HC_OPTS+=-fstack-check -fconcurrent -D__PARALLEL_HASKELL__ -DPAR -optcpp-D__PARALLEL_HASKELL__ -optc-DPAR -optc-DCONCURRENT
141
142 #
143 # Way `mg': 
144 #  Q: is passing -D__GRANSIM__ and -DGRAN to hscpp needed?
145 WAY_mg_NAME=GranSim
146 WAY_mg_HC_OPTS+=-fstack-check -fconcurrent -fgransim -D__GRANSIM__ -DGRAN -optcpp-D__GRANSIM__ -optc-DGRAN -optc-D__CONCURRENT_HASKELL__ -optc-DCONCURRENT
147
148 #
149 # Ways for different garbage collectors
150 #
151 WAY_2s_NAME=2-space GC
152 WAY_2s_HC_OPTS+=-optc-DGC2s
153
154 WAY_1s_NAME=1-space GC
155 WAY_1s_HC_OPTS+=-optc-DGC1s
156
157 WAY_du_NAME=dual-mode GC
158 WAY_du_HC_OPTS+=-optc-DGCdu