Make "make clean" in compiler/ only clean the stage we want to clean
[ghc-hetmet.git] / compiler / Makefile
1 # -----------------------------------------------------------------------------
2 # Main 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 ifeq "$(stage)" ""
21 stage=1
22 endif
23
24 include $(TOP)/mk/boilerplate.mk
25 include $(TOP)/mk/cabal-flags.mk
26
27 ifeq "$(GhcThreaded) $(GhcProfiled)" "YES YES"
28 $(error Cannot make GHC both threaded and profiled)
29 endif
30
31 CONFIG_HS       = main/Config.hs
32 PRIMOP_BITS = primop-data-decl.hs-incl        \
33               primop-tag.hs-incl              \
34               primop-list.hs-incl             \
35               primop-has-side-effects.hs-incl \
36               primop-out-of-line.hs-incl      \
37               primop-commutable.hs-incl       \
38               primop-needs-wrapper.hs-incl    \
39               primop-can-fail.hs-incl         \
40               primop-strictness.hs-incl       \
41               primop-primop-info.hs-incl
42
43 boot:: boot.stage.$(stage)
44
45 all:: build.stage.$(stage)
46
47 doc:: doc.stage.$(stage)
48
49 stage1 ::
50         $(MAKE) stage=1
51
52 stage2 ::
53         $(MAKE) stage=2
54
55 stage3 ::
56         $(MAKE) stage=3
57
58 clean distclean::
59         $(RM) -f prelude/primops.txt
60         $(RM) -f $(PRIMOP_BITS)
61         $(RM) -f $(CONFIG_HS)
62         $(RM) -f parser/Parser.y
63         $(RM) -rf stage1 stage2plus
64         $(RM) -f $(STAGE3_PACKAGE_CONF)
65
66 ifeq "$(CLEAN_ALL_STAGES)" "YES"
67 clean distclean:: clean.stage.1 clean.stage.2 clean.stage.3
68 else
69 clean distclean:: clean.stage.$(stage)
70 endif
71
72 clean.stage.%:
73         -$(CABAL) clean --distpref dist-stage$*
74         $(RM) -f Makefile-stage$*
75
76 CONFIGURE_FLAGS_STAGE1 += --flags=stage1
77 CONFIGURE_FLAGS_STAGE2 += --flags=-stage1
78
79 CONFIGURE_FLAGS_STAGE1 += --flags=-ghci
80
81 ifeq "$(GhcWithInterpreter)" "YES"
82 CONFIGURE_FLAGS_STAGE2 += --flags=ghci
83
84 ifeq "$(BuildSharedLibs)" "YES"
85 CONFIGURE_FLAGS_STAGE2 += --enable-shared
86 # If we are going to use dynamic libraries instead of .o files for ghci,
87 # we will need to always retain CAFs in the compiler.
88 # ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
89 # function which sets the keepCAFs flag for the RTS before any Haskell
90 # code is run.
91 CONFIGURE_FLAGS_STAGE2 += --flags=dynlibs
92 else
93 CONFIGURE_FLAGS_STAGE2 += --flags=-dynlibs
94 endif
95
96 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
97 # Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
98 # or not?
99 # XXX This should logically be a CPP option, but there doesn't seem to
100 # be a flag for that
101 CONFIGURE_FLAGS_STAGE2 += --ghc-option=-DGHCI_TABLES_NEXT_TO_CODE
102 endif
103
104 # Should the debugger commands be enabled?
105 ifeq "$(GhciWithDebugger)" "YES"
106 CONFIGURE_FLAGS_STAGE2 += --ghc-option=-DDEBUGGER
107 endif
108
109 # Enable editline if either:
110 #   - we're building stage 1 and $(GhcHasEditline)="YES"
111 #   - we're building stage 2/3, and we have built the editline package
112 #
113 # But we don't enable editline on Windows, as Windows terminals have
114 # editline-like support builtin.
115 #
116 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
117 CONFIGURE_FLAGS_STAGE1 += --flags=-editline
118 CONFIGURE_FLAGS_STAGE2 += --flags=-editline
119 else
120 ifeq "$(GhcHasEditline)" "YES"
121 CONFIGURE_FLAGS_STAGE1 += --flags=editline
122 else
123 CONFIGURE_FLAGS_STAGE1 += --flags=-editline
124 endif
125 ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/editline/unbuildable)" ""
126 CONFIGURE_FLAGS_STAGE2 += --flags=editline
127 else
128 CONFIGURE_FLAGS_STAGE2 += --flags=-editline
129 endif
130 endif
131
132 else
133 CONFIGURE_FLAGS_STAGE2 += --flags=-ghci
134 endif
135
136 ifeq "$(GhcWithNativeCodeGen)" "NO"
137 # XXX This should logically be a CPP option, but there doesn't seem to
138 # be a flag for that
139 COMMON_CONFIGURE_FLAGS += --ghc-option=-DOMIT_NATIVE_CODEGEN
140 endif
141
142 ifeq "$(TargetOS_CPP)" "openbsd"
143 COMMON_CONFIGURE_FLAGS += --ld-options="-Xlinker -E"
144 endif
145
146 ifeq "$(GhcUnregisterised)" "NO"
147 ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
148 # needed for generating proper relocation in large binaries: trac #856
149 COMMON_CONFIGURE_FLAGS += --ld-option=-Wl,--relax
150 endif
151 endif
152
153 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
154 # The #include is vital for the via-C route with older compilers, else the C
155 # compiler doesn't realise that the stcall foreign imports are indeed
156 # stdcall, and doesn't generate the Foo@8 name for them
157 # As it's only important for older compilers we don't need to do anything
158 # for stage2+.
159 CONFIGURE_FLAGS_STAGE1 += --ghc-option='-\#include'    \
160                           --ghc-option='"<windows.h>"' \
161                           --ghc-option='-\#include'    \
162                           --ghc-option='"<process.h>"'
163 endif
164
165 # ghc_strlen percolates through so many modules that it is easier to get its
166 # prototype via a global option instead of a myriad of per-file OPTIONS.
167 # Again, this is only important for older compilers, so we don't do it in
168 # stage 2+.
169 CONFIGURE_FLAGS_STAGE1 += --ghc-options='-\#include "cutils.h"'
170
171 CONFIGURE_FLAGS_STAGE3 = $(CONFIGURE_FLAGS_STAGE2)
172 CONFIGURE_FLAGS_STAGE1 += $(USE_BOOT_CONFIGURE_FLAGS)
173 CONFIGURE_FLAGS_STAGE2 += $(USE_STAGE1_CONFIGURE_FLAGS)
174 CONFIGURE_FLAGS_STAGE3 += $(USE_STAGE2_CONFIGURE_FLAGS)
175
176 boot.stage.%: $(PRIMOP_BITS) $(CONFIG_HS) parser/Parser.y
177         test -e $(STAGE3_PACKAGE_CONF) || echo "[]" > $(STAGE3_PACKAGE_CONF)
178         $(CABAL) configure --distpref dist-stage$* \
179                            $(CONFIGURE_FLAGS_STAGE$*) \
180                            $(INSTALL_DIRS_CONFIGURE_FLAGS) \
181                            $(COMMON_CONFIGURE_FLAGS) \
182                            --ghc-option=-DSTAGE=$*
183         $(RM) -f Makefile-stage$*
184         $(CABAL) makefile  --distpref dist-stage$* -f Makefile-stage$*
185
186 build.stage.%:
187         $(MAKE) -f Makefile-stage$* stage=$*
188         $(CABAL) register  --distpref dist-stage$* --inplace
189
190 doc.stage.%:
191         $(CABAL) haddock --distpref dist-stage$*
192
193 # XXX We ought to actually install the (stage 2) library
194 install:
195         @:
196
197 # -----------------------------------------------------------------------------
198 # Create compiler configuration
199 #
200 # The 'echo' commands simply spit the values of various make variables
201 # into Config.hs, whence they can be compiled and used by GHC itself
202
203 $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk
204         @$(RM) -f $(CONFIG_HS)
205         @echo "Creating $(CONFIG_HS) ... "
206         @echo "module Config where" >>$(CONFIG_HS)
207         @echo "cProjectName          :: String" >> $(CONFIG_HS)
208         @echo "cProjectName          = \"$(ProjectName)\"" >> $(CONFIG_HS)
209         @echo "cProjectVersion       :: String" >> $(CONFIG_HS)
210         @echo "cProjectVersion       = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
211         @echo "cProjectVersionInt    :: String" >> $(CONFIG_HS)
212         @echo "cProjectVersionInt    = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
213         @echo "cProjectPatchLevel    :: String" >> $(CONFIG_HS)
214         @echo "cProjectPatchLevel    = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
215         @echo "cBooterVersion        :: String" >> $(CONFIG_HS)
216         @echo "cBooterVersion        = \"$(GhcVersion)\"" >> $(CONFIG_HS)
217         @echo "cStage                :: String" >> $(CONFIG_HS)
218         @echo "cStage                = show (STAGE :: Int)" >> $(CONFIG_HS)
219         @echo "cHscIfaceFileVersion  :: String" >> $(CONFIG_HS)
220         @echo "cHscIfaceFileVersion  = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
221         @echo "cSplitObjs            :: String" >> $(CONFIG_HS)
222         @echo "cSplitObjs            = \"$(SplitObjs)\"" >> $(CONFIG_HS)
223         @echo "cGhcWithInterpreter   :: String" >> $(CONFIG_HS)
224         @echo "cGhcWithInterpreter   = \"$(GhcWithInterpreter)\"" >> $(CONFIG_HS)
225         @echo "cGhcWithNativeCodeGen :: String" >> $(CONFIG_HS)
226         @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
227         @echo "cGhcWithSMP           :: String" >> $(CONFIG_HS)
228         @echo "cGhcWithSMP           = \"$(GhcWithSMP)\"" >> $(CONFIG_HS)
229         @echo "cGhcRTSWays           :: String" >> $(CONFIG_HS)
230         @echo "cGhcRTSWays           = \"$(GhcRTSWays)\"" >> $(CONFIG_HS)
231         @echo "cGhcUnregisterised    :: String" >> $(CONFIG_HS)
232         @echo "cGhcUnregisterised    = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
233         @echo "cGhcEnableTablesNextToCode :: String" >> $(CONFIG_HS)
234         @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $(CONFIG_HS)
235         @echo "cLeadingUnderscore    :: String" >> $(CONFIG_HS)
236         @echo "cLeadingUnderscore    = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
237         @echo "cRAWCPP_FLAGS         :: String" >> $(CONFIG_HS)
238         @echo "cRAWCPP_FLAGS         = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
239         @echo "cGCC                  :: String" >> $(CONFIG_HS)
240         @echo "cGCC                  = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
241         @echo "cMKDLL                :: String" >> $(CONFIG_HS)
242         @echo "cMKDLL                = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
243         @echo "cLdIsGNULd            :: String" >> $(CONFIG_HS)
244         @echo "cLdIsGNULd            = \"$(LdIsGNULd)\"" >> $(CONFIG_HS)
245         @echo "cLD_X                 :: String" >> $(CONFIG_HS)
246         @echo "cLD_X                 = \"$(LD_X)\"" >> $(CONFIG_HS)
247         @echo "cGHC_DRIVER_DIR_REL   :: String" >> $(CONFIG_HS)
248         @echo "cGHC_DRIVER_DIR_REL   = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
249         @echo "cGHC_TOUCHY_PGM       :: String" >> $(CONFIG_HS)
250         @echo "cGHC_TOUCHY_PGM       = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
251         @echo "cGHC_TOUCHY_DIR_REL   :: String" >> $(CONFIG_HS)
252         @echo "cGHC_TOUCHY_DIR_REL   = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
253         @echo "cGHC_UNLIT_PGM        :: String" >> $(CONFIG_HS)
254         @echo "cGHC_UNLIT_PGM        = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
255         @echo "cGHC_UNLIT_DIR_REL    :: String" >> $(CONFIG_HS)
256         @echo "cGHC_UNLIT_DIR_REL    = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
257         @echo "cGHC_MANGLER_PGM      :: String" >> $(CONFIG_HS)
258         @echo "cGHC_MANGLER_PGM      = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
259         @echo "cGHC_MANGLER_DIR_REL  :: String" >> $(CONFIG_HS)
260         @echo "cGHC_MANGLER_DIR_REL  = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
261         @echo "cGHC_SPLIT_PGM        :: String" >> $(CONFIG_HS)
262         @echo "cGHC_SPLIT_PGM        = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
263         @echo "cGHC_SPLIT_DIR_REL    :: String" >> $(CONFIG_HS)
264         @echo "cGHC_SPLIT_DIR_REL    = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
265         @echo "cGHC_SYSMAN_PGM       :: String" >> $(CONFIG_HS)
266         @echo "cGHC_SYSMAN_PGM       = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
267         @echo "cGHC_SYSMAN_DIR_REL   :: String" >> $(CONFIG_HS)
268         @echo "cGHC_SYSMAN_DIR_REL   = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
269         @echo "cGHC_CP               :: String" >> $(CONFIG_HS)
270         @echo "cGHC_CP               = \"$(GHC_CP)\"" >> $(CONFIG_HS)
271         @echo "cGHC_PERL             :: String" >> $(CONFIG_HS)
272         @echo "cGHC_PERL             = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
273         @echo "cEnableWin32DLLs      :: String" >> $(CONFIG_HS)
274         @echo "cEnableWin32DLLs      = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
275         @echo "cCONTEXT_DIFF         :: String" >> $(CONFIG_HS)
276         @echo "cCONTEXT_DIFF         = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
277         @echo "cUSER_WAY_NAMES       :: String" >> $(CONFIG_HS)
278         @echo "cUSER_WAY_NAMES       = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
279         @echo "cUSER_WAY_OPTS        :: String" >> $(CONFIG_HS)
280         @echo "cUSER_WAY_OPTS        = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
281         @echo "cDEFAULT_TMPDIR       :: String" >> $(CONFIG_HS)
282         @echo "cDEFAULT_TMPDIR       = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
283         @echo "cRelocatableBuild     :: Bool"                 >> $(CONFIG_HS)
284 ifeq "$(RelocatableBuild)" "YES"
285         @echo "cRelocatableBuild     = True"                  >> $(CONFIG_HS)
286 else
287         @echo "cRelocatableBuild     = False"                 >> $(CONFIG_HS)
288 endif
289         @echo "cLibFFI               :: Bool"                 >> $(CONFIG_HS)
290 ifeq "$(UseLibFFIForAdjustors)" "YES"
291         @echo "cLibFFI               = True"                  >> $(CONFIG_HS)
292 else
293         @echo "cLibFFI               = False"                 >> $(CONFIG_HS)
294 endif
295         @echo done.
296
297 # -----------------------------------------------------------------------------
298 # Create platform includes
299
300 # Here we generate a little header file containing CPP symbols that GHC
301 # uses to determine which platform it is building on/for.  The platforms
302 # can differ between stage1 and stage2 if we're cross-compiling, so we
303 # need one of these header files per stage.
304
305 PLATFORM_H = ghc_boot_platform.h
306
307 stage1/$(PLATFORM_H) : $(FPTOOLS_TOP)/mk/config.mk
308         $(MKDIRHIER) stage1
309         @echo "Creating $@..."
310         @$(RM) $@
311         @echo "#ifndef __PLATFORM_H__"  >$@
312         @echo "#define __PLATFORM_H__" >>$@
313         @echo >> $@
314         @echo "#define BuildPlatform_NAME  \"$(BUILDPLATFORM)\"" >> $@
315         @echo "#define HostPlatform_NAME   \"$(HOSTPLATFORM)\"" >> $@
316         @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
317         @echo >> $@
318         @echo "#define $(BuildPlatform_CPP)_BUILD       1" >> $@
319         @echo "#define $(HostPlatform_CPP)_HOST         1" >> $@
320         @echo "#define $(TargetPlatform_CPP)_TARGET     1" >> $@
321         @echo >> $@
322         @echo "#define $(BuildArch_CPP)_BUILD_ARCH      1" >> $@
323         @echo "#define $(HostArch_CPP)_HOST_ARCH        1" >> $@
324         @echo "#define $(TargetArch_CPP)_TARGET_ARCH    1" >> $@
325         @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
326         @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
327         @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
328         @echo >> $@
329         @echo "#define $(BuildOS_CPP)_BUILD_OS          1" >> $@
330         @echo "#define $(HostOS_CPP)_HOST_OS            1" >> $@
331         @echo "#define $(TargetOS_CPP)_TARGET_OS        1" >> $@  
332         @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
333         @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
334         @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
335 ifeq "$(HostOS_CPP)" "irix"
336         @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS           " >> $@  
337         @echo "#define $(IRIX_MAJOR)_TARGET_OS          1" >> $@  
338         @echo "#endif                                    " >> $@  
339 endif
340         @echo >> $@
341         @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR  1" >> $@
342         @echo "#define $(HostVendor_CPP)_HOST_VENDOR    1" >> $@
343         @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR  1" >> $@
344         @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
345         @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
346         @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
347         @echo >> $@
348         @echo "#endif /* __PLATFORM_H__ */"          >> $@
349         @echo "Done."
350
351 # For stage2 and above, the BUILD platform is the HOST of stage1, and
352 # the HOST platform is the TARGET of stage1.  The TARGET remains the same
353 # (stage1 is the cross-compiler, not stage2).
354 stage2plus/$(PLATFORM_H) : $(FPTOOLS_TOP)/mk/config.mk
355         $(MKDIRHIER) stage2plus
356         @echo "Creating $@..."
357         @$(RM) $@
358         @echo "#ifndef __PLATFORM_H__"  >$@
359         @echo "#define __PLATFORM_H__" >>$@
360         @echo >> $@
361         @echo "#define BuildPlatform_NAME  \"$(HOSTPLATFORM)\"" >> $@
362         @echo "#define HostPlatform_NAME   \"$(TARGETPLATFORM)\"" >> $@
363         @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
364         @echo >> $@
365         @echo "#define $(HostPlatform_CPP)_BUILD        1" >> $@
366         @echo "#define $(TargetPlatform_CPP)_HOST               1" >> $@
367         @echo "#define $(TargetPlatform_CPP)_TARGET     1" >> $@
368         @echo >> $@
369         @echo "#define $(HostArch_CPP)_BUILD_ARCH       1" >> $@
370         @echo "#define $(TargetArch_CPP)_HOST_ARCH      1" >> $@
371         @echo "#define $(TargetArch_CPP)_TARGET_ARCH    1" >> $@
372         @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
373         @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
374         @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
375         @echo >> $@
376         @echo "#define $(HostOS_CPP)_BUILD_OS           1" >> $@
377         @echo "#define $(TargetOS_CPP)_HOST_OS          1" >> $@
378         @echo "#define $(TargetOS_CPP)_TARGET_OS        1" >> $@  
379         @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
380         @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
381         @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
382 ifeq "$(HostOS_CPP)" "irix"
383         @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS           " >> $@  
384         @echo "#define $(IRIX_MAJOR)_TARGET_OS          1" >> $@  
385         @echo "#endif                                    " >> $@  
386 endif
387         @echo >> $@
388         @echo "#define $(HostVendor_CPP)_BUILD_VENDOR   1" >> $@
389         @echo "#define $(TargetVendor_CPP)_HOST_VENDOR  1" >> $@
390         @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR  1" >> $@
391         @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
392         @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
393         @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
394         @echo >> $@
395         @echo "#endif /* __PLATFORM_H__ */"          >> $@
396         @echo "Done."
397
398 ifeq "$(stage)" "1"
399 STAGE_PLATFORM_H = stage1/$(PLATFORM_H)
400 else
401 STAGE_PLATFORM_H = stage2plus/$(PLATFORM_H)
402 endif
403
404 boot :: $(STAGE_PLATFORM_H)
405
406 # ----------------------------------------------------------------------------
407 #               Generate supporting stuff for prelude/PrimOp.lhs 
408 #               from prelude/primops.txt
409
410 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
411 SRC_CPP_OPTS += ${GhcCppOpts}
412
413 prelude/primops.txt parser/Parser.y: %: %.pp stage1/$(PLATFORM_H)
414         $(CPP) $(RAWCPP_FLAGS) -P $(CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
415
416 primop-data-decl.hs-incl: prelude/primops.txt
417         $(GENPRIMOP) --data-decl          < $< > $@
418 primop-tag.hs-incl: prelude/primops.txt
419         $(GENPRIMOP) --primop-tag         < $< > $@
420 primop-list.hs-incl: prelude/primops.txt
421         $(GENPRIMOP) --primop-list        < $< > $@
422 primop-has-side-effects.hs-incl: prelude/primops.txt
423         $(GENPRIMOP) --has-side-effects   < $< > $@
424 primop-out-of-line.hs-incl: prelude/primops.txt
425         $(GENPRIMOP) --out-of-line        < $< > $@
426 primop-commutable.hs-incl: prelude/primops.txt
427         $(GENPRIMOP) --commutable         < $< > $@
428 primop-needs-wrapper.hs-incl: prelude/primops.txt
429         $(GENPRIMOP) --needs-wrapper      < $< > $@
430 primop-can-fail.hs-incl: prelude/primops.txt
431         $(GENPRIMOP) --can-fail           < $< > $@
432 primop-strictness.hs-incl: prelude/primops.txt
433         $(GENPRIMOP) --strictness         < $< > $@
434 primop-primop-info.hs-incl: prelude/primops.txt
435         $(GENPRIMOP) --primop-primop-info < $< > $@
436
437 # Usages aren't used any more; but the generator 
438 # can still generate them if we want them back
439 primop-usage.hs-incl: prelude/primops.txt
440         $(GENPRIMOP) --usage              < $< > $@
441
442 #-----------------------------------------------------------------------------
443 # binary-dist
444 #
445
446 include $(TOP)/mk/bindist.mk
447 LIB_DIST_DIR = dist-stage$(stage)
448