blob: fc7461f76015e484b5b63a1f6234f7ba9d62b0d1 [file] [log] [blame]
David Turner046f7a02000-09-15 22:42:06 +00001#
2# FreeType build system -- top-level sub-Makefile
3#
4
Werner Lemberg47a5f412000-10-17 03:38:43 +00005
6# Copyright 1996-2000 by
7# David Turner, Robert Wilhelm, and Werner Lemberg.
8#
9# This file is part of the FreeType project, and may only be used, modified,
10# and distributed under the terms of the FreeType project license,
11# LICENSE.TXT. By continuing to use, modify, or distribute this file you
12# indicate that you have read the license and understand and accept it
13# fully.
David Turner046f7a02000-09-15 22:42:06 +000014
15
16# This file is designed for GNU Make, do not use it with another Make tool!
17#
18# It works as follows:
19#
20# - When invoked for the first time, this Makefile will include the rules
21# found in `PROJECT/builds/detect.mk'. They are in charge of detecting
22# the current platform.
23#
24# A summary of the detection will be displayed, and the file `config.mk'
25# will be created in the current directory.
26#
27# - When invoked later, this Makefile will include the rules found in
28# `config.mk'. This sub-Makefile will define some system-specific
29# variables (like compiler, compilation flags, object suffix, etc.), then
30# include the rules found in `PROJECT/builds/PROJECT.mk', used to build
31# the library.
32#
33# See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more
34# details on host platform detection and library builds.
35
36
37.PHONY: setup
38
David Turnerbeece1b2000-09-19 18:33:20 +000039ifndef CONFIG_MK
Werner Lemberg4b92cf82000-10-10 03:58:32 +000040 CONFIG_MK := config.mk
David Turnerbeece1b2000-09-19 18:33:20 +000041endif
David Turner046f7a02000-09-15 22:42:06 +000042
43# If no configuration sub-makefile is present, or if `setup' is the target
44# to be built, run the auto-detection rules to figure out which
45# configuration rules file to use.
46#
47# Note that the configuration file is put in the current directory, which is
48# not necessarily $(TOP).
49
50# If `config.mk' is not present, set `check_platform'.
51#
52ifeq ($(wildcard $(CONFIG_MK)),)
53 check_platform := 1
54endif
55
56# If `setup' is one of the targets requested, set `check_platform'.
57#
58ifneq ($(findstring setup,$(MAKECMDGOALS)),)
59 check_platform := 1
60endif
61
62# Include the automatic host platform detection rules when we need to
63# check the platform.
64#
65ifdef check_platform
66
67 all: setup
68
Werner Lembergbd547dc2000-09-22 21:23:29 +000069 ifdef USE_MODULES
70 # If the module list $(MODULE_LIST) file is not present, generate it.
71 #
72 #modules: make_module_list setup
73 endif
David Turner046f7a02000-09-15 22:42:06 +000074
75 include $(TOP)/builds/detect.mk
76
Werner Lembergbd547dc2000-09-22 21:23:29 +000077 ifdef USE_MODULES
78 include $(TOP)/builds/modules.mk
David Turner046f7a02000-09-15 22:42:06 +000079
Werner Lembergbd547dc2000-09-22 21:23:29 +000080 ifeq ($(wildcard $(MODULE_LIST)),)
81 setup: make_module_list
82 endif
David Turner046f7a02000-09-15 22:42:06 +000083 endif
David Turner046f7a02000-09-15 22:42:06 +000084
85 # This rule makes sense for Unix only to remove files created by a run
86 # of the configure script which hasn't been successful (so that no
87 # `config.mk' has been created). It uses the built-in $(RM) command of
88 # GNU make.
89 #
90 distclean:
Werner Lembergbd547dc2000-09-22 21:23:29 +000091 $(RM) builds/unix/config.cache
92 $(RM) builds/unix/config.log
93 $(RM) builds/unix/config.status
94 $(RM) builds/unix/unix-def.mk
95 $(RM) builds/unix/unix-cc.mk
David Turner046f7a02000-09-15 22:42:06 +000096
97 # IMPORTANT:
98 #
99 # `setup' must be defined by the host platform detection rules to create
100 # the `config.mk' file in the current directory.
101
102else
103
104 # A configuration sub-Makefile is present -- simply run it.
105 #
106 all: single
107
Werner Lembergbd547dc2000-09-22 21:23:29 +0000108 ifdef USE_MODULES
109 modules: make_module_list
110 endif
David Turner046f7a02000-09-15 22:42:06 +0000111
112 BUILD_PROJECT := yes
113 include $(CONFIG_MK)
114
115endif # test check_platform
116
117# EOF