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