Commit 36d03c9f583f4c4b2ad2870784e2fe50814820c9

Werner Lemberg 2015-01-12T11:26:30

Fix Savannah bug #43976. Assure that FreeType's internal include directories are found before `CPPFLAGS' (which might be set by the user in the environment), and `CPPFLAGS' before `CFLAGS'. * builds/freetype.mk (FT_CFLAGS): Don't add `INCLUDE_FLAGS'. (FT_COMPILE): Make this a special variable for compiling only the files handled in `freetype.mk'. (.c.$O): Removed, unused. * src/*/rules.mk (*_COMPILE): Fix order of include directories.

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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
diff --git a/ChangeLog b/ChangeLog
index 084f67d..027a293 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2015-01-12  Werner Lemberg  <wl@gnu.org>
+
+	Fix Savannah bug #43976.
+
+	Assure that FreeType's internal include directories are found before
+	`CPPFLAGS' (which might be set by the user in the environment), and
+	`CPPFLAGS' before `CFLAGS'.
+
+	* builds/freetype.mk (FT_CFLAGS): Don't add `INCLUDE_FLAGS'.
+	(FT_COMPILE): Make this a special variable for compiling only the
+	files handled in `freetype.mk'.
+	(.c.$O): Removed, unused.
+
+	* src/*/rules.mk (*_COMPILE): Fix order of include directories.
+
 2015-01-11  Werner Lemberg  <wl@gnu.org>
 
 	[truetype] Prettyfing.
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 8b2e2ea..5e874ac 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -155,15 +155,13 @@ ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),)
   FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="<ftoption.h>"
 endif
 
-# Note that a build with the `configure' script uses $(CFLAGS) only.
+# `CPPFLAGS' might be specified by the user in the environment.
 #
 FT_CFLAGS  = $(CPPFLAGS) \
-             $(INCLUDE_FLAGS) \
              $(CFLAGS) \
              $DFT2_BUILD_LIBRARY \
              $DFT_CONFIG_MODULES_H="<ftmodule.h>" \
              $(FTOPTION_FLAG)
-FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
 
 
 # Include the `exports' rules file.
@@ -195,6 +193,8 @@ DEVEL_H    := $(wildcard $(TOP_DIR)/devel/*.h)
 FREETYPE_H := $(PUBLIC_H) $(INTERNAL_H) $(CONFIG_H) $(DEVEL_H)
 
 
+FT_COMPILE := $(CC) $(ANSIFLAGS) $(INCLUDE_FLAGS) $(FT_CFLAGS)
+
 # ftsystem component
 #
 FTSYS_SRC ?= $(BASE_DIR)/ftsystem.c
@@ -270,9 +270,6 @@ objects: $(OBJECTS_LIST)
 
 library: $(PROJECT_LIBRARY)
 
-.c.$O:
-	$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
-
 
 ifneq ($(findstring refdoc,$(MAKECMDGOALS)),)
   # poor man's `sed' emulation with make's built-in string functions
diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk
index 658f04e..5849cbe 100644
--- a/src/autofit/rules.mk
+++ b/src/autofit/rules.mk
@@ -20,7 +20,10 @@ AUTOF_DIR := $(SRC_DIR)/autofit
 
 # compilation flags for the driver
 #
-AUTOF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR))
+AUTOF_COMPILE := $(CC) $(ANSIFLAGS)                              \
+                       $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR)) \
+                       $(INCLUDE_FLAGS)                          \
+                       $(FT_CFLAGS)
 
 
 # AUTOF driver sources (i.e., C files)
diff --git a/src/base/rules.mk b/src/base/rules.mk
index cbd8107..640ab6d 100644
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -23,7 +23,10 @@
 #                 layer proper.
 
 
-BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base)
+BASE_COMPILE := $(CC) $(ANSIFLAGS)                             \
+                      $I$(subst /,$(COMPILER_SEP),$(BASE_DIR)) \
+                      $(INCLUDE_FLAGS)                         \
+                      $(FT_CFLAGS)
 
 
 # Base layer sources
diff --git a/src/bdf/rules.mk b/src/bdf/rules.mk
index 6ff1614..d1dd76b 100644
--- a/src/bdf/rules.mk
+++ b/src/bdf/rules.mk
@@ -32,7 +32,10 @@
 BDF_DIR := $(SRC_DIR)/bdf
 
 
-BDF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(BDF_DIR))
+BDF_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(BDF_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # bdf driver sources (i.e., C files)
diff --git a/src/bzip2/rules.mk b/src/bzip2/rules.mk
index 0ff2628..845066d 100644
--- a/src/bzip2/rules.mk
+++ b/src/bzip2/rules.mk
@@ -22,7 +22,9 @@ BZIP2_DIR := $(SRC_DIR)/bzip2
 
 # compilation flags for the driver
 #
-BZIP2_COMPILE := $(FT_COMPILE)
+BZIP2_COMPILE := $(CC) $(ANSIFLAGS)     \
+                       $(INCLUDE_FLAGS) \
+                       $(FT_CFLAGS)
 
 
 # BZIP2 support sources (i.e., C files)
diff --git a/src/cache/rules.mk b/src/cache/rules.mk
index ed75a6a..d64d9bc 100644
--- a/src/cache/rules.mk
+++ b/src/cache/rules.mk
@@ -17,9 +17,13 @@
 #
 CACHE_DIR   := $(SRC_DIR)/cache
 
+
 # compilation flags for the driver
 #
-CACHE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CACHE_DIR))
+CACHE_COMPILE := $(CC) $(ANSIFLAGS)                              \
+                       $I$(subst /,$(COMPILER_SEP),$(CACHE_DIR)) \
+                       $(INCLUDE_FLAGS)                          \
+                       $(FT_CFLAGS)
 
 
 # Cache driver sources (i.e., C files)
@@ -33,6 +37,7 @@ CACHE_DRV_SRC := $(CACHE_DIR)/ftcbasic.c \
                  $(CACHE_DIR)/ftcmru.c   \
                  $(CACHE_DIR)/ftcsbits.c
 
+
 # Cache driver headers
 #
 CACHE_DRV_H := $(CACHE_DIR)/ftccache.h \
diff --git a/src/cff/rules.mk b/src/cff/rules.mk
index 13115c2..23b4730 100644
--- a/src/cff/rules.mk
+++ b/src/cff/rules.mk
@@ -18,7 +18,10 @@
 CFF_DIR := $(SRC_DIR)/cff
 
 
-CFF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CFF_DIR))
+CFF_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(CFF_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # CFF driver sources (i.e., C files)
diff --git a/src/cid/rules.mk b/src/cid/rules.mk
index f362744..9926c8a 100644
--- a/src/cid/rules.mk
+++ b/src/cid/rules.mk
@@ -18,7 +18,10 @@
 CID_DIR := $(SRC_DIR)/cid
 
 
-CID_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CID_DIR))
+CID_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(CID_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # CID driver sources (i.e., C files)
diff --git a/src/gxvalid/rules.mk b/src/gxvalid/rules.mk
index 57bc082..c4bd4c8 100644
--- a/src/gxvalid/rules.mk
+++ b/src/gxvalid/rules.mk
@@ -20,7 +20,10 @@ GXV_DIR := $(SRC_DIR)/gxvalid
 
 # compilation flags for the driver
 #
-GXV_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(GXV_DIR))
+GXV_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(GXV_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # GXV driver sources (i.e., C files)
diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk
index 37cd991..23222a1 100644
--- a/src/gzip/rules.mk
+++ b/src/gzip/rules.mk
@@ -21,9 +21,14 @@ GZIP_DIR := $(SRC_DIR)/gzip
 # compilation flags for the driver
 #
 ifeq ($(SYSTEM_ZLIB),)
-  GZIP_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(GZIP_DIR))
+  GZIP_COMPILE := $(CC) $(ANSIFLAGS)                             \
+                        $I$(subst /,$(COMPILER_SEP),$(GZIP_DIR)) \
+                        $(INCLUDE_FLAGS)                         \
+                        $(FT_CFLAGS)
 else
-  GZIP_COMPILE := $(FT_COMPILE)
+  GZIP_COMPILE := $(CC) $(ANSIFLAGS)     \
+                        $(INCLUDE_FLAGS) \
+                        $(FT_CFLAGS)
 endif
 
 
diff --git a/src/lzw/rules.mk b/src/lzw/rules.mk
index 5550a48..4362939 100644
--- a/src/lzw/rules.mk
+++ b/src/lzw/rules.mk
@@ -23,7 +23,10 @@ LZW_DIR := $(SRC_DIR)/lzw
 
 # compilation flags for the driver
 #
-LZW_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(LZW_DIR))
+LZW_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(LZW_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # LZW support sources (i.e., C files)
diff --git a/src/otvalid/rules.mk b/src/otvalid/rules.mk
index 53bd41e..7454335 100644
--- a/src/otvalid/rules.mk
+++ b/src/otvalid/rules.mk
@@ -20,7 +20,10 @@ OTV_DIR := $(SRC_DIR)/otvalid
 
 # compilation flags for the driver
 #
-OTV_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(OTV_DIR))
+OTV_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(OTV_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # OTV driver sources (i.e., C files)
diff --git a/src/pcf/rules.mk b/src/pcf/rules.mk
index 7864152..1b55daf 100644
--- a/src/pcf/rules.mk
+++ b/src/pcf/rules.mk
@@ -30,7 +30,10 @@
 PCF_DIR := $(SRC_DIR)/pcf
 
 
-PCF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PCF_DIR))
+PCF_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(PCF_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # pcf driver sources (i.e., C files)
diff --git a/src/pfr/rules.mk b/src/pfr/rules.mk
index 60b96c7..01f44f1 100644
--- a/src/pfr/rules.mk
+++ b/src/pfr/rules.mk
@@ -20,7 +20,10 @@ PFR_DIR := $(SRC_DIR)/pfr
 
 # compilation flags for the driver
 #
-PFR_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PFR_DIR))
+PFR_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(PFR_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # pfr driver sources (i.e., C files)
diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk
index 7a1be37..788d813 100644
--- a/src/psaux/rules.mk
+++ b/src/psaux/rules.mk
@@ -20,7 +20,10 @@ PSAUX_DIR := $(SRC_DIR)/psaux
 
 # compilation flags for the driver
 #
-PSAUX_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PSAUX_DIR))
+PSAUX_COMPILE := $(CC) $(ANSIFLAGS)                              \
+                       $I$(subst /,$(COMPILER_SEP),$(PSAUX_DIR)) \
+                       $(INCLUDE_FLAGS)                          \
+                       $(FT_CFLAGS)
 
 
 # PSAUX driver sources (i.e., C files)
diff --git a/src/pshinter/rules.mk b/src/pshinter/rules.mk
index 888ece1..afc4a40 100644
--- a/src/pshinter/rules.mk
+++ b/src/pshinter/rules.mk
@@ -20,7 +20,10 @@ PSHINTER_DIR := $(SRC_DIR)/pshinter
 
 # compilation flags for the driver
 #
-PSHINTER_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PSHINTER_DIR))
+PSHINTER_COMPILE := $(CC) $(ANSIFLAGS)                                 \
+                          $I$(subst /,$(COMPILER_SEP),$(PSHINTER_DIR)) \
+                          $(INCLUDE_FLAGS)                             \
+                          $(FT_CFLAGS)
 
 
 # PSHINTER driver sources (i.e., C files)
diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk
index f321de2..278f659 100644
--- a/src/psnames/rules.mk
+++ b/src/psnames/rules.mk
@@ -20,7 +20,10 @@ PSNAMES_DIR := $(SRC_DIR)/psnames
 
 # compilation flags for the driver
 #
-PSNAMES_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PSNAMES_DIR))
+PSNAMES_COMPILE := $(CC) $(ANSIFLAGS)                                \
+                         $I$(subst /,$(COMPILER_SEP),$(PSNAMES_DIR)) \
+                         $(INCLUDE_FLAGS)                            \
+                         $(FT_CFLAGS)
 
 
 # PSNames driver sources (i.e., C files)
diff --git a/src/raster/rules.mk b/src/raster/rules.mk
index 0e0b5e4..6683ed7 100644
--- a/src/raster/rules.mk
+++ b/src/raster/rules.mk
@@ -19,7 +19,10 @@ RASTER_DIR := $(SRC_DIR)/raster
 
 # compilation flags for the driver
 #
-RASTER_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(RASTER_DIR))
+RASTER_COMPILE := $(CC) $(ANSIFLAGS)                               \
+                        $I$(subst /,$(COMPILER_SEP),$(RASTER_DIR)) \
+                        $(INCLUDE_FLAGS)                           \
+                        $(FT_CFLAGS)
 
 
 # raster driver sources (i.e., C files)
diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk
index a6c956a..b6e5aa0 100644
--- a/src/sfnt/rules.mk
+++ b/src/sfnt/rules.mk
@@ -20,7 +20,10 @@ SFNT_DIR := $(SRC_DIR)/sfnt
 
 # compilation flags for the driver
 #
-SFNT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SFNT_DIR))
+SFNT_COMPILE := $(CC) $(ANSIFLAGS)                             \
+                      $I$(subst /,$(COMPILER_SEP),$(SFNT_DIR)) \
+                      $(INCLUDE_FLAGS)                         \
+                      $(FT_CFLAGS)
 
 
 # SFNT driver sources (i.e., C files)
diff --git a/src/smooth/rules.mk b/src/smooth/rules.mk
index 88d0aa5..c8ac81c 100644
--- a/src/smooth/rules.mk
+++ b/src/smooth/rules.mk
@@ -17,9 +17,13 @@
 #
 SMOOTH_DIR := $(SRC_DIR)/smooth
 
+
 # compilation flags for the driver
 #
-SMOOTH_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SMOOTH_DIR))
+SMOOTH_COMPILE := $(CC) $(ANSIFLAGS)                               \
+                        $I$(subst /,$(COMPILER_SEP),$(SMOOTH_DIR)) \
+                        $(INCLUDE_FLAGS)                           \
+                        $(FT_CFLAGS)
 
 
 # smooth driver sources (i.e., C files)
diff --git a/src/truetype/rules.mk b/src/truetype/rules.mk
index d4b69f5..e39235b 100644
--- a/src/truetype/rules.mk
+++ b/src/truetype/rules.mk
@@ -20,7 +20,10 @@ TT_DIR := $(SRC_DIR)/truetype
 
 # compilation flags for the driver
 #
-TT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(TT_DIR))
+TT_COMPILE := $(CC) $(ANSIFLAGS)                           \
+                    $I$(subst /,$(COMPILER_SEP),$(TT_DIR)) \
+                    $(INCLUDE_FLAGS)                       \
+                    $(FT_CFLAGS)
 
 
 # TrueType driver sources (i.e., C files)
diff --git a/src/type1/rules.mk b/src/type1/rules.mk
index 15087b0..160946a 100644
--- a/src/type1/rules.mk
+++ b/src/type1/rules.mk
@@ -20,7 +20,10 @@ T1_DIR := $(SRC_DIR)/type1
 
 # compilation flags for the driver
 #
-T1_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(T1_DIR))
+T1_COMPILE := $(CC) $(ANSIFLAGS)                           \
+                    $I$(subst /,$(COMPILER_SEP),$(T1_DIR)) \
+                    $(INCLUDE_FLAGS)                       \
+                    $(FT_CFLAGS)
 
 
 # Type1 driver sources (i.e., C files)
diff --git a/src/type42/rules.mk b/src/type42/rules.mk
index eac1081..34a31e8 100644
--- a/src/type42/rules.mk
+++ b/src/type42/rules.mk
@@ -20,7 +20,10 @@ T42_DIR := $(SRC_DIR)/type42
 
 # compilation flags for the driver
 #
-T42_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(T42_DIR))
+T42_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(T42_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # Type42 driver source
diff --git a/src/winfonts/rules.mk b/src/winfonts/rules.mk
index 71a7df2..1a78171 100644
--- a/src/winfonts/rules.mk
+++ b/src/winfonts/rules.mk
@@ -18,7 +18,10 @@
 FNT_DIR := $(SRC_DIR)/winfonts
 
 
-FNT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(FNT_DIR))
+FNT_COMPILE := $(CC) $(ANSIFLAGS)                            \
+                     $I$(subst /,$(COMPILER_SEP),$(FNT_DIR)) \
+                     $(INCLUDE_FLAGS)                        \
+                     $(FT_CFLAGS)
 
 
 # Windows driver sources (i.e., C files)