David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 1 | # |
| 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 Turner | a90663f | 2000-07-08 00:41:13 +0000 | [diff] [blame] | 24 | # e.g. `$(TOP)/builds/unix'. |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 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 | # |
Werner Lemberg | d060a75 | 2000-07-20 06:57:41 +0000 | [diff] [blame] | 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 | # |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 65 | # 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 Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 73 | .PHONY: single multi objects library |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 74 | |
| 75 | # default target -- build single objects and library |
| 76 | # |
| 77 | single: objects library |
| 78 | |
| 79 | # `multi' target -- build multiple objects and library |
| 80 | # |
| 81 | multi: objects library |
| 82 | |
| 83 | |
| 84 | # The FreeType source directory, usually `./src'. |
| 85 | # |
| 86 | SRC := $(TOP)$(SEP)src |
| 87 | |
| 88 | |
| 89 | # The directory where the base layer components are placed, usually |
| 90 | # `./src/base'. |
| 91 | # |
| 92 | BASE_DIR := $(SRC)$(SEP)base |
| 93 | |
David Turner | d3c8e06 | 2000-12-04 22:53:55 +0000 | [diff] [blame] | 94 | # The build header file used to define all public header file names |
Werner Lemberg | 33d0236 | 2000-12-06 16:31:30 +0000 | [diff] [blame] | 95 | # as macro. |
David Turner | d3c8e06 | 2000-12-04 22:53:55 +0000 | [diff] [blame] | 96 | # |
| 97 | ifndef FT_BUILD_H |
Werner Lemberg | 33d0236 | 2000-12-06 16:31:30 +0000 | [diff] [blame] | 98 | FT_BUILD_H := $(TOP)$(SEP)include$(SEP)ft2build.h |
| 99 | FTBUILD_CMD := |
David Turner | d3c8e06 | 2000-12-04 22:53:55 +0000 | [diff] [blame] | 100 | else |
Werner Lemberg | 33d0236 | 2000-12-06 16:31:30 +0000 | [diff] [blame] | 101 | FTBUILD_CMD = $(D)FT_BUILD_H=$(FT_BUILD_H) |
David Turner | d3c8e06 | 2000-12-04 22:53:55 +0000 | [diff] [blame] | 102 | endif |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 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). |
| 108 | # |
| 109 | # |
| 110 | SRC_ := $(SRC)$(SEP) |
| 111 | BASE_ := $(BASE_DIR)$(SEP) |
| 112 | OBJ_ := $(OBJ_DIR)$(SEP) |
| 113 | LIB_ := $(LIB_DIR)$(SEP) |
| 114 | PUBLIC_ := $(TOP)$(SEP)include$(SEP)freetype$(SEP) |
| 115 | INTERNAL_ := $(PUBLIC_)internal$(SEP) |
| 116 | CONFIG_ := $(PUBLIC_)config$(SEP) |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 117 | CACHE_ := $(PUBLIC_)cache$(SEP) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 118 | |
| 119 | |
| 120 | # The final name of the library file. |
| 121 | # |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 122 | PROJECT_LIBRARY := $(LIB_)$(LIBRARY).$A |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 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 |
David Turner | a90663f | 2000-07-08 00:41:13 +0000 | [diff] [blame] | 130 | # in the `freetype/builds/<system>' directory, as these |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 131 | # files will override the default sources. |
| 132 | # |
David Turner | 8d3a401 | 2001-03-20 11:14:24 +0000 | [diff] [blame] | 133 | INCLUDES := $(BUILD) $(TOP)$(SEP)include |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 134 | |
| 135 | INCLUDE_FLAGS = $(INCLUDES:%=$I%) |
| 136 | |
| 137 | |
| 138 | # C flags used for the compilation of an object file. This must include at |
David Turner | a90663f | 2000-07-08 00:41:13 +0000 | [diff] [blame] | 139 | # least the paths for the `base' and `builds/<system>' directories; |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 140 | # debug/optimization/warning flags + ansi compliance if needed. |
| 141 | # |
| 142 | FT_CFLAGS = $(CFLAGS) $(INCLUDE_FLAGS) |
| 143 | FT_CC = $(CC) $(FT_CFLAGS) |
| 144 | FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS) |
| 145 | |
| 146 | |
| 147 | # Include the `modules' rules file. |
| 148 | # |
David Turner | a90663f | 2000-07-08 00:41:13 +0000 | [diff] [blame] | 149 | include $(TOP)/builds/modules.mk |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 150 | |
| 151 | |
| 152 | # Initialize the list of objects. |
| 153 | # |
| 154 | OBJECTS_LIST := |
| 155 | |
| 156 | |
| 157 | # Define $(PUBLIC_H) as the list of all public header files located in |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 158 | # `$(TOP)/include/freetype'. $(BASE_H), $(CACHE_H), and $(CONFIG_H) are |
| 159 | # defined similarly. |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 160 | # |
| 161 | # This is used to simplify the dependency rules -- if one of these files |
| 162 | # changes, the whole library is recompiled. |
| 163 | # |
| 164 | PUBLIC_H := $(wildcard $(PUBLIC_)*.h) |
| 165 | BASE_H := $(wildcard $(INTERNAL_)*.h) |
Werner Lemberg | 3c7c5da | 2000-10-19 15:56:22 +0000 | [diff] [blame] | 166 | CONFIG_H := $(wildcard $(CONFIG_)*.h) \ |
| 167 | $(wildcard $(BUILD)$(SEP)freetype$(SEP)config$(SEP)*.h) |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 168 | CACHE_H := $(wildcard $(CACHE_)*.h) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 169 | |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 170 | FREETYPE_H := $(PUBLIC_H) $(BASE_H) $(CONFIG_H) $(CACHE_H) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 171 | |
| 172 | |
| 173 | # ftsystem component |
| 174 | # |
| 175 | ifndef FTSYS_SRC |
| 176 | FTSYS_SRC = $(BASE_)ftsystem.c |
| 177 | endif |
| 178 | |
| 179 | FTSYS_OBJ = $(OBJ_)ftsystem.$O |
| 180 | |
| 181 | OBJECTS_LIST += $(FTSYS_OBJ) |
| 182 | |
| 183 | $(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H) |
| 184 | $(FT_COMPILE) $T$@ $< |
| 185 | |
| 186 | |
| 187 | # ftdebug component |
| 188 | # |
| 189 | ifndef FTDEBUG_SRC |
| 190 | FTDEBUG_SRC = $(BASE_)ftdebug.c |
| 191 | endif |
| 192 | |
| 193 | FTDEBUG_OBJ = $(OBJ_)ftdebug.$O |
| 194 | |
| 195 | OBJECTS_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 | # |
| 203 | include $(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 | # |
| 217 | FTINIT_SRC := $(BASE_)ftinit.c |
| 218 | FTINIT_OBJ := $(OBJ_)ftinit.$O |
| 219 | |
| 220 | OBJECTS_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 | # |
| 231 | OBJ_M = $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M) |
| 232 | OBJ_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 | # |
| 242 | BASE_OBJECTS := $(OBJECTS_LIST) |
| 243 | |
| 244 | ifneq ($(findstring multi,$(MAKECMDGOALS)),) |
| 245 | OBJECTS_LIST += $(OBJ_M) |
| 246 | else |
| 247 | OBJECTS_LIST += $(OBJ_S) |
| 248 | endif |
| 249 | |
| 250 | objects: $(OBJECTS_LIST) |
| 251 | |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 252 | library: $(PROJECT_LIBRARY) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 253 | |
| 254 | .c.$O: |
| 255 | $(FT_COMPILE) $T$@ $< |
| 256 | |
| 257 | |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 258 | .PHONY: clean_project_std distclean_project_std |
| 259 | |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 260 | # Standard cleaning and distclean rules. These are not accepted |
| 261 | # on all systems though. |
| 262 | # |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 263 | clean_project_std: |
Werner Lemberg | d060a75 | 2000-07-20 06:57:41 +0000 | [diff] [blame] | 264 | -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 265 | |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 266 | distclean_project_std: clean_project_std |
| 267 | -$(DELETE) $(PROJECT_LIBRARY) |
Werner Lemberg | d060a75 | 2000-07-20 06:57:41 +0000 | [diff] [blame] | 268 | -$(DELETE) *.orig *~ core *.core $(DISTCLEAN) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 269 | |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 270 | |
| 271 | .PHONY: clean_project_dos distclean_project_dos |
| 272 | |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 273 | # The Dos command shell does not support very long list of arguments, so |
| 274 | # we are stuck with wildcards. |
| 275 | # |
Werner Lemberg | a64c55b | 2001-05-12 06:40:50 +0000 | [diff] [blame] | 276 | # Don't break the command lines with; this prevents the "del" command from |
| 277 | # working correctly on Win9x. |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 278 | # |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 279 | clean_project_dos: |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 280 | -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O $(CLEAN) $(NO_OUTPUT) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 281 | |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 282 | distclean_project_dos: clean_project_dos |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 283 | -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) $(DISTCLEAN) $(NO_OUTPUT) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 284 | |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 285 | |
| 286 | .PHONY: remove_config_mk |
| 287 | |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 288 | # Remove configuration file (used for distclean). |
| 289 | # |
| 290 | remove_config_mk: |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 291 | -$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK)) $(NO_OUTPUT) |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 292 | |
| 293 | |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 294 | .PHONY: clean distclean |
| 295 | |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 296 | # 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 Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 301 | clean: clean_project |
| 302 | distclean: distclean_project remove_config_mk |
David Turner | 7404301 | 2000-07-08 00:22:20 +0000 | [diff] [blame] | 303 | |
| 304 | # EOF |