Add 'make help', displaying a list of useful make targets
[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 # For help, type 'make help'
36 .PHONY: help
37 help :
38 @cat MAKEHELP
39
40 ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
41 -include mk/config.mk
42 else
43 include mk/config.mk
44 ifeq "$(ProjectVersion)" ""
45 $(error Please run ./configure first)
46 endif
47 endif
48
49 include mk/custom-settings.mk
50
51 # No need to update makefiles for these targets:
52 REALGOALS=$(filter-out bootstrapping-files framework-pkg clean clean_% distclean maintainer-clean show help,$(MAKECMDGOALS))
53
54 # NB. not the same as saying '%: ...', which doesn't do the right thing:
55 # it does nothing if we specify a target that already exists.
56 .PHONY: $(REALGOALS)
57 $(REALGOALS) all:
58 @echo "===--- updating makefiles phase 0"
59 $(MAKE) -r --no-print-directory -f ghc.mk phase=0 just-makefiles
60 ifneq "$(OMIT_PHASE_1)" "YES"
61 @echo "===--- updating makefiles phase 1"
62 $(MAKE) -r --no-print-directory -f ghc.mk phase=1 just-makefiles
63 endif
64 ifneq "$(OMIT_PHASE_2)" "YES"
65 @echo "===--- updating makefiles phase 2"
66 $(MAKE) -r --no-print-directory -f ghc.mk phase=2 just-makefiles
67 endif
68 ifneq "$(OMIT_PHASE_3)" "YES"
69 @echo "===--- updating makefiles phase 3"
70 $(MAKE) -r --no-print-directory -f ghc.mk phase=3 just-makefiles
71 endif
72 @echo "===--- finished updating makefiles"
73 $(MAKE) -r --no-print-directory -f ghc.mk $@
74
75 binary-dist:
76 ifeq "$(mingw32_TARGET_OS)" "1"
77 $(MAKE) -r --no-print-directory -f ghc.mk windows-binary-dist
78 $(MAKE) -r --no-print-directory -f ghc.mk windows-installer
79 else
80 rm -f bindist-list
81 $(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
82 $(MAKE) -r --no-print-directory -f ghc.mk binary-dist
83 endif
84
85 clean distclean maintainer-clean:
86 $(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
87 test ! -d testsuite || $(MAKE) -C testsuite $@
88
89 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
90 $(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
91
92 bootstrapping-files show:
93 $(MAKE) -r --no-print-directory -f ghc.mk $@
94
95 ifeq "$(darwin_TARGET_OS)" "1"
96 framework-pkg:
97 $(MAKE) -C distrib/MacOS $@
98 endif
99
100 # If the user says 'make A B', then we don't want to invoke two
101 # instances of the rule above in parallel:
102 .NOTPARALLEL:
103
104 endif