1#
2# FreeType 2 configuration rules templates for Unix + configure
3#
4
5
6# Copyright 1996-2018 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
15SHELL := @SHELL@
16
17TOP_DIR := $(shell cd $(TOP_DIR); pwd)
18
19DELETE := rm -f
20DELDIR := rm -rf
21CAT    := cat
22SEP    := /
23
24# this is used for `make distclean' and `make install'
25OBJ_BUILD ?= $(BUILD_DIR)
26
27# don't use `:=' here since the path stuff will be included after this file
28#
29FTSYS_SRC = @FTSYS_SRC@
30
31INSTALL         := @INSTALL@
32INSTALL_DATA    := @INSTALL_DATA@
33INSTALL_PROGRAM := @INSTALL_PROGRAM@
34INSTALL_SCRIPT  := @INSTALL_SCRIPT@
35MKINSTALLDIRS   := @MKDIR_P@
36
37CLEAN += $(OBJ_BUILD)/freetype-config \
38         $(OBJ_BUILD)/freetype2.pc
39
40DISTCLEAN += $(OBJ_BUILD)/config.cache  \
41             $(OBJ_BUILD)/config.log    \
42             $(OBJ_BUILD)/config.status \
43             $(OBJ_BUILD)/unix-def.mk   \
44             $(OBJ_BUILD)/unix-cc.mk    \
45             $(OBJ_BUILD)/ftconfig.h    \
46             $(OBJ_BUILD)/ftoption.h    \
47             $(LIBTOOL)                 \
48             $(OBJ_BUILD)/Makefile
49
50
51# Standard installation variables.
52#
53prefix       := @prefix@
54exec_prefix  := @exec_prefix@
55libdir       := @libdir@
56bindir       := @bindir@
57includedir   := @includedir@
58datarootdir  := @datarootdir@
59datadir      := @datadir@
60mandir       := @mandir@
61
62version_info := @version_info@
63
64# Variables needed for `freetype-config' and `freetype.pc'.
65#
66PKG_CONFIG         := @PKG_CONFIG@
67REQUIRES_PRIVATE   := @REQUIRES_PRIVATE@
68LIBS_PRIVATE       := @LIBS_PRIVATE@
69LIBSSTATIC_CONFIG  := @LIBSSTATIC_CONFIG@
70build_libtool_libs := @build_libtool_libs@
71ft_version         := @ft_version@
72
73# The directory where all library files are placed.
74#
75# By default, this is the same as $(OBJ_DIR); however, this can be changed
76# to suit particular needs.
77#
78LIB_DIR := $(OBJ_DIR)
79
80# The BASE_SRC macro lists all source files that should be included in
81# src/base/ftbase.c.  When configure sets up CFLAGS to build ftmac.c,
82# ftmac.c should be added to BASE_SRC.
83ftmac_c := @ftmac_c@
84
85# The SYSTEM_ZLIB macro is defined if the user wishes to link dynamically
86# with its system wide zlib. If SYSTEM_ZLIB is 'yes', the zlib part of the
87# ftgzip module is not compiled in.
88SYSTEM_ZLIB := @SYSTEM_ZLIB@
89
90
91# The NO_OUTPUT macro is appended to command lines in order to ignore
92# the output of some programs.
93#
94NO_OUTPUT := 2> /dev/null
95
96
97# To support calls like
98#
99#   configure --includedir='${libdir}'/freetype2/include
100#
101# we generate `freetype-config' and `freetype.pc' at compile time so that
102# those variables are properly expanded.
103
104$(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in
105	rm -f $@ $@.tmp
106	sed -e 's|%LIBSSTATIC_CONFIG%|$(LIBSSTATIC_CONFIG)|'   \
107	    -e 's|%PKG_CONFIG%|$(PKG_CONFIG)|'                 \
108	    -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
109	    -e 's|%exec_prefix%|$(exec_prefix)|'               \
110	    -e 's|%ft_version%|$(ft_version)|'                 \
111	    -e 's|%includedir%|$(includedir)|'                 \
112	    -e 's|%libdir%|$(libdir)|'                         \
113	    -e 's|%prefix%|$(prefix)|'                         \
114	    $<                                                 \
115	    > $@.tmp
116	chmod +x $@.tmp
117	chmod go-w $@.tmp
118	mv $@.tmp $@
119
120# To support directory names with spaces (as might easily happen on Windows
121# platforms), the right solution would be to surround the pkg-variables in
122# `freetype2.pc' with double quotes.  However, doing so ironically disables
123# the prefix override mechanism especially written for Windows.  This is a
124# bug in pkg-config version 0.28 and earlier.
125#
126# For this reason, we escape spaces with backslashes.
127
128exec_prefix_x := $(subst $(space),\\$(space),$(exec_prefix))
129includedir_x  := $(subst $(space),\\$(space),$(includedir))
130libdir_x      := $(subst $(space),\\$(space),$(libdir))
131prefix_x      := $(subst $(space),\\$(space),$(prefix))
132
133$(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in
134	rm -f $@ $@.tmp
135	sed -e 's|%REQUIRES_PRIVATE%|$(REQUIRES_PRIVATE)|'     \
136	    -e 's|%LIBS_PRIVATE%|$(LIBS_PRIVATE)|'             \
137	    -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
138	    -e 's|%exec_prefix%|$(exec_prefix_x)|'             \
139	    -e 's|%ft_version%|$(ft_version)|'                 \
140	    -e 's|%includedir%|$(includedir_x)|'               \
141	    -e 's|%libdir%|$(libdir_x)|'                       \
142	    -e 's|%prefix%|$(prefix_x)|'                       \
143	    $<                                                 \
144	    > $@.tmp
145	chmod a-w $@.tmp
146	mv $@.tmp $@
147
148all install: $(OBJ_BUILD)/freetype-config \
149     $(OBJ_BUILD)/freetype2.pc
150
151# EOF
152