[project @ 2003-08-18 14:54:40 by panne]
[ghc-hetmet.git] / mk / boilerplate.mk
1 #################################################################################
2 #
3 #                           mk/boilerplate.mk
4 #
5 #               The Glorious fptools Boilerplate Makefile
6 #
7 # This one file should be included (directly or indirectly) by all Makefiles 
8 # in the fptools hierarchy.
9 #
10 #################################################################################
11
12 # We want to disable all the built-in rules that make uses; having them
13 # just slows things down, and we write all the rules ourselves.
14 # Setting .SUFFIXES to empty disables them all.
15 MAKEFLAGS += --no-builtin-rules
16
17 # FPTOOLS_TOP is the *relative* path to the fptools toplevel directory from the
18 # location where a project Makefile was invoked. It is set by looking at the
19 # current value of TOP.
20 #
21 FPTOOLS_TOP := $(TOP)
22
23
24 # This rule makes sure that "all" is the default target, regardless of where it appears
25 #               THIS RULE MUST REMAIN FIRST!
26 default: all
27
28
29 # -----------------------------------------------------------------------------
30 #       make sure the autoconf stuff is up to date...
31
32 $(TOP)/mk/config.mk : $(TOP)/mk/config.mk.in $(TOP)/mk/config.h.in $(TOP)/configure 
33         @if test ! -f $(FPTOOLS_TOP)/config.status; then \
34                 echo "You haven't run $(FPTOOLS_TOP)/configure yet."; \
35                 exit 1; \
36         fi
37         @echo "Running $(FPTOOLS_TOP)/config.status to update configuration info..."
38         @( cd $(FPTOOLS_TOP) && ./config.status )
39
40 $(TOP)/configure : $(TOP)/configure.ac $(TOP)/aclocal.m4
41         @echo "Regenerating $(FPTOOLS_TOP)/configure..."
42         @( cd $(FPTOOLS_TOP) && $(MAKE) -f Makefile.config ./configure )
43
44 # -----------------------------------------------------------------------------
45 # Misc bits
46
47 # If $(way) is set then we define $(way_) and $(_way) from it in the
48 # obvious fashion.  This must be done before suffix.mk is included,
49 # because the pattern rules in that file depend on these variables.
50
51 ifneq "$(way)" ""
52   way_ := $(way)_
53   _way := _$(way)
54 endif
55
56
57 # When using $(patsubst ...) and friends, you can't use a literal comma
58 # freely - so we use ${comma} instead.  (See PACKAGE_CPP_OPTS in package.mk
59 # for an example usage.)
60 comma=,
61
62 # -----------------------------------------------------------------------------
63 #       Now follow the pieces of boilerplate
64 #       The "-" signs tell make not to complain if they don't exist
65
66 include $(TOP)/mk/config.mk
67 # All configuration information
68 #       (generated by "configure" from config.mk.in)
69 #
70
71
72 include $(TOP)/mk/paths.mk
73 # Variables that say where things belong (e.g install directories)
74 # and where we are right now
75 # Also defines variables for standard files (SRCS, LIBS etc)
76
77
78 include $(TOP)/mk/opts.mk
79 # Variables that control the option flags for all the
80 # language processors
81
82 ifeq "$(BootingFromHc)" "YES"
83 include $(TOP)/mk/bootstrap.mk
84 endif
85
86 -include $(TOP)/mk/build.mk
87 # (Optional) build-specific configuration
88 #
89
90 ifndef FAST
91 -include .depend
92 endif
93 # The dependencies file from the current directory