Build system: cleanup BUILD_DIRS + add lots of Notes
[ghc.git] / ghc.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009-2013 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 # http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 # ToDo List.
14 #
15 # * remove old Makefiles, add new stubs for building in subdirs
16 # * docs/Makefile
17 # * docs/docbook-cheat-sheet/Makefile
18 # * docs/man/Makefile
19 # * docs/storage-mgmt/Makefile
20 # * docs/vh/Makefile
21 # * rts/dotnet/Makefile
22 # * utils/Makefile
23 # * add Makefiles for the rest of the utils/ programs that aren't built
24 # by default (need to exclude them from 'make all' too)
25
26 # Possible cleanups:
27 #
28 # * per-source-file dependencies instead of one .depend file?
29 # * eliminate undefined variables, and use --warn-undefined-variables?
30 # * put outputs from different ways in different subdirs of distdir/build,
31 # then we don't have to use -osuf/-hisuf. We would have to install
32 # them in different places too, so we'd need ghc-pkg support for packages
33 # of different ways.
34 # * make PACKAGES_STAGE1 generated by './configure' or './boot'?
35 # * we should use a directory of package.conf files rather than a single
36 # file for the inplace package database, so that we can express
37 # dependencies more accurately. Otherwise it's possible to get into
38 # a state where the package database is out of date, and the build
39 # system doesn't know.
40
41 # Approximate build order.
42 #
43 # The actual build order is defined by dependencies, and the phase
44 # ordering used to ensure correct ordering of makefile-generation; see
45 # http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture/Idiom/PhaseOrdering
46 #
47 # * With bootstrapping compiler:
48 # o Build utils/ghc-cabal
49 # o Build utils/ghc-pkg
50 # o Build utils/hsc2hs
51 # o Build utils/genprimopcode
52 # o Build utils/deriveConstants
53 # * For each package:
54 # o configure, generate package-data.mk and inplace-pkg-config
55 # o register each package into inplace/lib/package.conf
56 # * build libffi (if not disabled by --with-system-libffi)
57 # * With bootstrapping compiler:
58 # o Build libraries/{filepath,hpc,Cabal}
59 # o Build compiler (stage 1)
60 # * With stage 1 compiler:
61 # o Build libraries/*
62 # o Build rts
63 # o Build utils/* (except haddock)
64 # o Build compiler (stage 2)
65 # * With stage 2 compiler:
66 # o Build utils/haddock
67 # o Build compiler (stage 3) (optional)
68 # * With haddock:
69 # o libraries/*
70 # o compiler
71
72 .PHONY: default all haddock
73
74 # We need second expansion for the way we handle directories, so that
75 # | $$$$(dir $$$$@)/.
76 # expands to the directory of a rule that uses a % pattern.
77 .SECONDEXPANSION:
78
79 default : all
80
81
82 ##################################################
83 # Check that we have a new enough 'make'
84
85 HAVE_EVAL := NO
86 $(eval HAVE_EVAL := YES)
87
88 ifeq "$(HAVE_EVAL)" "NO"
89 $(error Your make does not support eval. You need GNU make >= 3.81)
90 endif
91
92 ifeq "$(abspath /)" ""
93 $(error Your make does not support abspath. You need GNU make >= 3.81)
94 endif
95 ##################################################
96
97
98 # Catch make if it runs away into an infinite loop
99 ifeq "$(MAKE_RESTARTS)" ""
100 else ifeq "$(MAKE_RESTARTS)" "1"
101 else
102 $(error Make has restarted itself $(MAKE_RESTARTS) times; is there a makefile bug? See http://ghc.haskell.org/trac/ghc/wiki/Building/Troubleshooting#Makehasrestarteditself3timesisthereamakefilebug for details)
103 endif
104
105 # -----------------------------------------------------------------------------
106 # Misc GNU make utils
107
108 nothing=
109 space=$(nothing) $(nothing)
110 comma=,
111
112 # -----------------------------------------------------------------------------
113 # Makefile debugging
114 #
115 # to see the effective value used for a Makefile variable, do
116 # make show VALUE=MY_VALUE
117 #
118
119 show:
120 @echo '$(VALUE)="$($(VALUE))"'
121
122 # echo is used by the nightly builders to query the build system for
123 # information.
124 # Using printf means that we don't get a trailing newline. We escape
125 # backslashes and double quotes in the string to protect them from the
126 # shell, and percent signs to protect them from printf.
127 echo:
128 @printf "$(subst %,%%,$(subst ",\",$(subst \,\\\\,$($(VALUE)))))"
129
130 # -----------------------------------------------------------------------------
131 # Include subsidiary build-system bits
132
133 include mk/tree.mk
134
135 ifneq "$(CLEANING)" "YES"
136 include mk/config.mk
137 ifeq "$(ProjectVersion)" ""
138 $(error Please run ./configure first)
139 endif
140 endif
141
142 include mk/ways.mk
143 include mk/warnings.mk
144
145 # (Optional) build-specific configuration
146 include mk/custom-settings.mk
147 SRC_CC_OPTS += $(WERROR)
148 SRC_HC_OPTS += $(WERROR)
149
150 ifneq "$(CLEANING)" "YES"
151 ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES"
152 ifeq "$(findstring dyn,$(GhcLibWays))" ""
153 $(error dyn is not in $$(GhcLibWays), but $$(DYNAMIC_GHC_PROGRAMS) is YES)
154 endif
155 else
156 ifeq "$(findstring v,$(GhcLibWays))" ""
157 $(error v is not in $$(GhcLibWays), and $$(DYNAMIC_GHC_PROGRAMS) is not YES)
158 endif
159 endif
160 ifeq "$(GhcProfiled)" "YES"
161 ifeq "$(findstring p,$(GhcLibWays))" ""
162 $(error p is not in $$(GhcLibWays), and $$(GhcProfiled) is YES)
163 endif
164 endif
165 endif
166
167 ifeq "$(phase)" ""
168 phase = final
169 endif
170
171 # -----------------------------------------------------------------------------
172 # Utility definitions
173
174 include rules/prof.mk
175 include rules/trace.mk
176 include rules/library-path.mk
177 include rules/add-dependency.mk
178 include rules/make-command.mk
179 include rules/pretty_commands.mk
180
181 # -----------------------------------------------------------------------------
182 # Macros for standard targets
183
184 include rules/all-target.mk
185 include rules/clean-target.mk
186
187 # -----------------------------------------------------------------------------
188 # The inplace tree
189
190 $(eval $(call clean-target,root,inplace,inplace/bin inplace/lib))
191
192 # -----------------------------------------------------------------------------
193 # Whether to build dependencies or not
194
195 # When we're just doing 'make clean' or 'make show', then we don't need
196 # to build dependencies.
197
198 ifeq "$(CLEANING)" "YES"
199 NO_INCLUDE_DEPS = YES
200 NO_INCLUDE_PKGDATA = YES
201 endif
202 ifneq "$(findstring bootstrapping-files,$(MAKECMDGOALS))" ""
203 NO_INCLUDE_DEPS = YES
204 NO_INCLUDE_PKGDATA = YES
205 endif
206 ifeq "$(findstring show,$(MAKECMDGOALS))" "show"
207 NO_INCLUDE_DEPS = YES
208 # We want package-data.mk for show
209 endif
210
211 # -----------------------------------------------------------------------------
212 # Ways
213
214 include rules/way-prelims.mk
215
216 $(foreach way,$(ALL_WAYS),\
217 $(eval $(call way-prelims,$(way))))
218
219 ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES"
220 GHCI_WAY = dyn
221 HADDOCK_WAY = dyn
222 else
223 GHCI_WAY = v
224 HADDOCK_WAY = v
225 endif
226
227 WINDOWS_DYN_PROG_RTS := rts
228 ifeq "$(GhcThreaded)" "YES"
229 WINDOWS_DYN_PROG_RTS := $(WINDOWS_DYN_PROG_RTS)_thr
230 endif
231 ifeq "$(GhcDebugged)" "YES"
232 WINDOWS_DYN_PROG_RTS := $(WINDOWS_DYN_PROG_RTS)_debug
233 endif
234 WINDOWS_DYN_PROG_RTS := $(WINDOWS_DYN_PROG_RTS)_dyn_LIB_FILE
235
236 # -----------------------------------------------------------------------------
237 # Compilation Flags
238
239 include rules/distdir-opts.mk
240 include rules/distdir-way-opts.mk
241
242 # -----------------------------------------------------------------------------
243 # Finding source files and object files
244
245 include rules/hs-sources.mk
246 include rules/c-sources.mk
247 include rules/includes-sources.mk
248 include rules/hs-objs.mk
249 include rules/c-objs.mk
250 include rules/cmm-objs.mk
251
252 # -----------------------------------------------------------------------------
253 # Suffix rules
254
255 # Suffix rules cause "make clean" to fail on Windows (trac #3233)
256 # so we don't make any when cleaning.
257 ifneq "$(CLEANING)" "YES"
258 include rules/hs-suffix-rules-srcdir.mk
259 include rules/hs-suffix-way-rules-srcdir.mk
260 include rules/hs-suffix-way-rules.mk
261 include rules/hi-rule.mk
262 include rules/c-suffix-rules.mk
263 include rules/cmm-suffix-rules.mk
264 endif
265
266 # -----------------------------------------------------------------------------
267 # Building package-data.mk files from .cabal files
268
269 include rules/package-config.mk
270
271 # -----------------------------------------------------------------------------
272 # Building dependencies
273
274 include rules/dependencies.mk
275 include rules/build-dependencies.mk
276 include rules/include-dependencies.mk
277
278 # -----------------------------------------------------------------------------
279 # Build package-data.mk files
280
281 include rules/build-package-data.mk
282
283 # -----------------------------------------------------------------------------
284 # Build and install a program
285
286 include rules/build-prog.mk
287 include rules/shell-wrapper.mk
288
289 # -----------------------------------------------------------------------------
290 # Build a perl script
291
292 include rules/build-perl.mk
293
294 # -----------------------------------------------------------------------------
295 # Build a package
296
297 include rules/build-package.mk
298 include rules/build-package-way.mk
299 include rules/haddock.mk
300 include rules/tags-package.mk
301 include rules/foreachLibrary.mk
302
303 # -----------------------------------------------------------------------------
304 # Registering hand-written package descriptions (used in rts)
305
306 include rules/manual-package-config.mk
307
308 # -----------------------------------------------------------------------------
309 # Docs
310
311 include rules/docbook.mk
312
313 # -----------------------------------------------------------------------------
314 # Making bindists and sdists
315
316 include rules/bindist.mk
317 include rules/sdist-ghc-file.mk
318
319 # -----------------------------------------------------------------------------
320 # Directories
321
322 # Don't try to delete directories:
323 .PRECIOUS: %/.
324
325 # Create build directories on demand. NB. the | below: this indicates
326 # that $(MKDIRHIER) is an order-only dependency, which means that this
327 # rule fires after building mkdirhier, but we won't try to recreate
328 # directories if mkdirhier changes.
329 %/. : | $(MKDIRHIER)
330 "$(MKDIRHIER)" $@
331
332 # -----------------------------------------------------------------------------
333 # Lax dependencies
334
335 ifeq "$(LAX_DEPENDENCIES)" "YES"
336 LAX_DEPS_FOLLOW = |
337 else
338 LAX_DEPS_FOLLOW =
339 endif
340
341 # This is a bit of a hack. When LAX_DEPS_FOLLOW is | some rules end up
342 # looking like
343 # target: a | b | c
344 # The first | signals the start of the order-only dependencies, but make
345 # treats the second | as a dependency. So we need to tell make how to
346 # build that dependency.
347
348 .PHONY: |
349 | :
350 @:
351
352 # -----------------------------------------------------------------------------
353 # Packages to build
354 # The lists of packages that we *actually* going to build in each stage:
355 #
356 # $(PACKAGES_STAGE0)
357 # $(PACKAGES_STAGE1)
358 # $(PACKAGES_STAGE2)
359 #
360 # Note that we need to add them to these variables in dependency
361 # order, as this is the order that they get configured in.
362
363 ifeq "$(CLEANING)" "YES"
364
365 define addLibraryForCleaning
366 # We just add all packages to both the stage 0 and stage 1 lists.
367 # Stage 2 gets cleaned in the same way as stage 1, so no need to
368 # add it there.
369 PACKAGES_STAGE0 += $1
370 PACKAGES_STAGE1 += $1
371 endef
372 $(eval $(call foreachLibrary,addLibraryForCleaning))
373
374 else # CLEANING
375
376 # Packages that are built by stage0. These packages are dependencies of
377 # programs such as GHC and ghc-pkg, that we do not assume the stage0
378 # compiler already has installed (or up-to-date enough).
379
380 PACKAGES_STAGE0 = binary Cabal/Cabal hpc bin-package-db hoopl transformers template-haskell
381 ifeq "$(Windows_Host)" "NO"
382 ifneq "$(HostOS_CPP)" "ios"
383 PACKAGES_STAGE0 += terminfo
384 endif
385 endif
386
387 PACKAGES_STAGE1 += ghc-prim
388 PACKAGES_STAGE1 += $(INTEGER_LIBRARY)
389 PACKAGES_STAGE1 += base
390 PACKAGES_STAGE1 += filepath
391 PACKAGES_STAGE1 += array
392 PACKAGES_STAGE1 += deepseq
393 PACKAGES_STAGE1 += bytestring
394 PACKAGES_STAGE1 += containers
395
396 ifeq "$(Windows_Host)" "YES"
397 PACKAGES_STAGE1 += Win32
398 endif
399 PACKAGES_STAGE1 += time
400 ifeq "$(Windows_Host)" "NO"
401 PACKAGES_STAGE1 += unix
402 endif
403
404 PACKAGES_STAGE1 += directory
405 PACKAGES_STAGE1 += process
406 PACKAGES_STAGE1 += hpc
407 PACKAGES_STAGE1 += pretty
408 PACKAGES_STAGE1 += template-haskell
409 PACKAGES_STAGE1 += binary
410 PACKAGES_STAGE1 += Cabal/Cabal
411 PACKAGES_STAGE1 += bin-package-db
412 PACKAGES_STAGE1 += hoopl
413 PACKAGES_STAGE1 += transformers
414
415 ifeq "$(HADDOCK_DOCS)" "YES"
416 PACKAGES_STAGE1 += xhtml
417 endif
418
419 ifeq "$(Windows_Target)" "NO"
420 ifneq "$(TargetOS_CPP)" "ios"
421 PACKAGES_STAGE1 += terminfo
422 endif
423 endif
424 PACKAGES_STAGE1 += haskeline
425
426 # See Note [No stage2 packages when CrossCompiling or Stage1Only].
427 # See Note [Stage1Only vs stage=1] in mk/config.mk.in.
428 ifeq "$(CrossCompiling) $(Stage1Only)" "NO NO"
429 define addExtraPackage
430 ifeq "$2" "-"
431 # Do nothing; this package is already handled above
432 else ifeq "$2" "dph"
433 ifeq "$$(BUILD_DPH) $$(GhcProfiled)" "YES NO"
434 # The DPH packages need TH, which is incompatible with a profiled GHC.
435 PACKAGES_STAGE2 += $1
436 endif
437 else ifeq "$2" "extra"
438 ifeq "$$(BUILD_EXTRA_PKGS)" "YES"
439 PACKAGES_STAGE2 += $1
440 endif
441 else
442 $$(error Unknown package tag: $2)
443 endif
444 endef
445 $(eval $(call foreachLibrary,addExtraPackage))
446 endif
447
448 # We install all packages that we build.
449 INSTALL_PACKAGES := $(addprefix libraries/,$(PACKAGES_STAGE1))
450 # See Note [Stage1Only vs stage=1] in mk/config.mk.in.
451 ifneq "$(Stage1Only)" "YES"
452 INSTALL_PACKAGES += compiler
453 endif
454 INSTALL_PACKAGES += $(addprefix libraries/,$(PACKAGES_STAGE2))
455
456 endif # CLEANING
457
458 # -------------------------------------------
459 # Note [Dependencies between package-data.mk files].
460
461 # We cannot run ghc-cabal to configure a package until we have
462 # configured and registered all of its dependencies. So the following
463 # hack forces all the configure steps to happen in exactly the following order:
464 #
465 # $(PACKAGES_STAGE1) ghc(stage2) $(PACKAGES_STAGE2)
466 #
467 # Ideally we should use the correct dependencies here to allow more
468 # parallelism, but we don't know the dependencies until we've
469 # generated the package-data.mk files.
470 define fixed_pkg_dep
471 libraries/$1/$2/package-data.mk : $$(fixed_pkg_prev)
472 fixed_pkg_prev:=libraries/$1/$2/package-data.mk
473 endef
474
475 ifneq "$(BINDIST)" "YES"
476 fixed_pkg_prev=
477 $(foreach pkg,$(PACKAGES_STAGE1),$(eval $(call fixed_pkg_dep,$(pkg),dist-install)))
478
479 # Intermezzo: utils that we build with the stage1 compiler. They depend on
480 # the stage1 packages, so we have to make sure those packages get configured
481 # and registered before we can start with these. Note that they don't depend on
482 # eachother, so we can configure them in parallel.
483 utils/ghc-pwd/dist-install/package-data.mk: $(fixed_pkg_prev)
484 utils/ghc-cabal/dist-install/package-data.mk: $(fixed_pkg_prev)
485 utils/dll-split/dist-install/package-data.mk: $(fixed_pkg_prev)
486 utils/hpc/dist-install/package-data.mk: $(fixed_pkg_prev)
487 utils/ghc-pkg/dist-install/package-data.mk: $(fixed_pkg_prev)
488 utils/hsc2hs/dist-install/package-data.mk: $(fixed_pkg_prev)
489 utils/compare_sizes/dist-install/package-data.mk: $(fixed_pkg_prev)
490 utils/runghc/dist-install/package-data.mk: $(fixed_pkg_prev)
491
492 # the GHC package doesn't live in libraries/, so we add its dependency manually:
493 compiler/stage2/package-data.mk: $(fixed_pkg_prev)
494
495 # and continue with PACKAGES_STAGE2, which depend on GHC:
496 fixed_pkg_prev:=compiler/stage2/package-data.mk
497 $(foreach pkg,$(PACKAGES_STAGE2),$(eval $(call fixed_pkg_dep,$(pkg),dist-install)))
498
499 ghc/stage1/package-data.mk: compiler/stage1/package-data.mk
500 ghc/stage2/package-data.mk: compiler/stage2/package-data.mk
501
502 # Utils that we build with the stage2 compiler.
503 # They depend on the ghc library and some other libraries, but depending on
504 # the ghc library's package-data.mk is sufficient, as that in turn depends on
505 # all the other libraries' package-data.mk files.
506 utils/haddock/dist/package-data.mk: compiler/stage2/package-data.mk
507 utils/ghctags/dist-install/package-data.mk: compiler/stage2/package-data.mk
508 utils/mkUserGuidePart/dist/package-data.mk: compiler/stage2/package-data.mk
509
510 # add the final package.conf dependency: ghc-prim depends on RTS
511 libraries/ghc-prim/dist-install/package-data.mk : rts/dist/package.conf.inplace
512 endif
513
514 # --------------------------------
515 # Misc package-related settings
516
517 # Run Haddock for the packages that will be installed. We need to handle
518 # compiler specially due to the different dist directory name.
519 $(foreach p,$(INSTALL_PACKAGES),$(eval $p_dist-install_DO_HADDOCK = YES))
520 compiler_stage2_DO_HADDOCK = YES
521
522 BOOT_PKG_CONSTRAINTS := \
523 $(foreach d,$(PACKAGES_STAGE0),\
524 $(foreach p,$(basename $(notdir $(wildcard libraries/$d/*.cabal))),\
525 --constraint "$p == $(shell grep -i "^Version:" libraries/$d/$p.cabal | sed "s/[^0-9.]//g")"))
526
527 # The actual .a and .so/.dll files: needed for dependencies.
528 ALL_STAGE1_LIBS = $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_v_LIB))
529 ifeq "$(BuildSharedLibs)" "YES"
530 ALL_STAGE1_LIBS += $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_dyn_LIB))
531 endif
532 BOOT_LIBS = $(foreach lib,$(PACKAGES_STAGE0),$(libraries/$(lib)_dist-boot_v_LIB))
533
534 # ----------------------------------------
535 # Special magic for the ghc-prim package
536
537 # We want the ghc-prim package to include the GHC.Prim module when it
538 # is registered, but not when it is built, because GHC.Prim is not a
539 # real source module, it is built-in to GHC. The old build system did
540 # this using Setup.hs, but we can't do that here, so we have a flag to
541 # enable GHC.Prim in the .cabal file (so that the ghc-prim package
542 # remains compatible with the old build system for the time being).
543 # GHC.Prim module in the ghc-prim package with a flag:
544 #
545 libraries/ghc-prim_CONFIGURE_OPTS += --flag=include-ghc-prim
546
547 # And then we strip it out again before building the package:
548 define libraries/ghc-prim_PACKAGE_MAGIC
549 libraries/ghc-prim_dist-install_MODULES := $$(filter-out GHC.Prim,$$(libraries/ghc-prim_dist-install_MODULES))
550 endef
551
552 PRIMOPS_TXT_STAGE1 = compiler/stage1/build/primops.txt
553
554 libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $$(genprimopcode_INPLACE) $(PRIMOPS_TXT_STAGE1) | $$(dir $$@)/.
555 "$(genprimopcode_INPLACE)" --make-haskell-wrappers < $(PRIMOPS_TXT_STAGE1) >$@
556
557 # Required so that Haddock documents the primops.
558 libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs
559
560 # ----------------------------------------
561 # Special magic for the integer package
562
563 ifneq "$(CLEANING)" "YES"
564 ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
565 libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-gmp
566 else ifeq "$(INTEGER_LIBRARY)" "integer-simple"
567 libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-simple
568 else
569 $(error Unknown integer library: $(INTEGER_LIBRARY))
570 endif
571 endif
572
573 # -----------------------------------------------------------------------------
574 # Include build instructions from all subdirs
575 BUILD_DIRS += utils/mkdirhier
576 BUILD_DIRS += utils/touchy
577 BUILD_DIRS += utils/unlit
578 BUILD_DIRS += utils/hp2ps
579 BUILD_DIRS += driver/split
580 BUILD_DIRS += utils/genprimopcode
581 BUILD_DIRS += driver
582 BUILD_DIRS += driver/ghci
583 BUILD_DIRS += driver/ghc
584 BUILD_DIRS += driver/haddock
585 BUILD_DIRS += libffi
586 BUILD_DIRS += utils/deriveConstants
587 BUILD_DIRS += includes
588 BUILD_DIRS += rts
589 BUILD_DIRS += bindisttest
590 BUILD_DIRS += utils/genapply
591
592 # When cleaning, don't add any library packages to BUILD_DIRS. We include
593 # ghc.mk files for all BUILD_DIRS, but they don't exist until after running
594 # `./boot`. Running `make clean` before anything else, as well as running
595 # `make maintainer-clean` twice, should work.
596 ifneq "$(CLEANING)" "YES"
597 # These are deliberately in reverse order, so as to ensure that
598 # there is no need to have them in dependency order. That's important
599 # because it's tricky to ensure that they are in dependency order when
600 # cross-compiling, as some packages may only be in PACKAGES_STAGE0
601 # or PACKAGES_STAGE1.
602 BUILD_DIRS += $(patsubst %, libraries/%, $(PACKAGES_STAGE2))
603 BUILD_DIRS += $(patsubst %, libraries/%, $(PACKAGES_STAGE1))
604 BUILD_DIRS += $(patsubst %, libraries/%, $(filter-out $(PACKAGES_STAGE1),$(PACKAGES_STAGE0)))
605 ifeq "$(BUILD_DPH)" "YES"
606 # Note: `$(eval $(call foreachLibrary,addExtraPackage))` above adds the
607 # packages listed in `libraries/dph/ghc-packages` (e.g. dph-base) to
608 # PACKAGES_STAGE2. But not 'libraries/dph' itself (it doesn't have a cabal
609 # file). Since it does have a ghc.mk file, we add it to BUILD_DIRS here.
610 BUILD_DIRS += $(wildcard libraries/dph)
611 endif
612 endif
613
614 BUILD_DIRS += libraries/integer-gmp/gmp
615 BUILD_DIRS += utils/haddock
616 BUILD_DIRS += utils/haddock/doc
617 BUILD_DIRS += compiler
618 BUILD_DIRS += utils/hsc2hs
619 BUILD_DIRS += utils/ghc-pkg
620 BUILD_DIRS += utils/testremove
621 BUILD_DIRS += utils/ghctags
622 BUILD_DIRS += utils/dll-split
623 BUILD_DIRS += utils/ghc-pwd
624 BUILD_DIRS += utils/ghc-cabal
625 BUILD_DIRS += utils/hpc
626 BUILD_DIRS += utils/runghc
627 BUILD_DIRS += ghc
628 BUILD_DIRS += utils/mkUserGuidePart
629 BUILD_DIRS += docs/users_guide
630 BUILD_DIRS += docs/man
631 BUILD_DIRS += utils/count_lines
632 BUILD_DIRS += utils/compare_sizes
633
634 # ----------------------------------------------
635 # Actually include the sub-ghc.mk's
636
637 ifeq "$(CLEANING)" "YES"
638 # Don't exclude any BUILD_DIRS when cleaning. When you for example build
639 # haddock once, but later set HADDOCK_DOCS back to NO, then 'make clean'
640 # should still clean the haddock directory.
641 else # CLEANING
642 ifeq "$(BINDIST)" "YES"
643 BUILD_DIRS := $(filter-out utils/mkdirhier,$(BUILD_DIRS))
644 BUILD_DIRS := $(filter-out utils/genprimopcode,$(BUILD_DIRS))
645 BUILD_DIRS := $(filter-out bindisttest,$(BUILD_DIRS))
646 BUILD_DIRS := $(filter-out utils/genapply,$(BUILD_DIRS))
647 BUILD_DIRS := $(filter-out utils/mkUserGuidePart,$(BUILD_DIRS))
648 endif
649 ifeq "$(HADDOCK_DOCS)" "NO"
650 BUILD_DIRS := $(filter-out utils/haddock,$(BUILD_DIRS))
651 BUILD_DIRS := $(filter-out utils/haddock/doc,$(BUILD_DIRS))
652 endif
653 ifeq "$(BUILD_DOCBOOK_HTML) $(BUILD_DOCBOOK_PS) $(BUILD_DOCBOOK_PDF)" "NO NO NO"
654 # Don't to build this little utility if we're not building the User's Guide.
655 BUILD_DIRS := $(filter-out utils/mkUserGuidePart,$(BUILD_DIRS))
656 endif
657 ifeq "$(Windows_Host)" "NO"
658 BUILD_DIRS := $(filter-out utils/touchy,$(BUILD_DIRS))
659 endif
660 ifeq "$(GhcUnregisterised)" "YES"
661 BUILD_DIRS := $(filter-out driver/split,$(BUILD_DIRS))
662 endif
663 ifeq "$(GhcWithInterpreter)" "NO"
664 # runghc is just GHCi in disguise
665 BUILD_DIRS := $(filter-out utils/runghc,$(BUILD_DIRS))
666 endif
667 ifneq "$(INTEGER_LIBRARY)" "integer-gmp"
668 BUILD_DIRS := $(filter-out libraries/integer-gmp/gmp,$(BUILD_DIRS))
669 endif
670 ifneq "$(CrossCompiling) $(Stage1Only)" "NO NO"
671 # See Note [No stage2 packages when CrossCompiling or Stage1Only].
672 # See Note [Stage1Only vs stage=1] in mk/config.mk.in.
673 BUILD_DIRS := $(filter-out utils/haddock,$(BUILD_DIRS))
674 BUILD_DIRS := $(filter-out utils/haddock/doc,$(BUILD_DIRS))
675 BUILD_DIRS := $(filter-out utils/ghctags,$(BUILD_DIRS))
676 BUILD_DIRS := $(filter-out utils/mkUserGuidePart,$(BUILD_DIRS))
677 endif
678 endif # CLEANING
679
680 include $(patsubst %, %/ghc.mk, $(BUILD_DIRS))
681
682 # A useful pseudo-target (must be after the include above, because it needs
683 # the value of things like $(libraries/base_dist-install_v_LIB).
684 .PHONY: stage1_libs
685 stage1_libs : $(ALL_STAGE1_LIBS)
686
687 # ----------------------------------------------
688 # Per-package compiler flags
689 #
690 # If you want to add per-package compiler flags, see `mk/warnings.mk`.
691
692 # Add $(GhcLib(Extra)HcOpts) to all package builds
693 $(foreach pkg,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts)))
694 $(foreach pkg,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_EXTRA_HC_OPTS += $$(GhcLibExtraHcOpts)))
695
696 # Add $(GhcBootLib(Extra)HcOpts) to all stage0 package builds
697 $(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$(GhcBootLibHcOpts)))
698 $(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_EXTRA_HC_OPTS += $$(GhcBootLibExtraHcOpts)))
699
700 # -----------------------------------------------------------------------------
701 # Bootstrapping libraries
702
703 # We need to build a few libraries with the installed GHC, since GHC itself
704 # and some of the tools depend on them:
705
706 ifneq "$(BINDIST)" "YES"
707
708 ifneq "$(BOOTSTRAPPING_CONF)" ""
709 ifeq "$(wildcard $(BOOTSTRAPPING_CONF))" ""
710 $(shell $(GHC_PKG) init $(BOOTSTRAPPING_CONF))
711 endif
712 endif
713
714 $(eval $(call clean-target,root,bootstrapping_conf,$(BOOTSTRAPPING_CONF)))
715
716 # register the boot packages in strict sequence, because running
717 # multiple ghc-pkgs in parallel doesn't work (registrations may get
718 # lost).
719 fixed_pkg_prev=
720 $(foreach pkg,$(PACKAGES_STAGE0),$(eval $(call fixed_pkg_dep,$(pkg),dist-boot)))
721 # ghc-pkg, unlike other utils that we build with the stage0 compiler (TODO: is
722 # this really true?), depends on several boot packages (e.g. Cabal and
723 # bin-package-db). They need to be configured before ghc-pkg, so we add a
724 # dependency between their package-data.mk files. See also Note
725 # [Dependencies between package-data.mk files].
726 utils/ghc-pkg/dist/package-data.mk: $(fixed_pkg_prev)
727 compiler/stage1/package-data.mk: $(fixed_pkg_prev)
728 endif
729
730 ifneq "$(BINDIST)" "YES"
731 # Make sure we have all the GHCi libs by the time we've built
732 # ghc-stage2. DPH includes a bit of Template Haskell which needs the
733 # GHCi libs, and we don't have a better way to express that dependency.
734 #
735 GHCI_LIBS = $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_GHCI_LIB)) \
736 $(compiler_stage2_GHCI_LIB)
737
738 ifeq "$(UseArchivesForGhci)" "NO"
739 ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(GHCI_LIBS)
740 endif
741
742 ifeq "$(UseArchivesForGhci)" "YES"
743 GHCI_lib_way = v
744 else
745 GHCI_lib_way = GHCI
746 endif
747
748 # Deps for TH uses in libraries
749 $(foreach way, $(GhcLibWays),$(eval \
750 libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.$($(way)_osuf): \
751 $(libraries/primitive_dist-install_$(GHCI_lib_way)_LIB) \
752 ))
753 endif
754
755 # -----------------------------------------------
756 # Haddock-related bits
757
758 # Build the Haddock contents and index
759 ifeq "$(HADDOCK_DOCS)" "YES"
760 libraries/dist-haddock/index.html: $(haddock_INPLACE) $(ALL_HADDOCK_FILES)
761 cd libraries && sh gen_contents_index --intree
762 ifeq "$(phase)" "final"
763 $(eval $(call all-target,library_doc_index,libraries/dist-haddock/index.html))
764 endif
765 INSTALL_LIBRARY_DOCS += libraries/dist-haddock/*
766 endif
767
768 # -----------------------------------------------------------------------------
769 # Creating a local mingw copy on Windows
770
771 ifeq "$(Windows_Host)" "YES"
772
773 install : install_mingw
774 .PHONY: install_mingw
775 install_mingw : $(INPLACE_MINGW)
776 "$(CP)" -Rp $(INPLACE_MINGW) $(prefix)
777
778 install : install_perl
779 .PHONY: install_perl
780 install_perl : $(INPLACE_PERL)
781 "$(CP)" -Rp $(INPLACE_PERL) $(prefix)
782
783 endif # Windows_Host
784
785 ifneq "$(BINDIST)" "YES"
786 $(ghc-prim-$(libraries/ghc-prim_dist-install_VERSION)_HADDOCK_FILE): \
787 libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs
788 endif # BINDIST
789
790 libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs: \
791 $(PRIMOPS_TXT_STAGE1) $$(genprimopcode_INPLACE) \
792 | $$(dir $$@)/.
793 "$(genprimopcode_INPLACE)" --make-haskell-source < $< > $@
794
795 .PHONY: tags
796 tags: tags_compiler
797
798 .PHONY: TAGS
799 TAGS: TAGS_compiler
800
801 # -----------------------------------------------------------------------------
802 # Installation
803
804 install: install_libs install_packages install_libexecs \
805 install_bins install_topdirs
806 ifeq "$(HADDOCK_DOCS)" "YES"
807 install: install_docs
808 endif
809
810 define installLibsTo
811 # $1 = libraries to install
812 # $2 = directory to install to
813 #
814 # The .dll case calls STRIP_CMD explicitly, instead of `install -s`, because
815 # on Win64, "install -s" calls a strip that doesn't understand 64bit binaries.
816 # For some reason, this means the DLLs end up non-executable, which means
817 # executables that use them just segfault.
818 $(INSTALL_DIR) $2
819 for i in $1; do \
820 case $$i in \
821 *.a) \
822 $(INSTALL_DATA) $(INSTALL_OPTS) $$i $2; \
823 $(RANLIB_CMD) $2/`basename $$i` ;; \
824 *.dll) \
825 $(INSTALL_PROGRAM) $(INSTALL_OPTS) $$i $2 ; \
826 $(STRIP_CMD) $2/`basename $$i` ;; \
827 *.so) \
828 $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $2 ;; \
829 *.dylib) \
830 $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $2;; \
831 *) \
832 $(INSTALL_DATA) $(INSTALL_OPTS) $$i $2; \
833 esac; \
834 done
835 endef
836
837 install_bins: $(INSTALL_BINS) $(INSTALL_SCRIPTS)
838 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
839 for i in $(INSTALL_BINS); do \
840 $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(bindir)" ; \
841 done
842 for i in $(INSTALL_SCRIPTS); do \
843 $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(bindir)" ; \
844 done
845
846 install_libs: $(INSTALL_LIBS)
847 $(call installLibsTo, $(INSTALL_LIBS), "$(DESTDIR)$(ghclibdir)")
848
849 install_libexecs: $(INSTALL_LIBEXECS)
850 ifeq "$(INSTALL_LIBEXECS)" ""
851 @:
852 else
853 $(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)/bin"
854 for i in $(INSTALL_LIBEXECS); do \
855 $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)/bin"; \
856 done
857 # We rename ghc-stage2, so that the right program name is used in error
858 # messages etc.
859 "$(MV)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc"
860 endif
861
862 install_topdirs: $(INSTALL_TOPDIR_BINS) $(INSTALL_TOPDIR_SCRIPTS)
863 $(INSTALL_DIR) "$(DESTDIR)$(topdir)"
864 for i in $(INSTALL_TOPDIR_BINS); do \
865 $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(topdir)"; \
866 done
867 for i in $(INSTALL_TOPDIR_SCRIPTS); do \
868 $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(topdir)"; \
869 done
870
871 install_docs: $(INSTALL_DOCS)
872 $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
873 ifneq "$(INSTALL_DOCS)" ""
874 for i in $(INSTALL_DOCS); do \
875 $(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)"; \
876 done
877 endif
878 $(INSTALL_DIR) "$(DESTDIR)$(docdir)/html"
879 $(INSTALL_DOC) $(INSTALL_OPTS) docs/index.html "$(DESTDIR)$(docdir)/html"
880 ifneq "$(INSTALL_LIBRARY_DOCS)" ""
881 $(INSTALL_DIR) "$(DESTDIR)$(docdir)/html/libraries"
882 for i in $(INSTALL_LIBRARY_DOCS); do \
883 $(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)/html/libraries/"; \
884 done
885 $(INSTALL_DATA) $(INSTALL_OPTS) libraries/prologue.txt "$(DESTDIR)$(docdir)/html/libraries/"
886 $(INSTALL_SCRIPT) $(INSTALL_OPTS) libraries/gen_contents_index "$(DESTDIR)$(docdir)/html/libraries/"
887 endif
888 ifneq "$(INSTALL_HTML_DOC_DIRS)" ""
889 for i in $(INSTALL_HTML_DOC_DIRS); do \
890 $(INSTALL_DIR) "$(DESTDIR)$(docdir)/html/`basename $$i`"; \
891 $(INSTALL_DOC) $(INSTALL_OPTS) $$i/* "$(DESTDIR)$(docdir)/html/`basename $$i`"; \
892 done
893 endif
894
895 INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d
896
897 # Install packages in the right order, so that ghc-pkg doesn't complain.
898 # Also, install ghc-pkg first.
899 ifeq "$(Windows_Host)" "NO"
900 INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc
901 INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc-pkg
902 else
903 INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
904 INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
905 endif
906
907 # Set the INSTALL_DISTDIR_p for each package; compiler is special
908 $(foreach p,$(filter-out compiler,$(INSTALL_PACKAGES)),\
909 $(eval INSTALL_DISTDIR_$p = dist-install))
910 INSTALL_DISTDIR_compiler = stage2
911
912 # Now we can do the installation
913 install_packages: install_libexecs
914 install_packages: rts/dist/package.conf.install
915 $(INSTALL_DIR) "$(DESTDIR)$(topdir)"
916 $(call removeTrees,"$(INSTALLED_PACKAGE_CONF)")
917 $(INSTALL_DIR) "$(INSTALLED_PACKAGE_CONF)"
918 $(INSTALL_DIR) "$(DESTDIR)$(topdir)/rts"
919 $(call installLibsTo, $(RTS_INSTALL_LIBS), "$(DESTDIR)$(topdir)/rts")
920 $(foreach p, $(INSTALL_PACKAGES), \
921 $(call make-command, \
922 "$(ghc-cabal_INPLACE)" copy \
923 $p $(INSTALL_DISTDIR_$p) \
924 "$(STRIP_CMD)" \
925 '$(DESTDIR)' \
926 '$(prefix)' \
927 '$(ghclibdir)' \
928 '$(docdir)/html/libraries' \
929 '$(GhcLibWays)'))
930 "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/dist/package.conf.install
931 $(foreach p, $(INSTALL_PACKAGES), \
932 $(call make-command, \
933 "$(ghc-cabal_INPLACE)" register \
934 $p $(INSTALL_DISTDIR_$p) \
935 "$(INSTALLED_GHC_REAL)" \
936 "$(INSTALLED_GHC_PKG_REAL)" \
937 "$(DESTDIR)$(topdir)" \
938 '$(DESTDIR)' \
939 '$(prefix)' \
940 '$(ghclibdir)' \
941 '$(docdir)/html/libraries' \
942 $(RelocatableBuild)))
943 # when we install the packages above, ghc-pkg obeys umask when creating
944 # the package.conf files, but for everything else we specify the
945 # permissions. We therefore now fix the permissions of package.cache.
946 # This means "sudo make install" does the right thing even if it runs
947 # with an 077 umask.
948 for f in '$(INSTALLED_PACKAGE_CONF)'/*; do $(CREATE_DATA) "$$f"; done
949
950 # -----------------------------------------------------------------------------
951 # Binary distributions
952
953 ifneq "$(CLEANING)" "YES"
954 # This rule seems to hold some files open on Windows which prevents
955 # cleaning, perhaps due to the $(wildcard).
956
957 $(eval $(call bindist-list,.,\
958 LICENSE \
959 README \
960 INSTALL \
961 configure config.sub config.guess install-sh \
962 settings.in \
963 packages \
964 Makefile \
965 mk/config.mk.in \
966 $(INPLACE_BIN)/mkdirhier \
967 utils/ghc-cabal/dist-install/build/tmp/ghc-cabal \
968 utils/ghc-pwd/dist-install/build/tmp/ghc-pwd \
969 $(BINDIST_WRAPPERS) \
970 $(BINDIST_PERL_SOURCES) \
971 $(BINDIST_LIBS) \
972 $(BINDIST_HI) \
973 $(BINDIST_EXTRAS) \
974 $(includes_H_FILES) \
975 $(includes_DERIVEDCONSTANTS) \
976 $(includes_GHCCONSTANTS) \
977 $(libffi_HEADERS) \
978 $(INSTALL_LIBEXECS) \
979 $(INSTALL_LIBEXEC_SCRIPTS) \
980 $(INSTALL_TOPDIR_BINS) \
981 $(INSTALL_TOPDIR_SCRIPTS) \
982 $(INSTALL_BINS) \
983 $(INSTALL_SCRIPTS) \
984 $(INSTALL_MANPAGES) \
985 $(INSTALL_DOCS) \
986 $(INSTALL_LIBRARY_DOCS) \
987 $(addsuffix /*,$(INSTALL_HTML_DOC_DIRS)) \
988 docs/index.html \
989 compiler/stage2/doc \
990 $(wildcard libraries/*/dist-install/doc/) \
991 $(wildcard libraries/*/*/dist-install/doc/) \
992 $(filter-out settings,$(INSTALL_LIBS)) \
993 $(RTS_INSTALL_LIBS) \
994 $(filter-out %/project.mk mk/config.mk %/mk/install.mk,$(MAKEFILE_LIST)) \
995 mk/project.mk \
996 mk/install.mk.in \
997 bindist.mk \
998 libraries/gen_contents_index \
999 libraries/prologue.txt \
1000 $(wildcard libraries/dph/LICENSE \
1001 libraries/dph/ghc-packages \
1002 libraries/dph/ghc-packages2 \
1003 libraries/dph/ghc-stage2-package) \
1004 ))
1005 endif
1006 # mk/project.mk gets an absolute path, so we manually include it in
1007 # the bindist with a relative path
1008
1009 BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
1010
1011 unix-binary-dist-prep:
1012 $(call removeTrees,bindistprep/)
1013 "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
1014 set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh settings.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
1015 echo "HADDOCK_DOCS = $(HADDOCK_DOCS)" >> $(BIN_DIST_MK)
1016 echo "BUILD_DOCBOOK_HTML = $(BUILD_DOCBOOK_HTML)" >> $(BIN_DIST_MK)
1017 echo "BUILD_DOCBOOK_PS = $(BUILD_DOCBOOK_PS)" >> $(BIN_DIST_MK)
1018 echo "BUILD_DOCBOOK_PDF = $(BUILD_DOCBOOK_PDF)" >> $(BIN_DIST_MK)
1019 echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK)
1020 echo "override ghc-cabal_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" >> $(BIN_DIST_MK)
1021 echo "UseSystemLibFFI = $(UseSystemLibFFI)" >> $(BIN_DIST_MK)
1022 cd $(BIN_DIST_PREP_DIR) && autoreconf
1023 $(call removeFiles,$(BIN_DIST_PREP_TAR))
1024 # h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
1025 # tree then we want to include the real file, not a symlink to it
1026 cd bindistprep && "$(TAR_CMD)" hcf - -T ../bindist-list | $(TAR_COMP_CMD) -c > ../$(BIN_DIST_PREP_TAR_COMP)
1027
1028 windows-binary-dist-prep:
1029 $(call removeTrees,bindistprep/)
1030 $(MAKE) prefix=$(TOP)/$(BIN_DIST_PREP_DIR) install
1031 cd bindistprep && "$(TAR_CMD)" cf - $(BIN_DIST_NAME) | $(TAR_COMP_CMD) -c > ../$(BIN_DIST_PREP_TAR_COMP)
1032
1033 # tryTimes tries to run its third argument multiple times, until it
1034 # succeeds. Don't call it directly; call try10Times instead.
1035 # The first and second argument to tryTimes are lists of values.
1036 # The length of the first argument is the number of times we have
1037 # already tried. The length of the second argument is the number more
1038 # times we will try.
1039 tryTimes = $(if $2, \
1040 { echo 'Try $(words x $1): $3' ; $3 ; } || \
1041 $(call tryTimes,x $1,$(wordlist 2,$(words $2),$2),$3), \
1042 )
1043
1044 # Try to run the argument 10 times. If all 10 fail, fail.
1045 try10Times = $(call tryTimes,,x x x x x x x x x x,$1) { echo Failed; false; }
1046
1047 .PHONY: publish-binary-dist
1048 publish-binary-dist:
1049 $(call try10Times,$(PublishCp) $(BIN_DIST_TAR_COMP) $(PublishLocation)/dist)
1050
1051 ifeq "$(mingw32_TARGET_OS)" "1"
1052 DOCDIR_TO_PUBLISH = $(BIN_DIST_INST_DIR)/doc
1053 else
1054 DOCDIR_TO_PUBLISH = $(BIN_DIST_INST_DIR)/share/doc/ghc
1055 endif
1056
1057 .PHONY: publish-docs
1058 publish-docs:
1059 $(call try10Times,$(PublishCp) -r $(DOCDIR_TO_PUBLISH)/* $(PublishLocation)/docs)
1060
1061 # -----------------------------------------------------------------------------
1062 # Source distributions
1063
1064 # Do it like this:
1065 #
1066 # $ ./boot
1067 # $ ./configure
1068 # $ make sdist
1069 #
1070
1071 # A source dist is built from a (partial) build tree, because we
1072 # require some extra files not contained in a git checkout: the
1073 # output from Happy and Alex, for example.
1074 #
1075 # The steps performed by 'make sdist' are as follows:
1076 # - build those extra files
1077 # - create a complete link-tree of the current build tree in /tmp
1078 # - run 'make distclean' on that tree
1079 # - remove a bunch of other files that we know shouldn't be in the dist
1080
1081 #
1082 # Directory in which we're going to build the src dist
1083 #
1084 SRC_DIST_ROOT = sdistprep
1085 SRC_DIST_BASE_NAME = ghc-$(ProjectVersion)
1086
1087 SRC_DIST_GHC_NAME = ghc-$(ProjectVersion)-src
1088 SRC_DIST_GHC_ROOT = $(SRC_DIST_ROOT)/ghc
1089 SRC_DIST_GHC_DIR = $(SRC_DIST_GHC_ROOT)/$(SRC_DIST_BASE_NAME)
1090 SRC_DIST_GHC_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_GHC_NAME).tar.$(TAR_COMP_EXT)
1091
1092 SRC_DIST_WINDOWS_TARBALLS_NAME = ghc-$(ProjectVersion)-windows-extra-src
1093 SRC_DIST_WINDOWS_TARBALLS_ROOT = $(SRC_DIST_ROOT)/windows-tarballs
1094 SRC_DIST_WINDOWS_TARBALLS_DIR = $(SRC_DIST_WINDOWS_TARBALLS_ROOT)/$(SRC_DIST_BASE_NAME)
1095 SRC_DIST_WINDOWS_TARBALLS_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_WINDOWS_TARBALLS_NAME).tar.$(TAR_COMP_EXT)
1096
1097 SRC_DIST_TESTSUITE_NAME = ghc-$(ProjectVersion)-testsuite
1098 SRC_DIST_TESTSUITE_ROOT = $(SRC_DIST_ROOT)/testsuite-ghc
1099 SRC_DIST_TESTSUITE_DIR = $(SRC_DIST_TESTSUITE_ROOT)/$(SRC_DIST_BASE_NAME)
1100 SRC_DIST_TESTSUITE_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_TESTSUITE_NAME).tar.$(TAR_COMP_EXT)
1101
1102 #
1103 # Files to include in source distributions
1104 #
1105 SRC_DIST_GHC_DIRS = mk rules docs distrib bindisttest libffi includes \
1106 utils docs rts compiler ghc driver libraries libffi-tarballs
1107 SRC_DIST_GHC_FILES += \
1108 configure.ac config.guess config.sub configure \
1109 aclocal.m4 README.md ANNOUNCE HACKING.md INSTALL.md LICENSE Makefile \
1110 install-sh settings.in VERSION GIT_COMMIT_ID \
1111 boot packages ghc.mk MAKEHELP.md
1112
1113 .PHONY: VERSION
1114 VERSION:
1115 @if test -f $@ && test "`cat $@`" = "$(ProjectVersion)"; \
1116 then echo "$@ needs no update"; \
1117 else echo "update $@ ($(ProjectVersion))"; echo "$(ProjectVersion)" > $@; fi
1118
1119 .PHONY: GIT_COMMIT_ID
1120 GIT_COMMIT_ID:
1121 @if test -d .git && test "`git rev-parse HEAD`" != "$(ProjectGitCommitId)"; then \
1122 echo "******************************************************************************"; \
1123 echo "Stale ProjectGitCommitId (=$(ProjectGitCommitId)) detected!"; \
1124 echo "'git rev-parse HEAD' says: `git rev-parse HEAD`"; \
1125 echo "Please re-run './configure' before creating source-distribution"; \
1126 echo "******************************************************************************"; \
1127 exit 1; \
1128 fi
1129 @if test -f $@ && test "`cat $@`" = "$(ProjectGitCommitId)"; \
1130 then echo "$@ needs no update"; \
1131 else echo "update $@ ($(ProjectGitCommitId))"; echo -n "$(ProjectGitCommitId)" > $@; fi
1132
1133 sdist-ghc-prep-tree : VERSION GIT_COMMIT_ID
1134
1135 # Extra packages which shouldn't be in the source distribution: see #8801
1136 EXTRA_PACKAGES=parallel stm random primitive vector dph
1137
1138 .PHONY: sdist-ghc-prep-tree
1139 sdist-ghc-prep-tree :
1140 $(call removeTrees,$(SRC_DIST_GHC_ROOT))
1141 $(call removeFiles,$(SRC_DIST_GHC_TARBALL))
1142 mkdir -p $(SRC_DIST_ROOT)
1143 mkdir -p $(SRC_DIST_GHC_ROOT)
1144 mkdir -p $(SRC_DIST_GHC_DIR)
1145 cd $(SRC_DIST_GHC_DIR) && for i in $(SRC_DIST_GHC_DIRS); do mkdir -p $$i; ( cd $$i && lndir $(TOP)/$$i ); done
1146 cd $(SRC_DIST_GHC_DIR) && for i in $(SRC_DIST_GHC_FILES); do $(LN_S) $(TOP)/$$i .; done
1147 cd $(SRC_DIST_GHC_DIR) && $(MAKE) distclean
1148 $(call removeTrees,$(SRC_DIST_GHC_DIR)/libraries/tarballs/)
1149 $(call removeTrees,$(SRC_DIST_GHC_DIR)/libraries/stamp/)
1150 $(call removeTrees,$(SRC_DIST_GHC_DIR)/compiler/stage[123])
1151 $(call removeFiles,$(SRC_DIST_GHC_DIR)/mk/build.mk)
1152 for i in $(EXTRA_PACKAGES); do $(RM) $(RM_OPTS_REC) $(SRC_DIST_GHC_DIR)/libraries/$$i/; done
1153 cd $(SRC_DIST_GHC_DIR) && "$(FIND)" $(SRC_DIST_GHC_DIRS) \( -name .git -o -name "autom4te*" -o -name "*~" -o -name "\#*" -o -name ".\#*" -o -name "log" -o -name "*-SAVE" -o -name "*.orig" -o -name "*.rej" \) -print | "$(XARGS)" $(XARGS_OPTS) "$(RM)" $(RM_OPTS_REC)
1154
1155 # Add files generated by alex and happy.
1156 # These rules depend on sdist-ghc-prep-tree.
1157 $(eval $(call sdist-ghc-file,compiler,stage2,cmm,CmmLex,x))
1158 $(eval $(call sdist-ghc-file,compiler,stage2,cmm,CmmParse,y))
1159 $(eval $(call sdist-ghc-file,compiler,stage2,parser,Lexer,x))
1160 $(eval $(call sdist-ghc-file,compiler,stage2,parser,Parser,y))
1161 $(eval $(call sdist-ghc-file,utils/hpc,dist-install,,HpcParser,y))
1162 $(eval $(call sdist-ghc-file,utils/genprimopcode,dist,,Lexer,x))
1163 $(eval $(call sdist-ghc-file,utils/genprimopcode,dist,,Parser,y))
1164
1165 .PHONY: sdist-ghc-prep
1166 sdist-ghc-prep : sdist-ghc-prep-tree
1167
1168 .PHONY: sdist-windows-tarballs-prep
1169 sdist-windows-tarballs-prep :
1170 $(call removeTrees,$(SRC_DIST_WINDOWS_TARBALLS_ROOT))
1171 $(call removeFiles,$(SRC_DIST_WINDOWS_TARBALLS_TARBALL))
1172 mkdir -p $(SRC_DIST_ROOT)
1173 mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_ROOT)
1174 mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_DIR)
1175 mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs
1176 cd $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs && lndir $(TOP)/ghc-tarballs
1177 $(call removeTrees,$(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs/.git)
1178
1179 .PHONY: sdist-testsuite-prep
1180 sdist-testsuite-prep :
1181 $(call removeTrees,$(SRC_DIST_TESTSUITE_ROOT))
1182 $(call removeFiles,$(SRC_DIST_TESTSUITE_TARBALL))
1183 mkdir -p $(SRC_DIST_ROOT)
1184 mkdir -p $(SRC_DIST_TESTSUITE_ROOT)
1185 mkdir -p $(SRC_DIST_TESTSUITE_DIR)
1186 mkdir -p $(SRC_DIST_TESTSUITE_DIR)/testsuite
1187 cd $(SRC_DIST_TESTSUITE_DIR)/testsuite && lndir $(TOP)/testsuite
1188 cd $(SRC_DIST_TESTSUITE_DIR)/testsuite && $(MAKE) distclean
1189
1190 .PHONY: sdist-ghc
1191 sdist-ghc: sdist-ghc-prep
1192 cd $(SRC_DIST_GHC_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> src_ghc_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_GHC_TARBALL)
1193
1194 .PHONY: sdist-windows-tarballs
1195 sdist-windows-tarballs: sdist-windows-tarballs-prep
1196 cd $(SRC_DIST_WINDOWS_TARBALLS_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> windows_extra_src_ghc_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_WINDOWS_TARBALLS_TARBALL)
1197
1198 .PHONY: sdist-testsuite
1199 sdist-testsuite: sdist-testsuite-prep
1200 cd $(SRC_DIST_TESTSUITE_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> testsuite_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_TESTSUITE_TARBALL)
1201
1202
1203 .PHONY: sdist
1204 sdist : sdist-ghc sdist-windows-tarballs sdist-testsuite
1205
1206 sdist-manifest : $(SRC_DIST_GHC_TARBALL)
1207 tar tjf $(SRC_DIST_GHC_TARBALL) | sed "s|^ghc-$(ProjectVersion)/||" | sort >sdist-manifest
1208
1209 # Upload the distribution(s)
1210 # Retrying is to work around buggy firewalls that corrupt large file transfers
1211 # over SSH.
1212 ifneq "$(PublishLocation)" ""
1213 publish-sdist :
1214 $(call try10Times,$(PublishCp) $(SRC_DIST_GHC_TARBALL) $(PublishLocation)/dist)
1215 $(call try10Times,$(PublishCp) $(SRC_DIST_TESTSUITE_TARBALL) $(PublishLocation)/dist)
1216 endif
1217
1218 # -----------------------------------------------------------------------------
1219 # sdisting libraries
1220
1221 # Use manually, with e.g.:
1222 # make sdist_directory
1223
1224 sdist_%:
1225 inplace/bin/ghc-cabal sdist libraries/$* dist-install
1226
1227 # -----------------------------------------------------------------------------
1228 # Cleaning
1229
1230 .PHONY: clean
1231
1232 CLEAN_FILES += libraries/integer-gmp/include/HsIntegerGmp.h
1233 CLEAN_FILES += libraries/base/include/EventConfig.h
1234 CLEAN_FILES += mk/config.mk.old
1235 CLEAN_FILES += mk/project.mk.old
1236 CLEAN_FILES += compiler/ghc.cabal.old
1237
1238 # These are no longer generated, but we still clean them for a while
1239 # as they may still be in old GHC trees:
1240 CLEAN_FILES += includes/GHCConstants.h
1241 CLEAN_FILES += includes/DerivedConstants.h
1242 CLEAN_FILES += includes/ghcautoconf.h
1243 CLEAN_FILES += includes/ghcplatform.h
1244 CLEAN_FILES += includes/ghcversion.h
1245 CLEAN_FILES += utils/ghc-pkg/Version.hs
1246 CLEAN_FILES += compiler/prelude/primops.txt
1247 CLEAN_FILES += $(wildcard compiler/primop*incl)
1248
1249 clean : clean_files clean_libraries
1250
1251 .PHONY: clean_files
1252 clean_files :
1253 $(call removeFiles,$(CLEAN_FILES))
1254 # this is here since CLEAN_FILES can't handle folders
1255 $(call removeTrees,includes/dist-derivedconstants)
1256 $(call removeTrees,inplace/bin)
1257 $(call removeTrees,inplace/lib)
1258 $(call removeTrees,libraries/bootstrapping.conf)
1259
1260 .PHONY: clean_libraries
1261 clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
1262 clean_libraries: $(patsubst %,clean_libraries/%_dist-boot,$(PACKAGES_STAGE0))
1263
1264 clean_libraries:
1265 $(call removeTrees,$(patsubst %, libraries/%/dist, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
1266 $(call removeFiles,$(wildcard $(patsubst %.in, %, $(wildcard $(patsubst %, libraries/%/*.buildinfo.in, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))))))
1267 $(call removeFiles,$(patsubst %, libraries/%/config.log, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
1268 $(call removeFiles,$(patsubst %, libraries/%/config.status, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
1269 $(call removeFiles,$(wildcard $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))))
1270
1271 # We have to define a clean target for each library manually, because the
1272 # libraries/*/ghc.mk files are not included when we're cleaning.
1273 ifeq "$(CLEANING)" "YES"
1274 $(foreach lib,$(PACKAGES_STAGE0),\
1275 $(eval $(call clean-target,libraries/$(lib),dist-boot,libraries/$(lib)/dist-boot)))
1276 $(foreach lib,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),\
1277 $(eval $(call clean-target,libraries/$(lib),dist-install,libraries/$(lib)/dist-install)))
1278 endif
1279
1280 clean : clean_haddock_index
1281 .PHONY: clean_haddock_index
1282 clean_haddock_index:
1283 $(call removeTrees,libraries/dist-haddock)
1284
1285 clean : clean_bindistprep
1286 .PHONY: clean_bindistprep
1287 clean_bindistprep:
1288 $(call removeTrees,bindistprep/)
1289
1290 distclean : clean
1291 # Clean the files that ./validate creates.
1292 $(call removeFiles,mk/are-validating.mk)
1293
1294 # Clean the files that we ask ./configure to create.
1295 $(call removeFiles,mk/config.mk)
1296 $(call removeFiles,mk/install.mk)
1297 $(call removeFiles,mk/project.mk)
1298 $(call removeFiles,compiler/ghc.cabal)
1299 $(call removeFiles,ghc/ghc-bin.cabal)
1300 $(call removeFiles,utils/runghc/runghc.cabal)
1301 $(call removeFiles,settings)
1302 $(call removeFiles,docs/users_guide/ug-book.xml)
1303 $(call removeFiles,docs/users_guide/ug-ent.xml)
1304 $(call removeFiles,docs/index.html)
1305 $(call removeFiles,libraries/prologue.txt)
1306 $(call removeFiles,distrib/configure.ac)
1307 $(call removeFiles,ch01.html ch02.html index.html)
1308
1309 # ./configure also makes these.
1310 $(call removeFiles,mk/config.h)
1311
1312 # Internal files generated by ./configure for itself.
1313 $(call removeFiles,config.cache config.status config.log)
1314
1315 # ./configure build ghc-pwd in utils/ghc-pwd/dist-boot, so clean it up.
1316 $(call removeTrees,utils/ghc-pwd/dist-boot)
1317
1318 # The root Makefile makes .old versions of some files that configure
1319 # generates, so we clean those too.
1320 $(call removeFiles,mk/config.mk.old)
1321 $(call removeFiles,mk/project.mk.old)
1322 $(call removeFiles,compiler/ghc.cabal.old)
1323
1324 # Clean the *Config.h files generated by library configure scripts
1325 $(call removeFiles,libraries/base/include/HsBaseConfig.h)
1326 $(call removeFiles,libraries/base/include/EventConfig.h)
1327 $(call removeFiles,libraries/directory/include/HsDirectoryConfig.h)
1328 $(call removeFiles,libraries/process/include/HsProcessConfig.h)
1329 $(call removeFiles,libraries/unix/include/HsUnixConfig.h)
1330 $(call removeFiles,libraries/time/lib/include/HsTimeConfig.h)
1331
1332 # The library configure scripts also like creating autom4te.cache
1333 # directories, so clean them all up.
1334 $(call removeTrees,$(patsubst %, libraries/%/autom4te.cache, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
1335
1336 # We make these when making or testing bindists
1337 $(call removeFiles,bindist-list)
1338 $(call removeTrees,bindisttest/a)
1339
1340 # Not sure why this is being cleaned here.
1341 $(call removeTrees,includes/dist-derivedconstants)
1342
1343 # Finally, clean the inplace tree.
1344 $(call removeTrees,inplace)
1345
1346 maintainer-clean : distclean
1347 $(call removeFiles,configure mk/config.h.in)
1348 $(call removeTrees,autom4te.cache $(wildcard libraries/*/autom4te.cache))
1349 $(call removeFiles,$(patsubst %, libraries/%/GNUmakefile, \
1350 $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
1351 $(call removeFiles,$(patsubst %, libraries/%/ghc.mk, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
1352 $(call removeFiles,$(patsubst %, libraries/%/configure, \
1353 $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
1354 $(call removeFiles,libraries/base/include/HsBaseConfig.h.in)
1355 $(call removeFiles,libraries/directory/include/HsDirectoryConfig.h.in)
1356 $(call removeFiles,libraries/process/include/HsProcessConfig.h.in)
1357 $(call removeFiles,libraries/unix/include/HsUnixConfig.h.in)
1358 $(call removeFiles,libraries/time/lib/include/HsTimeConfig.h.in)
1359
1360 .PHONY: all_libraries
1361
1362 .PHONY: bootstrapping-files
1363 # See https://ghc.haskell.org/trac/ghc/wiki/Building/Porting
1364 bootstrapping-files: $(includes_H_CONFIG)
1365 bootstrapping-files: $(includes_DERIVEDCONSTANTS)
1366 bootstrapping-files: $(includes_GHCCONSTANTS)
1367 bootstrapping-files: $(libffi_HEADERS)
1368
1369 .DELETE_ON_ERROR:
1370
1371 # -----------------------------------------------------------------------------
1372
1373 ifeq "$(HADDOCK_DOCS)" "YES"
1374 BINDIST_HADDOCK_FLAG = --with-haddock="$(BINDIST_PREFIX)/bin/haddock"
1375 endif
1376 ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES"
1377 BINDIST_LIBRARY_FLAGS = --enable-shared --disable-library-vanilla
1378 else
1379 BINDIST_LIBRARY_FLAGS = --enable-library-vanilla --disable-shared
1380 endif
1381 BINDIST_LIBRARY_FLAGS += --disable-library-prof
1382
1383 .PHONY: validate_build_xhtml
1384 validate_build_xhtml:
1385 cd libraries/xhtml && "$(BINDIST_PREFIX)/bin/ghc" --make Setup
1386 cd libraries/xhtml && ./Setup configure --with-ghc="$(BINDIST_PREFIX)/bin/ghc" $(BINDIST_HADDOCK_FLAG) $(BINDIST_LIBRARY_FLAGS) --global --builddir=dist-bindist --prefix="$(BINDIST_PREFIX)"
1387 cd libraries/xhtml && ./Setup build --builddir=dist-bindist
1388 ifeq "$(HADDOCK_DOCS)" "YES"
1389 cd libraries/xhtml && ./Setup haddock -v0 --ghc-options=-optP-P --builddir=dist-bindist
1390 endif
1391 cd libraries/xhtml && ./Setup install --builddir=dist-bindist
1392 cd libraries/xhtml && ./Setup clean --builddir=dist-bindist
1393 cd libraries/xhtml && rm -f Setup Setup.exe Setup.hi Setup.o
1394
1395 # Note [No stage2 packages when CrossCompiling or Stage1Only]
1396 #
1397 # (first read Note [CrossCompiling vs Stage1Only] and
1398 # Note [Stage1Only vs stage=1] in mk/config.mk.in)
1399 #
1400 # When either CrossCompiling=YES or Stage1Only=YES, we have to exclude the
1401 # following packages from the build:
1402 # * packages that we build with ghc-stage2 [1]
1403 # * packages that depend on the ghc library [2]
1404 #
1405 # Here's why:
1406 # - first of all, ghc-stage1 can't use stage0's ghc library (it's too old)
1407 # - neither do we register the ghc library (compiler/stage1) that we build
1408 # with stage0. TODO Why not? We do build it...
1409 # - as a result, we need to a) use ghc-stage2 to build packages that depend on
1410 # the ghc library (e.g. ghctags [4] and mkUserGuidePart) and b) exclude
1411 # those packages when ghc-stage2 is not available.
1412 # - when Stage1Only=YES, it's clear that ghc-stage2 is not available (we just
1413 # said we didn't want it), so we have to exclude the stage2 packages from
1414 # the build. This includes the case where Stage1Only=YES is combined with
1415 # CrossCompiling=YES (Building GHC as a cross-compiler [3]).
1416 # - when CrossCompiling=YES, but Stage1Only=NO (Cross-compiling GHC itself
1417 # [3]), we can not use ghc-stage2 either. The reason is that stage2 doesn't
1418 # run on the host platform at all; it is built to run on $(TARGETPLATFORM)"
1419 # [5]. Therefore in this case we also have to exclude the stage2 packages
1420 # from the build.
1421 #
1422 # [1] find utils -name ghc.mk | xargs grep -l 'build-prog.*,2'
1423 #
1424 # [2]
1425 # find utils -name package-data.mk | xargs grep -l 'DEP_NAMES =.* ghc\($\| \)'
1426 #
1427 # [3] https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling
1428 #
1429 # [4] 5fb72555f7b7ab67a33583f33ad9160761ca434f
1430 # "ghctags needs the stage2 compiler, since it uses the GHC API."
1431 #
1432 # [5] * bc31dbe8ee22819054df60f5ef219fed393a1c54
1433 # "Disable any packages built with stage 2 when cross-compiling
1434 # Since we can't run stage 2 on the host."
1435 #
1436 # * 72995160b0b190577b5c0cb8d7bd0426cc455b05
1437 # "We cannot use the stage 2 compiler, it runs on $(TARGETPLATFORM)"
1438
1439 # -----------------------------------------------------------------------------
1440 # Numbered phase targets
1441
1442 # In phase 1, we'll be building dependency files for most things
1443 # built by the bootstrapping compiler while make is 'include'ing
1444 # makefiles. But in order to build dependency files, we'll need to
1445 # build any automatically generated .hs files, which means that
1446 # we'll need to be able to build any tools that generate .hs files
1447 # etc. But in order to do that, we need to already know the
1448 # dependencies for those tools, so we build their dependency files
1449 # here.
1450 .PHONY: phase_0_builds
1451 # hsc2hs is needed, e.g. to make the .hs files for hpc.
1452 phase_0_builds: $(utils/hsc2hs_dist_depfile_haskell)
1453 phase_0_builds: $(utils/hsc2hs_dist_depfile_c_asm)
1454 # genprimopcode is needed to make the .hs-incl files that are in the
1455 # ghc package.
1456 phase_0_builds: $(utils/genprimopcode_dist_depfile_haskell)
1457 phase_0_builds: $(utils/genprimopcode_dist_depfile_c_asm)
1458 # deriveConstants is used to create header files included in the
1459 # ghc package.
1460 phase_0_builds: $(utils/deriveConstants_dist_depfile_haskell)
1461 phase_0_builds: $(utils/deriveConstants_dist_depfile_c_asm)
1462
1463 .PHONY: phase_1_builds
1464 phase_1_builds: $(PACKAGE_DATA_MKS)
1465