michael@0: # michael@0: # FreeType build system -- top-level sub-Makefile michael@0: # michael@0: michael@0: michael@0: # Copyright 1996-2001, 2003, 2006, 2008-2010, 2012-2014 by michael@0: # David Turner, Robert Wilhelm, and Werner Lemberg. michael@0: # michael@0: # This file is part of the FreeType project, and may only be used, modified, michael@0: # and distributed under the terms of the FreeType project license, michael@0: # LICENSE.TXT. By continuing to use, modify, or distribute this file you michael@0: # indicate that you have read the license and understand and accept it michael@0: # fully. michael@0: michael@0: michael@0: # This file is designed for GNU Make, do not use it with another Make tool! michael@0: # michael@0: # It works as follows: michael@0: # michael@0: # - When invoked for the first time, this Makefile includes the rules found michael@0: # in `PROJECT/builds/detect.mk'. They are in charge of detecting the michael@0: # current platform. michael@0: # michael@0: # A summary of the detection is displayed, and the file `config.mk' is michael@0: # created in the current directory. michael@0: # michael@0: # - When invoked later, this Makefile includes the rules found in michael@0: # `config.mk'. This sub-Makefile defines some system-specific variables michael@0: # (like compiler, compilation flags, object suffix, etc.), then includes michael@0: # the rules found in `PROJECT/builds/PROJECT.mk', used to build the michael@0: # library. michael@0: # michael@0: # See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more michael@0: # details on host platform detection and library builds. michael@0: michael@0: michael@0: # First of all, check whether we have `$(value ...)'. We do this by testing michael@0: # for `$(eval ...)' which has been introduced in the same GNU make version. michael@0: michael@0: eval_available := michael@0: $(eval eval_available := T) michael@0: ifneq ($(eval_available),T) michael@0: $(error FreeType's build system needs a Make program which supports $$(value)) michael@0: endif michael@0: michael@0: michael@0: .PHONY: all dist distclean modules setup michael@0: michael@0: michael@0: # The `space' variable is used to avoid trailing spaces in defining the michael@0: # `T' variable later. michael@0: # michael@0: empty := michael@0: space := $(empty) $(empty) michael@0: michael@0: michael@0: # The main configuration file, defining the `XXX_MODULES' variables. We michael@0: # prefer a `modules.cfg' file in OBJ_DIR over TOP_DIR. michael@0: # michael@0: ifndef MODULES_CFG michael@0: MODULES_CFG := $(TOP_DIR)/modules.cfg michael@0: ifneq ($(wildcard $(OBJ_DIR)/modules.cfg),) michael@0: MODULES_CFG := $(OBJ_DIR)/modules.cfg michael@0: endif michael@0: endif michael@0: michael@0: michael@0: # FTMODULE_H, as its name suggests, indicates where the FreeType module michael@0: # class file resides. michael@0: # michael@0: FTMODULE_H ?= $(OBJ_DIR)/ftmodule.h michael@0: michael@0: michael@0: include $(MODULES_CFG) michael@0: michael@0: michael@0: # The list of modules we are using. michael@0: # michael@0: MODULES := $(FONT_MODULES) \ michael@0: $(HINTING_MODULES) \ michael@0: $(RASTER_MODULES) \ michael@0: $(AUX_MODULES) michael@0: michael@0: michael@0: CONFIG_MK ?= config.mk michael@0: michael@0: # If no configuration sub-makefile is present, or if `setup' is the target michael@0: # to be built, run the auto-detection rules to figure out which michael@0: # configuration rules file to use. michael@0: # michael@0: # Note that the configuration file is put in the current directory, which is michael@0: # not necessarily $(TOP_DIR). michael@0: michael@0: # If `config.mk' is not present, set `check_platform'. michael@0: # michael@0: ifeq ($(wildcard $(CONFIG_MK)),) michael@0: check_platform := 1 michael@0: endif michael@0: michael@0: # If `setup' is one of the targets requested, set `check_platform'. michael@0: # michael@0: ifneq ($(findstring setup,$(MAKECMDGOALS)),) michael@0: check_platform := 1 michael@0: endif michael@0: michael@0: # Include the automatic host platform detection rules when we need to michael@0: # check the platform. michael@0: # michael@0: ifdef check_platform michael@0: michael@0: all modules: setup michael@0: michael@0: include $(TOP_DIR)/builds/detect.mk michael@0: michael@0: # This rule makes sense for Unix only to remove files created by a run of michael@0: # the configure script which hasn't been successful (so that no michael@0: # `config.mk' has been created). It uses the built-in $(RM) command of michael@0: # GNU make. Similarly, `nul' is created if e.g. `make setup windows' has michael@0: # been erroneously used. michael@0: # michael@0: # Note: This test is duplicated in `builds/unix/detect.mk'. michael@0: # michael@0: is_unix := $(strip $(wildcard /sbin/init) \ michael@0: $(wildcard /usr/sbin/init) \ michael@0: $(wildcard /dev/null) \ michael@0: $(wildcard /hurd/auth)) michael@0: ifneq ($(is_unix),) michael@0: michael@0: distclean: michael@0: $(RM) builds/unix/config.cache michael@0: $(RM) builds/unix/config.log michael@0: $(RM) builds/unix/config.status michael@0: $(RM) builds/unix/unix-def.mk michael@0: $(RM) builds/unix/unix-cc.mk michael@0: $(RM) builds/unix/freetype2.pc michael@0: $(RM) nul michael@0: michael@0: endif # test is_unix michael@0: michael@0: # IMPORTANT: michael@0: # michael@0: # `setup' must be defined by the host platform detection rules to create michael@0: # the `config.mk' file in the current directory. michael@0: michael@0: else michael@0: michael@0: # A configuration sub-Makefile is present -- simply run it. michael@0: # michael@0: all: single michael@0: michael@0: BUILD_PROJECT := yes michael@0: include $(CONFIG_MK) michael@0: michael@0: endif # test check_platform michael@0: michael@0: michael@0: # We always need the list of modules in ftmodule.h. michael@0: # michael@0: all setup: $(FTMODULE_H) michael@0: michael@0: michael@0: # The `modules' target unconditionally rebuilds the module list. michael@0: # michael@0: modules: michael@0: $(FTMODULE_H_INIT) michael@0: $(FTMODULE_H_CREATE) michael@0: $(FTMODULE_H_DONE) michael@0: michael@0: include $(TOP_DIR)/builds/modules.mk michael@0: michael@0: michael@0: # This target builds the tarballs. michael@0: # michael@0: # Not to be run by a normal user -- there are no attempts to make it michael@0: # generic. michael@0: michael@0: # we check for `dist', not `distclean' michael@0: ifneq ($(findstring distx,$(MAKECMDGOALS)x),) michael@0: FT_H := include/freetype.h michael@0: michael@0: major := $(shell sed -n 's/.*FREETYPE_MAJOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) michael@0: minor := $(shell sed -n 's/.*FREETYPE_MINOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) michael@0: patch := $(shell sed -n 's/.*FREETYPE_PATCH[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) michael@0: michael@0: version := $(major).$(minor).$(patch) michael@0: winversion := $(major)$(minor)$(patch) michael@0: endif michael@0: michael@0: dist: michael@0: -rm -rf tmp michael@0: rm -f freetype-$(version).tar.gz michael@0: rm -f freetype-$(version).tar.bz2 michael@0: rm -f ft$(winversion).zip michael@0: michael@0: for d in `find . -wholename '*/.git' -prune \ michael@0: -o -type f \ michael@0: -o -print` ; do \ michael@0: mkdir -p tmp/$$d ; \ michael@0: done ; michael@0: michael@0: currdir=`pwd` ; \ michael@0: for f in `find . -wholename '*/.git' -prune \ michael@0: -o -name .gitignore \ michael@0: -o -name .mailmap \ michael@0: -o -type d \ michael@0: -o -print` ; do \ michael@0: ln -s $$currdir/$$f tmp/$$f ; \ michael@0: done michael@0: michael@0: @# Prevent generation of .pyc files. Python follows (soft) links if michael@0: @# the link's directory is write protected, so we have temporarily michael@0: @# disable write access here too. michael@0: chmod -w src/tools/docmaker michael@0: michael@0: cd tmp ; \ michael@0: $(MAKE) devel ; \ michael@0: $(MAKE) do-dist michael@0: michael@0: chmod +w src/tools/docmaker michael@0: michael@0: mv tmp freetype-$(version) michael@0: michael@0: tar cfh - freetype-$(version) \ michael@0: | gzip -9 -c > freetype-$(version).tar.gz michael@0: tar cfh - freetype-$(version) \ michael@0: | bzip2 -c > freetype-$(version).tar.bz2 michael@0: michael@0: @# Use CR/LF for zip files. michael@0: zip -lr9 ft$(winversion).zip freetype-$(version) michael@0: michael@0: rm -fr freetype-$(version) michael@0: michael@0: michael@0: # The locations of the latest `config.guess' and `config.sub' versions (from michael@0: # GNU `config' git repository), relative to the `tmp' directory used during michael@0: # `make dist'. michael@0: # michael@0: CONFIG_GUESS = ~/git/config/config.guess michael@0: CONFIG_SUB = ~/git/config/config.sub michael@0: michael@0: michael@0: # Don't say `make do-dist'. Always use `make dist' instead. michael@0: # michael@0: .PHONY: do-dist michael@0: michael@0: do-dist: distclean refdoc michael@0: @# Without removing the files, `autoconf' and friends follow links. michael@0: rm -f builds/unix/aclocal.m4 michael@0: rm -f builds/unix/configure.ac michael@0: rm -f builds/unix/configure michael@0: michael@0: sh autogen.sh michael@0: rm -rf builds/unix/autom4te.cache michael@0: michael@0: cp $(CONFIG_GUESS) builds/unix michael@0: cp $(CONFIG_SUB) builds/unix michael@0: michael@0: # EOF