Makefile 3.8 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 64
	@echo "===--- updating makefiles phase 0"
	$(MAKE) -r --no-print-directory -f ghc.mk phase=0 just-makefiles
65
ifneq "$(OMIT_PHASE_1)" "YES"
Ian Lynagh's avatar
Ian Lynagh committed
66 67
	@echo "===--- updating makefiles phase 1"
	$(MAKE) -r --no-print-directory -f ghc.mk phase=1 just-makefiles
68 69
endif
ifneq "$(OMIT_PHASE_2)" "YES"
Ian Lynagh's avatar
Ian Lynagh committed
70 71
	@echo "===--- updating makefiles phase 2"
	$(MAKE) -r --no-print-directory -f ghc.mk phase=2 just-makefiles
72 73
endif
ifneq "$(OMIT_PHASE_3)" "YES"
Ian Lynagh's avatar
Ian Lynagh committed
74 75
	@echo "===--- updating makefiles phase 3"
	$(MAKE) -r --no-print-directory -f ghc.mk phase=3 just-makefiles
76
endif
Ian Lynagh's avatar
Ian Lynagh committed
77 78
	@echo "===--- finished updating makefiles"
	$(MAKE) -r --no-print-directory -f ghc.mk $@
79

Ian Lynagh's avatar
Ian Lynagh committed
80
binary-dist: binary-dist-prep
81
ifeq "$(mingw32_TARGET_OS)" "1"
Ian Lynagh's avatar
Ian Lynagh committed
82 83 84 85 86 87 88
	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
89 90
	$(MAKE) -r --no-print-directory -f ghc.mk windows-installer
else
Ian Lynagh's avatar
Ian Lynagh committed
91 92
	rm -f bindist-list
	$(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
Ian Lynagh's avatar
Ian Lynagh committed
93
	$(MAKE) -r --no-print-directory -f ghc.mk unix-binary-dist-prep
94
endif
95

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

100
$(filter clean_%, $(MAKECMDGOALS)) : clean_% :
101
	$(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
102

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

106 107 108 109 110
ifeq "$(darwin_TARGET_OS)" "1"
framework-pkg:
	$(MAKE) -C distrib/MacOS $@
endif

111 112 113 114 115 116
# 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
117 118 119
# If the user says 'make A B', then we don't want to invoke two
# instances of the rule above in parallel:
.NOTPARALLEL:
120

Ian Lynagh's avatar
Ian Lynagh committed
121
endif
122 123 124 125 126 127 128 129 130

.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