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