Makefile 3.13 KB
Newer Older
1 2 3 4 5 6 7
# -----------------------------------------------------------------------------
#
# (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
8 9
#      http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
#      http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 11
#
# -----------------------------------------------------------------------------
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 75 76 77 78 79
binary-dist: binary-dist-prep
	mv bindistprep/*.tar.bz2 .

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

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

90
$(filter clean_%, $(MAKECMDGOALS)) : clean_% :
91
	$(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
92

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

96 97 98 99 100
ifeq "$(darwin_TARGET_OS)" "1"
framework-pkg:
	$(MAKE) -C distrib/MacOS $@
endif

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

Ian Lynagh's avatar
Ian Lynagh committed
105
endif
106 107 108

.PHONY: test
test:
109
	$(MAKE) -C testsuite/tests CLEANUP=1 OUTPUT_SUMMARY=../../testsuite_summary.txt fast
110 111 112

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