[project @ 2003-01-14 14:58:42 by simonmar]
[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.in $(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 #       Now follow the pieces of boilerplate
58 #       The "-" signs tell make not to complain if they don't exist
59
60 include $(TOP)/mk/config.mk
61 # All configuration information
62 #       (generated by "configure" from config.mk.in)
63 #
64
65
66 include $(TOP)/mk/paths.mk
67 # Variables that say where things belong (e.g install directories)
68 # and where we are right now
69 # Also defines variables for standard files (SRCS, LIBS etc)
70
71
72 include $(TOP)/mk/opts.mk
73 # Variables that control the option flags for all the
74 # language processors
75
76 ifeq "$(BootingFromHc)" "YES"
77 include $(TOP)/mk/bootstrap.mk
78 endif
79
80 -include $(TOP)/mk/build.mk
81 # (Optional) build-specific configuration
82 #
83
84 ifndef FAST
85 -include .depend
86 endif
87 # The dependencies file from the current directory