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