More build system changes; ghc-pkg is now built with Cabal
[ghc-hetmet.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 hasktags hp2ps parallel unlit runghc hpc pwd
7 else
8 ifeq "$(BootingFromHc)" "YES"
9 SUBDIRS = mkdependC mkdirhier runstdtest genapply genprimopcode unlit
10 else
11 SUBDIRS = mkdependC mkdirhier runstdtest hasktags hp2ps \
12           installPackage parallel unlit genprimopcode genapply runghc hpc pwd
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 # Utils that we don't build by default:
25 #       nofib-analyse
26
27 # Utils that are old and/or bitrotted:
28 #       stat2resid
29 #       debugNCG
30 #       ext-core
31 #       genargs
32 #       heap-view
33 #       pvm
34 #       verbatim
35 #       ltx
36 #       hstags
37
38 # "heap-view" is not in the list because (a) it requires
39 #  a Haskell compiler (which you may not have yet), and (b) you are
40 #  unlikely to want it desperately.  It is easy to build once you have
41 #  a Haskell compiler and if you want it.
42
43 binary-dist:
44         $(INSTALL_DIR)           $(BIN_DIST_DIR)/utils
45         $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/
46         set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d binary-dist; done
47
48 include $(TOP)/mk/target.mk
49
50 # genprimopcode is needed to boot in ghc/compiler...
51 ifneq "$(BootingFromHc)" "YES"
52 boot ::
53         $(MAKE) -C genprimopcode
54 endif
55
56 WITH_BOOTSTRAPPING_COMPILER = ghc-pkg hsc2hs
57
58 WITH_STAGE1 = ghc-pkg
59 ifneq "$(NO_INSTALL_HSC2HS)" "YES"
60 WITH_STAGE1 += hsc2hs
61 endif
62
63 with-bootstrapping-compiler: \
64     $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P)
65
66 with-stage-1: $(foreach P,$(WITH_STAGE1),with-stage-1.$P)
67
68 install:: $(foreach P,$(WITH_STAGE1),install.$P)
69
70 $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P): \
71 with-bootstrapping-compiler.%:
72         $(MAKE) -C $* with-bootstrapping-compiler
73
74 $(foreach P,$(WITH_STAGE1),with-stage-1.$P): \
75 with-stage-1.%:
76         $(MAKE) -C $* with-stage-1
77
78 $(foreach P,$(WITH_STAGE1),install.$P): \
79 install.%:
80         $(MAKE) -C $* install
81