blob: 9411164fd4b0f43ed8322783e00899eef9e2f492 [file] [log] [blame]
David Turner046f7a02000-09-15 22:42:06 +00001#
2# FreeType build system -- top-level sub-Makefile
3#
4
5# Copyright 2000 by David Turner
6
7
8# This file is designed for GNU Make, do not use it with another Make tool!
9#
10# It works as follows:
11#
12# - When invoked for the first time, this Makefile will include the rules
13# found in `PROJECT/builds/detect.mk'. They are in charge of detecting
14# the current platform.
15#
16# A summary of the detection will be displayed, and the file `config.mk'
17# will be created in the current directory.
18#
19# - When invoked later, this Makefile will include the rules found in
20# `config.mk'. This sub-Makefile will define some system-specific
21# variables (like compiler, compilation flags, object suffix, etc.), then
22# include the rules found in `PROJECT/builds/PROJECT.mk', used to build
23# the library.
24#
25# See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more
26# details on host platform detection and library builds.
27
28
29.PHONY: setup
30
David Turnerbeece1b2000-09-19 18:33:20 +000031ifndef CONFIG_MK
David Turner046f7a02000-09-15 22:42:06 +000032CONFIG_MK := config.mk
David Turnerbeece1b2000-09-19 18:33:20 +000033endif
David Turner046f7a02000-09-15 22:42:06 +000034
35# If no configuration sub-makefile is present, or if `setup' is the target
36# to be built, run the auto-detection rules to figure out which
37# configuration rules file to use.
38#
39# Note that the configuration file is put in the current directory, which is
40# not necessarily $(TOP).
41
42# If `config.mk' is not present, set `check_platform'.
43#
44ifeq ($(wildcard $(CONFIG_MK)),)
45 check_platform := 1
46endif
47
48# If `setup' is one of the targets requested, set `check_platform'.
49#
50ifneq ($(findstring setup,$(MAKECMDGOALS)),)
51 check_platform := 1
52endif
53
54# Include the automatic host platform detection rules when we need to
55# check the platform.
56#
57ifdef check_platform
58
59 all: setup
60
Werner Lembergbd547dc2000-09-22 21:23:29 +000061 ifdef USE_MODULES
62 # If the module list $(MODULE_LIST) file is not present, generate it.
63 #
64 #modules: make_module_list setup
65 endif
David Turner046f7a02000-09-15 22:42:06 +000066
67 include $(TOP)/builds/detect.mk
68
Werner Lembergbd547dc2000-09-22 21:23:29 +000069 ifdef USE_MODULES
70 include $(TOP)/builds/modules.mk
David Turner046f7a02000-09-15 22:42:06 +000071
Werner Lembergbd547dc2000-09-22 21:23:29 +000072 ifeq ($(wildcard $(MODULE_LIST)),)
73 setup: make_module_list
74 endif
David Turner046f7a02000-09-15 22:42:06 +000075 endif
David Turner046f7a02000-09-15 22:42:06 +000076
77 # This rule makes sense for Unix only to remove files created by a run
78 # of the configure script which hasn't been successful (so that no
79 # `config.mk' has been created). It uses the built-in $(RM) command of
80 # GNU make.
81 #
82 distclean:
Werner Lembergbd547dc2000-09-22 21:23:29 +000083 $(RM) builds/unix/config.cache
84 $(RM) builds/unix/config.log
85 $(RM) builds/unix/config.status
86 $(RM) builds/unix/unix-def.mk
87 $(RM) builds/unix/unix-cc.mk
David Turner046f7a02000-09-15 22:42:06 +000088
89 # IMPORTANT:
90 #
91 # `setup' must be defined by the host platform detection rules to create
92 # the `config.mk' file in the current directory.
93
94else
95
96 # A configuration sub-Makefile is present -- simply run it.
97 #
98 all: single
99
Werner Lembergbd547dc2000-09-22 21:23:29 +0000100 ifdef USE_MODULES
101 modules: make_module_list
102 endif
David Turner046f7a02000-09-15 22:42:06 +0000103
104 BUILD_PROJECT := yes
105 include $(CONFIG_MK)
106
107endif # test check_platform
108
109# EOF