2 include $(TOP)/mk/boilerplate.mk
4 ifeq "$(DOING_BIN_DIST)" "YES"
5 # We're doing a binary-dist, descend into a subset of the dirs.
6 SUBDIRS = mkdirhier hp2ps parallel unlit
8 ifeq "$(BootingFromHc)" "YES"
9 SUBDIRS = mkdependC mkdirhier runstdtest genapply genprimopcode unlit
11 SUBDIRS = mkdependC mkdirhier runstdtest hp2ps \
12 parallel unlit genprimopcode genapply
14 #ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
15 ## lndir doesn't build on Windows
20 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
24 # XXX pwd and lndir building disabled for now
26 # Utils that we don't build by default:
29 # Utils that are old and/or bitrotted:
40 # "heap-view" is not in the list because (a) it requires
41 # a Haskell compiler (which you may not have yet), and (b) you are
42 # unlikely to want it desperately. It is easy to build once you have
43 # a Haskell compiler and if you want it.
45 include $(TOP)/mk/target.mk
47 # genprimopcode is needed to boot in ghc/compiler...
48 ifneq "$(BootingFromHc)" "YES"
50 $(MAKE) -C genprimopcode
53 ############################################
55 # The utils may be built with the bootstrapping compiler, for use during
56 # the build, or with the stage2 compiler, for installing. Some of them
57 # are built with both; we can't install the utils built with the
58 # bootstrapping compiler as they may use different versions of C
59 # libraries. The reason we use stage2 rather than stage1 is that some
60 # utils, e.g. haddock, need the GHC API package.
62 WITH_BOOTSTRAPPING_COMPILER = installPackage ghc-pkg hsc2hs hpc
64 WITH_STAGE2 = installPackage ghc-pkg hasktags runghc hpc pwd haddock
65 ifneq "$(NO_INSTALL_HSC2HS)" "YES"
69 # sort removes duplicates - we don't actually care about the order
70 WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE2))
72 # We need to build pwd with stage 2, as it goes in bindists, but we
73 # don't actually want to install it. Likewise the installPackage
75 DO_NOT_INSTALL = pwd installPackage
77 binary-dist: $(foreach P,$(WITH_STAGE2),binary-dist.$P)
78 ifeq "$(WHERE_AM_I)" ""
79 echo "I don't know where I am" >&2
82 echo $(WHERE_AM_I)/Makefile >> $(BIN_DIST_LIST)
83 set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d binary-dist WHERE_AM_I=$(WHERE_AM_I)/$$d; done
85 clean:: $(foreach P,$(WITH_EITHER),clean.$P)
87 distclean:: $(foreach P,$(WITH_EITHER),distclean.$P)
89 with-bootstrapping-compiler: \
90 $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P)
92 with-stage-2: $(foreach P,$(WITH_STAGE2),with-stage-2.$P)
93 $(MAKE) -C haddock install-inplace
95 install:: $(foreach P,$(filter-out $(DO_NOT_INSTALL),$(WITH_STAGE2)),install.$P)
97 $(foreach P,$(WITH_EITHER),clean.$P): \
101 $(foreach P,$(WITH_EITHER),distclean.$P): \
103 $(MAKE) -C $* distclean
105 $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P): \
106 with-bootstrapping-compiler.%:
107 $(MAKE) -C $* with-bootstrapping-compiler
109 $(foreach P,$(WITH_STAGE2),with-stage-2.$P): \
111 $(MAKE) -C $* with-stage-2
113 $(foreach P,$(WITH_STAGE2),install.$P): \
115 $(MAKE) -C $* install
117 $(foreach P,$(WITH_STAGE2),binary-dist.$P): \
119 $(MAKE) -C $* binary-dist WHERE_AM_I=$(WHERE_AM_I)/$*