remove Solaris-specific hacks, now unnecessary
[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 # configure touches certain files even if they haven't changed. This
55 # can mean a lot of unnecessary recompilation after a re-configure, so
56 # here we cache the old versions of these files so we can restore the
57 # timestamps.
58 %.old: %
59 @set -x && test -f $@ && cmp -s $< $@ || cp -p $< $@
60 touch -r $@ $<
61
62
63 # NB. not the same as saying '%: ...', which doesn't do the right thing:
64 # it does nothing if we specify a target that already exists.
65 .PHONY: $(REALGOALS)
66 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
67 @echo "===--- updating makefiles phase 0"
68 $(MAKE) -r --no-print-directory -f ghc.mk phase=0 just-makefiles
69 ifneq "$(OMIT_PHASE_1)" "YES"
70 @echo "===--- updating makefiles phase 1"
71 $(MAKE) -r --no-print-directory -f ghc.mk phase=1 just-makefiles
72 endif
73 ifneq "$(OMIT_PHASE_2)" "YES"
74 @echo "===--- updating makefiles phase 2"
75 $(MAKE) -r --no-print-directory -f ghc.mk phase=2 just-makefiles
76 endif
77 ifneq "$(OMIT_PHASE_3)" "YES"
78 @echo "===--- updating makefiles phase 3"
79 $(MAKE) -r --no-print-directory -f ghc.mk phase=3 just-makefiles
80 endif
81 @echo "===--- finished updating makefiles"
82 $(MAKE) -r --no-print-directory -f ghc.mk $@
83
84 binary-dist:
85 ifeq "$(mingw32_TARGET_OS)" "1"
86 $(MAKE) -r --no-print-directory -f ghc.mk windows-binary-dist
87 $(MAKE) -r --no-print-directory -f ghc.mk windows-installer
88 else
89 rm -f bindist-list
90 $(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
91 $(MAKE) -r --no-print-directory -f ghc.mk binary-dist
92 endif
93
94 clean distclean maintainer-clean:
95 $(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
96 test ! -d testsuite || $(MAKE) -C testsuite $@
97
98 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
99 $(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
100
101 bootstrapping-files show:
102 $(MAKE) -r --no-print-directory -f ghc.mk $@
103
104 ifeq "$(darwin_TARGET_OS)" "1"
105 framework-pkg:
106 $(MAKE) -C distrib/MacOS $@
107 endif
108
109 # If the user says 'make A B', then we don't want to invoke two
110 # instances of the rule above in parallel:
111 .NOTPARALLEL:
112
113 endif