compiler: de-lhs hsSyn/
[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 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 show
23 install show:
24 $(MAKE) -r --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES
25
26 else
27
28 default : all
29 @:
30
31 # For help, type 'make help'
32 .PHONY: help
33 help:
34 @cat MAKEHELP
35
36 ifneq "$(filter maintainer-clean distclean clean help,$(MAKECMDGOALS))" ""
37 -include mk/config.mk
38 else
39 include mk/config.mk
40 ifeq "$(ProjectVersion)" ""
41 $(error Please run ./configure first)
42 endif
43 endif
44
45 include mk/custom-settings.mk
46
47 # Verify that stage 0 LLVM backend isn't affected by Bug #9439 if needed
48 ifeq "$(GHC_LLVM_AFFECTED_BY_9439)" "1"
49 ifneq "$(findstring -fllvm,$(GhcHcOpts) $(GhcStage1HcOpts))" ""
50 $(error Stage 0 compiler is affected by Bug #9439. Refusing to bootstrap with -fllvm)
51 endif
52 endif
53
54 # No need to update makefiles for these targets:
55 REALGOALS=$(filter-out binary-dist binary-dist-prep bootstrapping-files framework-pkg clean clean_% distclean maintainer-clean show echo help test fulltest,$(MAKECMDGOALS))
56
57 # configure touches certain files even if they haven't changed. This
58 # can mean a lot of unnecessary recompilation after a re-configure, so
59 # here we cache the old versions of these files so we can restore the
60 # timestamps.
61 %.old: %
62 @set -x && test -f $@ && cmp -s $< $@ || cp -p $< $@
63 touch -r $@ $<
64
65
66 # NB. not the same as saying '%: ...', which doesn't do the right thing:
67 # it does nothing if we specify a target that already exists.
68 .PHONY: $(REALGOALS)
69 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
70 ifneq "$(OMIT_PHASE_0)" "YES"
71 @echo "===--- building phase 0"
72 $(MAKE) -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
73 endif
74 ifneq "$(OMIT_PHASE_1)" "YES"
75 @echo "===--- building phase 1"
76 $(MAKE) -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
77 endif
78 @echo "===--- building final phase"
79 $(MAKE) -r --no-print-directory -f ghc.mk phase=final $@
80
81 binary-dist: binary-dist-prep
82 mv bindistprep/*.tar.$(TAR_COMP_EXT) .
83
84 binary-dist-prep:
85 ifeq "$(mingw32_TARGET_OS)" "1"
86 $(MAKE) -r --no-print-directory -f ghc.mk windows-binary-dist-prep
87 else
88 rm -f bindist-list
89 $(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
90 $(MAKE) -r --no-print-directory -f ghc.mk unix-binary-dist-prep
91 endif
92
93 clean distclean maintainer-clean:
94 $(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
95 test ! -d testsuite || $(MAKE) -C testsuite $@
96
97 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
98 $(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
99
100 bootstrapping-files show echo:
101 $(MAKE) -r --no-print-directory -f ghc.mk $@
102
103 ifeq "$(darwin_TARGET_OS)" "1"
104 framework-pkg:
105 $(MAKE) -C distrib/MacOS $@
106 endif
107
108 # If the user says 'make A B', then we don't want to invoke two
109 # instances of the rule above in parallel:
110 .NOTPARALLEL:
111
112 endif
113
114 .PHONY: test
115 test:
116 $(MAKE) -C testsuite/tests CLEANUP=1 OUTPUT_SUMMARY=../../testsuite_summary.txt fast
117
118 .PHONY: fulltest
119 fulltest:
120 $(MAKE) -C testsuite/tests CLEANUP=1 OUTPUT_SUMMARY=../../testsuite_summary.txt
121