[project @ 2003-06-24 10:03:39 by simonmar]
[ghc-hetmet.git] / ghc / compiler / Makefile
1 # -----------------------------------------------------------------------------
2 # Main ghc/compiler Makefile
3
4 # Targets:
5 #
6 #       all     builds stage1 compiler
7 #
8 #       boot stage=N   generate build dirs and dependencies for stage N.
9 #                      NB. Must be done before 'make stageN'.
10 #                      NB. Cannot 'make boot stage=2' until stage1 has
11 #                          been built (similarly for stage3).
12 #
13 #       stage1  (or stage=1) builds stage1 compiler
14 #       stage2  (or stage=2) builds stage2 compiler
15 #       stage3  (or stage=3) builds stage3 compiler
16 #
17
18 TOP = ..
19
20 # Use GHC for compiling C bits (NB. must be before boilerplate include)
21 # NB. this requires BootingFromHc to be set on the make command line!
22 #
23 ifneq "$(BootingFromHc)" "YES"
24 UseGhcForCc = YES
25 endif
26
27 include $(TOP)/mk/boilerplate.mk
28
29 #-----------------------------------------------------------------------------
30 # Counting source code lines
31
32 USER_SRCS = $(filter-out $(DERIVED_SRCS),$(SRCS))
33 count :
34         ./count_lines $(USER_SRCS)
35
36 #-----------------------------------------------------------------------------
37 # Building ghc different ways (default is just `normal' sequential)
38
39 WAYS=$(GhcCompilerWays)
40
41 # -----------------------------------------------------------------------------
42 # Bootstrapping
43
44 # The stage1/stage2/stage3 business is quite delicate.  Here's how it works:
45
46 #  - the variable $(stage) holds the current stage number.  To build a 
47 #    particular stage, you say 'make stage=N' where N is 1, 2, or 3.
48 #    N defaults to 1.
49 #
50 #  - for stage N, object files and .hi files are placed inside 
51 #    the directory stageN, in subdirectories as per the sources.
52 #
53 #  - .hi-boot files are *linked* into the stageN tree, because in GHC 5.05+
54 #    the .hi-boot file must reside in the same place as the .hi file.
55 #
56 #  - we use explicit -o and -ohi options to direct the output from C & 
57 #    Haskell compilations.
58 #
59 #  - we generate a different .depend file for each build.  They need to be
60 #    different, because each stage might include different files: stage1
61 #    might not include GHCi, for example.  For each stage, a normal .depend
62 #    file is generated, and then post-processed to add the correct stageN/
63 #    prefix to each object and .hi filename.  The resulting .depend file
64 #    is named .depend-$(stage).  See the end of this Makefile for details.
65 #
66 #  - normal implicit rules don't work any more, because they're of the form
67 #
68 #        %.o : %.hs 
69 #
70 #    whereas we really need 
71 #
72 #        stageN/%.o : %.hs
73 #
74 #    so suffix.mk now defines the appropriate suffix rules when
75 #    $(odir) is set to a non-empty value.  Here we set $(odir) to
76 #    stage1, stage2, or stage3.
77 #
78 #  There are other plausible designs that might work, but each has different
79 #  problems:
80 #
81 #  - using -odir and -hidir: GHC <= 4.08 doesn't support -hidir, and
82 #    anyway -odir puts all the objects in one directory (strips off the
83 #    subdirectory part), which eventually forces us to use VPATH to find
84 #    the sources.  I have a really bad feeling about VPATH.
85 #
86 #  - invoke make in the stageN subdirectory.  This probably requires VPATH
87 #    too.
88 #
89 #  - create a link tree.  The problem with requiring link trees is that 
90 #    Windows doesn't support symbolic links.
91
92 boot ::
93         $(MKDIRHIER) stage$(stage)
94         for i in $(ALL_DIRS); do \
95             $(MKDIRHIER) stage$(stage)/$$i; \
96         done
97 # On Windows, we can't use symbolic links for the -hi-boot files
98 # because GHC itself is a Mingw program and does not understand
99 # symbolic links.  So we have to copy the files instead of link them.
100 # That means that if you modify a .hi-boot file in Windows, you
101 # have to to say 'make boot' again.
102 #
103 # PS: 'ln -s foo baz' takes 'foo' relative to the path to 'baz'
104 #     whereas 'cp foo baz' treats the two paths independently.
105 #     Hence the "../.." in the ln command line
106 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
107         for i in */*hi-boot*; do \
108             cp -u -f $$i stage$(stage)/$$i; \
109         done
110 else
111         for i in */*hi-boot*; do \
112             $(LN_S) -f ../../$$i stage$(stage)/$$i || true ; \
113         done
114 endif
115
116 ifeq "$(stage)" ""
117 stage=1
118 endif
119
120 ifeq "$(stage)" "1"
121 HC=$(GHC)
122 endif
123
124 ifeq "$(stage)" "2"
125 HC=$(GHC_STAGE1)
126 endif
127
128 ifeq "$(stage)" "3"
129 HC=$(GHC_STAGE2)
130 endif
131
132 stage1 ::
133         $(MAKE) stage=1
134
135 stage2 ::
136         $(MAKE) stage=2
137
138 stage3 ::
139         $(MAKE) stage=3
140
141 odir=stage$(stage)
142
143 SRC_HC_OPTS += $(patsubst %, -i$(odir)/%, $(ALL_DIRS))
144
145 HS_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(HS_SRCS))))
146 C_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(C_SRCS))))
147
148 CLEAN_FILES += $(odir)/*/*.hi
149
150 ifeq "$(stage)" "1"
151 mostlyclean clean distclean maintainer-clean ::
152         $(MAKE) $@ stage=2
153         $(MAKE) $@ stage=3
154 endif
155
156 # -----------------------------------------------------------------------------
157 #               Set HS_PROG
158
159 # Note: there have been reports of people running up against the ARG_MAX limit
160 # when linking ghc with all its constituent object files. The likely source of 
161 # the problem is that the environment is a bit too big, so a workaround could
162 # be to do `env PATH=$(PATH) make ghc' to minimise the environment. (or the
163 # equivalent of `env' if it doesn't exist locally).
164 #
165 ifneq "$(way)" "dll"
166 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
167 HS_PROG=$(odir)/ghc$(_way)-$(ProjectVersion)
168 else
169 HS_PROG=$(odir)/ghc$(_way)
170 endif
171 else
172 HS_PROG=$(odir)/ghc-$(ProjectVersion)
173 endif
174
175 # -----------------------------------------------------------------------------
176 # Create compiler configuration
177 #
178 # The 'echo' commands simply spit the values of various make variables
179 # into Config.hs, whence they can be compiled and used by GHC itself
180
181 CONFIG_HS       = main/Config.hs
182 boot :: $(CONFIG_HS)
183
184 $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk Makefile
185         @$(RM) -f $(CONFIG_HS)
186         @echo "Creating $(CONFIG_HS) ... "
187         @echo "module Config where" >>$(CONFIG_HS)
188         @echo "cProjectName          = \"$(ProjectName)\"" >> $(CONFIG_HS)
189         @echo "cProjectVersion       = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
190         @echo "cProjectVersionInt    = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
191         @echo "cProjectPatchLevel    = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
192         @echo "cBooterVersion        = \"$(GhcVersion)\"" >> $(CONFIG_HS)
193         @echo "cHscIfaceFileVersion  = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
194         @echo "cHOSTPLATFORM         = \"$(HOSTPLATFORM)\"" >> $(CONFIG_HS)
195         @echo "cTARGETPLATFORM       = \"$(TARGETPLATFORM)\"" >> $(CONFIG_HS)
196         @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
197         @echo "cGhcUnregisterised    = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
198         @echo "cLeadingUnderscore    = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
199         @echo "cRAWCPP_FLAGS         = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
200         @echo "cGCC                  = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
201         @echo "cMKDLL                = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
202         @echo "cPROJECT_DIR          = \"$(PROJECT_DIR)\"" >> $(CONFIG_HS)
203         @echo "cGHC_DRIVER_DIR_REL   = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
204         @echo "cGHC_TOUCHY_PGM       = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
205         @echo "cGHC_TOUCHY_DIR_REL   = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
206         @echo "cGHC_UNLIT_PGM        = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
207         @echo "cGHC_UNLIT_DIR_REL    = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
208         @echo "cGHC_MANGLER_PGM      = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
209         @echo "cGHC_MANGLER_DIR_REL  = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
210         @echo "cGHC_SPLIT_PGM        = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
211         @echo "cGHC_SPLIT_DIR_REL    = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
212         @echo "cGHC_SYSMAN_PGM       = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
213         @echo "cGHC_SYSMAN_DIR_REL   = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
214         @echo "cGHC_CP               = \"$(GHC_CP)\"" >> $(CONFIG_HS)
215         @echo "cGHC_PERL             = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
216 ifeq ($(GhcWithIlx),YES)
217         @echo "cILX2IL               = \"$(ILX2IL)\"" >> $(CONFIG_HS)
218         @echo "cILASM                = \"$(ILASM)\"" >> $(CONFIG_HS)
219 endif
220         @echo "cEnableWin32DLLs      = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
221         @echo "cCONTEXT_DIFF         = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
222         @echo "cHaveLibGmp           = \"$(HaveLibGmp)\"" >> $(CONFIG_HS)
223         @echo "cUSER_WAY_NAMES       = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
224         @echo "cUSER_WAY_OPTS        = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
225         @echo "cDEFAULT_TMPDIR       = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
226         @echo done.
227
228 CLEAN_FILES += $(CONFIG_HS)
229
230 # -----------------------------------------------------------------------------
231 # Set SRCS etc.
232 #
233 # First figure out ALL_DIRS, the source sub-directories
234
235 ALL_DIRS = \
236   utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
237   specialise simplCore stranal stgSyn simplStg codeGen absCSyn main \
238   profiling parser cprAnalysis compMan ndpFlatten cbits
239
240 # Make sure we include Config.hs even if it doesn't exist yet...
241 ALL_SRCS += $(CONFIG_HS)
242
243 # HsGeneric.hs is not used just now
244 EXCLUDED_SRCS += hsSyn/HsGeneric.hs
245
246 ifeq ($(GhcWithNativeCodeGen),YES)
247 ALL_DIRS += nativeGen
248 else
249 SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
250 endif
251
252 ifeq ($(GhcWithIlx),YES)
253 ALL_DIRS += ilxGen
254 SRC_HC_OPTS += -DILX
255 endif
256
257 ifeq ($(GhcWithJavaGen),YES)
258 ALL_DIRS += javaGen
259 SRC_HC_OPTS += -DJAVA
260 endif
261
262 ifeq "$(BootingFromHc)" "YES"
263 # HC files are always from a self-booted compiler
264 bootstrapped = YES
265 compiling_with_4xx=NO
266 else
267 ifneq "$(findstring $(stage), 2 3)" ""
268 bootstrapped = YES
269 compiling_with_4xx = NO
270 else
271 bootstrapped = $(shell if (test $(GhcCanonVersion) -ge $(ProjectVersionInt) -a $(GhcPatchLevel) -ge $(ProjectPatchLevel)); then echo YES; else echo NO; fi)
272 compiling_with_4xx = $(shell if (test $(GhcCanonVersion) -lt 500); then echo YES; else echo NO; fi)
273 endif
274 endif
275
276 # Only include GHCi if we're bootstrapping with at least version 411
277 ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
278 # Yes, include the interepreter, readline, and Template Haskell extensions
279 SRC_HC_OPTS += -DGHCI -package haskell-src
280 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
281 SRC_HC_OPTS += -package unix
282 ifeq "$(GhcLibsWithReadline)" "YES"
283 SRC_HC_OPTS += -package readline 
284 endif
285 endif
286 ALL_DIRS += ghci
287 else
288 # No interpreter, so exclude Template Haskell modules
289 EXCLUDED_SRCS += deSugar/DsMeta.hs typecheck/TcSplice.lhs hsSyn/Convert.lhs
290 endif 
291
292 # There are some C files to include in HS_PROG, so add these to HS_OBJS
293 HS_OBJS  += $(C_OBJS)
294
295 # -----------------------------------------------
296 # mkdependC stuff
297 #
298 # Big Fudge to get around inherent problem that Makefile setup
299 # has got with 'mkdependC'.
300
301 SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
302
303 # XXX not really correct, hschooks.c actually gets include files like
304 # RtsFlags.c from the installed GHC, but we can't tell mkdependC about that.
305 SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
306
307 # -----------------------------------------------------------------------------
308 #               Haskell compilations
309
310 SRC_HC_OPTS += \
311   -cpp -fglasgow-exts -Rghc-timing \
312   -I. -IcodeGen -InativeGen -Iparser
313
314 # Omitted:      -I$(GHC_INCLUDE_DIR)
315 # We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS, 
316 # to avoid the use of an explicit path in GHC source files
317 #       (include "../includes/config.h"
318 # But alas GHC 4.08 (and others for all I know) uses this very
319 # same include path when compiling the .hc files it generates.
320 # Disaster!  Then the hc file sees the GHC 5.02 (or whatever)
321 # include files.   For the moment we've reverted to using
322 # an explicit path in the .hs sources
323 #
324 # For the benefit of <5.00 compilers, do include GHC_INCLUDE_DIR
325 # when generating dependencies. (=> it gets passed onto mkdependHS,
326 # which needs it).
327 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
328
329 # When bootstrapped, we don't make use of *any* packages
330 # (except possibly readline if GHCi is enabled, see above)
331 ifneq "$(bootstrapped)" "YES"
332 ifneq "$(mingw32_HOST_OS)" "1"
333 SRC_HC_OPTS += -package concurrent -package posix -package util
334 else
335 SRC_HC_OPTS += -package concurrent -package util
336 endif
337 endif
338
339 SRC_CC_OPTS += -Iparser -I. -O
340 SRC_HC_OPTS += -recomp $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
341 SRC_HC_OPTS += -H16M
342
343 ifeq "$(BootingFromHc)" "YES"
344 SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
345 endif
346
347 #       Special flags for particular modules
348 #       The standard suffix rule for compiling a Haskell file
349 #       adds these flags to the command line
350
351 prelude/PrimOp_HC_OPTS          = -no-recomp -H80m
352
353 # because the NCG can't handle the 64-bit math in here
354 prelude/PrelRules_HC_OPTS       = -fvia-C
355
356 main/ParsePkgConf_HC_OPTS       += -fno-warn-incomplete-patterns
357 # Use -fvia-C since the NCG can't handle the narrow16Int# (and intToInt16#?)
358 # primops on all platforms.
359 parser/Parser_HC_OPTS           += -Onot -fno-warn-incomplete-patterns -fvia-C
360
361 # The latest GHC version doesn't have a -K option yet, and it doesn't
362 # seem to be necessary anymore for the modules below.
363 ifeq "$(compiling_with_4xx)" "YES"
364 parser/Parser_HC_OPTS           += -K2m
365 endif
366
367 ifeq "$(HOSTPLATFORM)" "hppa1.1-hp-hpux9"
368 rename/RnMonad_HC_OPTS          =  -O2 -O2-for-C
369 endif
370
371 utils/StringBuffer_HC_OPTS      = -fvia-C -fno-prune-tydecls
372 utils/Digraph_HC_OPTS           = -fglasgow-exts 
373
374 ifeq "$(bootstrapped)" "YES"
375 utils/Binary_HC_OPTS            = -funbox-strict-fields
376 endif
377
378 # 4.08.2's NCG can't cope with Binary
379 ifeq "$(compiling_with_4xx)" "YES"
380 utils/Binary_HC_OPTS            += -fvia-C
381 endif
382
383 # ByteCodeItbls uses primops that the NCG doesn't support yet.
384 ghci/ByteCodeItbls_HC_OPTS      += -fvia-C
385 ghci/ByteCodeLink_HC_OPTS       += -fvia-C -monly-3-regs
386
387 # BinIface and Binary take ages to both compile and run if you don's use -O
388 main/BinIface_HC_OPTS           += -O
389 utils/Binary_HC_OPTS            += -O
390 utils/FastMutInt_HC_OPTS        += -O
391
392
393 # CSE interacts badly with top-level IORefs (reportedly in DriverState and
394 # DriverMkDepend), causing some of them to be commoned up.  We have a fix for
395 # this in 5.00+, but earlier versions of the compiler will need CSE turned off.
396 # To be on the safe side, we disable CSE in *all* modules with top-level IORefs.
397 compMan/CompManager_HC_OPTS     = -fno-cse
398 ghci/InteractiveUI_HC_OPTS      = -fno-cse
399 main/CmdLineOpts_HC_OPTS        = -fno-cse
400 main/DriverFlags_HC_OPTS        = -fno-cse
401 main/DriverMkDepend_HC_OPTS     = -fno-cse
402 main/DriverPipeline_HC_OPTS     = -fno-cse
403 main/DriverState_HC_OPTS        = -fno-cse
404 main/DriverUtil_HC_OPTS         = -fno-cse
405 main/Finder_HC_OPTS             = -fno-cse
406 main/SysTools_HC_OPTS           = -fno-cse
407
408 # The #include is vital for the via-C route, else the C
409 # compiler doesn't realise that the stcall foreign imports are indeed
410 # stdcall, and doesn't generate the Foo@8 name for them
411 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
412 main/SysTools_HC_OPTS           += '-\#include <windows.h>' '-\#include <process.h>'
413 endif
414
415 # Required due to use of Concurrent.myThreadId
416 utils/Panic_HC_OPTS += -fvia-C
417
418 # ghc_strlen percolates through so many modules that it is easier to get its
419 # prototype via a global option instead of a myriad of per-file OPTIONS
420 SRC_HC_OPTS += '-\#include "hschooks.h"'
421
422 # ----------------------------------------------------------------------------
423 #               Generate supporting stuff for prelude/PrimOp.lhs 
424 #               from prelude/primops.txt
425
426 GENPOC=$(TOP)/utils/genprimopcode/genprimopcode
427
428 PRIMOP_BITS=primop-data-decl.hs-incl \
429             primop-tag.hs-incl  \
430             primop-list.hs-incl  \
431             primop-has-side-effects.hs-incl  \
432             primop-out-of-line.hs-incl  \
433             primop-commutable.hs-incl  \
434             primop-needs-wrapper.hs-incl  \
435             primop-can-fail.hs-incl  \
436             primop-strictness.hs-incl  \
437             primop-primop-info.hs-incl
438
439 CLEAN_FILES += prelude/primops.txt
440 CLEAN_FILES += $(PRIMOP_BITS)
441
442 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
443 SRC_CPP_OPTS += ${GhcCppOpts}
444
445 ifneq "$(BootingFromHc)" "YES"
446 prelude/PrimOp.lhs $(odir)/prelude/PrimOp.o: $(PRIMOP_BITS)
447 endif
448
449 ifneq "$(BootingFromHc)" "YES"
450 depend :: $(PRIMOP_BITS)
451 endif
452
453 primop-data-decl.hs-incl: prelude/primops.txt
454         $(GENPOC) --data-decl          < $< > $@
455 primop-tag.hs-incl: prelude/primops.txt
456         $(GENPOC) --primop-tag         < $< > $@
457 primop-list.hs-incl: prelude/primops.txt
458         $(GENPOC) --primop-list        < $< > $@
459 primop-has-side-effects.hs-incl: prelude/primops.txt
460         $(GENPOC) --has-side-effects   < $< > $@
461 primop-out-of-line.hs-incl: prelude/primops.txt
462         $(GENPOC) --out-of-line        < $< > $@
463 primop-commutable.hs-incl: prelude/primops.txt
464         $(GENPOC) --commutable         < $< > $@
465 primop-needs-wrapper.hs-incl: prelude/primops.txt
466         $(GENPOC) --needs-wrapper      < $< > $@
467 primop-can-fail.hs-incl: prelude/primops.txt
468         $(GENPOC) --can-fail           < $< > $@
469 primop-strictness.hs-incl: prelude/primops.txt
470         $(GENPOC) --strictness         < $< > $@
471 primop-primop-info.hs-incl: prelude/primops.txt
472         $(GENPOC) --primop-primop-info < $< > $@
473
474 # Usages aren't used any more; but the generator 
475 # can still generate them if we want them back
476 primop-usage.hs-incl: prelude/primops.txt
477         $(GENPOC) --usage              < $< > $@
478
479
480
481 # ----------------------------------------------------------------------------
482 #               Parsers/lexers
483
484 SRC_HAPPY_OPTS += +RTS -K2m -H16m -RTS
485
486 #-----------------------------------------------------------------------------
487 #               Linking
488
489 SRC_LD_OPTS += -no-link-chk 
490
491 # -----------------------------------------------------------------------------
492 # create ghc-inplace, a convenient way to run ghc from the build tree...
493
494 all :: $(odir)/ghc-inplace ghc-inplace
495
496 $(odir)/ghc-inplace : $(HS_PROG)
497         @$(RM) $@
498         echo '#!/bin/sh' >>$@
499         echo exec $(FPTOOLS_TOP_ABS)/ghc/compiler/$(HS_PROG) '-B$(subst \,\\,$(FPTOOLS_TOP_ABS_PLATFORM))' '"$$@"' >>$@
500         chmod 755 $@
501
502 ghc-inplace : stage1/ghc-inplace
503         $(LN_S) -f $< $@
504
505 CLEAN_FILES += $(odir)/ghc-inplace ghc-inplace
506
507 #-----------------------------------------------------------------------------
508 #               install
509
510 # We don't want ghc treated as an ordinary executable,
511 # but put it together with the libraries.
512 # Also don't want any interface files installed
513
514 DESTDIR = $(INSTALL_LIBRARY_DIR_GHC)
515
516 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
517 INSTALL_LIBEXECS += $(HS_PROG)
518 else
519 INSTALL_PROGS += $(HS_PROG)
520 endif
521
522 # ----------------------------------------------------------------------------
523 # profiling.
524
525 rename/RnBinds_HC_OPTS += -auto-all
526 rename/RnEnv_HC_OPTS += -auto-all
527 rename/RnExpr_HC_OPTS += -auto-all
528 rename/RnHiFiles_HC_OPTS += -auto-all
529 rename/RnHsSyn_HC_OPTS += -auto-all
530 rename/Rename_HC_OPTS += -auto-all
531 rename/RnIfaces_HC_OPTS += -auto-all
532 rename/RnNames_HC_OPTS += -auto-all
533 rename/RnSource_HC_OPTS += -auto-all
534 rename/RnTypes_HC_OPTS += -auto-all
535
536 typecheck/Inst_HC_OPTS += -auto-all
537 typecheck/TcBinds_HC_OPTS += -auto-all
538 typecheck/TcClassDcl_HC_OPTS += -auto-all
539 typecheck/TcDefaults_HC_OPTS += -auto-all
540 typecheck/TcDeriv_HC_OPTS += -auto-all
541 typecheck/TcEnv_HC_OPTS += -auto-all
542 typecheck/TcExpr_HC_OPTS += -auto-all
543 typecheck/TcForeign_HC_OPTS += -auto-all
544 typecheck/TcGenDeriv_HC_OPTS += -auto-all
545 typecheck/TcHsSyn_HC_OPTS += -auto-all
546 typecheck/TcIfaceSig_HC_OPTS += -auto-all
547 typecheck/TcInstDcls_HC_OPTS += -auto-all
548 typecheck/TcMatches_HC_OPTS += -auto-all
549 typecheck/TcMonoType_HC_OPTS += -auto-all
550 typecheck/TcMType_HC_OPTS += -auto-all
551 typecheck/TcPat_HC_OPTS += -auto-all
552 typecheck/TcRnDriver_HC_OPTS += -auto-all
553 #typecheck/TcRnMonad_HC_OPTS += -auto-all
554 #typecheck/TcRnTypes_HC_OPTS += -auto-all
555 typecheck/TcRules_HC_OPTS += -auto-all
556 typecheck/TcSimplify_HC_OPTS += -auto-all
557 typecheck/TcSplice_HC_OPTS += -auto-all
558 typecheck/TcTyClsDecls_HC_OPTS += -auto-all
559 typecheck/TcTyDecls_HC_OPTS += -auto-all
560 typecheck/TcType_HC_OPTS += -auto-all
561 typecheck/TcUnify_HC_OPTS += -auto-all
562
563 absCSyn/PprAbsC_HC_OPTS += -auto-all
564
565 #-----------------------------------------------------------------------------
566 #               clean
567
568 MAINTAINER_CLEAN_FILES += parser/Parser.info main/ParsePkgConf.info
569
570 #-----------------------------------------------------------------------------
571 #               Include target-rule boilerplate
572
573 # Don't use the default MKDEPENDHS stuff... we'll do our own, below
574 MKDEPENDHS_SRCS =
575 MKDEPENDC_SRCS =
576
577 include $(TOP)/mk/target.mk
578
579 # -----------------------------------------------------------------------------
580 # Dependencies
581
582 MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
583
584 MKDEPENDHS=$(HC)
585
586 # Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet.
587 depend :: $(HS_SRCS) $(C_SRCS)
588         $(MKDEPENDHS) -M -optdep-f -optdep.depend-BASE $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) $(HS_SRCS)
589         $(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS) 
590         $(PERL) -pe 'binmode(stdin); binmode(stdout); s@^(\S*\.o)@stage$(stage)/$$1@g; s@(\S*\.hi)@stage$(stage)/$$1@g' <.depend-BASE >.depend-$(stage)
591 # The binmode stuff tells perl not to add stupid ^M's to the output
592
593 -include .depend-$(stage)