modules/freetype2/builds/freetype.mk

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/freetype2/builds/freetype.mk	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,368 @@
     1.4 +#
     1.5 +# FreeType 2 library sub-Makefile
     1.6 +#
     1.7 +
     1.8 +
     1.9 +# Copyright 1996-2006, 2008, 2013, 2014 by
    1.10 +# David Turner, Robert Wilhelm, and Werner Lemberg.
    1.11 +#
    1.12 +# This file is part of the FreeType project, and may only be used, modified,
    1.13 +# and distributed under the terms of the FreeType project license,
    1.14 +# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
    1.15 +# indicate that you have read the license and understand and accept it
    1.16 +# fully.
    1.17 +
    1.18 +
    1.19 +# DO NOT INVOKE THIS MAKEFILE DIRECTLY!  IT IS MEANT TO BE INCLUDED BY
    1.20 +# OTHER MAKEFILES.
    1.21 +
    1.22 +
    1.23 +# The following variables (set by other Makefile components, in the
    1.24 +# environment, or on the command line) are used:
    1.25 +#
    1.26 +#   BUILD_DIR      The architecture dependent directory,
    1.27 +#                  e.g. `$(TOP_DIR)/builds/unix'.  Added to INCLUDES also.
    1.28 +#
    1.29 +#   OBJ_DIR        The directory in which object files are created.
    1.30 +#
    1.31 +#   LIB_DIR        The directory in which the library is created.
    1.32 +#
    1.33 +#   DOC_DIR        The directory in which the API reference is created.
    1.34 +#
    1.35 +#   INCLUDES       A list of directories to be included additionally.
    1.36 +#
    1.37 +#   DEVEL_DIR      Development directory which is added to the INCLUDES
    1.38 +#                  variable before the standard include directories.
    1.39 +#
    1.40 +#   CFLAGS         Compilation flags.  This overrides the default settings
    1.41 +#                  in the platform-specific configuration files.
    1.42 +#
    1.43 +#   FTSYS_SRC      If set, its value is used as the name of a replacement
    1.44 +#                  file for `src/base/ftsystem.c'.
    1.45 +#
    1.46 +#   FTDEBUG_SRC    If set, its value is used as the name of a replacement
    1.47 +#                  file for `src/base/ftdebug.c'.  [For a normal build, this
    1.48 +#                  file does nothing.]
    1.49 +#
    1.50 +#   FTMODULE_H     The file which contains the list of module classes for
    1.51 +#                  the current build.  Usually, this is automatically
    1.52 +#                  created by `modules.mk'.
    1.53 +#
    1.54 +#   BASE_OBJ_S
    1.55 +#   BASE_OBJ_M     A list of base objects (for single object and multiple
    1.56 +#                  object builds, respectively).  Set up in
    1.57 +#                  `src/base/rules.mk'.
    1.58 +#
    1.59 +#   BASE_EXT_OBJ   A list of base extension objects.  Set up in
    1.60 +#                  `src/base/rules.mk'.
    1.61 +#
    1.62 +#   DRV_OBJ_S
    1.63 +#   DRV_OBJ_M      A list of driver objects (for single object and multiple
    1.64 +#                  object builds, respectively).  Set up cumulatively in
    1.65 +#                  `src/<driver>/rules.mk'.
    1.66 +#
    1.67 +#   CLEAN
    1.68 +#   DISTCLEAN      The sub-makefiles can append additional stuff to these two
    1.69 +#                  variables which is to be removed for the `clean' resp.
    1.70 +#                  `distclean' target.
    1.71 +#
    1.72 +#   TOP_DIR, SEP,
    1.73 +#   COMPILER_SEP,
    1.74 +#   LIBRARY, CC,
    1.75 +#   A, I, O, T     Check `config.mk' for details.
    1.76 +
    1.77 +
    1.78 +# The targets `objects' and `library' are defined at the end of this
    1.79 +# Makefile after all other rules have been included.
    1.80 +#
    1.81 +.PHONY: single multi objects library refdoc
    1.82 +
    1.83 +# default target -- build single objects and library
    1.84 +#
    1.85 +single: objects library
    1.86 +
    1.87 +# `multi' target -- build multiple objects and library
    1.88 +#
    1.89 +multi: objects library
    1.90 +
    1.91 +
    1.92 +# The FreeType source directory, usually `./src'.
    1.93 +#
    1.94 +SRC_DIR := $(TOP_DIR)/src
    1.95 +
    1.96 +# The directory where the base layer components are placed, usually
    1.97 +# `./src/base'.
    1.98 +#
    1.99 +BASE_DIR := $(SRC_DIR)/base
   1.100 +
   1.101 +# Other derived directories.
   1.102 +#
   1.103 +PUBLIC_DIR   := $(TOP_DIR)/include
   1.104 +INTERNAL_DIR := $(PUBLIC_DIR)/internal
   1.105 +SERVICES_DIR := $(INTERNAL_DIR)/services
   1.106 +CONFIG_DIR   := $(PUBLIC_DIR)/config
   1.107 +
   1.108 +# The documentation directory.
   1.109 +#
   1.110 +DOC_DIR ?= $(TOP_DIR)/docs/reference
   1.111 +
   1.112 +# The final name of the library file.
   1.113 +#
   1.114 +PROJECT_LIBRARY := $(LIB_DIR)/$(LIBRARY).$A
   1.115 +
   1.116 +
   1.117 +# include paths
   1.118 +#
   1.119 +# IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed
   1.120 +#                 before the standard include list.  Porters are then able to
   1.121 +#                 put their own version of some of the FreeType components
   1.122 +#                 in the `builds/<system>' directory, as these files will
   1.123 +#                 override the default sources.
   1.124 +#
   1.125 +INCLUDES := $(subst /,$(COMPILER_SEP),$(OBJ_DIR) \
   1.126 +                                      $(DEVEL_DIR) \
   1.127 +                                      $(BUILD_DIR) \
   1.128 +                                      $(TOP_DIR)/include)
   1.129 +
   1.130 +INCLUDE_FLAGS := $(INCLUDES:%=$I%)
   1.131 +
   1.132 +ifdef DEVEL_DIR
   1.133 +  # We assume that all library dependencies for FreeType are fulfilled for a
   1.134 +  # development build, so we directly access the necessary include directory
   1.135 +  # information using `pkg-config'.
   1.136 +  INCLUDE_FLAGS += $(shell pkg-config --cflags libpng \
   1.137 +                                               harfbuzz )
   1.138 +endif
   1.139 +
   1.140 +
   1.141 +# C flags used for the compilation of an object file.  This must include at
   1.142 +# least the paths for the `base' and `builds/<system>' directories;
   1.143 +# debug/optimization/warning flags + ansi compliance if needed.
   1.144 +#
   1.145 +# $(INCLUDE_FLAGS) should come before $(CFLAGS) to avoid problems with
   1.146 +# old FreeType versions.
   1.147 +#
   1.148 +# Note what we also define the macro FT2_BUILD_LIBRARY when building
   1.149 +# FreeType.  This is required to let our sources include the internal
   1.150 +# headers (something forbidden by clients).
   1.151 +#
   1.152 +# Finally, we define FT_CONFIG_MODULES_H so that the compiler uses the
   1.153 +# generated version of `ftmodule.h' in $(OBJ_DIR).  If there is an
   1.154 +# `ftoption.h' files in $(OBJ_DIR), define FT_CONFIG_OPTIONS_H too.
   1.155 +#
   1.156 +ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),)
   1.157 +  FTOPTION_H    := $(OBJ_DIR)/ftoption.h
   1.158 +  FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="<ftoption.h>"
   1.159 +endif
   1.160 +
   1.161 +# Note that a build with the `configure' script uses $(CFLAGS) only.
   1.162 +#
   1.163 +FT_CFLAGS  = $(CPPFLAGS) \
   1.164 +             $(INCLUDE_FLAGS) \
   1.165 +             $(CFLAGS) \
   1.166 +             $DFT2_BUILD_LIBRARY \
   1.167 +             $DFT_CONFIG_MODULES_H="<ftmodule.h>" \
   1.168 +             $(FTOPTION_FLAG)
   1.169 +FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
   1.170 +
   1.171 +
   1.172 +# Include the `exports' rules file.
   1.173 +#
   1.174 +include $(TOP_DIR)/builds/exports.mk
   1.175 +
   1.176 +
   1.177 +# Initialize the list of objects.
   1.178 +#
   1.179 +OBJECTS_LIST :=
   1.180 +
   1.181 +
   1.182 +# Define $(PUBLIC_H) as the list of all public header files located in
   1.183 +# `$(TOP_DIR)/include/freetype'.  $(INTERNAL_H), and $(CONFIG_H) are defined
   1.184 +# similarly.
   1.185 +#
   1.186 +# This is used to simplify the dependency rules -- if one of these files
   1.187 +# changes, the whole library is recompiled.
   1.188 +#
   1.189 +PUBLIC_H   := $(wildcard $(PUBLIC_DIR)/*.h)
   1.190 +INTERNAL_H := $(wildcard $(INTERNAL_DIR)/*.h) \
   1.191 +              $(wildcard $(SERVICES_DIR)/*.h)
   1.192 +CONFIG_H   := $(wildcard $(CONFIG_DIR)/*.h) \
   1.193 +              $(wildcard $(BUILD_DIR)/config/*.h) \
   1.194 +              $(FTMODULE_H) \
   1.195 +              $(FTOPTION_H)
   1.196 +DEVEL_H    := $(wildcard $(TOP_DIR)/devel/*.h)
   1.197 +
   1.198 +FREETYPE_H := $(PUBLIC_H) $(INTERNAL_H) $(CONFIG_H) $(DEVEL_H)
   1.199 +
   1.200 +
   1.201 +# ftsystem component
   1.202 +#
   1.203 +FTSYS_SRC ?= $(BASE_DIR)/ftsystem.c
   1.204 +
   1.205 +FTSYS_OBJ := $(OBJ_DIR)/ftsystem.$O
   1.206 +
   1.207 +OBJECTS_LIST += $(FTSYS_OBJ)
   1.208 +
   1.209 +$(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H)
   1.210 +	$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
   1.211 +
   1.212 +
   1.213 +# ftdebug component
   1.214 +#
   1.215 +FTDEBUG_SRC ?= $(BASE_DIR)/ftdebug.c
   1.216 +
   1.217 +FTDEBUG_OBJ := $(OBJ_DIR)/ftdebug.$O
   1.218 +
   1.219 +OBJECTS_LIST += $(FTDEBUG_OBJ)
   1.220 +
   1.221 +$(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H)
   1.222 +	$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
   1.223 +
   1.224 +
   1.225 +# Include all rule files from FreeType components.
   1.226 +#
   1.227 +include $(SRC_DIR)/base/rules.mk
   1.228 +include $(patsubst %,$(SRC_DIR)/%/rules.mk,$(MODULES))
   1.229 +
   1.230 +
   1.231 +# ftinit component
   1.232 +#
   1.233 +#   The C source `ftinit.c' contains the FreeType initialization routines.
   1.234 +#   It is able to automatically register one or more drivers when the API
   1.235 +#   function FT_Init_FreeType() is called.
   1.236 +#
   1.237 +#   The set of initial drivers is determined by the driver Makefiles
   1.238 +#   includes above.  Each driver Makefile updates the FTINIT_xxx lists
   1.239 +#   which contain additional include paths and macros used to compile the
   1.240 +#   single `ftinit.c' source.
   1.241 +#
   1.242 +FTINIT_SRC := $(BASE_DIR)/ftinit.c
   1.243 +FTINIT_OBJ := $(OBJ_DIR)/ftinit.$O
   1.244 +
   1.245 +OBJECTS_LIST += $(FTINIT_OBJ)
   1.246 +
   1.247 +$(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H)
   1.248 +	$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
   1.249 +
   1.250 +
   1.251 +# All FreeType library objects.
   1.252 +#
   1.253 +OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
   1.254 +OBJ_S := $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
   1.255 +
   1.256 +
   1.257 +# The target `multi' on the Make command line indicates that we want to
   1.258 +# compile each source file independently.
   1.259 +#
   1.260 +# Otherwise, each module/driver is compiled in a single object file through
   1.261 +# source file inclusion (see `src/base/ftbase.c' or
   1.262 +# `src/truetype/truetype.c' for examples).
   1.263 +#
   1.264 +BASE_OBJECTS := $(OBJECTS_LIST)
   1.265 +
   1.266 +ifneq ($(findstring multi,$(MAKECMDGOALS)),)
   1.267 +  OBJECTS_LIST += $(OBJ_M)
   1.268 +else
   1.269 +  OBJECTS_LIST += $(OBJ_S)
   1.270 +endif
   1.271 +
   1.272 +objects: $(OBJECTS_LIST)
   1.273 +
   1.274 +library: $(PROJECT_LIBRARY)
   1.275 +
   1.276 +.c.$O:
   1.277 +	$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
   1.278 +
   1.279 +
   1.280 +ifneq ($(findstring refdoc,$(MAKECMDGOALS)),)
   1.281 +  # poor man's `sed' emulation with make's built-in string functions
   1.282 +  work := $(strip $(shell $(CAT) $(PUBLIC_DIR)/freetype.h))
   1.283 +  work := $(subst |,x,$(work))
   1.284 +  work := $(subst $(space),|,$(work))
   1.285 +  work := $(subst \#define|FREETYPE_MAJOR|,$(space),$(work))
   1.286 +  work := $(word 2,$(work))
   1.287 +  major := $(subst |,$(space),$(work))
   1.288 +  major := $(firstword $(major))
   1.289 +
   1.290 +  work := $(subst \#define|FREETYPE_MINOR|,$(space),$(work))
   1.291 +  work := $(word 2,$(work))
   1.292 +  minor := $(subst |,$(space),$(work))
   1.293 +  minor := $(firstword $(minor))
   1.294 +
   1.295 +  work := $(subst \#define|FREETYPE_PATCH|,$(space),$(work))
   1.296 +  work := $(word 2,$(work))
   1.297 +  patch := $(subst |,$(space),$(work))
   1.298 +  patch := $(firstword $(patch))
   1.299 +
   1.300 +  version := $(major).$(minor).$(patch)
   1.301 +endif
   1.302 +
   1.303 +# We write-protect the docmaker directory to suppress generation
   1.304 +# of .pyc files.
   1.305 +#
   1.306 +refdoc:
   1.307 +	-chmod -w $(SRC_DIR)/tools/docmaker
   1.308 +	python $(SRC_DIR)/tools/docmaker/docmaker.py \
   1.309 +               --prefix=ft2                          \
   1.310 +               --title=FreeType-$(version)           \
   1.311 +               --output=$(DOC_DIR)                   \
   1.312 +               $(PUBLIC_DIR)/*.h                     \
   1.313 +               $(PUBLIC_DIR)/config/*.h              \
   1.314 +               $(PUBLIC_DIR)/cache/*.h
   1.315 +	-chmod +w $(SRC_DIR)/tools/docmaker
   1.316 +
   1.317 +
   1.318 +.PHONY: clean_project_std distclean_project_std
   1.319 +
   1.320 +# Standard cleaning and distclean rules.  These are not accepted
   1.321 +# on all systems though.
   1.322 +#
   1.323 +clean_project_std:
   1.324 +	-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN)
   1.325 +
   1.326 +distclean_project_std: clean_project_std
   1.327 +	-$(DELETE) $(PROJECT_LIBRARY)
   1.328 +	-$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
   1.329 +
   1.330 +
   1.331 +.PHONY: clean_project_dos distclean_project_dos
   1.332 +
   1.333 +# The Dos command shell does not support very long list of arguments, so
   1.334 +# we are stuck with wildcards.
   1.335 +#
   1.336 +# Don't break the command lines with \; this prevents the "del" command from
   1.337 +# working correctly on Win9x.
   1.338 +#
   1.339 +clean_project_dos:
   1.340 +	-$(DELETE) $(subst /,$(SEP),$(OBJ_DIR)/*.$O $(CLEAN) $(NO_OUTPUT))
   1.341 +
   1.342 +distclean_project_dos: clean_project_dos
   1.343 +	-$(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY) $(DISTCLEAN) $(NO_OUTPUT))
   1.344 +
   1.345 +
   1.346 +.PHONY: remove_config_mk remove_ftmodule_h
   1.347 +
   1.348 +# Remove configuration file (used for distclean).
   1.349 +#
   1.350 +remove_config_mk:
   1.351 +	-$(DELETE) $(subst /,$(SEP),$(CONFIG_MK) $(NO_OUTPUT))
   1.352 +
   1.353 +# Remove module list (used for distclean).
   1.354 +#
   1.355 +remove_ftmodule_h:
   1.356 +	-$(DELETE) $(subst /,$(SEP),$(FTMODULE_H) $(NO_OUTPUT))
   1.357 +
   1.358 +
   1.359 +.PHONY: clean distclean
   1.360 +
   1.361 +# The `config.mk' file must define `clean_freetype' and
   1.362 +# `distclean_freetype'.  Implementations may use to relay these to either
   1.363 +# the `std' or `dos' versions from above, or simply provide their own
   1.364 +# implementation.
   1.365 +#
   1.366 +clean: clean_project
   1.367 +distclean: distclean_project remove_config_mk remove_ftmodule_h
   1.368 +	-$(DELETE) $(subst /,$(SEP),$(DOC_DIR)/*.html $(NO_OUTPUT))
   1.369 +
   1.370 +
   1.371 +# EOF

mercurial