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