Some "install" and "clean" fixes
[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 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 #       ext-core
33 #       genargs
34 #       heap-view
35 #       pvm
36 #       verbatim
37 #       ltx
38 #       hstags
39
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.
44
45 binary-dist:
46         $(INSTALL_DIR)           $(BIN_DIST_DIR)/utils
47         $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/
48         set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d binary-dist; done
49
50 include $(TOP)/mk/target.mk
51
52 # genprimopcode is needed to boot in ghc/compiler...
53 ifneq "$(BootingFromHc)" "YES"
54 boot ::
55         $(MAKE) -C genprimopcode
56 endif
57
58 WITH_BOOTSTRAPPING_COMPILER = installPackage ghc-pkg hsc2hs hpc
59
60 WITH_STAGE1 = installPackage ghc-pkg hasktags runghc hpc
61 ifneq "$(NO_INSTALL_HSC2HS)" "YES"
62 WITH_STAGE1 += hsc2hs
63 endif
64
65 # sort removes duplicates - we don't actually care about the order
66 WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE1))
67
68 clean:: $(foreach P,$(WITH_EITHER),clean.$P)
69
70 with-bootstrapping-compiler: \
71     $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P)
72
73 with-stage-1: $(foreach P,$(WITH_STAGE1),with-stage-1.$P)
74
75 install:: $(foreach P,$(WITH_STAGE1),install.$P)
76
77 $(foreach P,$(WITH_EITHER),clean.$P): \
78 clean.%:
79         $(MAKE) -C $* clean
80
81 $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P): \
82 with-bootstrapping-compiler.%:
83         $(MAKE) -C $* with-bootstrapping-compiler
84
85 $(foreach P,$(WITH_STAGE1),with-stage-1.$P): \
86 with-stage-1.%:
87         $(MAKE) -C $* with-stage-1
88
89 $(foreach P,$(WITH_STAGE1),install.$P): \
90 install.%:
91         $(MAKE) -C $* install
92