David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 1 | # |
| 2 | # FreeType build system -- top-level sub-Makefile |
| 3 | # |
| 4 | |
Werner Lemberg | 47a5f41 | 2000-10-17 03:38:43 +0000 | [diff] [blame] | 5 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 6 | # Copyright 1996-2000, 2001, 2003, 2006 by |
Werner Lemberg | 47a5f41 | 2000-10-17 03:38:43 +0000 | [diff] [blame] | 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. |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 14 | |
| 15 | |
| 16 | # This file is designed for GNU Make, do not use it with another Make tool! |
| 17 | # |
| 18 | # It works as follows: |
| 19 | # |
Werner Lemberg | 1639c79 | 2006-05-06 16:44:58 +0000 | [diff] [blame] | 20 | # - When invoked for the first time, this Makefile includes the rules found |
| 21 | # in `PROJECT/builds/detect.mk'. They are in charge of detecting the |
| 22 | # current platform. |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 23 | # |
Werner Lemberg | 1639c79 | 2006-05-06 16:44:58 +0000 | [diff] [blame] | 24 | # A summary of the detection is displayed, and the file `config.mk' is |
| 25 | # created in the current directory. |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 26 | # |
Werner Lemberg | 1639c79 | 2006-05-06 16:44:58 +0000 | [diff] [blame] | 27 | # - When invoked later, this Makefile includes the rules found in |
| 28 | # `config.mk'. This sub-Makefile defines some system-specific variables |
| 29 | # (like compiler, compilation flags, object suffix, etc.), then includes |
| 30 | # the rules found in `PROJECT/builds/PROJECT.mk', used to build the |
| 31 | # library. |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 32 | # |
| 33 | # See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more |
| 34 | # details on host platform detection and library builds. |
| 35 | |
| 36 | |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 37 | .PHONY: all dist distclean modules setup |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 38 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 39 | |
Werner Lemberg | 91481f8 | 2000-11-04 23:41:02 +0000 | [diff] [blame] | 40 | # The `space' variable is used to avoid trailing spaces in defining the |
| 41 | # `T' variable later. |
| 42 | # |
| 43 | empty := |
| 44 | space := $(empty) $(empty) |
| 45 | |
| 46 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 47 | # The main configuration file, defining the `XXX_MODULES' variables. We |
| 48 | # prefer a `modules.cfg' file in OBJ_DIR over TOP_DIR. |
| 49 | # |
| 50 | ifndef MODULES_CFG |
| 51 | MODULES_CFG := $(TOP_DIR)/modules.cfg |
| 52 | ifneq ($(wildcard $(OBJ_DIR)/modules.cfg),) |
| 53 | MODULES_CFG := $(OBJ_DIR)/modules.cfg |
| 54 | endif |
| 55 | endif |
| 56 | |
| 57 | |
| 58 | # FTMODULE_H, as its name suggests, indicates where the FreeType module |
Werner Lemberg | 1639c79 | 2006-05-06 16:44:58 +0000 | [diff] [blame] | 59 | # class file resides. |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 60 | # |
Werner Lemberg | 8a4de0d | 2006-02-01 07:52:11 +0000 | [diff] [blame] | 61 | FTMODULE_H ?= $(OBJ_DIR)/ftmodule.h |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 62 | |
| 63 | |
| 64 | include $(MODULES_CFG) |
| 65 | |
| 66 | |
| 67 | # The list of modules we are using. |
| 68 | # |
| 69 | MODULES := $(FONT_MODULES) \ |
| 70 | $(HINTING_MODULES) \ |
| 71 | $(RASTER_MODULES) \ |
| 72 | $(AUX_MODULES) |
| 73 | |
| 74 | |
Werner Lemberg | 8a4de0d | 2006-02-01 07:52:11 +0000 | [diff] [blame] | 75 | CONFIG_MK ?= config.mk |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 76 | |
| 77 | # If no configuration sub-makefile is present, or if `setup' is the target |
| 78 | # to be built, run the auto-detection rules to figure out which |
| 79 | # configuration rules file to use. |
| 80 | # |
| 81 | # Note that the configuration file is put in the current directory, which is |
Werner Lemberg | 89df58f | 2002-06-14 08:09:25 +0000 | [diff] [blame] | 82 | # not necessarily $(TOP_DIR). |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 83 | |
| 84 | # If `config.mk' is not present, set `check_platform'. |
| 85 | # |
| 86 | ifeq ($(wildcard $(CONFIG_MK)),) |
| 87 | check_platform := 1 |
| 88 | endif |
| 89 | |
| 90 | # If `setup' is one of the targets requested, set `check_platform'. |
| 91 | # |
| 92 | ifneq ($(findstring setup,$(MAKECMDGOALS)),) |
| 93 | check_platform := 1 |
| 94 | endif |
| 95 | |
| 96 | # Include the automatic host platform detection rules when we need to |
| 97 | # check the platform. |
| 98 | # |
| 99 | ifdef check_platform |
| 100 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 101 | all modules: setup |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 102 | |
Werner Lemberg | 89df58f | 2002-06-14 08:09:25 +0000 | [diff] [blame] | 103 | include $(TOP_DIR)/builds/detect.mk |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 104 | |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 105 | # This rule makes sense for Unix only to remove files created by a run |
| 106 | # of the configure script which hasn't been successful (so that no |
| 107 | # `config.mk' has been created). It uses the built-in $(RM) command of |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 108 | # GNU make. Similarly, `nul' is created if e.g. `make setup win32' has |
| 109 | # been erroneously used. |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 110 | # |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 111 | # Note: This test is duplicated in `builds/unix/detect.mk'. |
Werner Lemberg | a64c55b | 2001-05-12 06:40:50 +0000 | [diff] [blame] | 112 | # |
Werner Lemberg | 858f310 | 2003-06-09 04:46:30 +0000 | [diff] [blame] | 113 | is_unix := $(strip $(wildcard /sbin/init) \ |
| 114 | $(wildcard /usr/sbin/init) \ |
| 115 | $(wildcard /hurd/auth)) |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 116 | ifneq ($(is_unix),) |
| 117 | |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 118 | distclean: |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 119 | $(RM) builds/unix/config.cache |
| 120 | $(RM) builds/unix/config.log |
| 121 | $(RM) builds/unix/config.status |
| 122 | $(RM) builds/unix/unix-def.mk |
| 123 | $(RM) builds/unix/unix-cc.mk |
Werner Lemberg | 5e3614f | 2003-09-12 19:38:13 +0000 | [diff] [blame] | 124 | $(RM) builds/unix/freetype2.pc |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 125 | $(RM) nul |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 126 | |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 127 | endif # test is_unix |
| 128 | |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 129 | # IMPORTANT: |
| 130 | # |
| 131 | # `setup' must be defined by the host platform detection rules to create |
| 132 | # the `config.mk' file in the current directory. |
| 133 | |
| 134 | else |
| 135 | |
| 136 | # A configuration sub-Makefile is present -- simply run it. |
| 137 | # |
| 138 | all: single |
| 139 | |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 140 | BUILD_PROJECT := yes |
| 141 | include $(CONFIG_MK) |
| 142 | |
| 143 | endif # test check_platform |
| 144 | |
Werner Lemberg | 858f310 | 2003-06-09 04:46:30 +0000 | [diff] [blame] | 145 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 146 | # We always need the list of modules in ftmodule.h. |
| 147 | # |
| 148 | all setup: $(FTMODULE_H) |
| 149 | |
| 150 | |
| 151 | # The `modules' target unconditionally rebuilds the module list. |
| 152 | # |
| 153 | modules: |
| 154 | $(FTMODULE_H_INIT) |
| 155 | $(FTMODULE_H_CREATE) |
| 156 | $(FTMODULE_H_DONE) |
| 157 | |
| 158 | include $(TOP_DIR)/builds/modules.mk |
| 159 | |
| 160 | |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 161 | # This target builds the tarballs. |
| 162 | # |
| 163 | # Not to be run by a normal user -- there are no attempts to make it |
| 164 | # generic. |
| 165 | |
Werner Lemberg | 4e1d6c0 | 2006-12-09 08:20:37 +0000 | [diff] [blame^] | 166 | ifneq ($(findstring dist,$(MAKECMDGOALS)),) |
| 167 | FT_H := include/freetype/freetype.h |
| 168 | |
| 169 | major := $(shell sed -n 's/.*FREETYPE_MAJOR.*\([0-9]\+\)/\1/p' < $(FT_H)) |
| 170 | minor := $(shell sed -n 's/.*FREETYPE_MINOR.*\([0-9]\+\)/\1/p' < $(FT_H)) |
| 171 | patch := $(shell sed -n 's/.*FREETYPE_PATCH.*\([0-9]\+\)/\1/p' < $(FT_H)) |
| 172 | |
| 173 | version := $(major).$(minor).$(patch) |
| 174 | winversion := $(major)$(minor)$(patch) |
| 175 | endif |
| 176 | |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 177 | dist: |
| 178 | -rm -rf tmp |
Werner Lemberg | 4e1d6c0 | 2006-12-09 08:20:37 +0000 | [diff] [blame^] | 179 | rm -f freetype-$(version).tar.gz |
| 180 | rm -f freetype-$(version).tar.bz2 |
| 181 | rm -f ft$(winversion).zip |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 182 | |
| 183 | for d in `find . -wholename '*/CVS' -prune \ |
| 184 | -o -type f \ |
| 185 | -o -print` ; do \ |
| 186 | mkdir -p tmp/$$d ; \ |
| 187 | done ; |
| 188 | |
| 189 | currdir=`pwd` ; \ |
| 190 | for f in `find . -wholename '*/CVS' -prune \ |
| 191 | -o -name .cvsignore \ |
| 192 | -o -type d \ |
| 193 | -o -print` ; do \ |
| 194 | ln -s $$currdir/$$f tmp/$$f ; \ |
| 195 | done |
| 196 | |
| 197 | @# Prevent generation of .pyc files. Python follows (soft) links if |
| 198 | @# the link's directory is write protected, so we have temporarily |
| 199 | @# disable write access here too. |
| 200 | chmod -w src/tools/docmaker |
| 201 | |
| 202 | cd tmp ; \ |
| 203 | $(MAKE) devel ; \ |
| 204 | $(MAKE) do-dist |
| 205 | |
| 206 | chmod +w src/tools/docmaker |
| 207 | |
Werner Lemberg | 4e1d6c0 | 2006-12-09 08:20:37 +0000 | [diff] [blame^] | 208 | mv tmp freetype-$(version) |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 209 | |
Werner Lemberg | 4e1d6c0 | 2006-12-09 08:20:37 +0000 | [diff] [blame^] | 210 | tar cfh - freetype-$(version) \ |
| 211 | | gzip -c > freetype-$(version).tar.gz |
| 212 | tar cfh - freetype-$(version) \ |
| 213 | | bzip2 -c > freetype-$(version).tar.bz2 |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 214 | |
| 215 | @# Use CR/LF for zip files. |
Werner Lemberg | 4e1d6c0 | 2006-12-09 08:20:37 +0000 | [diff] [blame^] | 216 | zip -lr ft$(winversion).zip freetype-$(version) |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 217 | |
Werner Lemberg | 4e1d6c0 | 2006-12-09 08:20:37 +0000 | [diff] [blame^] | 218 | rm -fr freetype-$(version) |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 219 | |
| 220 | |
| 221 | # The locations of the latest `config.guess' and `config.sub' versions (from |
| 222 | # GNU `config' CVS), relative to the `tmp' directory used during `make dist'. |
| 223 | # |
| 224 | CONFIG_GUESS = ../../../config/config.guess |
| 225 | CONFIG_SUB = ../../../config/config.sub |
| 226 | |
| 227 | |
| 228 | # Don't say `make do-dist'. Always use `make dist' instead. |
| 229 | # |
| 230 | .PHONY: do-dist |
| 231 | |
| 232 | do-dist: distclean refdoc |
| 233 | @# Without removing the files, `autoconf' and friends follow links. |
| 234 | rm -f builds/unix/aclocal.m4 |
Werner Lemberg | 3d69a19 | 2006-05-10 13:47:22 +0000 | [diff] [blame] | 235 | rm -f builds/unix/configure.ac |
| 236 | rm -f builds/unix/configure |
Werner Lemberg | e0d1559 | 2006-05-10 13:44:47 +0000 | [diff] [blame] | 237 | |
| 238 | sh autogen.sh |
| 239 | rm -rf builds/unix/autom4te.cache |
| 240 | |
| 241 | cp $(CONFIG_GUESS) builds/unix |
| 242 | cp $(CONFIG_SUB) builds/unix |
| 243 | |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 244 | # EOF |