revert between 56095 -> 55830 in arch
[AROS.git] / developer / debug / test / freetype / Makefile
blobdf8df50f0910bc287d75a82a1a1276e63448f71c
1 all: exes
4 ####################################################################
6 # The `space' variable is used to avoid trailing spaces in defining
7 # the `T' variable later.
9 empty :=
10 space := $(empty) $(empty)
13 ####################################################################
15 # TOP_DIR is the directory where the main FreeType source is found,
16 # as well as the `config.mk' file.
18 # TOP_DIR_2 is the directory is the top of the demonstration
19 # programs directory.
21 # OBJ_DIR gives the objects directory of the FreeType library.
23 TOP_DIR ?= ../freetype2
24 TOP_DIR_2 ?= .
25 OBJ_DIR ?= $(TOP_DIR)/objs
28 ######################################################################
30 # CONFIG_MK points to the current `config.mk' to use. It is defined
31 # by default as $(TOP_DIR)/config.mk.
33 ifndef CONFIG_MK
34 PROJECT := freetype
35 CONFIG_MK := $(TOP_DIR)/config.mk
36 endif
39 ######################################################################
41 # MODULES_CFG points to the current `modules.cfg' to use. It is defined
42 # by default as $(TOP_DIR)/modules.cfg.
44 MODULES_CFG ?= $(TOP_DIR)/modules.cfg
46 ifeq ($(wildcard $(MODULES_CFG)),)
47 no_modules_cfg := 1
48 endif
51 ####################################################################
53 # Check that we have a working `config.mk' in the above directory.
54 # If not, issue a warning message, then stop there.
56 ifeq ($(wildcard $(CONFIG_MK)),)
57 no_config_mk := 1
58 endif
60 ifdef no_config_mk
62 exes:
63 $(info Please compile the library before the demo programs!)
64 clean distclean:
65 $(info I need a path to FreeType 2's `config.mk' to do that!)
66 $(info Set the `TOP_DIR' variable to the correct value.)
68 else
70 ####################################################################
72 # Good, now include `config.mk' in order to know how to build
73 # object files from sources, as well as other things (compiler
74 # flags).
76 include $(CONFIG_MK)
78 ifndef no_modules_cfg
79 include $(MODULES_CFG)
80 endif
82 have_makefile := $(strip $(wildcard Makefile))
84 ifeq ($(PLATFORM),unix)
85 ifdef DEVEL_DIR
86 PLATFORM := unixdev
87 endif
88 endif
91 ####################################################################
93 # Define a few important variables now.
95 ifeq ($(PLATFORM),unix)
96 # without absolute paths libtool fails
97 TOP_DIR := $(shell cd $(TOP_DIR); pwd)
98 TOP_DIR_2 := $(shell cd $(TOP_DIR_2); pwd)
99 ifneq ($(have_makefile),)
100 BIN_DIR_2 ?= $(TOP_DIR_2)/bin
101 OBJ_DIR_2 ?= $(TOP_DIR_2)/objs
102 else
103 BIN_DIR_2 ?= .
104 OBJ_DIR_2 ?= .
105 endif
106 else
107 ifneq ($(have_makefile),)
108 BIN_DIR_2 ?= bin
109 OBJ_DIR_2 ?= objs
110 else
111 BIN_DIR_2 ?= .
112 OBJ_DIR_2 ?= .
113 endif
114 endif
116 GRAPH_DIR := $(TOP_DIR_2)/graph
118 ifeq ($(TOP_DIR),..)
119 SRC_DIR := src
120 else
121 SRC_DIR := $(TOP_DIR_2)/src
122 endif
124 FT_INCLUDES := $(OBJ_BUILD) \
125 $(BUILD_DIR) \
126 $(DEVEL_DIR) \
127 $(TOP_DIR)/include \
128 $(SRC_DIR)
130 COMPILE = $(CC) $(CPPFLAGS) \
131 $(CFLAGS) \
132 $(ANSIFLAGS) \
133 $(INCLUDES:%=$I%) \
134 $DFT_CONFIG_MODULES_H="<ftmodule.h>"
136 # Enable C99 for gcc to avoid warnings.
137 # Note that clang++ aborts with an error if we use `-std=C99',
138 # so check for `++' in $(CC) also.
139 ifneq ($(findstring -pedantic,$(COMPILE)),)
140 ifeq ($(findstring ++,$(CC)),)
141 COMPILE += -std=c99
142 endif
143 endif
145 FTLIB := $(LIB_DIR)/$(LIBRARY).$A
147 # `-lm' is required to compile on some Unix systems.
149 ifeq ($(PLATFORM),unix)
150 MATH := -lm
151 endif
153 ifeq ($(PLATFORM),unixdev)
154 MATH := -lm
155 endif
157 # The default variables used to link the executables. These can
158 # be redefined for platform-specific stuff.
160 # The first token of LINK_ITEMS must be the executable.
162 LINK_ITEMS = $T$(subst /,$(COMPILER_SEP),$@ $<)
164 ifeq ($(PLATFORM),unix)
165 CC = $(CCraw)
166 LINK_CMD = $(subst /,$(SEP),$(OBJ_BUILD)/libtool) \
167 --mode=link $(CC) \
168 $(subst /,$(COMPILER_SEP),$(LDFLAGS))
169 LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) $(LIB_CLOCK_GETTIME)
170 else
171 LINK_CMD = $(CC) $(subst /,$(COMPILER_SEP),$(LDFLAGS))
172 ifeq ($(PLATFORM),unixdev)
173 LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) -lm -lrt -lz -lbz2
174 LINK_LIBS += $(shell pkg-config --libs libpng)
175 LINK_LIBS += $(shell pkg-config --libs harfbuzz)
176 else
177 LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE))
178 endif
179 endif
181 LINK = $(LINK_CMD) \
182 $(LINK_ITEMS) \
183 $(LINK_LIBS)
184 LINK_COMMON = $(LINK_CMD) \
185 $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ)) \
186 $(LINK_LIBS)
187 LINK_GRAPH = $(LINK_COMMON) $(subst /,$(COMPILER_SEP),$(GRAPH_LIB)) \
188 $(GRAPH_LINK) $(MATH)
189 LINK_NEW = $(LINK_CMD) \
190 $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ) \
191 $(FTCOMMON_OBJ)) \
192 $(LINK_LIBS) $(subst /,$(COMPILER_SEP),$(GRAPH_LIB)) \
193 $(GRAPH_LINK) $(MATH)
195 .PHONY: exes clean distclean
198 ###################################################################
200 # Include the rules needed to compile the graphics sub-system.
201 # This will also select which graphics driver to compile to the
202 # sub-system.
204 include $(GRAPH_DIR)/rules.mk
207 ####################################################################
209 # Detect DOS-like platforms, currently DOS, Win 3.1, Win32 & OS/2.
211 ifneq ($(findstring $(PLATFORM),os2 win16 win32 dos),)
212 DOSLIKE := 1
213 endif
216 ###################################################################
218 # Clean-up rules. Because the `del' command on DOS-like platforms
219 # cannot take a long list of arguments, we simply erase the directory
220 # contents.
222 ifdef DOSLIKE
224 clean_demo:
225 -del objs\*.$(SO) 2> nul
226 -del $(subst /,\,$(TOP_DIR_2)/src/*.bak) 2> nul
228 distclean_demo: clean_demo
229 -del objs\*.lib 2> nul
230 -del bin\*.exe 2> nul
232 else
234 clean_demo:
235 -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/*.$(SO) $(OBJ_DIR_2)/*.$(O))
236 -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/*.$(SA) $(OBJ_DIR_2)/*.$(A))
237 -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/.libs/*)
238 -$(DELETE) $(subst /,$(SEP),$(SRC_DIR)/*.bak graph/*.bak)
239 -$(DELETE) $(subst /,$(SEP),$(SRC_DIR)/*~ graph/*~)
241 distclean_demo: clean_demo
242 -$(DELETE) $(subst /,$(SEP),$(EXES:%=$(BIN_DIR_2)/%$E))
243 -$(DELETE) $(subst /,$(SEP),$(GRAPH_LIB))
244 ifeq ($(PLATFORM),unix)
245 -$(DELETE) $(BIN_DIR_2)/.libs/*
246 -$(DELDIR) $(BIN_DIR_2)/.libs
247 endif
249 endif
251 clean: clean_demo
252 distclean: distclean_demo
255 ####################################################################
257 # Compute the executable suffix to use, and put it in `E'.
258 # It is ".exe" on DOS-ish platforms, and nothing otherwise.
260 ifdef DOSLIKE
261 E := .exe
262 else
263 E :=
264 endif
267 ####################################################################
269 # POSIX TERMIOS: Do not define if you use OLD U*ix like 4.2BSD.
271 ifeq ($(PLATFORM),unix)
272 EXTRAFLAGS = $DUNIX $DHAVE_POSIX_TERMIOS
273 endif
275 ifeq ($(PLATFORM),unixdev)
276 EXTRAFLAGS = $DUNIX $DHAVE_POSIX_TERMIOS
277 endif
280 ###################################################################
282 # The list of demonstration programs to build.
284 # Note that ttdebug only works if the FreeType's `truetype' driver has
285 # been compiled with TT_CONFIG_OPTION_BYTECODE_INTERPRETER defined.
287 EXES := ftbench \
288 ftdump \
289 ftlint \
290 ttdebug
292 # Comment out the next line if you don't have a graphics subsystem.
293 EXES += ftdiff \
294 ftgamma \
295 ftgrid \
296 ftmulti \
297 ftstring \
298 ftview
300 # ftvalid requires ftgxval.c and ftotval.c
302 ifneq ($(findstring ftgxval.c,$(BASE_EXTENSIONS)),)
303 ifneq ($(findstring ftotval.c,$(BASE_EXTENSIONS)),)
304 EXES += ftvalid
305 endif
306 endif
308 # The following programs are not compiled automatically; either comment
309 # out the affected line or use the program name as a Makefile target.
311 # EXES += ftchkwd
312 # EXES += ftmemchk
313 # EXES += ftpatchk
314 # EXES += fttimer
315 # EXES += testname
317 exes: $(EXES:%=$(BIN_DIR_2)/%$E)
320 INCLUDES := $(subst /,$(COMPILER_SEP),$(FT_INCLUDES))
323 # generic rule
324 $(OBJ_DIR_2)/%.$(SO): $(SRC_DIR)/%.c $(FTLIB)
325 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
328 ####################################################################
330 # Rules for compiling object files for text-only demos.
332 $(OBJ_DIR_2)/common.$(SO): $(SRC_DIR)/common.c
333 $(OBJ_DIR_2)/output.$(SO): $(SRC_DIR)/output.c
334 $(OBJ_DIR_2)/mlgetopt.$(SO): $(SRC_DIR)/mlgetopt.c
335 COMMON_OBJ := $(OBJ_DIR_2)/common.$(SO) \
336 $(OBJ_DIR_2)/output.$(SO) \
337 $(OBJ_DIR_2)/mlgetopt.$(SO)
340 FTCOMMON_OBJ := $(OBJ_DIR_2)/ftcommon.$(SO)
341 $(FTCOMMON_OBJ): $(SRC_DIR)/ftcommon.c $(SRC_DIR)/ftcommon.h
342 $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \
343 $T$(subst /,$(COMPILER_SEP),$@ $<)
346 $(OBJ_DIR_2)/ftlint.$(SO): $(SRC_DIR)/ftlint.c
347 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
349 $(OBJ_DIR_2)/ftbench.$(SO): $(SRC_DIR)/ftbench.c
350 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS)
352 $(OBJ_DIR_2)/ftpatchk.$(SO): $(SRC_DIR)/ftpatchk.c
353 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS)
355 $(OBJ_DIR_2)/ftchkwd.$(SO): $(SRC_DIR)/ftchkwd.c
356 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS)
358 $(OBJ_DIR_2)/compos.$(SO): $(SRC_DIR)/compos.c
359 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
361 $(OBJ_DIR_2)/ftmemchk.$(SO): $(SRC_DIR)/ftmemchk.c
362 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
364 $(OBJ_DIR_2)/fttimer.$(SO): $(SRC_DIR)/fttimer.c
365 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
367 $(OBJ_DIR_2)/fttry.$(SO): $(SRC_DIR)/fttry.c
368 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
370 $(OBJ_DIR_2)/testname.$(SO): $(SRC_DIR)/testname.c
371 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
373 # $(OBJ_DIR_2)/ftsbit.$(SO): $(SRC_DIR)/ftsbit.c
374 # $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
377 # We simplify the dependencies on the graphics library by using
378 # $(GRAPH_LIB) directly.
380 $(OBJ_DIR_2)/ftgamma.$(SO): $(SRC_DIR)/ftgamma.c \
381 $(SRC_DIR)/ftcommon.h \
382 $(GRAPH_LIB)
383 $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \
384 $T$(subst /,$(COMPILER_SEP),$@ $<)
386 $(OBJ_DIR_2)/ftmulti.$(SO): $(SRC_DIR)/ftmulti.c \
387 $(GRAPH_LIB)
388 $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \
389 $T$(subst /,$(COMPILER_SEP),$@ $<)
391 $(OBJ_DIR_2)/ftstring.$(SO): $(SRC_DIR)/ftstring.c \
392 $(SRC_DIR)/ftcommon.h \
393 $(GRAPH_LIB)
394 $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \
395 $T$(subst /,$(COMPILER_SEP),$@ $<)
398 ####################################################################
400 # Special rule to compile the `ftdump' program as it includes
401 # internal header files.
403 $(OBJ_DIR_2)/ftdump.$(SO): $(SRC_DIR)/ftdump.c
404 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY
407 ####################################################################
409 # Special rule to compile the `t1dump' program as it includes
410 # the Type1 source path.
412 $(OBJ_DIR_2)/t1dump.$(SO): $(SRC_DIR)/t1dump.c
413 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
416 ####################################################################
418 # Special rule to compile the `ftvalid' program as it includes
419 # internal header files.
421 $(OBJ_DIR_2)/ftvalid.$(SO): $(SRC_DIR)/ftvalid.c
422 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY
425 ####################################################################
427 # Special rule to compile the `ftview' program as it includes
428 # internal header files.
430 $(OBJ_DIR_2)/ftview.$(SO): $(SRC_DIR)/ftview.c \
431 $(SRC_DIR)/ftcommon.h \
432 $(GRAPH_LIB)
433 $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \
434 $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY
437 ####################################################################
439 # Special rule to compile the `ftdiff' program as it includes
440 # internal header files.
442 $(OBJ_DIR_2)/ftdiff.$(SO): $(SRC_DIR)/ftdiff.c \
443 $(SRC_DIR)/ftcommon.h \
444 $(GRAPH_LIB)
445 $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \
446 $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY
449 ####################################################################
451 # Special rule to compile the `ftgrid' program as it includes
452 # internal header files.
454 $(OBJ_DIR_2)/ftgrid.$(SO): $(SRC_DIR)/ftgrid.c \
455 $(SRC_DIR)/ftcommon.h \
456 $(GRAPH_LIB)
457 $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \
458 $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY
461 ####################################################################
463 # Special rule to compile the `ttdebug' program as it includes
464 # the TrueType source path and needs extra flags for correct keyboard
465 # handling on Unix.
467 $(OBJ_DIR_2)/ttdebug.$(SO): $(SRC_DIR)/ttdebug.c
468 $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) \
469 $I$(subst /,$(COMPILER_SEP),$(TOP_DIR)/src/truetype) \
470 $(EXTRAFLAGS) $DFT2_BUILD_LIBRARY
473 ####################################################################
475 # Rules used to link the executables. Note that they could be
476 # overridden by system-specific things.
478 $(BIN_DIR_2)/ftlint$E: $(OBJ_DIR_2)/ftlint.$(SO) $(FTLIB) $(COMMON_OBJ)
479 $(LINK_COMMON)
481 $(BIN_DIR_2)/ftbench$E: $(OBJ_DIR_2)/ftbench.$(SO) $(FTLIB) $(COMMON_OBJ)
482 $(LINK_COMMON)
484 $(BIN_DIR_2)/ftpatchk$E: $(OBJ_DIR_2)/ftpatchk.$(SO) $(FTLIB) $(COMMON_OBJ)
485 $(LINK_COMMON)
487 $(BIN_DIR_2)/ftchkwd$E: $(OBJ_DIR_2)/ftchkwd.$(SO) $(FTLIB) $(COMMON_OBJ)
488 $(LINK_COMMON)
490 $(BIN_DIR_2)/ftmemchk$E: $(OBJ_DIR_2)/ftmemchk.$(SO) $(FTLIB) $(COMMON_OBJ)
491 $(LINK_COMMON)
493 $(BIN_DIR_2)/compos$E: $(OBJ_DIR_2)/compos.$(SO) $(FTLIB) $(COMMON_OBJ)
494 $(LINK_COMMON)
496 $(BIN_DIR_2)/ftvalid$E: $(OBJ_DIR_2)/ftvalid.$(SO) $(FTLIB) $(COMMON_OBJ)
497 $(LINK_COMMON)
499 $(BIN_DIR_2)/ftdump$E: $(OBJ_DIR_2)/ftdump.$(SO) $(FTLIB) $(COMMON_OBJ)
500 $(LINK_COMMON)
502 $(BIN_DIR_2)/fttimer$E: $(OBJ_DIR_2)/fttimer.$(SO) $(FTLIB) $(COMMON_OBJ)
503 $(LINK_COMMON)
505 $(BIN_DIR_2)/fttry$E: $(OBJ_DIR_2)/fttry.$(SO) $(FTLIB)
506 $(LINK)
508 # $(BIN_DIR_2)/ftsbit$E: $(OBJ_DIR_2)/ftsbit.$(SO) $(FTLIB)
509 # $(LINK)
511 $(BIN_DIR_2)/t1dump$E: $(OBJ_DIR_2)/t1dump.$(SO) $(FTLIB)
512 $(LINK)
514 $(BIN_DIR_2)/ttdebug$E: $(OBJ_DIR_2)/ttdebug.$(SO) $(FTLIB) $(COMMON_OBJ)
515 $(LINK_COMMON)
517 $(BIN_DIR_2)/testname$E: $(OBJ_DIR_2)/testname.$(SO) $(FTLIB)
518 $(LINK)
521 $(BIN_DIR_2)/ftview$E: $(OBJ_DIR_2)/ftview.$(SO) $(FTLIB) \
522 $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ)
523 $(LINK_NEW)
525 $(BIN_DIR_2)/ftgrid$E: $(OBJ_DIR_2)/ftgrid.$(SO) $(FTLIB) \
526 $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ)
527 $(LINK_NEW)
529 $(BIN_DIR_2)/ftgamma$E: $(OBJ_DIR_2)/ftgamma.$(SO) $(FTLIB) \
530 $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ)
531 $(LINK_NEW)
533 $(BIN_DIR_2)/ftdiff$E: $(OBJ_DIR_2)/ftdiff.$(SO) $(FTLIB) \
534 $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ)
535 $(LINK_NEW)
537 $(BIN_DIR_2)/ftmulti$E: $(OBJ_DIR_2)/ftmulti.$(SO) $(FTLIB) \
538 $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ)
539 $(LINK_NEW)
541 $(BIN_DIR_2)/ftstring$E: $(OBJ_DIR_2)/ftstring.$(SO) $(FTLIB) \
542 $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ)
543 $(LINK_NEW)
546 endif
549 # This target builds the tarballs.
551 # Not to be run by a normal user -- there are no attempts to make it
552 # generic.
554 # we check for `dist', not `distclean'
555 ifneq ($(findstring distx,$(MAKECMDGOALS)x),)
556 FT_H := ../freetype2/include/freetype/freetype.h
558 major := $(shell sed -n 's/.*FREETYPE_MAJOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H))
559 minor := $(shell sed -n 's/.*FREETYPE_MINOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H))
560 patch := $(shell sed -n 's/.*FREETYPE_PATCH[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H))
562 # ifneq ($(findstring x0x,x$(patch)x),)
563 # version := $(major).$(minor)
564 # winversion := $(major)$(minor)
565 # else
566 version := $(major).$(minor).$(patch)
567 winversion := $(major)$(minor)$(patch)
568 # endif
569 endif
571 dist:
572 -rm -rf tmp
573 rm -f ft2demos-$(version).tar.gz
574 rm -f ft2demos-$(version).tar.bz2
575 rm -f ftdmo$(winversion).zip
577 for d in `find . -wholename '*/.git' -prune \
578 -o -type f \
579 -o -print` ; do \
580 mkdir -p tmp/$$d ; \
581 done ;
583 currdir=`pwd` ; \
584 for f in `find . -wholename '*/.git' -prune \
585 -o -name .gitignore \
586 -o -name .mailmap \
587 -o -type d \
588 -o -print` ; do \
589 ln -s $$currdir/$$f tmp/$$f ; \
590 done
592 cd tmp ; \
593 $(MAKE) distclean
595 mv tmp ft2demos-$(version)
597 tar -H ustar -chf - ft2demos-$(version) \
598 | gzip -c > ft2demos-$(version).tar.gz
599 tar -H ustar -chf - ft2demos-$(version) \
600 | bzip2 -c > ft2demos-$(version).tar.bz2
602 @# Use CR/LF for zip files.
603 zip -lr ftdmo$(winversion).zip ft2demos-$(version)
605 rm -fr ft2demos-$(version)
607 # EOF