1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
all: exes
####################################################################
#
# TOP is the directory where the main FreeType source is found,
# as well as the 'config.mk' file
#
# TOP2 is the directory is the top of the demonstration
# programs directory
#
ifndef TOP
TOP := ..
endif
ifndef TOP2
TOP2 := $(TOP)/demos
endif
######################################################################
#
# MY_CONFIG_MK points to the current "config.mk" to use. It is
# defined by default as $(TOP)/config.mk
#
ifndef CONFIG_MK
CONFIG_MK := $(TOP)/config.mk
endif
####################################################################
#
# Check that we have a working `config.mk' in the above directory.
# If not, issue a warning message, then stop there..
#
ifeq ($(wildcard $(CONFIG_MK)),)
no_config_mk := 1
endif
ifdef no_config_mk
exes:
@echo Please compile the library before the demo programs!
clean distclean:
@echo "I need \`$(TOP)/config.mk' to do that!"
else
####################################################################
#
# Good, now include the `config.mk' in order to know how to build
# object files from sources, as well as other things (compiler flags)
#
include $(CONFIG_MK)
####################################################################
#
# Define a few important variables now
#
TOP_ := $(TOP)$(SEP)
TOP2_ := $(TOP2)$(SEP)
SRC_ := $(TOP)$(SEP)src$(SEP)
BIN_ := bin$(SEP)
OBJ_ := obj$(SEP)
GRAPH_DIR := graph
ifeq ($(TOP),..)
SRC_DIR := src
else
SRC_DIR := $(TOP2_)src
endif
SRC_DIR_ := $(SRC_DIR)$(SEP)
FT_INCLUDES := $(BUILD) $(TOP_)config $(TOP_)include $(SRC_)base $(SRC_DIR)
TT_INCLUDES := $(SRC_)shared $(SRC_)truetype
T1_INCLUDES := $(SRC_)shared $(SRC_)type1
COMPILE = $(CC) $(CFLAGS) $(INCLUDES:%=$I%)
FTLIB := $(TOP_)$(LIB_DIR)$(SEP)$(LIBRARY).$A
# the default commands used to link the executables. These can
# be re-defined for platform-specific stuff..
#
LINK = $(CC) $T$@ $< $(FTLIB) $(EFENCE) $(LDFLAGS)
# the program "src/ftstring.c" used the math library which isn't linked
# with the program by default on Unix, we thus add it whenever appropriate
#
ifeq ($(PLATFORM),unix)
LINK += -lm
endif
COMMON_LINK = $(LINK) $(COMMON_OBJ)
GRAPH_LINK = $(COMMON_LINK) $(GRAPH_LIB)
GRAPH_LINK2 = $(GRAPH_LINK) $(EXTRA_GRAPH_OBJS)
.PHONY: exes clean distclean
###################################################################
#
# Include the rules needed to compile the graphics sub-system.
# This will also select which graphics driver to compile to the
# sub-system..
#
include $(GRAPH_DIR)/rules.mk
####################################################################
#
# Detect DOS-like platforms, currently DOS, Win 3.1, Win32 & OS/2
#
ifneq ($(findstring $(PLATFORM),os2 win16 win32 dos),)
DOSLIKE := 1
endif
###################################################################
#
# Clean-up rules. Because the `del' command on DOS-like platforms
# cannot take a long list of arguments, we simply erase the directory
# contents.
#
ifdef DOSLIKE
clean_demo:
-del obj\*.$O 2> nul
-del $(subst /,\,$(TOP2))\src\*.bak 2> nul
distclean_demo: clean_demo
-del obj\*.lib 2> nul
-del bin\*.exe 2> nul
else
clean_demo:
-$(DELETE) $(OBJ_)*.$O
-$(DELETE) $(SRC_)*.bak graph$(SEP)*.bak
-$(DELETE) $(SRC_)*~ graph$(SEP)*~
distclean_demo: clean_demo
-$(DELETE) $(EXES:%=$(BIN_)%$E)
-$(DELETE) $(GRAPH_LIB)
endif
clean: clean_demo
distclean: distclean_demo
####################################################################
#
# Compute the executable suffix to use, and put it in `E'.
# It is ".exe" on DOS-ish platforms, and nothing otherwise.
#
ifdef DOSLIKE
E := .exe
else
E :=
endif
###################################################################
#
# The list of demonstration programs to build.
#
# EXES := ftlint ftview fttimer compos ftstring memtest ftmulti
EXES := ftlint ftview fttimer ftstring memtest ftmulti
ifneq ($(findstring $(PLATFORM),os2 unix win32),)
EXES += ttdebug
endif
exes: $(EXES:%=$(BIN_)%$E)
INCLUDES := $(FT_INCLUDES)
####################################################################
#
# Rules for compiling object files for text-only demos
#
COMMON_OBJ := $(OBJ_)common.$O
$(COMMON_OBJ): $(SRC_DIR_)common.c
ifdef DOSLIKE
$(COMPILE) $T$@ $< $DEXPAND_WILDCARDS
else
$(COMPILE) $T$@ $<
endif
$(OBJ_)%.$O: $(SRC_DIR_)%.c $(FTLIB)
$(COMPILE) $T$@ $<
$(OBJ_)ftlint.$O: $(SRC_DIR_)ftlint.c
$(COMPILE) $T$@ $<
$(OBJ_)compos.$O: $(SRC_DIR_)compos.c
$(COMPILE) $T$@ $<
$(OBJ_)memtest.$O: $(SRC_DIR_)memtest.c
$(COMPILE) $T$@ $<
$(OBJ_)fttry.$O: $(SRC_DIR_)fttry.c
$(COMPILE) $T$@ $<
$(OBJ_)ftview.$O: $(SRC_DIR_)ftview.c $(GRAPH_LIB)
$(COMPILE) $(GRAPH_INCLUDES:%=$I%) $T$@ $<
$(OBJ_)ftmulti.$O: $(SRC_DIR_)ftmulti.c $(GRAPH_LIB)
$(COMPILE) $(GRAPH_INCLUDES:%=$I%) $T$@ $<
$(OBJ_)ftstring.$O: $(SRC_DIR_)ftstring.c $(GRAPH_LIB)
$(COMPILE) $(GRAPH_INCLUDES:%=$I%) $T$@ $<
$(OBJ_)fttimer.$O: $(SRC_DIR_)fttimer.c $(GRAPH_LIB)
$(COMPILE) $(GRAPH_INCLUDES:%=$I%) $T$@ $<
# $(OBJ_)ftsbit.$O: $(SRC_DIR)/ftsbit.c $(GRAPH_LIB)
# $(COMPILE) $T$@ $<
####################################################################
#
# Special rule to compile the `t1dump' program as it includes
# the Type1 source path
#
$(OBJ_)t1dump.$O: $(SRC_DIR)/t1dump.c
$(COMPILE) $(T1_INCLUDES:%=$I%) $T$@ $<
####################################################################
#
# Special rule to compile the `ttdebug' program as it includes
# the TrueType source path and needs extra flags for correct keyboard
# handling on Unix
# POSIX TERMIOS: Do not define if you use OLD U*ix like 4.2BSD.
#
# detect a Unix system
ifeq ($(PLATFORM),unix)
EXTRAFLAGS = $DUNIX $DHAVE_POSIX_TERMIOS
endif
$(OBJ_)ttdebug.$O: $(SRC_DIR)/ttdebug.c
$(COMPILE) $(TT_INCLUDES:%=$I%) $T$@ $< $(EXTRAFLAGS)
####################################################################
#
# Rules used to link the executables. Note that they could be
# over-ridden by system-specific things..
#
$(BIN_)ftlint$E: $(OBJ_)ftlint.$O $(FTLIB) $(COMMON_OBJ)
$(COMMON_LINK)
$(BIN_)memtest$E: $(OBJ_)memtest.$O $(FTLIB) $(COMMON_OBJ)
$(COMMON_LINK)
$(BIN_)compos$E: $(OBJ_)compos.$O $(FTLIB) $(COMMON_OBJ)
$(COMMON_LINK)
$(BIN_)fttry$E: $(OBJ_)fttry.$O $(FTLIB)
$(LINK)
$(BIN_)ftsbit$E: $(OBJ_)ftsbit.$O $(FTLIB)
$(LINK)
$(BIN_)t1dump$E: $(OBJ_)t1dump.$O $(FTLIB)
$(LINK)
$(BIN_)ttdebug$E: $(OBJ_)ttdebug.$O $(FTLIB)
$(LINK)
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(GRAPH_LINK)
$(BIN_)ftmulti$E: $(OBJ_)ftmulti.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(GRAPH_LINK)
$(BIN_)ftstring$E: $(OBJ_)ftstring.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(GRAPH_LINK)
$(BIN_)fttimer$E: $(OBJ_)fttimer.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(GRAPH_LINK)
endif
# EOF