Don't require the library ghc.mk files in order to clean
[ghc.git] / Makefile
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 ifeq "$(wildcard distrib/)" ""
14
15 # We're in a bindist
16
17 .PHONY: default
18 default:
19 @echo 'Run "make install" to install'
20 @false
21
22 .PHONY: install
23 install:
24 $(MAKE) -r --no-print-directory -f ghc.mk install BINDIST=YES NO_INCLUDE_DEPS=YES
25
26 .PHONY: show
27 show:
28 $(MAKE) -r --no-print-directory -f ghc.mk $@
29
30 else
31
32 default : all
33 @:
34
35 ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
36 -include mk/config.mk
37 else
38 include mk/config.mk
39 ifeq "$(ProjectVersion)" ""
40 $(error Please run ./configure first)
41 endif
42 endif
43
44 include mk/custom-settings.mk
45
46 PACKAGE_MK=libraries/base/ghc.mk
47 $(PACKAGE_MK):
48 sh boot-pkgs
49
50 # No need to update makefiles for these targets:
51 REALGOALS=$(filter-out framework-pkg clean clean_% distclean maintainer-clean show,$(MAKECMDGOALS))
52
53 # NB. not the same as saying '%: ...', which doesn't do the right thing:
54 # it does nothing if we specify a target that already exists.
55 .PHONY: $(REALGOALS)
56 $(REALGOALS) all: $(PACKAGE_MK)
57 @echo "===--- updating makefiles phase 0"
58 $(MAKE) -r --no-print-directory -f ghc.mk phase=0 just-makefiles
59 @echo "===--- updating makefiles phase 1"
60 $(MAKE) -r --no-print-directory -f ghc.mk phase=1 just-makefiles
61 @echo "===--- updating makefiles phase 2"
62 $(MAKE) -r --no-print-directory -f ghc.mk phase=2 just-makefiles
63 @echo "===--- updating makefiles phase 3"
64 $(MAKE) -r --no-print-directory -f ghc.mk phase=3 just-makefiles
65 @echo "===--- finished updating makefiles"
66 $(MAKE) -r --no-print-directory -f ghc.mk $@
67
68 binary-dist:
69 rm -f bindist-list
70 $(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
71 $(MAKE) -r --no-print-directory -f ghc.mk binary-dist
72
73 clean distclean maintainer-clean:
74 $(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
75 test ! -d testsuite || $(MAKE) -C testsuite $@
76
77 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
78 $(MAKE) -r --no-print-directory -f ghc.mk $@
79
80 show: $(PACKAGE_MK)
81 $(MAKE) -r --no-print-directory -f ghc.mk $@
82
83 ifeq "$(darwin_TARGET_OS)" "1"
84 framework-pkg:
85 $(MAKE) -C distrib/MacOS $@
86 endif
87
88 # If the user says 'make A B', then we don't want to invoke two
89 # instances of the rule above in parallel:
90 .NOTPARALLEL:
91
92 endif