Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | # |
michael@0 | 2 | # FreeType 2 library sub-Makefile |
michael@0 | 3 | # |
michael@0 | 4 | |
michael@0 | 5 | |
michael@0 | 6 | # Copyright 1996-2006, 2008, 2013, 2014 by |
michael@0 | 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. |
michael@0 | 8 | # |
michael@0 | 9 | # This file is part of the FreeType project, and may only be used, modified, |
michael@0 | 10 | # and distributed under the terms of the FreeType project license, |
michael@0 | 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you |
michael@0 | 12 | # indicate that you have read the license and understand and accept it |
michael@0 | 13 | # fully. |
michael@0 | 14 | |
michael@0 | 15 | |
michael@0 | 16 | # DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY |
michael@0 | 17 | # OTHER MAKEFILES. |
michael@0 | 18 | |
michael@0 | 19 | |
michael@0 | 20 | # The following variables (set by other Makefile components, in the |
michael@0 | 21 | # environment, or on the command line) are used: |
michael@0 | 22 | # |
michael@0 | 23 | # BUILD_DIR The architecture dependent directory, |
michael@0 | 24 | # e.g. `$(TOP_DIR)/builds/unix'. Added to INCLUDES also. |
michael@0 | 25 | # |
michael@0 | 26 | # OBJ_DIR The directory in which object files are created. |
michael@0 | 27 | # |
michael@0 | 28 | # LIB_DIR The directory in which the library is created. |
michael@0 | 29 | # |
michael@0 | 30 | # DOC_DIR The directory in which the API reference is created. |
michael@0 | 31 | # |
michael@0 | 32 | # INCLUDES A list of directories to be included additionally. |
michael@0 | 33 | # |
michael@0 | 34 | # DEVEL_DIR Development directory which is added to the INCLUDES |
michael@0 | 35 | # variable before the standard include directories. |
michael@0 | 36 | # |
michael@0 | 37 | # CFLAGS Compilation flags. This overrides the default settings |
michael@0 | 38 | # in the platform-specific configuration files. |
michael@0 | 39 | # |
michael@0 | 40 | # FTSYS_SRC If set, its value is used as the name of a replacement |
michael@0 | 41 | # file for `src/base/ftsystem.c'. |
michael@0 | 42 | # |
michael@0 | 43 | # FTDEBUG_SRC If set, its value is used as the name of a replacement |
michael@0 | 44 | # file for `src/base/ftdebug.c'. [For a normal build, this |
michael@0 | 45 | # file does nothing.] |
michael@0 | 46 | # |
michael@0 | 47 | # FTMODULE_H The file which contains the list of module classes for |
michael@0 | 48 | # the current build. Usually, this is automatically |
michael@0 | 49 | # created by `modules.mk'. |
michael@0 | 50 | # |
michael@0 | 51 | # BASE_OBJ_S |
michael@0 | 52 | # BASE_OBJ_M A list of base objects (for single object and multiple |
michael@0 | 53 | # object builds, respectively). Set up in |
michael@0 | 54 | # `src/base/rules.mk'. |
michael@0 | 55 | # |
michael@0 | 56 | # BASE_EXT_OBJ A list of base extension objects. Set up in |
michael@0 | 57 | # `src/base/rules.mk'. |
michael@0 | 58 | # |
michael@0 | 59 | # DRV_OBJ_S |
michael@0 | 60 | # DRV_OBJ_M A list of driver objects (for single object and multiple |
michael@0 | 61 | # object builds, respectively). Set up cumulatively in |
michael@0 | 62 | # `src/<driver>/rules.mk'. |
michael@0 | 63 | # |
michael@0 | 64 | # CLEAN |
michael@0 | 65 | # DISTCLEAN The sub-makefiles can append additional stuff to these two |
michael@0 | 66 | # variables which is to be removed for the `clean' resp. |
michael@0 | 67 | # `distclean' target. |
michael@0 | 68 | # |
michael@0 | 69 | # TOP_DIR, SEP, |
michael@0 | 70 | # COMPILER_SEP, |
michael@0 | 71 | # LIBRARY, CC, |
michael@0 | 72 | # A, I, O, T Check `config.mk' for details. |
michael@0 | 73 | |
michael@0 | 74 | |
michael@0 | 75 | # The targets `objects' and `library' are defined at the end of this |
michael@0 | 76 | # Makefile after all other rules have been included. |
michael@0 | 77 | # |
michael@0 | 78 | .PHONY: single multi objects library refdoc |
michael@0 | 79 | |
michael@0 | 80 | # default target -- build single objects and library |
michael@0 | 81 | # |
michael@0 | 82 | single: objects library |
michael@0 | 83 | |
michael@0 | 84 | # `multi' target -- build multiple objects and library |
michael@0 | 85 | # |
michael@0 | 86 | multi: objects library |
michael@0 | 87 | |
michael@0 | 88 | |
michael@0 | 89 | # The FreeType source directory, usually `./src'. |
michael@0 | 90 | # |
michael@0 | 91 | SRC_DIR := $(TOP_DIR)/src |
michael@0 | 92 | |
michael@0 | 93 | # The directory where the base layer components are placed, usually |
michael@0 | 94 | # `./src/base'. |
michael@0 | 95 | # |
michael@0 | 96 | BASE_DIR := $(SRC_DIR)/base |
michael@0 | 97 | |
michael@0 | 98 | # Other derived directories. |
michael@0 | 99 | # |
michael@0 | 100 | PUBLIC_DIR := $(TOP_DIR)/include |
michael@0 | 101 | INTERNAL_DIR := $(PUBLIC_DIR)/internal |
michael@0 | 102 | SERVICES_DIR := $(INTERNAL_DIR)/services |
michael@0 | 103 | CONFIG_DIR := $(PUBLIC_DIR)/config |
michael@0 | 104 | |
michael@0 | 105 | # The documentation directory. |
michael@0 | 106 | # |
michael@0 | 107 | DOC_DIR ?= $(TOP_DIR)/docs/reference |
michael@0 | 108 | |
michael@0 | 109 | # The final name of the library file. |
michael@0 | 110 | # |
michael@0 | 111 | PROJECT_LIBRARY := $(LIB_DIR)/$(LIBRARY).$A |
michael@0 | 112 | |
michael@0 | 113 | |
michael@0 | 114 | # include paths |
michael@0 | 115 | # |
michael@0 | 116 | # IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed |
michael@0 | 117 | # before the standard include list. Porters are then able to |
michael@0 | 118 | # put their own version of some of the FreeType components |
michael@0 | 119 | # in the `builds/<system>' directory, as these files will |
michael@0 | 120 | # override the default sources. |
michael@0 | 121 | # |
michael@0 | 122 | INCLUDES := $(subst /,$(COMPILER_SEP),$(OBJ_DIR) \ |
michael@0 | 123 | $(DEVEL_DIR) \ |
michael@0 | 124 | $(BUILD_DIR) \ |
michael@0 | 125 | $(TOP_DIR)/include) |
michael@0 | 126 | |
michael@0 | 127 | INCLUDE_FLAGS := $(INCLUDES:%=$I%) |
michael@0 | 128 | |
michael@0 | 129 | ifdef DEVEL_DIR |
michael@0 | 130 | # We assume that all library dependencies for FreeType are fulfilled for a |
michael@0 | 131 | # development build, so we directly access the necessary include directory |
michael@0 | 132 | # information using `pkg-config'. |
michael@0 | 133 | INCLUDE_FLAGS += $(shell pkg-config --cflags libpng \ |
michael@0 | 134 | harfbuzz ) |
michael@0 | 135 | endif |
michael@0 | 136 | |
michael@0 | 137 | |
michael@0 | 138 | # C flags used for the compilation of an object file. This must include at |
michael@0 | 139 | # least the paths for the `base' and `builds/<system>' directories; |
michael@0 | 140 | # debug/optimization/warning flags + ansi compliance if needed. |
michael@0 | 141 | # |
michael@0 | 142 | # $(INCLUDE_FLAGS) should come before $(CFLAGS) to avoid problems with |
michael@0 | 143 | # old FreeType versions. |
michael@0 | 144 | # |
michael@0 | 145 | # Note what we also define the macro FT2_BUILD_LIBRARY when building |
michael@0 | 146 | # FreeType. This is required to let our sources include the internal |
michael@0 | 147 | # headers (something forbidden by clients). |
michael@0 | 148 | # |
michael@0 | 149 | # Finally, we define FT_CONFIG_MODULES_H so that the compiler uses the |
michael@0 | 150 | # generated version of `ftmodule.h' in $(OBJ_DIR). If there is an |
michael@0 | 151 | # `ftoption.h' files in $(OBJ_DIR), define FT_CONFIG_OPTIONS_H too. |
michael@0 | 152 | # |
michael@0 | 153 | ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),) |
michael@0 | 154 | FTOPTION_H := $(OBJ_DIR)/ftoption.h |
michael@0 | 155 | FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="<ftoption.h>" |
michael@0 | 156 | endif |
michael@0 | 157 | |
michael@0 | 158 | # Note that a build with the `configure' script uses $(CFLAGS) only. |
michael@0 | 159 | # |
michael@0 | 160 | FT_CFLAGS = $(CPPFLAGS) \ |
michael@0 | 161 | $(INCLUDE_FLAGS) \ |
michael@0 | 162 | $(CFLAGS) \ |
michael@0 | 163 | $DFT2_BUILD_LIBRARY \ |
michael@0 | 164 | $DFT_CONFIG_MODULES_H="<ftmodule.h>" \ |
michael@0 | 165 | $(FTOPTION_FLAG) |
michael@0 | 166 | FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS) |
michael@0 | 167 | |
michael@0 | 168 | |
michael@0 | 169 | # Include the `exports' rules file. |
michael@0 | 170 | # |
michael@0 | 171 | include $(TOP_DIR)/builds/exports.mk |
michael@0 | 172 | |
michael@0 | 173 | |
michael@0 | 174 | # Initialize the list of objects. |
michael@0 | 175 | # |
michael@0 | 176 | OBJECTS_LIST := |
michael@0 | 177 | |
michael@0 | 178 | |
michael@0 | 179 | # Define $(PUBLIC_H) as the list of all public header files located in |
michael@0 | 180 | # `$(TOP_DIR)/include/freetype'. $(INTERNAL_H), and $(CONFIG_H) are defined |
michael@0 | 181 | # similarly. |
michael@0 | 182 | # |
michael@0 | 183 | # This is used to simplify the dependency rules -- if one of these files |
michael@0 | 184 | # changes, the whole library is recompiled. |
michael@0 | 185 | # |
michael@0 | 186 | PUBLIC_H := $(wildcard $(PUBLIC_DIR)/*.h) |
michael@0 | 187 | INTERNAL_H := $(wildcard $(INTERNAL_DIR)/*.h) \ |
michael@0 | 188 | $(wildcard $(SERVICES_DIR)/*.h) |
michael@0 | 189 | CONFIG_H := $(wildcard $(CONFIG_DIR)/*.h) \ |
michael@0 | 190 | $(wildcard $(BUILD_DIR)/config/*.h) \ |
michael@0 | 191 | $(FTMODULE_H) \ |
michael@0 | 192 | $(FTOPTION_H) |
michael@0 | 193 | DEVEL_H := $(wildcard $(TOP_DIR)/devel/*.h) |
michael@0 | 194 | |
michael@0 | 195 | FREETYPE_H := $(PUBLIC_H) $(INTERNAL_H) $(CONFIG_H) $(DEVEL_H) |
michael@0 | 196 | |
michael@0 | 197 | |
michael@0 | 198 | # ftsystem component |
michael@0 | 199 | # |
michael@0 | 200 | FTSYS_SRC ?= $(BASE_DIR)/ftsystem.c |
michael@0 | 201 | |
michael@0 | 202 | FTSYS_OBJ := $(OBJ_DIR)/ftsystem.$O |
michael@0 | 203 | |
michael@0 | 204 | OBJECTS_LIST += $(FTSYS_OBJ) |
michael@0 | 205 | |
michael@0 | 206 | $(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H) |
michael@0 | 207 | $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) |
michael@0 | 208 | |
michael@0 | 209 | |
michael@0 | 210 | # ftdebug component |
michael@0 | 211 | # |
michael@0 | 212 | FTDEBUG_SRC ?= $(BASE_DIR)/ftdebug.c |
michael@0 | 213 | |
michael@0 | 214 | FTDEBUG_OBJ := $(OBJ_DIR)/ftdebug.$O |
michael@0 | 215 | |
michael@0 | 216 | OBJECTS_LIST += $(FTDEBUG_OBJ) |
michael@0 | 217 | |
michael@0 | 218 | $(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H) |
michael@0 | 219 | $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) |
michael@0 | 220 | |
michael@0 | 221 | |
michael@0 | 222 | # Include all rule files from FreeType components. |
michael@0 | 223 | # |
michael@0 | 224 | include $(SRC_DIR)/base/rules.mk |
michael@0 | 225 | include $(patsubst %,$(SRC_DIR)/%/rules.mk,$(MODULES)) |
michael@0 | 226 | |
michael@0 | 227 | |
michael@0 | 228 | # ftinit component |
michael@0 | 229 | # |
michael@0 | 230 | # The C source `ftinit.c' contains the FreeType initialization routines. |
michael@0 | 231 | # It is able to automatically register one or more drivers when the API |
michael@0 | 232 | # function FT_Init_FreeType() is called. |
michael@0 | 233 | # |
michael@0 | 234 | # The set of initial drivers is determined by the driver Makefiles |
michael@0 | 235 | # includes above. Each driver Makefile updates the FTINIT_xxx lists |
michael@0 | 236 | # which contain additional include paths and macros used to compile the |
michael@0 | 237 | # single `ftinit.c' source. |
michael@0 | 238 | # |
michael@0 | 239 | FTINIT_SRC := $(BASE_DIR)/ftinit.c |
michael@0 | 240 | FTINIT_OBJ := $(OBJ_DIR)/ftinit.$O |
michael@0 | 241 | |
michael@0 | 242 | OBJECTS_LIST += $(FTINIT_OBJ) |
michael@0 | 243 | |
michael@0 | 244 | $(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H) |
michael@0 | 245 | $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) |
michael@0 | 246 | |
michael@0 | 247 | |
michael@0 | 248 | # All FreeType library objects. |
michael@0 | 249 | # |
michael@0 | 250 | OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M) |
michael@0 | 251 | OBJ_S := $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S) |
michael@0 | 252 | |
michael@0 | 253 | |
michael@0 | 254 | # The target `multi' on the Make command line indicates that we want to |
michael@0 | 255 | # compile each source file independently. |
michael@0 | 256 | # |
michael@0 | 257 | # Otherwise, each module/driver is compiled in a single object file through |
michael@0 | 258 | # source file inclusion (see `src/base/ftbase.c' or |
michael@0 | 259 | # `src/truetype/truetype.c' for examples). |
michael@0 | 260 | # |
michael@0 | 261 | BASE_OBJECTS := $(OBJECTS_LIST) |
michael@0 | 262 | |
michael@0 | 263 | ifneq ($(findstring multi,$(MAKECMDGOALS)),) |
michael@0 | 264 | OBJECTS_LIST += $(OBJ_M) |
michael@0 | 265 | else |
michael@0 | 266 | OBJECTS_LIST += $(OBJ_S) |
michael@0 | 267 | endif |
michael@0 | 268 | |
michael@0 | 269 | objects: $(OBJECTS_LIST) |
michael@0 | 270 | |
michael@0 | 271 | library: $(PROJECT_LIBRARY) |
michael@0 | 272 | |
michael@0 | 273 | .c.$O: |
michael@0 | 274 | $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) |
michael@0 | 275 | |
michael@0 | 276 | |
michael@0 | 277 | ifneq ($(findstring refdoc,$(MAKECMDGOALS)),) |
michael@0 | 278 | # poor man's `sed' emulation with make's built-in string functions |
michael@0 | 279 | work := $(strip $(shell $(CAT) $(PUBLIC_DIR)/freetype.h)) |
michael@0 | 280 | work := $(subst |,x,$(work)) |
michael@0 | 281 | work := $(subst $(space),|,$(work)) |
michael@0 | 282 | work := $(subst \#define|FREETYPE_MAJOR|,$(space),$(work)) |
michael@0 | 283 | work := $(word 2,$(work)) |
michael@0 | 284 | major := $(subst |,$(space),$(work)) |
michael@0 | 285 | major := $(firstword $(major)) |
michael@0 | 286 | |
michael@0 | 287 | work := $(subst \#define|FREETYPE_MINOR|,$(space),$(work)) |
michael@0 | 288 | work := $(word 2,$(work)) |
michael@0 | 289 | minor := $(subst |,$(space),$(work)) |
michael@0 | 290 | minor := $(firstword $(minor)) |
michael@0 | 291 | |
michael@0 | 292 | work := $(subst \#define|FREETYPE_PATCH|,$(space),$(work)) |
michael@0 | 293 | work := $(word 2,$(work)) |
michael@0 | 294 | patch := $(subst |,$(space),$(work)) |
michael@0 | 295 | patch := $(firstword $(patch)) |
michael@0 | 296 | |
michael@0 | 297 | version := $(major).$(minor).$(patch) |
michael@0 | 298 | endif |
michael@0 | 299 | |
michael@0 | 300 | # We write-protect the docmaker directory to suppress generation |
michael@0 | 301 | # of .pyc files. |
michael@0 | 302 | # |
michael@0 | 303 | refdoc: |
michael@0 | 304 | -chmod -w $(SRC_DIR)/tools/docmaker |
michael@0 | 305 | python $(SRC_DIR)/tools/docmaker/docmaker.py \ |
michael@0 | 306 | --prefix=ft2 \ |
michael@0 | 307 | --title=FreeType-$(version) \ |
michael@0 | 308 | --output=$(DOC_DIR) \ |
michael@0 | 309 | $(PUBLIC_DIR)/*.h \ |
michael@0 | 310 | $(PUBLIC_DIR)/config/*.h \ |
michael@0 | 311 | $(PUBLIC_DIR)/cache/*.h |
michael@0 | 312 | -chmod +w $(SRC_DIR)/tools/docmaker |
michael@0 | 313 | |
michael@0 | 314 | |
michael@0 | 315 | .PHONY: clean_project_std distclean_project_std |
michael@0 | 316 | |
michael@0 | 317 | # Standard cleaning and distclean rules. These are not accepted |
michael@0 | 318 | # on all systems though. |
michael@0 | 319 | # |
michael@0 | 320 | clean_project_std: |
michael@0 | 321 | -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN) |
michael@0 | 322 | |
michael@0 | 323 | distclean_project_std: clean_project_std |
michael@0 | 324 | -$(DELETE) $(PROJECT_LIBRARY) |
michael@0 | 325 | -$(DELETE) *.orig *~ core *.core $(DISTCLEAN) |
michael@0 | 326 | |
michael@0 | 327 | |
michael@0 | 328 | .PHONY: clean_project_dos distclean_project_dos |
michael@0 | 329 | |
michael@0 | 330 | # The Dos command shell does not support very long list of arguments, so |
michael@0 | 331 | # we are stuck with wildcards. |
michael@0 | 332 | # |
michael@0 | 333 | # Don't break the command lines with \; this prevents the "del" command from |
michael@0 | 334 | # working correctly on Win9x. |
michael@0 | 335 | # |
michael@0 | 336 | clean_project_dos: |
michael@0 | 337 | -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR)/*.$O $(CLEAN) $(NO_OUTPUT)) |
michael@0 | 338 | |
michael@0 | 339 | distclean_project_dos: clean_project_dos |
michael@0 | 340 | -$(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY) $(DISTCLEAN) $(NO_OUTPUT)) |
michael@0 | 341 | |
michael@0 | 342 | |
michael@0 | 343 | .PHONY: remove_config_mk remove_ftmodule_h |
michael@0 | 344 | |
michael@0 | 345 | # Remove configuration file (used for distclean). |
michael@0 | 346 | # |
michael@0 | 347 | remove_config_mk: |
michael@0 | 348 | -$(DELETE) $(subst /,$(SEP),$(CONFIG_MK) $(NO_OUTPUT)) |
michael@0 | 349 | |
michael@0 | 350 | # Remove module list (used for distclean). |
michael@0 | 351 | # |
michael@0 | 352 | remove_ftmodule_h: |
michael@0 | 353 | -$(DELETE) $(subst /,$(SEP),$(FTMODULE_H) $(NO_OUTPUT)) |
michael@0 | 354 | |
michael@0 | 355 | |
michael@0 | 356 | .PHONY: clean distclean |
michael@0 | 357 | |
michael@0 | 358 | # The `config.mk' file must define `clean_freetype' and |
michael@0 | 359 | # `distclean_freetype'. Implementations may use to relay these to either |
michael@0 | 360 | # the `std' or `dos' versions from above, or simply provide their own |
michael@0 | 361 | # implementation. |
michael@0 | 362 | # |
michael@0 | 363 | clean: clean_project |
michael@0 | 364 | distclean: distclean_project remove_config_mk remove_ftmodule_h |
michael@0 | 365 | -$(DELETE) $(subst /,$(SEP),$(DOC_DIR)/*.html $(NO_OUTPUT)) |
michael@0 | 366 | |
michael@0 | 367 | |
michael@0 | 368 | # EOF |