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