fix value of this_mod passed to tcRnImports (#5545)
[ghc.git] / utils / Makefile
1 TOP=..
2 include $(TOP)/mk/boilerplate.mk
3
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
7 else
8 ifeq "$(BootingFromHc)" "YES"
9 SUBDIRS = mkdependC mkdirhier runstdtest genapply genprimopcode unlit
10 else
11 SUBDIRS = mkdependC mkdirhier runstdtest hp2ps \
12 parallel unlit genprimopcode genapply
13 endif
14 #ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
15 ## lndir doesn't build on Windows
16 #SUBDIRS += lndir
17 #endif
18 endif
19
20 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
21 SUBDIRS += touchy
22 endif
23
24 # XXX pwd and lndir building disabled for now
25
26 # Utils that we don't build by default:
27 # nofib-analyse
28
29 # Utils that are old and/or bitrotted:
30 # stat2resid
31 # debugNCG
32 # genargs
33 # heap-view
34 # pvm
35 # verbatim
36 # ltx
37 # hstags
38
39 # "heap-view" is not in the list because (a) it requires
40 # a Haskell compiler (which you may not have yet), and (b) you are
41 # unlikely to want it desperately. It is easy to build once you have
42 # a Haskell compiler and if you want it.
43
44 include $(TOP)/mk/target.mk
45
46 # genprimopcode is needed to boot in ghc/compiler...
47 ifneq "$(BootingFromHc)" "YES"
48 boot ::
49 $(MAKE) -C genprimopcode
50 endif
51
52 ############################################
53
54 # The utils may be built with the bootstrapping compiler, for use during
55 # the build, or with the stage2 compiler, for installing. Some of them
56 # are built with both; we can't install the utils built with the
57 # bootstrapping compiler as they may use different versions of C
58 # libraries. The reason we use stage2 rather than stage1 is that some
59 # utils, e.g. haddock, need the GHC API package.
60
61 WITH_BOOTSTRAPPING_COMPILER = installPackage ghc-pkg hsc2hs hpc
62
63 WITH_STAGE2 = installPackage ghc-pkg runghc hpc pwd haddock
64 ifneq "$(NO_INSTALL_HSC2HS)" "YES"
65 WITH_STAGE2 += hsc2hs
66 endif
67
68 # sort removes duplicates - we don't actually care about the order
69 WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE2))
70
71 # We need to build pwd with stage 2, as it goes in bindists, but we
72 # don't actually want to install it. Likewise the installPackage
73 # program.
74 DO_NOT_INSTALL = pwd installPackage
75
76 binary-dist: $(foreach P,$(WITH_STAGE2),binary-dist.$P)
77 ifeq "$(WHERE_AM_I)" ""
78 echo "I don't know where I am" >&2
79 exit 1
80 endif
81 echo $(WHERE_AM_I)/Makefile >> $(BIN_DIST_LIST)
82 set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d binary-dist WHERE_AM_I=$(WHERE_AM_I)/$$d; done
83
84 clean:: $(foreach P,$(WITH_EITHER),clean.$P)
85
86 distclean:: $(foreach P,$(WITH_EITHER),distclean.$P)
87
88 with-bootstrapping-compiler: \
89 $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P)
90
91 with-stage-2: $(foreach P,$(WITH_STAGE2),with-stage-2.$P)
92 $(MAKE) -C haddock install-inplace
93
94 install:: $(foreach P,$(filter-out $(DO_NOT_INSTALL),$(WITH_STAGE2)),install.$P)
95
96 $(foreach P,$(WITH_EITHER),clean.$P): \
97 clean.%:
98 $(MAKE) -C $* clean
99
100 $(foreach P,$(WITH_EITHER),distclean.$P): \
101 distclean.%:
102 $(MAKE) -C $* distclean
103
104 $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P): \
105 with-bootstrapping-compiler.%:
106 $(MAKE) -C $* with-bootstrapping-compiler
107
108 $(foreach P,$(WITH_STAGE2),with-stage-2.$P): \
109 with-stage-2.%:
110 $(MAKE) -C $* with-stage-2
111
112 $(foreach P,$(WITH_STAGE2),install.$P): \
113 install.%:
114 $(MAKE) -C $* install
115
116 $(foreach P,$(WITH_STAGE2),binary-dist.$P): \
117 binary-dist.%:
118 $(MAKE) -C $* binary-dist WHERE_AM_I=$(WHERE_AM_I)/$*
119