Makefile 3.49 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 help install-docs 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
Ian Lynagh's avatar
Ian Lynagh committed
63
	@echo "===--- building phase 0"
64
	$(MAKE) -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
65
ifneq "$(OMIT_PHASE_1)" "YES"
Ian Lynagh's avatar
Ian Lynagh committed
66
	@echo "===--- building phase 1"
67
	$(MAKE) -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
Ian Lynagh's avatar
Ian Lynagh committed
68 69
endif
	@echo "===--- building final phase"
Ian Lynagh's avatar
Ian Lynagh committed
70
	$(MAKE) -r --no-print-directory -f ghc.mk $@
71

Ian Lynagh's avatar
Ian Lynagh committed
72
binary-dist: binary-dist-prep
73
ifeq "$(mingw32_TARGET_OS)" "1"
Ian Lynagh's avatar
Ian Lynagh committed
74 75 76 77 78 79 80
	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
81 82
	$(MAKE) -r --no-print-directory -f ghc.mk windows-installer
else
Ian Lynagh's avatar
Ian Lynagh committed
83 84
	rm -f bindist-list
	$(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
Ian Lynagh's avatar
Ian Lynagh committed
85
	$(MAKE) -r --no-print-directory -f ghc.mk unix-binary-dist-prep
86
endif
87

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

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

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

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

103 104 105 106 107 108
# install-docs is a historical target that isn't supported in GHC 6.12. See #3662.
install-docs:
	@echo "The install-docs target is not supported in GHC 6.12.1 and later."
	@echo "'make install' now installs everything, including documentation."
	@exit 1

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

Ian Lynagh's avatar
Ian Lynagh committed
113
endif
114 115 116 117 118 119 120 121 122

.PHONY: test
test:
	$(MAKE) -C testsuite/tests/ghc-regress CLEANUP=1 OUTPUT_SUMMARY=../../../testsuite_summary.txt fast

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