source: trunk/third/freetype/builds/freetype.mk @ 18178

Revision 18178, 8.4 KB checked in by ghudson, 22 years ago (diff)
Merge with freetype 2.1.3.
Line 
1#
2# FreeType 2 library sub-Makefile
3#
4
5
6# Copyright 1996-2000, 2002 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.
14
15
16# DO NOT INVOKE THIS MAKEFILE DIRECTLY!  IT IS MEANT TO BE INCLUDED BY
17# OTHER MAKEFILES.
18
19
20# The following variables (set by other Makefile components, in the
21# environment, or on the command line) are used:
22#
23#   BUILD          The architecture dependent directory,
24#                  e.g. `$(TOP_DIR)/builds/unix'.
25#
26#   OBJ_DIR        The directory in which object files are created.
27#
28#   LIB_DIR        The directory in which the library is created.
29#
30#   INCLUDES       A list of directories to be included additionally.
31#                  Usually empty.
32#
33#   CFLAGS         Compilation flags.  This overrides the default settings
34#                  in the platform-specific configuration files.
35#
36#   FTSYS_SRC      If set, its value is used as the name of a replacement
37#                  file for `src/base/ftsystem.c'.
38#
39#   FTDEBUG_SRC    If set, its value is used as the name of a replacement
40#                  file for `src/base/ftdebug.c'.  [For a normal build, this
41#                  file does nothing.]
42#
43#   FT_MODULE_LIST The file which contains the list of modules for the
44#                  current build.  Usually, this is automatically created by
45#                  `modules.mk'.
46#
47#   BASE_OBJ_S
48#   BASE_OBJ_M     A list of base objects (for single object and multiple
49#                  object builds, respectively).  Set up in
50#                  `src/base/rules.mk'.
51#
52#   BASE_EXT_OBJ   A list of base extension objects.  Set up in
53#                  `src/base/rules.mk'.
54#
55#   DRV_OBJ_S
56#   DRV_OBJ_M      A list of driver objects (for single object and multiple
57#                  object builds, respectively).  Set up cumulatively in
58#                  `src/<driver>/rules.mk'.
59#
60#   CLEAN
61#   DISTCLEAN      The sub-makefiles can append additional stuff to these two
62#                  variables which is to be removed for the `clean' resp.
63#                  `distclean' target.
64#
65#   TOP_DIR, SEP,
66#   LIBRARY, CC,
67#   A, I, O, T     Check `config.mk' for details.
68
69
70# The targets `objects' and `library' are defined at the end of this
71# Makefile after all other rules have been included.
72#
73.PHONY: single multi objects library
74
75# default target -- build single objects and library
76#
77single: objects library
78
79# `multi' target -- build multiple objects and library
80#
81multi: objects library
82
83
84# The FreeType source directory, usually `./src'.
85#
86SRC := $(TOP_DIR)$(SEP)src
87
88
89# The directory where the base layer components are placed, usually
90# `./src/base'.
91#
92BASE_DIR := $(SRC)$(SEP)base
93
94# The build header file used to define all public header file names
95# as macro.
96#
97ifndef FT_BUILD_H
98  FT_BUILD_H  := $(TOP_DIR)$(SEP)include$(SEP)ft2build.h
99  FTBUILD_CMD :=
100else
101  FTBUILD_CMD = $(D)FT_BUILD_H=$(FT_BUILD_H)
102endif
103
104# A few short-cuts in order to avoid typing $(SEP) all the time for the
105# directory separator.
106#
107# For example: $(SRC_) equals to `./src/' where `.' is $(TOP_DIR).
108#
109#
110SRC_      := $(SRC)$(SEP)
111BASE_     := $(BASE_DIR)$(SEP)
112OBJ_      := $(OBJ_DIR)$(SEP)
113LIB_      := $(LIB_DIR)$(SEP)
114PUBLIC_   := $(TOP_DIR)$(SEP)include$(SEP)freetype$(SEP)
115INTERNAL_ := $(PUBLIC_)internal$(SEP)
116CONFIG_   := $(PUBLIC_)config$(SEP)
117CACHE_    := $(PUBLIC_)cache$(SEP)
118
119
120# The final name of the library file.
121#
122PROJECT_LIBRARY := $(LIB_)$(LIBRARY).$A
123
124
125# include paths
126#
127# IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed
128#                 in front of the include list.  Porters are then able to
129#                 put their own version of some of the FreeType components
130#                 in the `freetype/builds/<system>' directory, as these
131#                 files will override the default sources.
132#
133INCLUDES := $(OBJ_DIR) $(BUILD) $(TOP_DIR)$(SEP)include
134
135INCLUDE_FLAGS = $(INCLUDES:%=$I%)
136
137
138# C flags used for the compilation of an object file.  This must include at
139# least the paths for the `base' and `builds/<system>' directories;
140# debug/optimization/warning flags + ansi compliance if needed.
141#
142# $(INCLUDE_FLAGS) should come before $(CFLAGS) to avoid problems with
143# old FreeType versions.
144#
145FT_CFLAGS  = $(INCLUDE_FLAGS) $(CFLAGS)
146FT_CC      = $(CC) $(FT_CFLAGS)
147FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
148
149
150# Include the `modules' rules file.
151#
152include $(TOP_DIR)/builds/modules.mk
153
154
155# Initialize the list of objects.
156#
157OBJECTS_LIST :=
158
159
160# Define $(PUBLIC_H) as the list of all public header files located in
161# `$(TOP_DIR)/include/freetype'.  $(BASE_H), $(CACHE_H), and $(CONFIG_H) are
162# defined similarly.
163#
164# This is used to simplify the dependency rules -- if one of these files
165# changes, the whole library is recompiled.
166#
167PUBLIC_H   := $(wildcard $(PUBLIC_)*.h)
168BASE_H     := $(wildcard $(INTERNAL_)*.h)
169CONFIG_H   := $(wildcard $(CONFIG_)*.h) \
170              $(wildcard $(BUILD)$(SEP)freetype$(SEP)config$(SEP)*.h)
171CACHE_H    := $(wildcard $(CACHE_)*.h)
172
173FREETYPE_H := $(PUBLIC_H) $(BASE_H) $(CONFIG_H) $(CACHE_H)
174
175
176# ftsystem component
177#
178ifndef FTSYS_SRC
179  FTSYS_SRC = $(BASE_)ftsystem.c
180endif
181
182FTSYS_OBJ = $(OBJ_)ftsystem.$O
183
184OBJECTS_LIST += $(FTSYS_OBJ)
185
186$(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H)
187        $(FT_COMPILE) $T$@ $<
188
189
190# ftdebug component
191#
192ifndef FTDEBUG_SRC
193  FTDEBUG_SRC = $(BASE_)ftdebug.c
194endif
195
196FTDEBUG_OBJ = $(OBJ_)ftdebug.$O
197
198OBJECTS_LIST += $(FTDEBUG_OBJ)
199
200$(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H)
201        $(FT_COMPILE) $T$@ $<
202
203
204# Include all rule files from FreeType components.
205#
206include $(wildcard $(SRC)/*/rules.mk)
207
208
209# ftinit component
210#
211#   The C source `ftinit.c' contains the FreeType initialization routines.
212#   It is able to automatically register one or more drivers when the API
213#   function FT_Init_FreeType() is called.
214#
215#   The set of initial drivers is determined by the driver Makefiles
216#   includes above.  Each driver Makefile updates the FTINIT_xxx lists
217#   which contain additional include paths and macros used to compile the
218#   single `ftinit.c' source.
219#
220FTINIT_SRC := $(BASE_)ftinit.c
221FTINIT_OBJ := $(OBJ_)ftinit.$O
222
223OBJECTS_LIST += $(FTINIT_OBJ)
224
225$(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H) $(FT_MODULE_LIST)
226        $(FT_COMPILE) $T$@ $<
227
228
229# All FreeType library objects
230#
231#   By default, we include the base layer extensions.  These could be
232#   omitted on builds which do not want them.
233#
234OBJ_M = $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
235OBJ_S = $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
236
237
238# The target `multi' on the Make command line indicates that we want to
239# compile each source file independently.
240#
241# Otherwise, each module/driver is compiled in a single object file through
242# source file inclusion (see `src/base/ftbase.c' or
243# `src/truetype/truetype.c' for examples).
244#
245BASE_OBJECTS := $(OBJECTS_LIST)
246
247ifneq ($(findstring multi,$(MAKECMDGOALS)),)
248  OBJECTS_LIST += $(OBJ_M)
249else
250  OBJECTS_LIST += $(OBJ_S)
251endif
252
253objects: $(OBJECTS_LIST)
254
255library: $(PROJECT_LIBRARY)
256
257.c.$O:
258        $(FT_COMPILE) $T$@ $<
259
260
261.PHONY: clean_project_std distclean_project_std
262
263# Standard cleaning and distclean rules.  These are not accepted
264# on all systems though.
265#
266clean_project_std:
267        -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN)
268
269distclean_project_std: clean_project_std
270        -$(DELETE) $(PROJECT_LIBRARY)
271        -$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
272
273
274.PHONY: clean_project_dos distclean_project_dos
275
276# The Dos command shell does not support very long list of arguments, so
277# we are stuck with wildcards.
278#
279# Don't break the command lines with \; this prevents the "del" command from
280# working correctly on Win9x.
281#
282clean_project_dos:
283        -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O $(CLEAN) $(NO_OUTPUT)
284
285distclean_project_dos: clean_project_dos
286        -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) $(DISTCLEAN) $(NO_OUTPUT)
287
288
289.PHONY: remove_config_mk
290
291# Remove configuration file (used for distclean).
292#
293remove_config_mk:
294        -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK)) $(NO_OUTPUT)
295
296
297.PHONY: clean distclean
298
299# The `config.mk' file must define `clean_freetype' and
300# `distclean_freetype'.  Implementations may use to relay these to either
301# the `std' or `dos' versions from above, or simply provide their own
302# implementation.
303#
304clean: clean_project
305distclean: distclean_project remove_config_mk
306
307# EOF
Note: See TracBrowser for help on using the repository browser.