Remove the lock around NameCache for readBinIface.
[ghc-hetmet.git] / ghc.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 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://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 # ToDo List.
14 #
15 #   * finish installation
16 #     * Windows: should we have ghc-pkg-<version>?
17 #     * should we be stripping things?
18 #     * install libgmp.a, gmp.h
19 #   * need to fix Cabal for new Windows layout, see
20 #     Distribution/Simple/GHC.configureToolchain.
21 #   * remove old Makefiles, add new stubs for building in subdirs
22 #     * docs/Makefile
23 #     * docs/docbook-cheat-sheet/Makefile
24 #     * docs/ext-core/Makefile
25 #     * docs/man/Makefile
26 #     * docs/storage-mgmt/Makefile
27 #     * docs/vh/Makefile
28 #     * rts/dotnet/Makefile
29 #     * utils/Makefile
30 #   * optionally install stage3?
31 #   * add Makefiles for the rest of the utils/ programs that aren't built
32 #     by default (need to exclude them from 'make all' too)
33 #
34 # Tickets we can now close, or fix and close:
35 #
36 #   * 1693 make distclean
37 #   * 3173 make install with DESTDIR
38
39 # Possible cleanups:
40 #
41 #   * per-source-file dependencies instead of one .depend file?
42 #   * eliminate undefined variables, and use --warn-undefined-variables?
43 #   * perhaps we should make all the output dirs in the .depend rule, to
44 #     avoid all these mkdirhier calls?
45 #   * put outputs from different ways in different subdirs of distdir/build,
46 #     then we don't have to use -osuf/-hisuf.  We would have to install
47 #     them in different places too, so we'd need ghc-pkg support for packages
48 #     of different ways.
49 #   * make PACKAGES generated by configure or sh boot?
50 #   * we should use a directory of package.conf files rather than a single
51 #     file for the inplace package database, so that we can express
52 #     dependencies more accurately.  Otherwise it's possible to get into
53 #     a state where the package database is out of date, and the build
54 #     system doesn't know.
55
56 # Approximate build order.
57 #
58 # The actual build order is defined by dependencies, and the phase
59 # ordering used to ensure correct ordering of makefile-generation; see
60 #    http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture/Idiom/PhaseOrdering
61 #
62 #     * With bootstrapping compiler:
63 #           o Build utils/ghc-cabal
64 #           o Build utils/ghc-pkg
65 #           o Build utils/hsc2hs
66 #     * For each package:
67 #           o configure, generate package-data.mk and inplace-pkg-info
68 #           o register each package into inplace/lib/package.conf
69 #     * build libffi
70 #     * With bootstrapping compiler:
71 #           o Build libraries/{filepath,hpc,extensible-exceptions,Cabal}
72 #           o Build compiler (stage 1)
73 #     * With stage 1:
74 #           o Build libraries/*
75 #           o Build rts
76 #           o Build utils/* (except haddock)
77 #           o Build compiler (stage 2)
78 #     * With stage 2:
79 #           o Build utils/haddock
80 #           o Build compiler (stage 3) (optional)
81 #     * With haddock:
82 #           o libraries/*
83 #           o compiler
84
85 .PHONY: default all haddock
86
87 default : all
88
89 # Just bring makefiles up to date:
90 .PHONY: just-makefiles
91 just-makefiles:
92         @:
93
94 # -----------------------------------------------------------------------------
95 # Misc GNU make utils
96
97 nothing=
98 space=$(nothing) $(nothing)
99 comma=,
100
101 # Cancel all suffix rules.  Ideally we'd like to have 'make -r' turned on
102 # by default, because that disables all the implicit rules, but there doesn't
103 # seem to be a good way to do that.  This turns off all the old-style suffix
104 # rules, which does half the job and speeds up make quite a bit:
105 .SUFFIXES:
106
107 # -----------------------------------------------------------------------------
108 #                       Makefile debugging
109 # to see the effective value used for a Makefile variable, do
110 #  make show VALUE=MY_VALUE
111 #
112
113 show:
114         @echo '$(VALUE)="$($(VALUE))"'
115
116 # -----------------------------------------------------------------------------
117 # Include subsidiary build-system bits
118
119 include mk/tree.mk
120
121 ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
122 include mk/config.mk
123 ifeq "$(ProjectVersion)" ""
124 $(error Please run ./configure first)
125 endif
126 endif
127
128 # (Optional) build-specific configuration
129 include mk/custom-settings.mk
130
131 ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
132 ifeq "$(GhcLibWays)" ""
133 $(error $$(GhcLibWays) is empty, it must contain at least one way)
134 endif
135 endif
136
137 # -----------------------------------------------------------------------------
138 # Macros for standard targets
139
140 include rules/all-target.mk
141 include rules/clean-target.mk
142
143 # Helper macro
144 include rules/mkdep.mk
145
146 # -----------------------------------------------------------------------------
147 # The inplace tree
148
149 $(eval $(call clean-target,inplace,,inplace))
150
151 # -----------------------------------------------------------------------------
152 # Whether to build dependencies or not
153
154 # When we're just doing 'make clean' or 'make show', then we don't need
155 # to build dependencies.
156
157 ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
158 NO_INCLUDE_DEPS = YES
159 NO_INCLUDE_PKGDATA = YES
160 endif
161 ifneq "$(findstring bootstrapping-files,$(MAKECMDGOALS))" ""
162 NO_INCLUDE_DEPS = YES
163 NO_INCLUDE_PKGDATA = YES
164 endif
165 ifeq "$(findstring show,$(MAKECMDGOALS))" "show"
166 NO_INCLUDE_DEPS = YES
167 # We want package-data.mk for show
168 endif
169
170 # We don't haddock base3-compat, as it has the same package name as base
171 libraries/base3-compat_dist-install_DO_HADDOCK = NO
172
173 # We don't haddock the bootstrapping libraries
174 libraries/hpc_dist-boot_DO_HADDOCK = NO
175 libraries/Cabal_dist-boot_DO_HADDOCK = NO
176 libraries/extensible-exceptions_dist-boot_DO_HADDOCK = NO
177 libraries/filepath_dist-boot_DO_HADDOCK = NO
178
179 # -----------------------------------------------------------------------------
180 # Ways
181
182 include rules/way-prelims.mk
183
184 $(foreach way,$(ALL_WAYS),\
185   $(eval $(call way-prelims,$(way))))
186
187 # -----------------------------------------------------------------------------
188 # Compilation Flags
189
190 include rules/distdir-opts.mk
191 include rules/distdir-way-opts.mk
192
193 # -----------------------------------------------------------------------------
194 # Finding source files and object files
195
196 include rules/hs-sources.mk
197 include rules/c-sources.mk
198 include rules/includes-sources.mk
199 include rules/hs-objs.mk
200 include rules/c-objs.mk
201 include rules/cmm-objs.mk
202
203 # -----------------------------------------------------------------------------
204 # Suffix rules
205
206 # Suffix rules cause "make clean" to fail on Windows (trac #3233)
207 # so we don't make any when cleaning.
208 ifneq "$(CLEANING)" "YES"
209
210 include rules/hs-suffix-rules-srcdir.mk
211 include rules/hs-suffix-rules.mk
212
213 # -----------------------------------------------------------------------------
214 # Suffix rules for .hi files
215
216 include rules/hi-rule.mk
217
218 $(foreach way,$(ALL_WAYS),\
219   $(eval $(call hi-rule,$(way))))
220
221 #-----------------------------------------------------------------------------
222 # C-related suffix rules
223
224 include rules/c-suffix-rules.mk
225
226 #-----------------------------------------------------------------------------
227 # CMM-related suffix rules
228
229 include rules/cmm-suffix-rules.mk
230
231 endif
232
233 # -----------------------------------------------------------------------------
234 # Building package-data.mk files from .cabal files
235
236 include rules/package-config.mk
237
238 # -----------------------------------------------------------------------------
239 # Building dependencies
240
241 include rules/build-dependencies.mk
242
243 # -----------------------------------------------------------------------------
244 # Build package-data.mk files
245
246 include rules/build-package-data.mk
247
248 # -----------------------------------------------------------------------------
249 # Build and install a program
250
251 include rules/build-prog.mk
252 include rules/shell-wrapper.mk
253
254 # -----------------------------------------------------------------------------
255 # Build a perl script
256
257 include rules/build-perl.mk
258
259 # -----------------------------------------------------------------------------
260 # Build a package
261
262 include rules/build-package.mk
263 include rules/build-package-way.mk
264 include rules/haddock.mk
265
266 # -----------------------------------------------------------------------------
267 # Registering hand-written package descriptions (used in libffi and rts)
268
269 include rules/manual-package-config.mk
270
271 # -----------------------------------------------------------------------------
272 # Docs
273
274 include rules/docbook.mk
275
276 # -----------------------------------------------------------------------------
277 # Making bindists
278
279 include rules/bindist.mk
280
281 # -----------------------------------------------------------------------------
282 # Building libraries
283
284 define addPackage # args: $1 = package, $2 = condition
285     ifneq "$2" ""
286         ifeq "$$(CLEANING)" "YES"
287             PACKAGES += $1
288         else
289             ifeq $2
290                 PACKAGES += $1
291             endif
292         endif
293     else
294         PACKAGES += $1
295     endif
296 endef
297
298 $(eval $(call addPackage,ghc-prim))
299 ifeq "$(CLEANING)" "YES"
300 $(eval $(call addPackage,integer-gmp))
301 $(eval $(call addPackage,integer-simple))
302 else
303 $(eval $(call addPackage,$(INTEGER_LIBRARY)))
304 endif
305 $(eval $(call addPackage,base))
306 $(eval $(call addPackage,filepath))
307 $(eval $(call addPackage,array))
308 $(eval $(call addPackage,bytestring))
309 $(eval $(call addPackage,containers))
310
311 $(eval $(call addPackage,Win32,($$(Windows),YES)))
312 $(eval $(call addPackage,unix,($$(Windows),NO)))
313
314 $(eval $(call addPackage,old-locale))
315 $(eval $(call addPackage,old-time))
316 $(eval $(call addPackage,time))
317 $(eval $(call addPackage,directory))
318 $(eval $(call addPackage,process))
319 $(eval $(call addPackage,random))
320 $(eval $(call addPackage,extensible-exceptions))
321 $(eval $(call addPackage,haskell98))
322 $(eval $(call addPackage,hpc))
323 $(eval $(call addPackage,pretty))
324 $(eval $(call addPackage,syb))
325 $(eval $(call addPackage,template-haskell))
326 $(eval $(call addPackage,base3-compat))
327 $(eval $(call addPackage,Cabal))
328 $(eval $(call addPackage,mtl))
329 $(eval $(call addPackage,utf8-string))
330
331 $(eval $(call addPackage,terminfo,($$(Windows),NO)))
332
333 $(eval $(call addPackage,haskeline))
334
335 ifneq "$(BootingFromHc)" "YES"
336 PACKAGES_STAGE2 += \
337         dph/dph-base \
338         dph/dph-prim-interface \
339         dph/dph-prim-seq \
340         dph/dph-prim-par \
341         dph/dph-seq \
342         dph/dph-par
343 endif
344
345 BOOT_PKGS = Cabal hpc extensible-exceptions
346
347 # The actual .a and .so/.dll files: needed for dependencies.
348 ALL_STAGE1_LIBS  = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB))
349 ifeq "$(BuildSharedLibs)" "YES"
350 ALL_STAGE1_LIBS += $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_dyn_LIB))
351 endif
352 BOOT_LIBS = $(foreach lib,$(BOOT_PKGS),$(libraries/$(lib)_dist-boot_v_LIB))
353
354 OTHER_LIBS = libffi/libHSffi$(v_libsuf) libffi/HSffi.o
355 ifeq "$(BuildSharedLibs)" "YES"
356 OTHER_LIBS  += libffi/libHSffi$(dyn_libsuf)
357 endif
358
359 # We cannot run ghc-cabal to configure a package until we have
360 # configured and registered all of its dependencies.  So the following
361 # hack forces all the configure steps to happen in exactly the order
362 # given in the PACKAGES variable above.  Ideally we should use the
363 # correct dependencies here to allow more parallelism, but we don't
364 # know the dependencies until we've generated the pacakge-data.mk
365 # files.
366 define fixed_pkg_dep
367 libraries/$1/$2/package-data.mk : $$(GHC_PKG_INPLACE) $$(if $$(fixed_pkg_prev),libraries/$$(fixed_pkg_prev)/$2/package-data.mk)
368 fixed_pkg_prev:=$1
369 endef
370
371 ifneq "$(BINDIST)" "YES"
372 fixed_pkg_prev=
373 $(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),$(eval $(call fixed_pkg_dep,$(pkg),dist-install)))
374
375 # We assume that the stage2 compiler depends on all the libraries, so
376 # they all get added to the package database before we try to configure
377 # it
378 compiler/stage2/package-data.mk: $(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),libraries/$(pkg)/dist-install/package-data.mk)
379 ghc/stage1/package-data.mk: compiler/stage1/package-data.mk
380 ghc/stage2/package-data.mk: compiler/stage2/package-data.mk
381 # haddock depends on ghc and some libraries, but depending on GHC's
382 # package-data.mk is sufficient, as that in turn depends on all the
383 # libraries
384 utils/haddock/dist/package-data.mk: compiler/stage2/package-data.mk
385
386 utils/hsc2hs/dist-install/package-data.mk: compiler/stage2/package-data.mk
387
388 # add the final two package.conf dependencies: ghc-prim depends on RTS,
389 # and RTS depends on libffi.
390 libraries/ghc-prim/dist-install/package-data.mk : rts/package.conf.inplace
391 rts/package.conf.inplace : libffi/package.conf.inplace
392 endif
393
394 # -----------------------------------------------------------------------------
395 # Special magic for the ghc-prim package
396
397 # We want the ghc-prim package to include the GHC.Prim module when it
398 # is registered, but not when it is built, because GHC.Prim is not a
399 # real source module, it is built-in to GHC.  The old build system did
400 # this using Setup.hs, but we can't do that here, so we have a flag to
401 # enable GHC.Prim in the .cabal file (so that the ghc-prim package
402 # remains compatible with the old build system for the time being).
403 # GHC.Prim module in the ghc-prim package with a flag:
404 #
405 libraries/ghc-prim_CONFIGURE_OPTS += --flag=include-ghc-prim
406
407 # And then we strip it out again before building the package:
408 define libraries/ghc-prim_PACKAGE_MAGIC
409 libraries/ghc-prim_dist-install_MODULES := $$(filter-out GHC.Prim,$$(libraries/ghc-prim_dist-install_MODULES))
410 endef
411
412 PRIMOPS_TXT = $(GHC_COMPILER_DIR)/prelude/primops.txt
413
414 libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT)
415         "$(MKDIRHIER)" $(dir $@)
416         "$(GENPRIMOP_INPLACE)" --make-haskell-wrappers <$(PRIMOPS_TXT) >$@
417
418 libraries/ghc-prim/GHC/Prim.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT)
419         "$(GENPRIMOP_INPLACE)" --make-haskell-source <$(PRIMOPS_TXT) >$@
420
421
422 # -----------------------------------------------------------------------------
423 # Include build instructions from all subdirs
424
425 # For the rationale behind the build phases, see
426 #   http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture/Idiom/PhaseOrdering
427
428 # Setting foo_dist_DISABLE=YES means "in directory foo, for build
429 # "dist", just read the package-data.mk file, do not build anything".
430
431 # We carefully engineer things so that we can build the
432 # package-data.mk files early on: they depend only on a few tools also
433 # built early.  Having got the package-data.mk files built, we can
434 # restart make with up-to-date information about all the packages
435 # (this is phase 0).  The remaining problem is the .depend files:
436 #
437 #   - .depend files in libraries need the stage 1 compiler to build
438 #   - ghc/stage1/.depend needs compiler/stage1 built
439 #   - compiler/stage1/.depend needs the bootstrap libs built
440 #
441 # GHC 6.11+ can build a .depend file without having built the
442 # dependencies of the package, but we can't rely on the bootstrapping
443 # compiler being able to do this, which is why we have to separate the
444 # three phases above.
445
446 # So this is the final ordering:
447
448 # Phase 0 : all package-data.mk files
449 #           (requires ghc-cabal, ghc-pkg, mkdirhier, dummy-ghc etc.)
450 # Phase 1 : .depend files for bootstrap libs
451 #           (requires hsc2hs)
452 # Phase 2 : compiler/stage1/.depend
453 #           (requires bootstrap libs and genprimopcode)
454 # Phase 3 : ghc/stage1/.depend
455 #           (requires compiler/stage1)
456 #
457 # The rest : libraries/*/dist-install, compiler/stage2, ghc/stage2
458
459 BUILD_DIRS =
460
461 ifneq "$(BINDIST)" "YES"
462 BUILD_DIRS += \
463    $(GHC_MKDEPENDC_DIR) \
464    $(GHC_MKDIRHIER_DIR)
465 endif
466
467 BUILD_DIRS += \
468    docs/users_guide \
469    libraries/Cabal/doc \
470    $(GHC_UNLIT_DIR) \
471    $(GHC_HP2PS_DIR)
472
473 ifneq "$(GhcUnregisterised)" "YES"
474 BUILD_DIRS += \
475    $(GHC_MANGLER_DIR) \
476    $(GHC_SPLIT_DIR)
477 endif
478
479 ifneq "$(BINDIST)" "YES"
480 BUILD_DIRS += \
481    $(GHC_GENPRIMOP_DIR)
482 endif
483
484 BUILD_DIRS += \
485    driver \
486    driver/ghci \
487    driver/ghc \
488    libffi \
489    includes \
490    rts
491
492 ifneq "$(BINDIST)" "YES"
493 BUILD_DIRS += \
494    $(GHC_CABAL_DIR) \
495    $(GHC_GENAPPLY_DIR)
496 endif
497
498 BUILD_DIRS += \
499    utils/haddock \
500    utils/haddock/doc
501
502 ifneq "$(CLEANING)" "YES"
503 BUILD_DIRS += \
504    $(patsubst %, libraries/%, $(PACKAGES) $(PACKAGES_STAGE2))
505 ifneq "$(BootingFromHc)" "YES"
506 BUILD_DIRS += \
507    libraries/dph
508 endif
509 endif
510
511 ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
512 BUILD_DIRS += libraries/integer-gmp/gmp
513 endif
514
515 BUILD_DIRS += \
516    compiler \
517    $(GHC_HSC2HS_DIR) \
518    $(GHC_PKG_DIR) \
519    utils/hpc \
520    utils/runghc \
521    ghc
522 ifeq "$(Windows)" "YES"
523 BUILD_DIRS += \
524    $(GHC_TOUCHY_DIR)
525 endif
526
527 # XXX libraries/% must come before any programs built with stage1, see
528 # Note [lib-depends].
529
530 ifeq "$(phase)" "0"
531 $(foreach lib,$(BOOT_PKGS),$(eval \
532   libraries/$(lib)_dist-boot_DISABLE = YES))
533 endif
534
535 ifneq "$(findstring $(phase),0 1)" ""
536 # We can build deps for compiler/stage1 in phase 2
537 compiler_stage1_DISABLE = YES
538 endif
539
540 ifneq "$(findstring $(phase),0 1 2)" ""
541 ghc_stage1_DISABLE = YES
542 endif
543
544 ifneq "$(CLEANING)" "YES"
545 ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
546 libraries/base_dist-install_CONFIGURE_OPTS += --flags=-integer-simple
547 else
548     ifeq "$(INTEGER_LIBRARY)" "integer-simple"
549         libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-simple
550     else
551 $(error Unknown integer library: $(INTEGER_LIBRARY))
552     endif
553 endif
554 endif
555
556 ifneq "$(findstring $(phase),0 1 2 3)" ""
557 # In phases 0-3, we disable stage2-3, the full libraries and haddock
558 utils/haddock_dist_DISABLE = YES
559 utils/runghc_dist_DISABLE = YES
560 utils/hpc_dist_DISABLE = YES
561 utils/hsc2hs_dist-install_DISABLE = YES
562 utils/ghc-pkg_dist-install_DISABLE = YES
563 compiler_stage2_DISABLE = YES
564 compiler_stage3_DISABLE = YES
565 ghc_stage2_DISABLE = YES
566 ghc_stage3_DISABLE = YES
567 $(foreach lib,$(PACKAGES) $(PACKAGES_STAGE2),$(eval \
568   libraries/$(lib)_dist-install_DISABLE = YES))
569 endif
570
571 # These packages don't pass the Cabal checks because hs-source-dirs
572 # points outside the source directory. This isn't a real problem in
573 # these cases, so we just skip checking them.
574 CHECKED_libraries/dph/dph-seq = YES
575 CHECKED_libraries/dph/dph-par = YES
576 # In compiler's case, include-dirs points outside of the source tree
577 CHECKED_compiler = YES
578
579 include $(patsubst %, %/ghc.mk, $(BUILD_DIRS))
580
581 # We need -fno-warn-deprecated-flags to avoid failure with -Werror
582 GhcLibHcOpts += -fno-warn-deprecated-flags
583 ifeq "$(ghc_ge_609)" "YES"
584 GhcBootLibHcOpts += -fno-warn-deprecated-flags
585 endif
586
587 # Add $(GhcLibHcOpts) to all library builds
588 $(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts)))
589
590 # XXX Hack; remove this
591 $(foreach pkg,$(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += -Wwarn))
592
593 # XXX we configure packages with the bootstrapping compiler (for
594 # dependency reasons, see the phase ordering), which doesn't
595 # necessarily support all the extensions we need, and Cabal filters
596 # out the ones it thinks aren't supported.
597 libraries/base3-compat_dist-install_HC_OPTS += -XPackageImports
598
599 # A useful pseudo-target
600 .PHONY: stage1_libs
601 stage1_libs : $(ALL_STAGE1_LIBS)
602
603 libraries/index.html: $(ALL_HADDOCK_FILES)
604         cd libraries && sh gen_contents_index --inplace
605 $(eval $(call all-target,library_doc_index,libraries/index.html))
606 INSTALL_LIBRARY_DOCS += libraries/*.html libraries/*.gif libraries/*.css libraries/*.js
607
608 ifeq "$(CHECK_PACKAGES)" "YES"
609 all: check_packages
610 endif
611
612 # -----------------------------------------------------------------------------
613 # Bootstrapping libraries
614
615 # We need to build a few libraries with the installed GHC, since GHC itself
616 # and some of the tools depend on them:
617
618 ifneq "$(BINDIST)" "YES"
619
620 ifneq "$(BOOTSTRAPPING_CONF)" ""
621 ifeq "$(wildcard $(BOOTSTRAPPING_CONF))" ""
622 $(shell echo "[]" >$(BOOTSTRAPPING_CONF))
623 endif
624 endif
625
626 $(eval $(call clean-target,$(BOOTSTRAPPING_CONF),,$(BOOTSTRAPPING_CONF)))
627
628 # These three libraries do not depend on each other, so we can build
629 # them straight off:
630
631 $(eval $(call build-package,libraries/hpc,dist-boot,0))
632 $(eval $(call build-package,libraries/extensible-exceptions,dist-boot,0))
633 $(eval $(call build-package,libraries/Cabal,dist-boot,0))
634
635 # register the boot packages in strict sequence, because running
636 # multiple ghc-pkgs in parallel doesn't work (registrations may get
637 # lost).
638 fixed_pkg_prev=
639 $(foreach pkg,$(BOOT_PKGS),$(eval $(call fixed_pkg_dep,$(pkg),dist-boot)))
640
641 compiler/stage1/package-data.mk : \
642     libraries/Cabal/dist-boot/package-data.mk \
643     libraries/hpc/dist-boot/package-data.mk \
644     libraries/extensible-exceptions/dist-boot/package-data.mk
645
646 # These are necessary because the bootstrapping compiler may not know
647 # about cross-package dependencies:
648 $(compiler_stage1_depfile) : $(BOOT_LIBS)
649 $(ghc_stage1_depfile) : $(compiler_stage1_v_LIB)
650
651 $(foreach pkg,$(BOOT_PKGS),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$(GhcBootLibHcOpts)))
652
653 endif
654
655 # -----------------------------------------------------------------------------
656 # Creating a local mingw copy on Windows
657
658 ifeq "$(Windows)" "YES"
659
660 # directories don't work well as dependencies, hence a stamp file
661 $(INPLACE)/stamp-mingw : $(MKDIRHIER)
662         $(MKDIRHIER) $(INPLACE_MINGW)/bin
663         GCC=`type -p $(WhatGccIsCalled)`; \
664         GccDir=`dirname $$GCC`; \
665         "$(CP)" -p $$GccDir/{gcc.exe,ar.exe,as.exe,dlltool.exe,dllwrap.exe,windres.exe} $(INPLACE_MINGW)/bin; \
666         "$(CP)" -Rp $$GccDir/../include $(INPLACE_MINGW); \
667         "$(CP)" -Rp $$GccDir/../lib     $(INPLACE_MINGW); \
668         "$(CP)" -Rp $$GccDir/../libexec $(INPLACE_MINGW); \
669         "$(CP)" -Rp $$GccDir/../mingw32 $(INPLACE_MINGW)
670         touch $(INPLACE)/stamp-mingw
671
672 install : install_mingw
673 .PHONY: install_mingw
674 install_mingw : $(INPLACE_MINGW)
675         "$(CP)" -Rp $(INPLACE_MINGW) $(prefix)
676
677 $(INPLACE_LIB)/perl.exe $(INPLACE_LIB)/perl56.dll :
678         "$(CP)" $(GhcDir)../{perl.exe,perl56.dll} $(INPLACE_LIB)
679
680 endif # Windows
681
682 libraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock: \
683     libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs \
684     libraries/ghc-prim/dist-install/build/autogen/GHC/PrimopWrappers.hs
685
686 libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs: \
687                             $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE) $(MKDIRHIER)
688         "$(MKDIRHIER)" $(dir $@)
689         "$(GENPRIMOP_INPLACE)" --make-haskell-source < $< > $@
690
691 libraries/ghc-prim/dist-install/build/autogen/GHC/PrimopWrappers.hs: \
692                             $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE) $(MKDIRHIER)
693         "$(MKDIRHIER)" $(dir $@)
694         "$(GENPRIMOP_INPLACE)" --make-haskell-wrappers < $< > $@
695
696 # -----------------------------------------------------------------------------
697 # Installation
698
699 install: install_packages install_libs install_libexecs install_headers \
700          install_libexec_scripts install_bins install_docs \
701                  install_topdirs install_topdir_scripts
702
703 install_bins: $(INSTALL_BINS)
704         $(INSTALL_DIR) $(DESTDIR)$(bindir)
705         for i in $(INSTALL_BINS); do \
706                 $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(bindir) ;  \
707                 if test "$(darwin_TARGET_OS)" = "1"; then \
708                    sh mk/fix_install_names.sh $(ghclibdir) $(DESTDIR)$(bindir)/$$i ; \
709                 fi ; \
710         done
711
712 install_libs: $(INSTALL_LIBS)
713         $(INSTALL_DIR) $(DESTDIR)$(ghclibdir)
714         for i in $(INSTALL_LIBS); do \
715                 case $$i in \
716                   *.a) \
717                     $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir); \
718                     $(RANLIB) $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \
719                   *.dll) \
720                     $(INSTALL_DATA) -s $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir) ;; \
721                   *.so) \
722                     $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir) ;; \
723                   *.dylib) \
724                     $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir); \
725                     install_name_tool -id $(DESTDIR)$(ghclibdir)/`basename $$i` $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \
726                   *) \
727                     $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibdir); \
728                 esac; \
729         done
730
731 install_libexec_scripts: $(INSTALL_LIBEXEC_SCRIPTS)
732         $(INSTALL_DIR) $(DESTDIR)$(ghclibexecdir)
733         for i in $(INSTALL_LIBEXEC_SCRIPTS); do \
734                 $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghclibexecdir); \
735         done
736
737 install_libexecs:  $(INSTALL_LIBEXECS)
738         $(INSTALL_DIR) $(DESTDIR)$(ghclibexecdir)
739         for i in $(INSTALL_LIBEXECS); do \
740                 $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(ghclibexecdir); \
741         done
742
743 install_topdir_scripts: $(INSTALL_TOPDIR_SCRIPTS)
744         $(INSTALL_DIR) $(DESTDIR)$(topdir)
745         for i in $(INSTALL_TOPDIR_SCRIPTS); do \
746                 $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(topdir); \
747         done
748
749 install_topdirs: $(INSTALL_TOPDIRS)
750         $(INSTALL_DIR) $(DESTDIR)$(topdir)
751         for i in $(INSTALL_TOPDIRS); do \
752                 $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(topdir); \
753         done
754
755 install_headers: $(INSTALL_HEADERS)
756         $(INSTALL_DIR) $(DESTDIR)$(ghcheaderdir)
757         for i in $(INSTALL_HEADERS); do \
758                 $(INSTALL_HEADER) $(INSTALL_OPTS) $$i $(DESTDIR)$(ghcheaderdir); \
759         done
760
761 install_docs: $(INSTALL_HEADERS)
762         $(INSTALL_DIR) $(DESTDIR)$(docdir)
763         for i in $(INSTALL_DOCS); do \
764                 $(INSTALL_DOC) $(INSTALL_OPTS) $$i $(DESTDIR)$(docdir); \
765         done
766         $(INSTALL_DIR) $(INSTALL_OPTS) $(DESTDIR)$(docdir)/html; \
767         $(INSTALL_DOC) $(INSTALL_OPTS) docs/index.html $(DESTDIR)$(docdir)/html; \
768         for i in $(INSTALL_LIBRARY_DOCS); do \
769                 $(INSTALL_DOC) $(INSTALL_OPTS) $$i $(DESTDIR)$(docdir)/html/libraries/; \
770         done
771         for i in $(INSTALL_HTML_DOC_DIRS); do \
772                 $(INSTALL_DIR) $(INSTALL_OPTS) $(DESTDIR)$(docdir)/html/`basename $$i`; \
773                 $(INSTALL_DOC) $(INSTALL_OPTS) $$i/* $(DESTDIR)$(docdir)/html/`basename $$i`; \
774         done
775
776 INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf
777
778 # Install packages in the right order, so that ghc-pkg doesn't complain.
779 # Also, install ghc-pkg first.
780 ifeq "$(Windows)" "NO"
781 INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/ghc-pkg
782 else
783 INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
784 endif
785
786 install_packages: install_libexecs
787 install_packages: libffi/package.conf.install rts/package.conf.install
788         $(INSTALL_DIR) $(DESTDIR)$(topdir)
789         "$(RM)" $(RM_OPTS) $(INSTALLED_PACKAGE_CONF)
790         $(CREATE_DATA)     $(INSTALLED_PACKAGE_CONF)
791         echo "[]"       >> $(INSTALLED_PACKAGE_CONF)
792         "$(INSTALLED_GHC_PKG_REAL)" --force --global-conf $(INSTALLED_PACKAGE_CONF) update libffi/package.conf.install
793         "$(INSTALLED_GHC_PKG_REAL)" --force --global-conf $(INSTALLED_PACKAGE_CONF) update rts/package.conf.install
794         $(foreach p, $(PACKAGES) $(PACKAGES_STAGE2),\
795             "$(GHC_CABAL_INPLACE)" install \
796                  $(INSTALLED_GHC_PKG_REAL) \
797                  $(INSTALLED_PACKAGE_CONF) \
798                  libraries/$p dist-install \
799                  '$(DESTDIR)' '$(prefix)' '$(ghclibdir)' '$(docdir)/html/libraries' &&) true
800         "$(GHC_CABAL_INPLACE)" install \
801                  $(INSTALLED_GHC_PKG_REAL) \
802                  $(INSTALLED_PACKAGE_CONF) \
803                  compiler stage2 \
804                  '$(DESTDIR)' '$(prefix)' '$(ghclibdir)' '$(docdir)/html/libraries'
805
806 # -----------------------------------------------------------------------------
807 # Binary distributions
808
809 # This is split in 2 because of the shell argument limit
810 $(eval $(call bindist,root1,\
811     LICENSE \
812     configure config.sub config.guess install-sh \
813     extra-gcc-opts.in \
814     Makefile \
815     mk/config.mk.in \
816     $(INPLACE_BIN)/mkdirhier \
817     $(INPLACE_BIN)/ghc-cabal \
818     utils/ghc-pwd/ghc-pwd \
819         $(BINDIST_WRAPPERS) \
820         $(BINDIST_LIBS) \
821         $(BINDIST_HI) \
822         $(BINDIST_EXTRAS) \
823     $(INSTALL_HEADERS) \
824     $(INSTALL_LIBEXECS) \
825     $(INSTALL_LIBEXEC_SCRIPTS) \
826     $(INSTALL_TOPDIRS) \
827     $(INSTALL_TOPDIR_SCRIPTS) \
828     $(INSTALL_BINS) \
829     $(INSTALL_DOCS) \
830     $(INSTALL_LIBRARY_DOCS) \
831  ))
832 $(eval $(call bindist,root2,\
833     $(addsuffix /*,$(INSTALL_HTML_DOC_DIRS)) \
834         docs/index.html \
835         $(wildcard libraries/*/dist-install/doc/) \
836     $(filter-out extra-gcc-opts,$(INSTALL_LIBS)) \
837     $(filter-out %/project.mk mk/config.mk %/mk/install.mk,$(MAKEFILE_LIST)) \
838         mk/fix_install_names.sh \
839         mk/project.mk \
840         mk/install.mk.in \
841         bindist.mk \
842         libraries/dph/LICENSE \
843  ))
844 # mk/project.mk gets an absolute path, so we manually include it in
845 # the bindist with a relative path
846
847 BIN_DIST_MK = $(BIN_DIST_NAME)/bindist.mk
848
849 binary-dist:
850         "$(RM)" $(RM_OPTS) -r $(BIN_DIST_NAME)
851         mkdir $(BIN_DIST_NAME)
852         set -e; for i in LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.in ghc.mk inplace; do ln -s ../$$i $(BIN_DIST_NAME)/; done
853         echo "HADDOCK_DOCS       = $(HADDOCK_DOCS)"       >> $(BIN_DIST_MK)
854         echo "LATEX_DOCS         = $(LATEX_DOCS)"         >> $(BIN_DIST_MK)
855         echo "BUILD_DOCBOOK_HTML = $(BUILD_DOCBOOK_HTML)" >> $(BIN_DIST_MK)
856         echo "BUILD_DOCBOOK_PS   = $(BUILD_DOCBOOK_PS)"   >> $(BIN_DIST_MK)
857         echo "BUILD_DOCBOOK_PDF  = $(BUILD_DOCBOOK_PDF)"  >> $(BIN_DIST_MK)
858         ln -s ../distrib/configure-bin.ac $(BIN_DIST_NAME)/configure.ac
859         cd $(BIN_DIST_NAME) && autoreconf
860         "$(RM)" $(RM_OPTS) $(BIN_DIST_TAR)
861 # h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
862 # tree then we want to include the real file, not a symlink to it
863         "$(TAR)" hcf - -T $(BIN_DIST_LIST) | bzip2 -c > $(BIN_DIST_TAR_BZ2)
864
865 windows-binary-dist:
866         "$(RM)" $(RM_OPTS) -r $(BIN_DIST_NAME)
867         $(MAKE) prefix=$(BIN_DIST_DIR) install
868         "$(TAR)" cf - $(BIN_DIST_NAME) | bzip2 -c > $(BIN_DIST_TAR_BZ2)
869
870 windows-installer:
871         "$(ISCC)" /O. /F$(WINDOWS_INSTALLER_BASE) - < distrib/ghc.iss
872
873 nTimes = set -e; for i in `seq 1 $(1)`; do echo Try "$$i: $(2)"; if $(2); then break; fi; done
874
875 .PHONY: publish-binary-dist
876 publish-binary-dist:
877         $(call nTimes,10,$(PublishCp) $(BIN_DIST_TAR_BZ2) $(PublishLocation)/dist)
878 ifeq "$(mingw32_TARGET_OS)" "1"
879         $(call nTimes,10,$(PublishCp) $(WINDOWS_INSTALLER) $(PublishLocation)/dist)
880 endif
881
882 .PHONY: publish-docs
883 publish-docs:
884         $(call nTimes,10,$(PublishCp) -r bindisttest/installed/share/doc/ghc/* $(PublishLocation)/docs)
885
886 # -----------------------------------------------------------------------------
887 # Source distributions
888
889 # Do it like this:
890 #
891 #       $ make
892 #       $ make sdist
893 #
894
895 # A source dist is built from a complete build tree, because we
896 # require some extra files not contained in a darcs checkout: the
897 # output from Happy and Alex, for example.
898 #
899 # The steps performed by 'make dist' are as follows:
900 #   - create a complete link-tree of the current build tree in /tmp
901 #   - run 'make distclean' on that tree
902 #   - remove a bunch of other files that we know shouldn't be in the dist
903 #   - tar up first the extralibs package, then the main source package
904
905 #
906 # Directory in which we're going to build the src dist
907 #
908 SRC_DIST_NAME=ghc-$(ProjectVersion)
909 SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME)
910
911 #
912 # Files to include in source distributions
913 #
914 SRC_DIST_DIRS = mk rules docs distrib bindisttest libffi includes utils docs rts compiler ghc driver libraries
915 SRC_DIST_FILES += \
916         configure.ac config.guess config.sub configure \
917         aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \
918         ghc.spec.in ghc.spec extra-gcc-opts.in VERSION \
919         boot boot-pkgs packages ghc.mk
920
921 SRC_DIST_TARBALL = $(SRC_DIST_NAME)-src.tar.bz2
922
923 VERSION :
924         echo $(ProjectVersion) >VERSION
925
926 sdist : VERSION
927
928 # Use:
929 #     $(call sdist_file,compiler,stage2,cmm,CmmLex,x)
930 # to copy the generated file that replaces compiler/cmm/CmmLex.x, where
931 # "stage2" is the dist dir.
932 sdist_file = \
933   if test -f $(TOP)/$1/$2/build/$4.hs; then \
934     "$(CP)" $(TOP)/$1/$2/build/$4.hs $1/$3/ ; \
935     mv $1/$3/$4.$5 $1/$3/$4.$5.source ;\
936   else \
937     echo "does not exist: $1/$2//build/$4.hs"; \
938     exit 1; \
939   fi
940
941 .PHONY: sdist-prep
942 sdist-prep :
943         "$(RM)" $(RM_OPTS) -r $(SRC_DIST_DIR)
944         "$(RM)" $(RM_OPTS) $(SRC_DIST_TARBALL)
945         mkdir $(SRC_DIST_DIR)
946         ( cd $(SRC_DIST_DIR) \
947           && for i in $(SRC_DIST_DIRS); do mkdir $$i; (cd $$i && lndir $(TOP)/$$i ); done \
948           && for i in $(SRC_DIST_FILES); do $(LN_S) $(TOP)/$$i .; done \
949           && $(MAKE) distclean \
950           && if test -f $(TOP)/libraries/haskell-src/dist/build/Language/Haskell/Parser.hs; then "$(CP)" $(TOP)/libraries/haskell-src/dist/build/Language/Haskell/Parser.hs libraries/haskell-src/Language/Haskell/ ; mv libraries/haskell-src/Language/Haskell/Parser.ly libraries/haskell-src/Language/Haskell/Parser.ly.source ; fi \
951           && $(call sdist_file,compiler,stage2,cmm,CmmLex,x) \
952           && $(call sdist_file,compiler,stage2,cmm,CmmParse,y) \
953           && $(call sdist_file,compiler,stage2,main,ParsePkgConf,y) \
954           && $(call sdist_file,compiler,stage2,parser,HaddockLex,x) \
955           && $(call sdist_file,compiler,stage2,parser,HaddockParse,y) \
956           && $(call sdist_file,compiler,stage2,parser,Lexer,x) \
957           && $(call sdist_file,compiler,stage2,parser,Parser,y.pp) \
958           && $(call sdist_file,compiler,stage2,parser,ParserCore,y) \
959           && $(call sdist_file,utils/hpc,dist,,HpcParser,y) \
960           && $(call sdist_file,utils/genprimopcode,dist,,Lexer,x) \
961           && $(call sdist_file,utils/genprimopcode,dist,,Parser,y) \
962           && "$(RM)" $(RM_OPTS) -r compiler/stage[123] mk/build.mk \
963           && "$(FIND)" $(SRC_DIST_DIRS) \( -name _darcs -o -name SRC -o -name "autom4te*" -o -name "*~" -o -name ".cvsignore" -o -name "\#*" -o -name ".\#*" -o -name "log" -o -name "*-SAVE" -o -name "*.orig" -o -name "*.rej" -o -name "*-darcs-backup*" \) -print | xargs "$(RM)" $(RM_OPTS) -r \
964         )
965
966 .PHONY: sdist
967 sdist : sdist-prep
968         "$(TAR)" chf - $(SRC_DIST_NAME) 2>$src_log | bzip2 >$(TOP)/$(SRC_DIST_TARBALL)
969
970 sdist-manifest : $(SRC_DIST_TARBALL)
971         tar tjf $(SRC_DIST_TARBALL) | sed "s|^ghc-$(ProjectVersion)/||" | sort >sdist-manifest
972
973 # Upload the distribution(s)
974 # Retrying is to work around buggy firewalls that corrupt large file transfers
975 # over SSH.
976 ifneq "$(PublishLocation)" ""
977 publish-sdist :
978         $(call nTimes,10,$(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist)
979 endif
980
981 ifeq "$(BootingFromUnregisterisedHc)" "YES"
982 SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
983 endif
984
985 # -----------------------------------------------------------------------------
986 # Cleaning
987
988 .PHONY: clean
989
990 CLEAN_FILES += utils/ghc-pwd/ghc-pwd
991 CLEAN_FILES += utils/ghc-pwd/ghc-pwd.exe
992 CLEAN_FILES += utils/ghc-pwd/ghc-pwd.hi
993 CLEAN_FILES += utils/ghc-pwd/ghc-pwd.o
994 CLEAN_FILES += libraries/bootstrapping.conf
995 CLEAN_FILES += libraries/integer-gmp/gmp/gmp.h
996 CLEAN_FILES += libraries/integer-gmp/gmp/libgmp.a
997 CLEAN_FILES += libraries/integer-gmp/cbits/GmpDerivedConstants.h
998 CLEAN_FILES += libraries/integer-gmp/cbits/mkGmpDerivedConstants
999
1000 clean : clean_files clean_libraries clean_gmp
1001
1002 .PHONY: clean_files
1003 clean_files :
1004         "$(RM)" $(RM_OPTS) $(CLEAN_FILES)
1005
1006 clean_gmp:
1007         "$(RM)" $(RM_OPTS) -r libraries/integer-gmp/gmp/objs
1008         "$(RM)" $(RM_OPTS) -r libraries/integer-gmp/gmp/gmpbuild
1009
1010 .PHONY: clean_libraries
1011 clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES) $(PACKAGES_STAGE2))
1012 clean_libraries: $(patsubst %,clean_libraries/%_dist-boot,$(BOOT_PKGS))
1013
1014 clean_libraries:
1015         "$(RM)" $(RM_OPTS) -r $(patsubst %, libraries/%/dist, $(PACKAGES) $(PACKAGES_STAGE2))
1016         "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/*.buildinfo, $(PACKAGES) $(PACKAGES_STAGE2))
1017
1018 # We have to define a clean target for each library manually, because the
1019 # libraries/*/ghc.mk files are not included when we're cleaning.
1020 ifeq "$(CLEANING)" "YES"
1021 $(foreach lib,$(PACKAGES) $(PACKAGES_STAGE2),\
1022   $(eval $(call clean-target,libraries/$(lib),dist-install,libraries/$(lib)/dist-install)))
1023 endif
1024
1025 distclean : clean
1026         "$(RM)" $(RM_OPTS) config.cache config.status config.log mk/config.h mk/stamp-h
1027         "$(RM)" $(RM_OPTS) mk/config.mk mk/are-validating.mk mk/project.mk
1028         "$(RM)" $(RM_OPTS) mk/config.mk.old mk/project.mk.old
1029         "$(RM)" $(RM_OPTS) extra-gcc-opts docs/users_guide/ug-book.xml
1030         "$(RM)" $(RM_OPTS) compiler/ghc.cabal compiler/ghc.cabal.old
1031         "$(RM)" $(RM_OPTS) ghc/ghc-bin.cabal
1032         "$(RM)" $(RM_OPTS) libraries/base/include/HsBaseConfig.h
1033         "$(RM)" $(RM_OPTS) libraries/directory/include/HsDirectoryConfig.h
1034         "$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h
1035         "$(RM)" $(RM_OPTS) libraries/unix/include/HsUnixConfig.h
1036         "$(RM)" $(RM_OPTS) libraries/old-time/include/HsTimeConfig.h
1037
1038         "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.log, $(PACKAGES) $(PACKAGES_STAGE2))
1039         "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES) $(PACKAGES_STAGE2))
1040         "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES) $(PACKAGES_STAGE2))
1041         "$(RM)" $(RM_OPTS) -r $(patsubst %, libraries/%/autom4te.cache, $(PACKAGES) $(PACKAGES_STAGE2))
1042
1043 maintainer-clean : distclean
1044         "$(RM)" $(RM_OPTS) configure mk/config.h.in
1045         "$(RM)" $(RM_OPTS) -r autom4te.cache libraries/*/autom4te.cache
1046         "$(RM)" $(RM_OPTS) ghc.spec
1047         "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/GNUmakefile, \
1048                 $(PACKAGES) $(PACKAGES_STAGE2))
1049         "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/ghc.mk, $(PACKAGES) $(PACKAGES_STAGE2))
1050         "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/configure, \
1051                 $(PACKAGES) $(PACKAGES_STAGE2))
1052         "$(RM)" $(RM_OPTS) libraries/base/include/HsBaseConfig.h.in
1053         "$(RM)" $(RM_OPTS) libraries/directory/include/HsDirectoryConfig.h.in
1054         "$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h.in
1055         "$(RM)" $(RM_OPTS) libraries/unix/include/HsUnixConfig.h.in
1056         "$(RM)" $(RM_OPTS) libraries/old-time/include/HsTimeConfig.h.in
1057
1058 .PHONY: all_libraries
1059
1060 .PHONY: bootstrapping-files
1061 bootstrapping-files: $(OTHER_LIBS)
1062 bootstrapping-files: includes/ghcautoconf.h
1063 bootstrapping-files: includes/DerivedConstants.h
1064 bootstrapping-files: includes/GHCConstants.h
1065
1066 .DELETE_ON_ERROR:
1067