Makefile 3.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------
12

Ian Lynagh's avatar
Ian Lynagh committed
13
ifeq "$(wildcard distrib/)" ""
14

Ian Lynagh's avatar
Ian Lynagh committed
15
# We're in a bindist
16

Ian Lynagh's avatar
Ian Lynagh committed
17 18 19 20
.PHONY: default
default:
	@echo 'Run "make install" to install'
	@false
21

Ian Lynagh's avatar
Ian Lynagh committed
22 23 24
.PHONY: install show
install show:
	$(MAKE) -r --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES
25

26
else
27

Ian Lynagh's avatar
Ian Lynagh committed
28 29
default : all
	@:
30

31 32 33 34 35
# For help, type 'make help'
.PHONY: help
help :
	@cat MAKEHELP

36 37 38
ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
-include mk/config.mk
else
39 40 41 42
include mk/config.mk
ifeq "$(ProjectVersion)" ""
$(error Please run ./configure first)
endif
43
endif
44 45 46

include mk/custom-settings.mk

Ian Lynagh's avatar
Ian Lynagh committed
47
# No need to update makefiles for these targets:
48
REALGOALS=$(filter-out binary-dist binary-dist-prep bootstrapping-files framework-pkg clean clean_% distclean maintainer-clean show echo help test fulltest,$(MAKECMDGOALS))
49

50 51 52 53
# configure touches certain files even if they haven't changed.  This
# can mean a lot of unnecessary recompilation after a re-configure, so
# here we cache the old versions of these files so we can restore the
# timestamps.
kili's avatar
kili committed
54
%.old:  %
55
	@set -x && test -f $@ && cmp -s $< $@ || cp -p $< $@
kili's avatar
kili committed
56 57
	touch -r $@ $<

58

Ian Lynagh's avatar
Ian Lynagh committed
59 60 61
# NB. not the same as saying '%: ...', which doesn't do the right thing:
# it does nothing if we specify a target that already exists.
.PHONY: $(REALGOALS)
kili's avatar
kili committed
62
$(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
63
ifneq "$(OMIT_PHASE_0)" "YES"
Ian Lynagh's avatar
Ian Lynagh committed
64
	@echo "===--- building phase 0"
65
	$(MAKE) -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
66
endif
67
ifneq "$(OMIT_PHASE_1)" "YES"
Ian Lynagh's avatar
Ian Lynagh committed
68
	@echo "===--- building phase 1"
69
	$(MAKE) -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
Ian Lynagh's avatar
Ian Lynagh committed
70 71
endif
	@echo "===--- building final phase"
72
	$(MAKE) -r --no-print-directory -f ghc.mk phase=final $@
73

Ian Lynagh's avatar
Ian Lynagh committed
74
binary-dist: binary-dist-prep
75
ifeq "$(mingw32_TARGET_OS)" "1"
Ian Lynagh's avatar
Ian Lynagh committed
76 77 78 79 80 81 82
	mv bindistprep/*.exe .
endif
	mv bindistprep/*.tar.bz2 .

binary-dist-prep:
ifeq "$(mingw32_TARGET_OS)" "1"
	$(MAKE) -r --no-print-directory -f ghc.mk windows-binary-dist-prep
83
else
Ian Lynagh's avatar
Ian Lynagh committed
84 85
	rm -f bindist-list
	$(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
Ian Lynagh's avatar
Ian Lynagh committed
86
	$(MAKE) -r --no-print-directory -f ghc.mk unix-binary-dist-prep
87
endif
88

89 90
clean distclean maintainer-clean:
	$(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
Ian Lynagh's avatar
Ian Lynagh committed
91
	test ! -d testsuite || $(MAKE) -C testsuite $@
Ian Lynagh's avatar
Ian Lynagh committed
92

93
$(filter clean_%, $(MAKECMDGOALS)) : clean_% :
94
	$(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
95

96
bootstrapping-files show echo:
Ian Lynagh's avatar
Ian Lynagh committed
97
	$(MAKE) -r --no-print-directory -f ghc.mk $@
sof's avatar
sof committed
98

99 100 101 102 103
ifeq "$(darwin_TARGET_OS)" "1"
framework-pkg:
	$(MAKE) -C distrib/MacOS $@
endif

Ian Lynagh's avatar
Ian Lynagh committed
104 105 106
# If the user says 'make A B', then we don't want to invoke two
# instances of the rule above in parallel:
.NOTPARALLEL:
107

Ian Lynagh's avatar
Ian Lynagh committed
108
endif
109 110 111

.PHONY: test
test:
112
	$(MAKE) -C testsuite/tests CLEANUP=1 OUTPUT_SUMMARY=../../testsuite_summary.txt fast
113 114 115

.PHONY: fulltest
fulltest:
116
	$(MAKE) -C testsuite/tests CLEANUP=1 OUTPUT_SUMMARY=../../testsuite_summary.txt
117