2 # FreeType build system -- top-level sub-Makefile
6 # Copyright 1996-2000, 2001, 2003, 2006, 2008, 2009 by
7 # David Turner, Robert Wilhelm, and Werner Lemberg.
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
16 # This file is designed for GNU Make, do not use it with another Make tool!
18 # It works as follows:
20 # - When invoked for the first time, this Makefile includes the rules found
21 # in `PROJECT/builds/detect.mk'. They are in charge of detecting the
24 # A summary of the detection is displayed, and the file `config.mk' is
25 # created in the current directory.
27 # - When invoked later, this Makefile includes the rules found in
28 # `config.mk'. This sub-Makefile defines some system-specific variables
29 # (like compiler, compilation flags, object suffix, etc.), then includes
30 # the rules found in `PROJECT/builds/PROJECT.mk', used to build the
33 # See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more
34 # details on host platform detection and library builds.
37 # First of all, check whether we have `$(value ...)'. We do this by testing
38 # for `$(eval ...)' which has been introduced in the same GNU make version.
41 $(eval eval_available
:= T
)
42 ifneq ($(eval_available
),T
)
43 $(error FreeType
's build system needs a Make program which supports $$(value))
47 .PHONY: all dist distclean modules setup
50 # The `space' variable is used to avoid trailing spaces in defining the
54 space
:= $(empty
) $(empty
)
57 # The main configuration file, defining the `XXX_MODULES' variables. We
58 # prefer a `modules.cfg' file in OBJ_DIR over TOP_DIR.
61 MODULES_CFG
:= $(TOP_DIR
)/modules.cfg
62 ifneq ($(wildcard $(OBJ_DIR
)/modules.cfg
),)
63 MODULES_CFG
:= $(OBJ_DIR
)/modules.cfg
68 # FTMODULE_H, as its name suggests, indicates where the FreeType module
71 FTMODULE_H ?
= $(OBJ_DIR
)/ftmodule.h
74 include $(MODULES_CFG
)
77 # The list of modules we are using.
79 MODULES
:= $(FONT_MODULES
) \
85 CONFIG_MK ?
= config.mk
87 # If no configuration sub-makefile is present, or if `setup' is the target
88 # to be built, run the auto-detection rules to figure out which
89 # configuration rules file to use.
91 # Note that the configuration file is put in the current directory, which is
92 # not necessarily $(TOP_DIR).
94 # If `config.mk' is not present, set `check_platform'.
96 ifeq ($(wildcard $(CONFIG_MK
)),)
100 # If `setup' is one of the targets requested, set `check_platform'.
102 ifneq ($(findstring setup
,$(MAKECMDGOALS
)),)
106 # Include the automatic host platform detection rules when we need to
107 # check the platform.
113 include $(TOP_DIR
)/builds
/detect.mk
115 # This rule makes sense for Unix only to remove files created by a run
116 # of the configure script which hasn't been successful (so that no
117 # `config.mk' has been created). It uses the built-in $(RM) command of
118 # GNU make. Similarly, `nul' is created if e.g. `make setup win32' has
119 # been erroneously used.
121 # Note: This test is duplicated in `builds/unix/detect.mk'.
123 is_unix
:= $(strip $(wildcard /sbin
/init
) \
124 $(wildcard /usr
/sbin
/init
) \
125 $(wildcard /hurd
/auth
))
129 $(RM
) builds
/unix
/config.cache
130 $(RM
) builds
/unix
/config.log
131 $(RM
) builds
/unix
/config.status
132 $(RM
) builds
/unix
/unix-def.mk
133 $(RM
) builds
/unix
/unix-cc.mk
134 $(RM
) builds
/unix
/freetype2.
pc
141 # `setup' must be defined by the host platform detection rules to create
142 # the `config.mk' file in the current directory.
146 # A configuration sub-Makefile is present -- simply run it.
153 endif # test check_platform
156 # We always need the list of modules in ftmodule.h.
158 all setup
: $(FTMODULE_H
)
161 # The `modules' target unconditionally rebuilds the module list.
168 include $(TOP_DIR
)/builds
/modules.mk
171 # This target builds the tarballs.
173 # Not to be run by a normal user -- there are no attempts to make it
176 # we check for `dist', not `distclean'
177 ifneq ($(findstring distx
,$(MAKECMDGOALS
)x
),)
178 FT_H
:= include/freetype
/freetype.h
180 major
:= $(shell sed
-n
's/.*FREETYPE_MAJOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H
))
181 minor
:= $(shell sed
-n
's/.*FREETYPE_MINOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H
))
182 patch
:= $(shell sed
-n
's/.*FREETYPE_PATCH[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H
))
184 version
:= $(major
).
$(minor
).
$(patch
)
185 winversion
:= $(major
)$(minor
)$(patch
)
190 rm -f freetype-
$(version
).
tar.gz
191 rm -f freetype-
$(version
).
tar.bz2
192 rm -f ft
$(winversion
).zip
194 for d in
`find . -wholename '*/.git' -prune \
201 for f in
`find . -wholename '*/.git' -prune \
202 -o -name .cvsignore \
205 ln
-s
$$currdir/$$f tmp
/$$f ; \
208 @
# Prevent generation of .pyc files. Python follows (soft) links if
209 @
# the link's directory is write protected, so we have temporarily
210 @
# disable write access here too.
211 chmod
-w src
/tools
/docmaker
217 chmod
+w src
/tools
/docmaker
219 mv tmp freetype-
$(version
)
221 tar cfh
- freetype-
$(version
) \
222 | gzip
-9 -c
> freetype-
$(version
).
tar.gz
223 tar cfh
- freetype-
$(version
) \
224 | bzip2
-c
> freetype-
$(version
).
tar.bz2
226 @
# Use CR/LF for zip files.
227 zip
-lr9 ft
$(winversion
).zip freetype-
$(version
)
229 rm -fr freetype-
$(version
)
232 # The locations of the latest `config.guess' and `config.sub' versions (from
233 # GNU `config' CVS), relative to the `tmp' directory used during `make dist'.
235 CONFIG_GUESS
= ~
/git
/config
/config.guess
236 CONFIG_SUB
= ~
/git
/config
/config.sub
239 # Don't say `make do-dist'. Always use `make dist' instead.
243 do-dist
: distclean refdoc
244 @
# Without removing the files, `autoconf' and friends follow links.
245 rm -f builds
/unix
/aclocal.m4
246 rm -f builds
/unix
/configure.ac
247 rm -f builds
/unix
/configure
250 rm -rf builds
/unix
/autom4te.cache
252 cp
$(CONFIG_GUESS
) builds
/unix
253 cp
$(CONFIG_SUB
) builds
/unix