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