blob: 53f0e85370befeac50b540e1445733ac75c2bf03 [file] [log] [blame]
David Turner74043012000-07-08 00:22:20 +00001#
2# FreeType 2 library sub-Makefile
3#
4
5
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.
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,
David Turnera90663f2000-07-08 00:41:13 +000024# e.g. `$(TOP)/builds/unix'.
David Turner74043012000-07-08 00:22:20 +000025#
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#
Werner Lembergd060a752000-07-20 06:57:41 +000060# 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#
David Turner74043012000-07-08 00:22:20 +000065# TOP, 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#
Werner Lemberg594f0c92000-12-20 22:09:41 +000073.PHONY: single multi objects library
David Turner74043012000-07-08 00:22:20 +000074
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)$(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
David Turnerd3c8e062000-12-04 22:53:55 +000094# The build header file used to define all public header file names
Werner Lemberg33d02362000-12-06 16:31:30 +000095# as macro.
David Turnerd3c8e062000-12-04 22:53:55 +000096#
97ifndef FT_BUILD_H
Werner Lemberg33d02362000-12-06 16:31:30 +000098 FT_BUILD_H := $(TOP)$(SEP)include$(SEP)ft2build.h
99 FTBUILD_CMD :=
David Turnerd3c8e062000-12-04 22:53:55 +0000100else
Werner Lemberg33d02362000-12-06 16:31:30 +0000101 FTBUILD_CMD = $(D)FT_BUILD_H=$(FT_BUILD_H)
David Turnerd3c8e062000-12-04 22:53:55 +0000102endif
David Turner74043012000-07-08 00:22:20 +0000103
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).
108#
109#
110SRC_ := $(SRC)$(SEP)
111BASE_ := $(BASE_DIR)$(SEP)
112OBJ_ := $(OBJ_DIR)$(SEP)
113LIB_ := $(LIB_DIR)$(SEP)
114PUBLIC_ := $(TOP)$(SEP)include$(SEP)freetype$(SEP)
115INTERNAL_ := $(PUBLIC_)internal$(SEP)
116CONFIG_ := $(PUBLIC_)config$(SEP)
Werner Lembergbd547dc2000-09-22 21:23:29 +0000117CACHE_ := $(PUBLIC_)cache$(SEP)
David Turner74043012000-07-08 00:22:20 +0000118
119
120# The final name of the library file.
121#
David Turner046f7a02000-09-15 22:42:06 +0000122PROJECT_LIBRARY := $(LIB_)$(LIBRARY).$A
David Turner74043012000-07-08 00:22:20 +0000123
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
David Turnera90663f2000-07-08 00:41:13 +0000130# in the `freetype/builds/<system>' directory, as these
David Turner74043012000-07-08 00:22:20 +0000131# files will override the default sources.
132#
David Turner8d3a4012001-03-20 11:14:24 +0000133INCLUDES := $(BUILD) $(TOP)$(SEP)include
David Turner74043012000-07-08 00:22:20 +0000134
135INCLUDE_FLAGS = $(INCLUDES:%=$I%)
136
137
138# C flags used for the compilation of an object file. This must include at
David Turnera90663f2000-07-08 00:41:13 +0000139# least the paths for the `base' and `builds/<system>' directories;
David Turner74043012000-07-08 00:22:20 +0000140# debug/optimization/warning flags + ansi compliance if needed.
141#
142FT_CFLAGS = $(CFLAGS) $(INCLUDE_FLAGS)
143FT_CC = $(CC) $(FT_CFLAGS)
144FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
145
146
147# Include the `modules' rules file.
148#
David Turnera90663f2000-07-08 00:41:13 +0000149include $(TOP)/builds/modules.mk
David Turner74043012000-07-08 00:22:20 +0000150
151
152# Initialize the list of objects.
153#
154OBJECTS_LIST :=
155
156
157# Define $(PUBLIC_H) as the list of all public header files located in
Werner Lembergbd547dc2000-09-22 21:23:29 +0000158# `$(TOP)/include/freetype'. $(BASE_H), $(CACHE_H), and $(CONFIG_H) are
159# defined similarly.
David Turner74043012000-07-08 00:22:20 +0000160#
161# This is used to simplify the dependency rules -- if one of these files
162# changes, the whole library is recompiled.
163#
164PUBLIC_H := $(wildcard $(PUBLIC_)*.h)
165BASE_H := $(wildcard $(INTERNAL_)*.h)
Werner Lemberg3c7c5da2000-10-19 15:56:22 +0000166CONFIG_H := $(wildcard $(CONFIG_)*.h) \
167 $(wildcard $(BUILD)$(SEP)freetype$(SEP)config$(SEP)*.h)
Werner Lembergbd547dc2000-09-22 21:23:29 +0000168CACHE_H := $(wildcard $(CACHE_)*.h)
David Turner74043012000-07-08 00:22:20 +0000169
Werner Lembergbd547dc2000-09-22 21:23:29 +0000170FREETYPE_H := $(PUBLIC_H) $(BASE_H) $(CONFIG_H) $(CACHE_H)
David Turner74043012000-07-08 00:22:20 +0000171
172
173# ftsystem component
174#
175ifndef FTSYS_SRC
176 FTSYS_SRC = $(BASE_)ftsystem.c
177endif
178
179FTSYS_OBJ = $(OBJ_)ftsystem.$O
180
181OBJECTS_LIST += $(FTSYS_OBJ)
182
183$(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H)
184 $(FT_COMPILE) $T$@ $<
185
186
187# ftdebug component
188#
189ifndef FTDEBUG_SRC
190 FTDEBUG_SRC = $(BASE_)ftdebug.c
191endif
192
193FTDEBUG_OBJ = $(OBJ_)ftdebug.$O
194
195OBJECTS_LIST += $(FTDEBUG_OBJ)
196
197$(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H)
198 $(FT_COMPILE) $T$@ $<
199
200
201# Include all rule files from FreeType components.
202#
203include $(wildcard $(SRC)/*/rules.mk)
204
205
206# ftinit component
207#
208# The C source `ftinit.c' contains the FreeType initialization routines.
209# It is able to automatically register one or more drivers when the API
210# function FT_Init_FreeType() is called.
211#
212# The set of initial drivers is determined by the driver Makefiles
213# includes above. Each driver Makefile updates the FTINIT_xxx lists
214# which contain additional include paths and macros used to compile the
215# single `ftinit.c' source.
216#
217FTINIT_SRC := $(BASE_)ftinit.c
218FTINIT_OBJ := $(OBJ_)ftinit.$O
219
220OBJECTS_LIST += $(FTINIT_OBJ)
221
222$(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H) $(FT_MODULE_LIST)
223 $(FT_COMPILE) $T$@ $<
224
225
226# All FreeType library objects
227#
228# By default, we include the base layer extensions. These could be
229# omitted on builds which do not want them.
230#
231OBJ_M = $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
232OBJ_S = $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
233
234
235# The target `multi' on the Make command line indicates that we want to
236# compile each source file independently.
237#
238# Otherwise, each module/driver is compiled in a single object file through
239# source file inclusion (see `src/base/ftbase.c' or
240# `src/truetype/truetype.c' for examples).
241#
242BASE_OBJECTS := $(OBJECTS_LIST)
243
244ifneq ($(findstring multi,$(MAKECMDGOALS)),)
245 OBJECTS_LIST += $(OBJ_M)
246else
247 OBJECTS_LIST += $(OBJ_S)
248endif
249
250objects: $(OBJECTS_LIST)
251
David Turner046f7a02000-09-15 22:42:06 +0000252library: $(PROJECT_LIBRARY)
David Turner74043012000-07-08 00:22:20 +0000253
254.c.$O:
255 $(FT_COMPILE) $T$@ $<
256
257
Werner Lemberg594f0c92000-12-20 22:09:41 +0000258.PHONY: clean_project_std distclean_project_std
259
David Turner74043012000-07-08 00:22:20 +0000260# Standard cleaning and distclean rules. These are not accepted
261# on all systems though.
262#
David Turner046f7a02000-09-15 22:42:06 +0000263clean_project_std:
Werner Lembergd060a752000-07-20 06:57:41 +0000264 -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN)
David Turner74043012000-07-08 00:22:20 +0000265
David Turner046f7a02000-09-15 22:42:06 +0000266distclean_project_std: clean_project_std
267 -$(DELETE) $(PROJECT_LIBRARY)
Werner Lembergd060a752000-07-20 06:57:41 +0000268 -$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
David Turner74043012000-07-08 00:22:20 +0000269
Werner Lemberg594f0c92000-12-20 22:09:41 +0000270
271.PHONY: clean_project_dos distclean_project_dos
272
David Turner74043012000-07-08 00:22:20 +0000273# The Dos command shell does not support very long list of arguments, so
274# we are stuck with wildcards.
275#
Werner Lemberga64c55b2001-05-12 06:40:50 +0000276# Don't break the command lines with; this prevents the "del" command from
277# working correctly on Win9x.
David Turnerebe85f52001-05-11 14:25:57 +0000278#
David Turner046f7a02000-09-15 22:42:06 +0000279clean_project_dos:
David Turnerebe85f52001-05-11 14:25:57 +0000280 -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O $(CLEAN) $(NO_OUTPUT)
David Turner74043012000-07-08 00:22:20 +0000281
David Turner046f7a02000-09-15 22:42:06 +0000282distclean_project_dos: clean_project_dos
David Turnerebe85f52001-05-11 14:25:57 +0000283 -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) $(DISTCLEAN) $(NO_OUTPUT)
David Turner74043012000-07-08 00:22:20 +0000284
Werner Lemberg594f0c92000-12-20 22:09:41 +0000285
286.PHONY: remove_config_mk
287
David Turner74043012000-07-08 00:22:20 +0000288# Remove configuration file (used for distclean).
289#
290remove_config_mk:
David Turner046f7a02000-09-15 22:42:06 +0000291 -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK)) $(NO_OUTPUT)
David Turner74043012000-07-08 00:22:20 +0000292
293
Werner Lemberg594f0c92000-12-20 22:09:41 +0000294.PHONY: clean distclean
295
David Turner74043012000-07-08 00:22:20 +0000296# The `config.mk' file must define `clean_freetype' and
297# `distclean_freetype'. Implementations may use to relay these to either
298# the `std' or `dos' versions from above, or simply provide their own
299# implementation.
300#
David Turner046f7a02000-09-15 22:42:06 +0000301clean: clean_project
302distclean: distclean_project remove_config_mk
David Turner74043012000-07-08 00:22:20 +0000303
304# EOF