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