users_guide: Various spelling fixes
[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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 # Eliminate use of the built-in implicit rules, and clear out the default list
14 # of suffixes for suffix rules. Speeds up make quite a bit. Both are needed
15 # for the shortest `make -d` output.
16 # Don't set --no-builtin-variables; some rules might stop working if you do
17 # (e.g. 'make clean' in testsuite/ currently relies on an implicit $RM).
18 MAKEFLAGS += --no-builtin-rules
19 .SUFFIXES:
20
21 ifeq "$(wildcard distrib/)" ""
22
23 # We're in a bindist
24
25 .PHONY: default
26 default:
27 @echo 'Run "make install" to install'
28 @false
29
30 .PHONY: install show
31 install show:
32 $(MAKE) --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES
33
34 else
35
36 .PHONY: default
37 default : all
38 @:
39
40 # For help, type 'make help'
41 .PHONY: help
42 help:
43 @cat MAKEHELP.md
44
45 ifneq "$(filter maintainer-clean distclean clean clean_% help,$(MAKECMDGOALS))" ""
46 -include mk/config.mk
47 else
48 include mk/config.mk
49 ifeq "$(ProjectVersion)" ""
50 $(error Please run ./configure first)
51 endif
52 endif
53
54 include mk/custom-settings.mk
55
56 # Verify that stage 0 LLVM backend isn't affected by Bug #9439 if needed
57 ifeq "$(GHC_LLVM_AFFECTED_BY_9439)" "1"
58 ifneq "$(findstring -fllvm,$(GhcHcOpts) $(GhcStage1HcOpts))" ""
59 $(error Stage 0 compiler is affected by Bug #9439. Refusing to bootstrap with -fllvm)
60 endif
61 endif
62
63 # No need to update makefiles for these targets:
64 # (the ones we're filtering out)
65 REALGOALS=$(filter-out \
66 binary-dist \
67 binary-dist-prep \
68 sdist sdist-ghc \
69 sdist-ghc-prep \
70 sdist-windows-tarballs \
71 sdist-windows-tarballs-prep \
72 sdist-testsuite \
73 sdist-testsuite-prep \
74 bootstrapping-files \
75 framework-pkg \
76 clean \
77 clean_% \
78 distclean \
79 maintainer-clean \
80 show \
81 echo \
82 help \
83 test \
84 fulltest \
85 fasttest \
86 ,$(MAKECMDGOALS))
87
88 # configure touches certain files even if they haven't changed. This
89 # can mean a lot of unnecessary recompilation after a re-configure, so
90 # here we cache the old versions of these files so we can restore the
91 # timestamps.
92 %.old: %
93 @set -x && test -f $@ && cmp -s $< $@ || cp -p $< $@
94 touch -r $@ $<
95
96
97 # NB. not the same as saying '%: ...', which doesn't do the right thing:
98 # it does nothing if we specify a target that already exists.
99 .PHONY: $(REALGOALS) all
100 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
101 ifneq "$(OMIT_PHASE_0)" "YES"
102 @echo "===--- building phase 0"
103 $(MAKE) --no-print-directory -f ghc.mk phase=0 phase_0_builds
104 endif
105 ifneq "$(OMIT_PHASE_1)" "YES"
106 @echo "===--- building phase 1"
107 $(MAKE) --no-print-directory -f ghc.mk phase=1 phase_1_builds
108 endif
109 @echo "===--- building final phase"
110 $(MAKE) --no-print-directory -f ghc.mk phase=final $@
111
112 .PHONY: binary-dist
113 binary-dist: binary-dist-prep
114 mv bindistprep/*.tar.$(TAR_COMP_EXT) .
115
116 .PHONY: binary-dist-prep
117 binary-dist-prep:
118 ifeq "$(mingw32_TARGET_OS)" "1"
119 $(MAKE) --no-print-directory -f ghc.mk windows-binary-dist-prep
120 else
121 rm -f bindist-list
122 $(MAKE) --no-print-directory -f ghc.mk bindist BINDIST=YES
123 $(MAKE) --no-print-directory -f ghc.mk unix-binary-dist-prep
124 endif
125
126 .PHONY: sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep
127 # Just running `./boot && ./configure && make sdist` should work, so skip
128 # phase 0 and 1 and don't build any dependency files.
129 sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep :
130 $(MAKE) --no-print-directory -f ghc.mk $@ NO_INCLUDE_DEPS=YES NO_INCLUDE_PKGDATA=YES
131
132 .PHONY: clean distclean maintainer-clean
133 clean distclean maintainer-clean:
134 $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
135 test ! -d testsuite || $(MAKE) -C testsuite $@
136
137 .PHONY: $(filter clean_%,$(MAKECMDGOALS))
138 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
139 $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
140
141 .PHONY: bootstrapping-files show echo
142 bootstrapping-files show echo:
143 $(MAKE) --no-print-directory -f ghc.mk $@
144
145 ifeq "$(darwin_TARGET_OS)" "1"
146 .PHONY: framework-pkg
147 framework-pkg:
148 $(MAKE) -C distrib/MacOS $@
149 endif
150
151 # If the user says 'make A B', then we don't want to invoke two
152 # instances of the rule above in parallel:
153 .NOTPARALLEL:
154
155 endif
156
157 .PHONY: fasttest
158 fasttest:
159 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt fast
160
161 .PHONY: fulltest test
162 fulltest test:
163 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt