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