Commit a90663f591e995bd148d7b45178c9d63a2b7eb93

David Turner 2000-07-08T00:41:13

vast clean-up of the sources in order to allow flat directory compilation (by defining the FT_FLAT_COMPILE macro at compile time..) moved "freetype2/BUILD" to "freetype2/docs/BUILD"

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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
diff --git a/Makefile b/Makefile
index 118d370..ab15cda 100644
--- a/Makefile
+++ b/Makefile
@@ -75,8 +75,8 @@ ifdef check_platform
   #
   modules: make_module_list setup
 
-  include $(TOP)/config/detect.mk
-  include $(TOP)/config/modules.mk
+  include $(TOP)/builds/detect.mk
+  include $(TOP)/builds/modules.mk
 
   ifeq ($(wildcard $(FT_MODULE_LIST)),)
     setup: make_module_list
diff --git a/builds/ansi/ansi.mk b/builds/ansi/ansi.mk
index c0cfcaf..4c9266e 100644
--- a/builds/ansi/ansi.mk
+++ b/builds/ansi/ansi.mk
@@ -20,7 +20,7 @@ endif
 DELETE   := rm -f
 SEP      := /
 HOSTSEP  := $(SEP)
-BUILD    := $(TOP)/config/ansi
+BUILD    := $(TOP)/builds/ansi
 PLATFORM := ansi
 
 # The directory where all object files are placed.
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/detect.mk b/builds/detect.mk
index 355fcb3..d34904a 100644
--- a/builds/detect.mk
+++ b/builds/detect.mk
@@ -17,7 +17,7 @@
 # the following variables:
 #
 #   BUILD        The configuration and system-specific directory.  Usually
-#                `freetype/config/$(PLATFORM)' but can be different for
+#                `freetype/builds/$(PLATFORM)' but can be different for
 #                custom builds of the library.
 #
 # The following variables must be defined in system specific `detect.mk'
@@ -52,7 +52,7 @@ DELETE   := $(RM)
 COPY     := cp
 SEP      := /
 
-BUILD_CONFIG_ = $(TOP)$(SEP)config$(SEP)
+BUILD_CONFIG_ = $(TOP)$(SEP)builds$(SEP)
 BUILD         = $(BUILD_CONFIG_)$(PLATFORM)
 CONFIG_RULES  = $(BUILD)$(SEP)$(CONFIG_FILE)
 
@@ -70,7 +70,7 @@ CONFIG_RULES  = $(BUILD)$(SEP)$(CONFIG_FILE)
 #
 BACKSLASH := $(strip \ )
 
-# Now, include all detection rule files found in the `config/<system>'
+# Now, include all detection rule files found in the `builds/<system>'
 # directories.  Note that the calling order of the various `detect.mk' files
 # isn't predictable.
 #
diff --git a/builds/dos/dos-gcc.mk b/builds/dos/dos-gcc.mk
index 79bd182..0599e57 100644
--- a/builds/dos/dos-gcc.mk
+++ b/builds/dos/dos-gcc.mk
@@ -20,7 +20,7 @@ endif
 DELETE   := rm -f
 SEP      := /
 HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/config/dos
+BUILD    := $(TOP)/builds/dos
 PLATFORM := dos
 
 # The directory where all object files are placed.
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/freetype.mk b/builds/freetype.mk
index c9d4a91..69afb14 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -21,7 +21,7 @@
 # environment, or on the command line) are used:
 #
 #   BUILD          The architecture dependent directory,
-#                  e.g. `$(TOP)/config/unix'.
+#                  e.g. `$(TOP)/builds/unix'.
 #
 #   OBJ_DIR        The directory in which object files are created.
 #
@@ -112,7 +112,7 @@ FT_LIBRARY := $(LIB_)$(LIBRARY).$A
 # IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed
 #                 in front of the include list.  Porters are then able to
 #                 put their own version of some of the FreeType components
-#                 in the `freetype/config/<system>' directory, as these
+#                 in the `freetype/builds/<system>' directory, as these
 #                 files will override the default sources.
 #
 INCLUDES := $(BUILD) $(TOP)$(SEP)include $(SRC)
@@ -121,7 +121,7 @@ INCLUDE_FLAGS = $(INCLUDES:%=$I%)
 
 
 # C flags used for the compilation of an object file.  This must include at
-# least the paths for the `base' and `config/<system>' directories;
+# least the paths for the `base' and `builds/<system>' directories;
 # debug/optimization/warning flags + ansi compliance if needed.
 #
 FT_CFLAGS  = $(CFLAGS) $(INCLUDE_FLAGS)
@@ -131,7 +131,7 @@ FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
 
 # Include the `modules' rules file.
 #
-include $(TOP)/config/modules.mk
+include $(TOP)/builds/modules.mk
 
 
 # Initialize the list of objects.
diff --git a/builds/os2/os2-dev.mk b/builds/os2/os2-dev.mk
index 7cab22b..fcd80b1 100644
--- a/builds/os2/os2-dev.mk
+++ b/builds/os2/os2-dev.mk
@@ -22,7 +22,7 @@ endif
 DELETE   := del
 SEP      := /
 HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/config/os2
+BUILD    := $(TOP)/builds/os2
 PLATFORM := os2
 CC       := gcc
 
@@ -108,7 +108,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/os2/os2-gcc.mk b/builds/os2/os2-gcc.mk
index e94728b..38c1322 100644
--- a/builds/os2/os2-gcc.mk
+++ b/builds/os2/os2-gcc.mk
@@ -20,7 +20,7 @@ endif
 DELETE   := del
 SEP      := /
 HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/config/os2
+BUILD    := $(TOP)/builds/os2
 PLATFORM := os2
 CC       := gcc
 
@@ -106,7 +106,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/unix/unix-dev.mk b/builds/unix/unix-dev.mk
index 591ad26..5cd5beb 100644
--- a/builds/unix/unix-dev.mk
+++ b/builds/unix/unix-dev.mk
@@ -22,7 +22,7 @@ endif
 DELETE   := rm -f
 SEP      := /
 HOSTSEP  := $(SEP)
-BUILD    := $(TOP)/config/unix
+BUILD    := $(TOP)/builds/unix
 PLATFORM := unix
 
 # The directory where all object files are placed.
@@ -107,7 +107,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/unix/unix-gcc.mk b/builds/unix/unix-gcc.mk
index f14b697..e6936dd 100644
--- a/builds/unix/unix-gcc.mk
+++ b/builds/unix/unix-gcc.mk
@@ -20,7 +20,7 @@ endif
 DELETE   := rm -f
 SEP      := /
 HOSTSEP  := $(SEP)
-BUILD    := $(TOP)/config/unix
+BUILD    := $(TOP)/builds/unix
 PLATFORM := unix
 
 # The directory where all object files are placed.
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/unix/unix.in b/builds/unix/unix.in
index 37a8395..a998274 100644
--- a/builds/unix/unix.in
+++ b/builds/unix/unix.in
@@ -20,7 +20,7 @@ endif
 DELETE   := @RMF@
 SEP      := /
 HOSTSEP  := $(SEP)
-BUILD    := $(TOP)/config/unix
+BUILD    := $(TOP)/builds/unix
 PLATFORM := unix
 
 # The directory where all object files are placed.
diff --git a/builds/unix/unix.mk b/builds/unix/unix.mk
index c85653d..9fec19b 100644
--- a/builds/unix/unix.mk
+++ b/builds/unix/unix.mk
@@ -20,7 +20,7 @@ endif
 DELETE   := rm -f
 SEP      := /
 HOSTSEP  := $(SEP)
-BUILD    := $(TOP)/config/unix
+BUILD    := $(TOP)/builds/unix
 PLATFORM := unix
 
 # The directory where all object files are placed.
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/win32/w32-dev.mk b/builds/win32/w32-dev.mk
index 294d63a..438e7f6 100644
--- a/builds/win32/w32-dev.mk
+++ b/builds/win32/w32-dev.mk
@@ -25,7 +25,7 @@ endif
 DELETE   := del
 SEP      := /
 HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/config/win32
+BUILD    := $(TOP)/builds/win32
 PLATFORM := win32
 CC       := gcc
 
@@ -111,7 +111,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/win32/w32-gcc.mk b/builds/win32/w32-gcc.mk
index c83c356..6357098 100644
--- a/builds/win32/w32-gcc.mk
+++ b/builds/win32/w32-gcc.mk
@@ -23,7 +23,7 @@ endif
 DELETE   := del
 SEP      := /
 HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/config/win32
+BUILD    := $(TOP)/builds/win32
 PLATFORM := win32
 CC       := gcc
 
@@ -109,7 +109,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/win32/w32-icc.mk b/builds/win32/w32-icc.mk
index deb0720..2f66279 100644
--- a/builds/win32/w32-icc.mk
+++ b/builds/win32/w32-icc.mk
@@ -108,7 +108,7 @@ ANSI_FLAGS := /Sa
 
 ifdef BUILD_FREETYPE
 
-include $(TOP)/config/freetype.mk
+include $(TOP)/builds/freetype.mk
 
 clean_freetype: clean_freetype_dos
 distclean_freetype: distclean_freetype_dos
diff --git a/builds/win32/w32-lcc.mk b/builds/win32/w32-lcc.mk
index 172ead1..601348d 100644
--- a/builds/win32/w32-lcc.mk
+++ b/builds/win32/w32-lcc.mk
@@ -19,7 +19,7 @@ endif
 DELETE   := del
 SEP      := /
 HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/config/win32
+BUILD    := $(TOP)/builds/win32
 PLATFORM := win32
 CC       := lcc
 
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/builds/win32/w32-vcc.mk b/builds/win32/w32-vcc.mk
index 4f0a4a3..4c5442f 100644
--- a/builds/win32/w32-vcc.mk
+++ b/builds/win32/w32-vcc.mk
@@ -19,7 +19,7 @@ endif
 DELETE   := del
 SEP      := /
 HOSTSEP  := $(strip \ )
-BUILD    := $(TOP)/config/win32
+BUILD    := $(TOP)/builds/win32
 PLATFORM := win32
 CC       := cl
 
@@ -105,7 +105,7 @@ ifdef BUILD_FREETYPE
   # Now include the main sub-makefile.  It contains all the rules used to
   # build the library with the previous variables defined.
   #
-  include $(TOP)/config/freetype.mk
+  include $(TOP)/builds/freetype.mk
 
   # The cleanup targets.
   #
diff --git a/config/freetype.mk b/config/freetype.mk
index dc3043a..c9d4a91 100644
--- a/config/freetype.mk
+++ b/config/freetype.mk
@@ -115,7 +115,7 @@ FT_LIBRARY := $(LIB_)$(LIBRARY).$A
 #                 in the `freetype/config/<system>' directory, as these
 #                 files will override the default sources.
 #
-INCLUDES := $(BUILD) $(TOP)$(SEP)include $(INCLUDES)
+INCLUDES := $(BUILD) $(TOP)$(SEP)include $(SRC)
 
 INCLUDE_FLAGS = $(INCLUDES:%=$I%)
 
diff --git a/docs/BUILD b/docs/BUILD
new file mode 100644
index 0000000..93c7463
--- /dev/null
+++ b/docs/BUILD
@@ -0,0 +1,264 @@
+FreeType 2 compilation how-to
+
+
+Introduction:
+
+Welcome to this new beta of the FreeType 2 library. You'll find in this
+document instructions on how to compile the library on your favorite
+platform.
+
+  *** UNIX USERS : Even though the FT2 build system doesn't
+  ************** : use the Autoconf/Automake tools, these will
+  ************** : be introduced in the Unix-specific parts of
+  ************** : the build in our final release..
+
+
+I. QUICK COMMAND-LINE GUIDE:
+----------------------------
+
+  Install GNU Make, then try the following on Unix or any system with gcc:
+
+     make    // this will setup the build
+     make    // this will build the library
+
+  On Win32+Visual C++:
+
+     make setup visualc    // setup the build for VisualC++ on Win32
+     make                  // build the library
+
+  Then, go to the "demos" directory and type
+
+     make
+
+  To compile the demo programs..
+
+  If this doesn't work, read the following..
+
+
+
+II. COMMAND-LINE COMPILATION:
+-----------------------------
+
+  Note that if you do not want to compile FreeType 2 from a command line
+  shell, please skip to section III below (DETAILED COMPILATION)
+
+  FreeType 2 includes a powerful and flexible build system that allows you
+  to easily compile it on a great variety of platforms from the command
+  line. To do so, just follow these simple instructions:
+
+  a/ Install GNU Make:
+
+     Because GNU Make is the only Make tool supported to compile FreeType 2,
+     you should install it on your machine.
+
+     Because the FT2 build system relies on many important features of GNU
+     Make, trying to build the library with any other Make tool will *fail*.
+
+
+  b/ Invoke "make":
+
+     Go to the root FT2 directory, then simply invoke GNU Make from the
+     command line, this will launch the FreeType 2 Host Platform detection
+     routines. A summary will be displayed, for example, on Win32:
+
+     ========================================================================
+        FreeType build system -- automatic system detection
+
+        The following settings are used:
+
+          platform                     win32
+          compiler                     gcc
+          configuration directory      ./builds/win32
+          configuration rules          ./builds/win32/w32-gcc.mk
+
+        If this does not correspond to your system or settings please remove
+        the file 'config.mk' from this directory then read the INSTALL file
+        for help.
+
+        Otherwise, simply type 'make' again to build the library.
+     =========================================================================
+
+     If the detected settings correspond to your platform and compiler,
+     skip to step e/. Note that if your platform is completely alien to
+     the build system, the detected platform will be "ansi".
+
+
+  c/ Configure the build system for a different compiler:
+
+     If the build system correctly detected your platform, but you want to
+     use a different compiler than the one specified in the summary (for
+     most platforms, gcc is the defaut compiler), simply invoke GNU Make
+     like :
+
+         make setup <compiler>
+
+     For example:
+
+            to use Visual C++ on Win32, type:  "make setup visualc"
+            to use LCC-Win32 on Win32, type:   "make setup lcc"
+
+     The <compiler> name to use is platform-dependent. The list of available
+     compilers for your system is available in the file
+     "builds/<system>/detect.mk" (note that we hope to make the list
+     displayed at user demand in the final release)..
+
+     If you're satisfying by the new configuration summary, skip to step e/
+
+
+  d/ Configure the build system for an unknown platform/compiler:
+
+     What the auto-detection/setup phase of the build system does is simply
+     copy a file to the current directory under the name "config.mk".
+
+     For example, on OS/2+gcc, it would simply copy "builds/os2/os2-gcc.mk"
+     to "./config.mk"
+
+     If for some reason your platform isn't correctly detected, simply copy
+     manually the configuration sub-makefile to "./config.mk" and go to
+     step e/.
+
+     Note that this file is a sub-Makefile used to specify Make variables
+     used to invoke the compiler and linker during the build, you can easily
+     create your own version from one of the existing configuration files,
+     then copy it to the current directory under the name "./config.mk".
+
+
+  e/ Build the library:
+
+     The auto-detection/setup phase should have copied a file in the current
+     directory, called "./config.mk". This file contains definitions of various
+     Make variables used to invoke the compiler and linker during the build.
+
+     To launch the build, simply invoke GNU Make again: the top Makefile will
+     detect the configuration file and run the build with it..
+
+
+  f/ Build the demonstration programs:
+
+     Once the library is compiled, go to "demos", then invoke GNU Make.
+
+     Note that the demonstration programs include a tiny graphics sub-system
+     that includes "drivers" to display Windows on Win32, X11 and OS/2. The
+     build system should automatically detect which driver to use based on
+     the current platform.
+
+     UNIX USERS TAKE NOTE: XXXXXX
+
+     When building the demos, the build system tries to detect your X11 path
+     by looking for the patterns "X11R5/bin", "X11R6/bin" or "X11/bin" in
+     your current path. If no X11 path is found, the demo programs will not
+     be able to display graphics and will fail. Change your current path
+     if you encounter this problem.
+
+     Note that the release version will use Autoconf to detect everything
+     on Unix, so this will not be necessary !!
+
+
+II. DETAILED COMPILATION PROCEDURE:
+-----------------------------------
+
+  If you don't want to compile FreeType 2 from the command-line (for example
+  from a graphical IDE on a Mac or Windows), you'll need to understand how the
+  FreeType files are organized.
+
+  FreeType 2 has a very module design, and it is made of several components.
+  Each component must be compiled as a stand-alone object file, even when it
+  is really made of several C source files. For example, the "base layer"
+  component is made of the following C files:
+
+    src/
+      base/
+        ftcalc.c    - computations
+        ftobjs.c    - object management
+        ftstream.c  - stream input
+        ftlist.c    - simple list management
+        ftoutln.c   - simple outline processing
+        ftextend.c  - extensions support
+
+  However, you can create a single object file by compiling the file
+  "src/base/ftbase.c", whose content is basically:
+
+        #include <base/ftcalc.c>
+        #include <base/ftobjs.c>
+        #include <base/ftstream.c>
+        #include <base/ftlist.c>
+        #include <base/ftoutln.c>
+        #include <base/ftextend.c>
+
+  Similarly, each component has a single "englobing" C file to compile it
+  as a stand-alone object, i.e. :
+
+     src/base/ftbase.c         - the base layer, high-level interface
+     src/sfnt/sfnt.c           - the "sfnt" module
+     src/psnames/psnames.c     - the Postscript Names module
+     src/truetype/truetype.c   - the TrueType font driver
+     src/type1/type1.c         - the Type 1 font driver
+
+
+  To compile one component, do the following:
+
+   - add the top-level "include" directory to your compilation include path
+
+   - add the "src" directory to your compilation include path.
+
+   - compile the component "source" file (see list below), you don't need
+     to be in the component's directory..
+
+  For example, the following line can be used to compile the truetype driver
+  on Unix:
+
+     cd freetype2/
+     cc -c -Iinclude -Isrc  src/truetype/truetype.c
+
+  Alternatively:
+
+     cd freetype2/src/truetype
+     cc -c -I../../include -I.. truetype.c
+
+  The complete list of files to compile for a feature-complete build of
+  FreeType 2 is:
+
+     src/base/ftsystem.c         - system-specific memory and i/o support
+     src/base/ftinit.c           - initialisation layer
+     src/base/ftdebug.c          - debugging component (empty in release build)
+     src/base/ftbase.c           - the "base layer" component
+     src/base/ftglyph.c          - optional convenience functions
+     src/raster1/raster1.c       - the monochrome bitmap renderer
+     src/smooth/smooth.c         - the anti-aliased bitmap renderer
+     src/sfnt/sfnt.c             - the "sfnt" module
+     src/psnames/psnames.c       - the "psnames" module
+     src/truetype/truetype.c     - the TrueType font driver
+     src/type1/type1.c           - the Type 1 font driver (incl. Multiple Masters)
+     src/cid/type1cid.c          - the Type 1 CID-keyed font driver
+     src/cff/cff.c               - the OpenType/CFF/CEF font driver
+     src/winfonts/winfnt.c       - the Windows FNT/FON font driver
+
+  All font drivers are optional. the "sfnt" and "psnames" modules are
+  mandatory for certain drivers.
+
+
+III. Support for flat-directory compilation:
+----------------------------------------
+
+  It is now possible to put all FreeType 2 source files into a single
+  directory, with the exception of the "include" hierarchy.
+
+  Note that you'll still need to only compile the 'wrapper' sources described
+  above. Define the "FT_FLAT_COMPILE" macro when compiling. Here's an
+  example:
+  
+   1/ Copy all files in current directory:
+   
+     cp freetype2/src/base/*.[hc] .
+     cp freetype2/src/raster1/*.[hc] .
+     cp freetype2/src/smooth/*.[hc] .
+     etc...
+
+   2/ Compile sources:
+        
+     cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftsystem.c
+     cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftinit.c
+     cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftdebug.c
+     cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftbase.c
+     etc...
+
diff --git a/src/base/ftbase.c b/src/base/ftbase.c
index 20e4199..5d13d5e 100644
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -16,12 +16,20 @@
 /***************************************************************************/
 
 
+#ifdef FT_FLAT_COMPILE
+#include "ftcalc.c"
+#include "ftobjs.c"
+#include "ftstream.c"
+#include "ftlist.c"
+#include "ftoutln.c"
+#include "ftextend.c"
+#else
 #include <ftcalc.c>
 #include <ftobjs.c>
 #include <ftstream.c>
 #include <ftlist.c>
 #include <ftoutln.c>
 #include <ftextend.c>
-
+#endif
 
 /* END */
diff --git a/src/cff/cff.c b/src/cff/cff.c
index 40f6124..2d3dad2 100644
--- a/src/cff/cff.c
+++ b/src/cff/cff.c
@@ -18,11 +18,20 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
-#include <t2driver.c>    /* driver interface     */
-#include <t2parse.c>     /* token parser         */
-#include <t2load.c>      /* tables loader        */
-#include <t2objs.c>      /* object management    */
-#include <t2gload.c>     /* glyph loader         */
+#ifdef FT_FLAT_COMPILE
+#include "t2driver.c"    /* driver interface     */
+#include "t2parse.c"     /* token parser         */
+#include "t2load.c"      /* tables loader        */
+#include "t2objs.c"      /* object management    */
+#include "t2gload.c"     /* glyph loader         */
+#else
+#include <cff/t2driver.c>    /* driver interface     */
+#include <cff/t2parse.c>     /* token parser         */
+#include <cff/t2load.c>      /* tables loader        */
+#include <cff/t2objs.c>      /* object management    */
+#include <cff/t2gload.c>     /* glyph loader         */
+#endif
+
 
 
 /* END */
diff --git a/src/cff/rules.mk b/src/cff/rules.mk
index d7cc66a..ba87af5 100644
--- a/src/cff/rules.mk
+++ b/src/cff/rules.mk
@@ -19,14 +19,7 @@ T2_DIR  := $(SRC_)cff
 T2_DIR_ := $(T2_DIR)$(SEP)
 
 
-# additional include flags used when compiling the driver
-#
-T2_INCLUDE := $(T2_DIR)
-
-# compilation flags for the driver
-#
-T2_CFLAGS  := $(T2_INCLUDE:%=$I%)
-T2_COMPILE := $(FT_COMPILE) $(T2_CFLAGS)
+T2_COMPILE := $(FT_COMPILE)
 
 
 # T2 driver sources (i.e., C files)
diff --git a/src/cff/t2driver.c b/src/cff/t2driver.c
index 5f81b2b..eea6699 100644
--- a/src/cff/t2driver.c
+++ b/src/cff/t2driver.c
@@ -22,11 +22,17 @@
 #include <freetype/internal/sfnt.h>
 #include <freetype/ttnameid.h>
 
-#include <t2driver.h>
-#include <t2gload.h>
-
 #include <freetype/internal/t2errors.h>
 
+#ifdef FT_FLAT_COMPILE
+#include "t2driver.h"
+#include "t2gload.h"
+#else
+#include <cff/t2driver.h>
+#include <cff/t2gload.h>
+#endif
+
+
 
   /*************************************************************************/
   /*                                                                       */
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index 52786be..f36841c 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -23,8 +23,13 @@
 #include <freetype/ftoutln.h>
 #include <freetype/tttags.h>
 
-#include <t2load.h>
-#include <t2gload.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2load.h"
+#include "t2gload.h"
+#else
+#include <cff/t2load.h>
+#include <cff/t2gload.h>
+#endif
 
 #include <freetype/internal/t2errors.h>
 
@@ -472,9 +477,9 @@
       builder->path_begun = 1;
       error = add_contour( builder );
       if ( !error )
-        error = add_point1( builder, x, y );
+        return error;
     }
-    return error;
+    return add_point1( builder, x, y );
   }
 
 
@@ -595,8 +600,8 @@
       v = *ip++;
       if ( v >= 32 || v == 28 )
       {
-        FT_Int  shift = 16;
-        FT_Long val;
+        FT_Int    shift = 16;
+        FT_Int32  val;
 
 
         /* this is an operand, push it on the stack */
@@ -604,7 +609,7 @@
         {
           if ( ip + 1 >= limit )
             goto Syntax_Error;
-          val = (FT_Short)( ( (FT_Int)ip[0] << 8 ) + ip[1] );
+          val = (FT_Int32)( ( (FT_Short)ip[0] << 8 ) | ip[1] );
           ip += 2;
         }
         else if ( v < 247 )
@@ -640,7 +645,7 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
         if ( !( val & 0xFFFF ) )
-          FT_TRACE4(( " %d", (FT_Int)( val >> 16 ) ));
+          FT_TRACE4(( " %d", (FT_Int32)( val >> 16 ) ));
         else
           FT_TRACE4(( " %.2f", val/65536.0 ));
 #endif
@@ -1296,7 +1301,7 @@
           {
             FT_Pos start_x, start_y; /* record start x,y values for alter use */
             FT_Int dx = 0, dy = 0;   /* used in hort./vert. algorithm below   */
-            FT_Int hort_flag, count;
+            FT_Int horizontal, count;
  
             FT_TRACE4(( " flex1" ));
    
@@ -1314,7 +1319,7 @@
             args = stack;
             
             /* grab up to the last argument */
-            while ( args < decoder->top - 1)
+            for ( count = 5; count > 0; count-- )
             {
               dx += args[0];
               dy += args[1];
@@ -1328,7 +1333,7 @@
             if ( dy < 0 ) dy = -dy;
    
             /* strange test, but here it is... */
-            hort_flag = (dx > dy);
+            horizontal = (dx > dy);
    
             for ( count = 5; count > 0; count-- )
             {
@@ -1338,7 +1343,7 @@
               args += 2;
             }
    
-            if (hort_flag)
+            if (horizontal)
             {
               x += args[0];
               y  = start_y;
diff --git a/src/cff/t2gload.h b/src/cff/t2gload.h
index 39ef98c..a089e88 100644
--- a/src/cff/t2gload.h
+++ b/src/cff/t2gload.h
@@ -20,7 +20,12 @@
 #define T2GLOAD_H
 
 #include <freetype/freetype.h>
-#include <t2objs.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t2objs.h"
+#else
+#include <cff/t2objs.h>
+#endif
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/cff/t2load.c b/src/cff/t2load.c
index fdbc9df..285c62f 100644
--- a/src/cff/t2load.c
+++ b/src/cff/t2load.c
@@ -23,8 +23,14 @@
 
 #include <freetype/internal/t2errors.h>
 #include <freetype/tttags.h>
-#include <t2load.h>
-#include <t2parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t2load.h"
+#include "t2parse.h"
+#else
+#include <cff/t2load.h>
+#include <cff/t2parse.h>
+#endif
 
 
   /*************************************************************************/
@@ -283,8 +289,6 @@
   }
 
 
-#if 0 /* unused until we fully support pure-CFF fonts */
-
   LOCAL_FUNC
   FT_String*  T2_Get_String( CFF_Index*          index,
                              FT_UInt             sid,
@@ -319,7 +323,6 @@
     }
   }
 
-#endif /* 0 */
 
 
   /*************************************************************************/
diff --git a/src/cff/t2load.h b/src/cff/t2load.h
index 0cf64e0..b86956d 100644
--- a/src/cff/t2load.h
+++ b/src/cff/t2load.h
@@ -29,14 +29,11 @@
   FT_String*  T2_Get_Name( CFF_Index*  index,
                            FT_UInt     element );
 
-#if 0  /* will be used later for pure-CFF font support */
-
   LOCAL_DEF
   FT_String*  T2_Get_String( CFF_Index*          index,
                              FT_UInt             sid,
                              PSNames_Interface*  interface );
 
-#endif
 
   LOCAL_DEF
   FT_Error  T2_Access_Element( CFF_Index*  index,
diff --git a/src/cff/t2objs.c b/src/cff/t2objs.c
index 2030bd1..fa4f9bf 100644
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -19,14 +19,21 @@
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftcalc.h>
 #include <freetype/internal/ftstream.h>
+#include <freetype/fterrors.h>
 #include <freetype/ttnameid.h>
 #include <freetype/tttags.h>
 
 #include <freetype/internal/sfnt.h>
 #include <freetype/internal/psnames.h>
-#include <t2objs.h>
 
-#include <t2load.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2objs.h"
+#include "t2load.h"
+#else
+#include <cff/t2objs.h>
+#include <cff/t2load.h>
+#endif
+
 #include <freetype/internal/t2errors.h>
 
 
@@ -46,7 +53,131 @@
   /*                                                                       */
   /*************************************************************************/
 
+  static
+  FT_String*   T2_StrCopy( FT_Memory  memory, const FT_String*  source )
+  {
+    FT_Error   error;
+    FT_String* result = 0;
+    FT_Int     len = (FT_Int)strlen(source);
+    
+    if ( !ALLOC( result, len+1 ) )
+    {
+      MEM_Copy( result, source, len );
+      result[len] = 0;
+    }
+    return result;
+  }
+
+
+  /* this function is used to build a Unicode charmap from the glyph names */
+  /* in a file..                                                           */
+  static
+  FT_Error   CFF_Build_Unicode_Charmap( T2_Face             face,
+                                        FT_ULong            base_offset,
+                                        PSNames_Interface*  psnames )
+  {
+    CFF_Font*       font = (CFF_Font*)face->extra.data;
+    FT_Memory       memory = FT_FACE_MEMORY(face);
+    FT_UInt         n, num_glyphs = face->root.num_glyphs;
+    const char**    glyph_names;
+    FT_Error        error;
+    CFF_Font_Dict*  dict = &font->top_font.font_dict;
+    FT_ULong        charset_offset;
+    FT_Byte         format;
+    FT_Stream       stream = face->root.stream;
+
+    charset_offset = dict->charset_offset;
+    if (!charset_offset)
+    {
+      FT_ERROR(( "CFF.Build_Unicode_Charmap: charset table is missing\n" ));
+      error = FT_Err_Invalid_File_Format;
+      goto Exit;
+    }
 
+    /* seek to charset table and allocate glyph names table */
+    if ( FILE_Seek( base_offset + charset_offset )           ||
+         ALLOC_ARRAY( glyph_names, num_glyphs, const char* ) )
+      goto Exit;
+
+    /* now, read each glyph name and store it in the glyph name table */
+    if ( READ_Byte(format) )
+      goto Fail;
+      
+    switch (format)
+    {
+      case 0:  /* format 0 - one SID per glyph */
+        {
+          const char**  gname = glyph_names;
+          const char**  limit = gname + num_glyphs;
+          
+          if ( ACCESS_Frame( num_glyphs*2 ) )
+            goto Fail;
+          
+          for ( ; gname < limit; gname++ )
+            gname[0] = T2_Get_String( &font->string_index,
+                                      GET_UShort(),
+                                      psnames );
+          FORGET_Frame();
+          break;
+        }
+        
+      case 1:  /* format 1 - sequential ranges                    */
+      case 2:  /* format 2 - sequential ranges with 16-bit counts */
+        {
+          const char**  gname = glyph_names;
+          const char**  limit = gname + num_glyphs;
+          FT_UInt       len = 3;
+          
+          if (format == 2)
+            len++;
+          
+          while (gname < limit)
+          {
+            FT_UInt   first;
+            FT_UInt   count;
+              
+            if ( ACCESS_Frame( len ) )
+              goto Fail;
+
+            first = GET_UShort();
+            if (format == 3)
+              count = GET_UShort();
+            else
+              count = GET_Byte();
+
+            FORGET_Frame();
+            
+            for ( ; count > 0; count-- )
+            {
+              gname[0] = T2_Get_String( &font->string_index,
+                                        first,
+                                        psnames );
+              gname++;
+              first++;
+            }
+          }
+          break;
+        }
+        
+      default:   /* unknown charset format  !! */
+        FT_ERROR(( "CFF: unknown charset format !!\n" ));
+        error = FT_Err_Invalid_File_Format;
+        goto Fail;
+    }
+
+    /* all right, the glyph names were loaded, we now need to create */
+    /* the corresponding unicode charmap..                           */
+
+  Fail:
+    for ( n = 0; n < num_glyphs; n++ )
+      FREE( glyph_names[n] );
+      
+    FREE( glyph_names );
+        
+  Exit:
+    return error;
+  }
+  
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -77,48 +208,82 @@
                           FT_Int         num_params,
                           FT_Parameter*  params )
   {
-    FT_Error         error;
-    SFNT_Interface*  sfnt;
-
+    FT_Error            error;
+    SFNT_Interface*     sfnt;
+    PSNames_Interface*  psnames;
+    FT_Bool             pure_cff    = 1;
+    FT_Bool             sfnt_format = 0;
 
     sfnt = (SFNT_Interface*)FT_Get_Module_Interface(
              face->root.driver->root.library, "sfnt" );
     if ( !sfnt )
       goto Bad_Format;
 
+    psnames = (PSNames_Interface*)FT_Get_Module_Interface(
+             face->root.driver->root.library, "psnames" );
+
     /* create input stream from resource */
     if ( FILE_Seek( 0 ) )
       goto Exit;
 
     /* check that we have a valid OpenType file */
     error = sfnt->init_face( stream, face, face_index, num_params, params );
-    if ( error )
-      goto Exit;
-
-    if ( face->format_tag != 0x4F54544FL )  /* `OTTO'; OpenType/CFF font */
+    if ( !error )
     {
-      FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
-      goto Bad_Format;
-    }
+      if ( face->format_tag != 0x4F54544FL )  /* `OTTO'; OpenType/CFF font */
+      {
+        FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
+        goto Bad_Format;
+      }
 
-    /* If we are performing a simple font format check, exit immediately */
-    if ( face_index < 0 )
-      return T2_Err_Ok;
+      /* If we are performing a simple font format check, exit immediately */
+      if ( face_index < 0 )
+        return T2_Err_Ok;
 
-    /* Load font directory */
-    error = sfnt->load_face( stream, face, face_index, num_params, params );
-    if ( error )
-      goto Exit;
+      sfnt_format = 1;  
 
-    /* now, load the CFF part of the file */
-    error = face->goto_table( face, TTAG_CFF, stream, 0 );
-    if ( error )
-      goto Exit;
+      /* now, the font can be either an OpenType/CFF font, or a SVG CEF font */
+      /* in the later case, it doesn't have a "head" table..                 */
+      error = face->goto_table( face, TTAG_head, stream, 0 );
+      if (!error)
+      {
+        pure_cff = 0;
+
+        /* Load font directory */
+        error = sfnt->load_face( stream, face, face_index, num_params, params );
+        if ( error )
+          goto Exit;
+      }
+      else
+      {
+        /* load the "cmap" table by hand */
+        error = sfnt->load_charmaps( face, stream );
+        if (error)
+          goto Exit;
+          
+        /* XXX: for now, we don't load the GPOS table, as OpenType Layout */
+        /* support will be added later to FreeType 2 as a separate module */
+      }
 
+      /* now, load the CFF part of the file */
+      error = face->goto_table( face, TTAG_CFF, stream, 0 );
+      if ( error )
+        goto Exit;
+    }
+    else
+    {
+      /* rewind to start of file, we're going to load a pure-CFF font */
+      (void)FILE_Seek(0);
+      error = FT_Err_Ok;
+    }
+
+
+    /* now load and parse the CFF table in the file */
     {
       CFF_Font*  cff;
       FT_Memory  memory = face->root.memory;
       FT_Face    root;
+      FT_UInt    flags;
 
 
       if ( ALLOC( cff, sizeof ( *cff ) ) )
@@ -130,11 +295,80 @@
         goto Exit;
 
       /* Complement the root flags with some interesting information. */
-      /* Note that for OpenType/CFF, there is no need to do this, but */
-      /* this will be necessary for pure CFF fonts through.           */
+      /* Note that this is only necessary for pure CFF and CEF fonts  */
+      
       root = &face->root;
-    }
+      if (pure_cff)
+      {
+        CFF_Font_Dict*  dict = &cff->top_font.font_dict;
+      
+        /* we need the psnames module for pure-CFF and CEF formats */
+        if (!psnames)
+        {
+          FT_ERROR(( "cannot open CFF & CEF fonts without the 'psnames' module\n" ));
+          goto Bad_Format;
+        }
+        
+        /* retrieve font family & style name */
+        if (dict->cid_registry)
+        {
+          root->family_name = T2_Get_String( &cff->string_index,
+                                             dict->cid_font_name,
+                                             psnames );
+
+          root->style_name  = T2_StrCopy( memory, "Regular" );  /* XXXX */
+        }
+        else
+        {
+          root->family_name = T2_Get_String( &cff->string_index,
+                                             dict->base_font_name,
+                                             psnames );
+                                             
+          root->style_name  = T2_Get_String( &cff->string_index,
+                                             dict->weight,
+                                             psnames );
+        }
+        
+          /*********************************************************************/
+          /*                                                                   */
+          /* Compute face flags.                                               */
+          /*                                                                   */
+          flags = FT_FACE_FLAG_SCALABLE  |    /* scalable outlines */
+                  FT_FACE_FLAG_HORIZONTAL;    /* horizontal data   */
+
+          if (sfnt_format)
+            flags |= FT_FACE_FLAG_SFNT;
+    
+          /* fixed width font? */
+          if ( dict->is_fixed_pitch )
+            flags |= FT_FACE_FLAG_FIXED_WIDTH;
+
+/* XXXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
+#if 0
+          /* kerning available ? */
+          if ( face->kern_pairs )
+            flags |= FT_FACE_FLAG_KERNING;
+#endif
 
+          root->face_flags = flags;
+    
+          /*********************************************************************/
+          /*                                                                   */
+          /* Compute style flags.                                              */
+          /*                                                                   */
+          flags = 0;
+    
+          if ( dict->italic_angle )
+            flags |= FT_STYLE_FLAG_ITALIC;
+            
+          /* XXXX : may not be correct .. */
+          if ( cff->top_font.private_dict.force_bold )
+            flags |= FT_STYLE_FLAG_BOLD;
+            
+          root->style_flags = flags;
+      }
+    }
+    
   Exit:
     return error;
 
diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c
index b60f984..7800fe4 100644
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -16,7 +16,12 @@
 /***************************************************************************/
 
 
-#include <t2parse.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2parse.h"
+#else
+#include <cff/t2parse.h>
+#endif
+
 #include <freetype/internal/t2errors.h>
 
 
@@ -417,7 +422,11 @@
 
   static const T2_Field_Handler  t2_field_handlers[] =
   {
-#include <t2tokens.h>
+#ifdef FT_FLAT_COMPILE
+#include "t2tokens.h"
+#else
+#include <cff/t2tokens.h>
+#endif
     { 0, 0, 0, 0, 0, 0, 0 }
   };
 
diff --git a/src/cid/cidafm.c b/src/cid/cidafm.c
index ce2739b..d37fe2e 100644
--- a/src/cid/cidafm.c
+++ b/src/cid/cidafm.c
@@ -15,8 +15,12 @@
 /*                                                                         */
 /***************************************************************************/
 
+#ifdef FT_FLAT_COMPILE
+#include "cidafm.h"
+#else
+#include <cid/cidafm.h>
+#endif
 
-#include <cidafm.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/t1types.h>
 #include <freetype/internal/t1errors.h>
diff --git a/src/cid/cidafm.h b/src/cid/cidafm.h
index 1e3f990..3496b5d 100644
--- a/src/cid/cidafm.h
+++ b/src/cid/cidafm.h
@@ -19,7 +19,11 @@
 #ifndef CIDAFM_H
 #define CIDAFM_H
 
-#include <cidobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidobjs.h"
+#else
+#include <cid/cidobjs.h>
+#endif
 
 
 #ifdef __cplusplus
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 4f32fa4..0c6b147 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -16,8 +16,14 @@
 /***************************************************************************/
 
 
-#include <cidload.h>
-#include <cidgload.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidload.h"
+#include "cidgload.h"
+#else
+#include <cid/cidload.h>
+#include <cid/cidgload.h>
+#endif
+
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/ftoutln.h>
diff --git a/src/cid/cidgload.h b/src/cid/cidgload.h
index 555586a..0538710 100644
--- a/src/cid/cidgload.h
+++ b/src/cid/cidgload.h
@@ -19,7 +19,11 @@
 #ifndef CIDGLOAD_H
 #define CIDGLOAD_H
 
-#include <cidobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidobjs.h"
+#else
+#include <cid/cidobjs.h>
+#endif
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index b9a94f5..cf5f50e 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -22,7 +22,12 @@
 
 #include <freetype/internal/t1types.h>
 #include <freetype/internal/t1errors.h>
-#include <cidload.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "cidload.h"
+#else
+#include <cid/cidload.h>
+#endif
 
 #include <stdio.h>
 #include <ctype.h>  /* for isspace(), isalnum() */
@@ -238,7 +243,11 @@
   static
   const CID_Field_Rec  t1_field_records[] =
   {
-#include <cidtokens.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidtokens.h"
+#else
+#include <cid/cidtokens.h>
+#endif
     { 0, 0, 0, 0, 0, 0, 0, 0 }
   };
 
diff --git a/src/cid/cidload.h b/src/cid/cidload.h
index dccfd38..0e58c92 100644
--- a/src/cid/cidload.h
+++ b/src/cid/cidload.h
@@ -20,7 +20,12 @@
 #define CIDLOAD_H
 
 #include <freetype/internal/ftstream.h>
-#include <cidparse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "cidparse.h"
+#else
+#include <cid/cidparse.h>
+#endif
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index eead86c..277dc1a 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -19,8 +19,14 @@
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
 
-#include <cidgload.h>
-#include <cidload.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidgload.h"
+#include "cidload.h"
+#else
+#include <cid/cidgload.h>
+#include <cid/cidload.h>
+#endif
+
 #include <freetype/internal/psnames.h>
 
 
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index 5b29db4..c7063a9 100644
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -21,7 +21,12 @@
 #include <freetype/internal/ftobjs.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/t1errors.h>
-#include <cidparse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "cidparse.h"
+#else
+#include <cid/cidparse.h>
+#endif
 
 #include <string.h>     /* for strncmp() */
 
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c
index 651dcb1..84ba677 100644
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -16,8 +16,13 @@
 /***************************************************************************/
 
 
-#include <cidriver.h>
-#include <cidgload.h>
+#ifdef FT_FLAT_COMPILE
+#include "cidriver.h"
+#include "cidgload.h"
+#else
+#include <cid/cidriver.h>
+#include <cid/cidgload.h>
+#endif
 
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
diff --git a/src/cid/rules.mk b/src/cid/rules.mk
index 20c0235..cbaaec7 100644
--- a/src/cid/rules.mk
+++ b/src/cid/rules.mk
@@ -19,14 +19,7 @@ CID_DIR  := $(SRC_)cid
 CID_DIR_ := $(CID_DIR)$(SEP)
 
 
-# additional include flags used when compiling the driver
-#
-CID_INCLUDE := $(CID_DIR)
-
-# compilation flags for the driver
-#
-CID_CFLAGS  := $(CID_INCLUDE:%=$I%)
-CID_COMPILE := $(FT_COMPILE) $(CID_CFLAGS)
+CID_COMPILE := $(FT_COMPILE)
 
 
 # CID driver sources (i.e., C files)
diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c
index 855f564..65feedc 100644
--- a/src/cid/type1cid.c
+++ b/src/cid/type1cid.c
@@ -18,14 +18,18 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
-#include <cidparse.c>
-#include <cidload.c>
-#include <cidobjs.c>
-#include <cidriver.c>
-#include <cidgload.c>
-
-#if 0
-#include <cidafm.c>
+#ifdef FT_FLAT_COMPILE
+#include "cidparse.c"
+#include "cidload.c"
+#include "cidobjs.c"
+#include "cidriver.c"
+#include "cidgload.c"
+#else
+#include <cid/cidparse.c>
+#include <cid/cidload.c>
+#include <cid/cidobjs.c>
+#include <cid/cidriver.c>
+#include <cid/cidgload.c>
 #endif
 
 
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 3a1a8a1..efd5ab9 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -18,7 +18,14 @@
 
 #include <freetype/internal/psnames.h>
 #include <freetype/internal/ftobjs.h>
-#include <psmodule.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "psmodule.h"
+#include "pstables.h"
+#else
+#include <psnames/psmodule.h>
+#include <psnames/pstables.h>
+#endif
 
 #include <stdlib.h>     /* for qsort()             */
 #include <string.h>     /* for strcmp(), strncpy() */
@@ -27,9 +34,6 @@
 #ifndef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES
 
 
-  /* see the Python script `freetype2/docs/glnames.py' which is used */
-  /* to generate the following file                                  */
-#include <pstables.h>
 
 
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk
index 0ee3373..25552b2 100644
--- a/src/psnames/rules.mk
+++ b/src/psnames/rules.mk
@@ -18,15 +18,10 @@
 PSNAMES_DIR  := $(SRC_)psnames
 PSNAMES_DIR_ := $(PSNAMES_DIR)$(SEP)
 
-# additional include flags used when compiling the driver
-#
-PSNAMES_INCLUDE := $(PSNAMES_DIR)
-
 
 # compilation flags for the driver
 #
-PSNAMES_CFLAGS  := $(PSNAMES_INCLUDE:%=$I%)
-PSNAMES_COMPILE := $(FT_COMPILE) $(PSNAMES_CFLAGS)
+PSNAMES_COMPILE := $(FT_COMPILE)
 
 
 # PSNames driver sources (i.e., C files)
diff --git a/src/raster1/ftrend1.c b/src/raster1/ftrend1.c
index 489cad9..0b8d72d 100644
--- a/src/raster1/ftrend1.c
+++ b/src/raster1/ftrend1.c
@@ -18,8 +18,14 @@
 
 #include <freetype/internal/ftobjs.h>
 #include <freetype/ftoutln.h>
-#include <ftrend1.h>
-#include <ftraster.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "ftrend1.h"
+#include "ftraster.h"
+#else
+#include <raster1/ftrend1.h>
+#include <raster1/ftraster.h>
+#endif
 
 
   /* initialize renderer -- init its raster */
diff --git a/src/raster1/raster1.c b/src/raster1/raster1.c
index 8f53a53..b6b6e62 100644
--- a/src/raster1/raster1.c
+++ b/src/raster1/raster1.c
@@ -18,8 +18,13 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
-#include <ftraster.c>
-#include <ftrend1.c>
+#ifdef FT_FLAT_COMPILE
+#include "ftraster.c"
+#include "ftrend1.c"
+#else
+#include <raster1/ftraster.c>
+#include <raster1/ftrend1.c>
+#endif
 
 
 /* END */
diff --git a/src/raster1/rules.mk b/src/raster1/rules.mk
index bd7da8a..3810845 100644
--- a/src/raster1/rules.mk
+++ b/src/raster1/rules.mk
@@ -18,15 +18,9 @@
 RAS1_DIR  := $(SRC_)raster1
 RAS1_DIR_ := $(RAS1_DIR)$(SEP)
 
-# additional include flags used when compiling the driver
-#
-RAS1_INCLUDE := $(RAS1_DIR)
-
-
 # compilation flags for the driver
 #
-RAS1_CFLAGS  := $(RAS1_INCLUDE:%=$I%)
-RAS1_COMPILE := $(FT_COMPILE) $(RAS1_CFLAGS)
+RAS1_COMPILE := $(FT_COMPILE)
 
 
 # raster1 driver sources (i.e., C files)
diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk
index e3b0bbd..2255e6a 100644
--- a/src/sfnt/rules.mk
+++ b/src/sfnt/rules.mk
@@ -19,14 +19,9 @@ SFNT_DIR  := $(SRC_)sfnt
 SFNT_DIR_ := $(SFNT_DIR)$(SEP)
 
 
-# additional include flags used when compiling the driver
-#
-SFNT_INCLUDE := $(SFNT_DIR)
-
 # compilation flags for the driver
 #
-SFNT_CFLAGS  := $(SFNT_INCLUDE:%=$I%)
-SFNT_COMPILE := $(FT_COMPILE) $(SFNT_CFLAGS)
+SFNT_COMPILE := $(FT_COMPILE)
 
 
 # SFNT driver sources (i.e., C files)
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index fe0a271..758d53a 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -18,12 +18,23 @@
 
 #include <freetype/internal/sfnt.h>
 #include <freetype/internal/ftobjs.h>
-#include <sfdriver.h>
-#include <ttload.h>
-#include <ttsbit.h>
-#include <ttpost.h>
-#include <ttcmap.h>
-#include <sfobjs.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "sfdriver.h"
+#include "ttload.h"
+#include "ttsbit.h"
+#include "ttpost.h"
+#include "ttcmap.h"
+#include "sfobjs.h"
+#else
+#include <sfnt/sfdriver.h>
+#include <sfnt/ttload.h>
+#include <sfnt/ttsbit.h>
+#include <sfnt/ttpost.h>
+#include <sfnt/ttcmap.h>
+#include <sfnt/sfobjs.h>
+#endif
+
 
 #include <string.h>     /* for strcmp() */
 
diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c
index a9aa182..a87158d 100644
--- a/src/sfnt/sfnt.c
+++ b/src/sfnt/sfnt.c
@@ -18,19 +18,41 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
-#include <ttload.c>
-#include <ttcmap.c>
-#include <sfobjs.c>
+#ifdef FT_FLAT_COMPILE
+
+#include "ttload.c"
+#include "ttcmap.c"
+#include "sfobjs.c"
 
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-#include <ttsbit.c>
+#include "ttsbit.c"
 #endif
 
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-#include <ttpost.c>
+#include "ttpost.c"
+#endif
+#include "sfdriver.c"
+
+
+#else /* FT_FLAT_COMPILE */
+
+#include <sfnt/ttload.c>
+#include <sfnt/ttcmap.c>
+#include <sfnt/sfobjs.c>
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+#include <sfnt/ttsbit.c>
 #endif
 
-#include <sfdriver.c>
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+#include <sfnt/ttpost.c>
+#endif
+#include <sfnt/sfdriver.c>
+
+#endif   /* FT_FLAT_COMPILE */
+
+
+
 
 
 /* END */
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 87cc0cc..98b38c1 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -16,7 +16,12 @@
 /***************************************************************************/
 
 
-#include <sfobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "sfobjs.h"
+#else
+#include <sfnt/sfobjs.h>
+#endif
+
 #include <freetype/internal/sfnt.h>
 #include <freetype/internal/psnames.h>
 #include <freetype/ttnameid.h>
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index f15963e..7982850 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -19,8 +19,15 @@
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/tterrors.h>
 
-#include <ttload.h>
-#include <ttcmap.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttload.h"
+#include "ttcmap.h"
+#else
+#include <sfnt/ttload.h>
+#include <sfnt/ttcmap.h>
+#endif
+
+
 
 
   /*************************************************************************/
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index a855720..e316beb 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -21,8 +21,15 @@
 #include <freetype/internal/tterrors.h>
 #include <freetype/tttags.h>
 
-#include <ttload.h>
-#include <ttcmap.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttload.h"
+#include "ttcmap.h"
+#else
+#include <sfnt/ttload.h>
+#include <sfnt/ttcmap.h>
+#endif
+
+
 
 
   /*************************************************************************/
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index d613174..4151a6c 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -29,8 +29,14 @@
 #include <freetype/internal/tterrors.h>
 #include <freetype/tttags.h>
 
-#include <ttpost.h>
-#include <ttload.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttpost.h"
+#include "ttload.h"
+#else
+#include <sfnt/ttpost.h>
+#include <sfnt/ttload.h>
+#endif
+
 
 
   /*************************************************************************/
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index f6ed29a..34c5480 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -20,7 +20,12 @@
 #include <freetype/internal/tterrors.h>
 #include <freetype/tttags.h>
 
-#include <ttsbit.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttsbit.h"
+#else
+#include <sfnt/ttsbit.h>
+#endif
+
 
 
   /*************************************************************************/
diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h
index 7992a7d..fcfec06 100644
--- a/src/sfnt/ttsbit.h
+++ b/src/sfnt/ttsbit.h
@@ -19,7 +19,12 @@
 #ifndef TTSBIT_H
 #define TTSBIT_H
 
-#include <ttload.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttload.h"
+#else
+#include <sfnt/ttload.h>
+#endif
+
 
 
 #ifdef __cplusplus
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 198fda2..7303b3a 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -123,8 +123,13 @@
 
 #else /* _STANDALONE_ */
 
-
+#ifdef FT_FLAT_COMPILE
 #include "ftgrays.h"
+#else
+#include <smooth/ftgrays.h>
+#endif
+
+
 #include <freetype/internal/ftobjs.h>  /* for FT_UNUSED()               */
 #include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
 #include <freetype/ftoutln.h>          /* for FT_Outline_Decompose()    */
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 1b1b0bd..91cfe77 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -18,8 +18,16 @@
 
 #include <freetype/internal/ftobjs.h>
 #include <freetype/ftoutln.h>
-#include <ftsmooth.h>
-#include <ftgrays.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "ftsmooth.h"
+#include "ftgrays.h"
+#else
+#include <smooth/ftsmooth.h>
+#include <smooth/ftgrays.h>
+#endif
+
+
 
 
   /* initialize renderer -- init its raster */
diff --git a/src/smooth/rules.mk b/src/smooth/rules.mk
index fd03339..a81d60a 100644
--- a/src/smooth/rules.mk
+++ b/src/smooth/rules.mk
@@ -18,15 +18,9 @@
 SMOOTH_DIR  := $(SRC_)smooth
 SMOOTH_DIR_ := $(SMOOTH_DIR)$(SEP)
 
-# additional include flags used when compiling the driver
-#
-SMOOTH_INCLUDE := $(SMOOTH_DIR)
-
-
 # compilation flags for the driver
 #
-SMOOTH_CFLAGS  := $(SMOOTH_INCLUDE:%=$I%)
-SMOOTH_COMPILE := $(FT_COMPILE) $(SMOOTH_CFLAGS)
+SMOOTH_COMPILE := $(FT_COMPILE)
 
 
 # smooth driver sources (i.e., C files)
diff --git a/src/smooth/smooth.c b/src/smooth/smooth.c
index bdb1245..9b60547 100644
--- a/src/smooth/smooth.c
+++ b/src/smooth/smooth.c
@@ -18,8 +18,15 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
-#include <ftgrays.c>
-#include <ftsmooth.c>
+#ifdef FT_FLAT_COMPILE
+#include "ftgrays.c"
+#include "ftsmooth.c"
+#else
+#include <smooth/ftgrays.c>
+#include <smooth/ftsmooth.c>
+#endif
+
+
 
 
 /* END */
diff --git a/src/truetype/rules.mk b/src/truetype/rules.mk
index 51c8556..9289378 100644
--- a/src/truetype/rules.mk
+++ b/src/truetype/rules.mk
@@ -19,14 +19,9 @@ TT_DIR  := $(SRC_)truetype
 TT_DIR_ := $(TT_DIR)$(SEP)
 
 
-# additional include flags used when compiling the driver
-#
-TT_INCLUDE := $(TT_DIR)
-
 # compilation flags for the driver
 #
-TT_CFLAGS  := $(TT_INCLUDE:%=$I%)
-TT_COMPILE := $(FT_COMPILE) $(TT_CFLAGS)
+TT_COMPILE := $(FT_COMPILE)
 
 
 # TrueType driver sources (i.e., C files)
diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c
index 642e4f7..0d6d582 100644
--- a/src/truetype/truetype.c
+++ b/src/truetype/truetype.c
@@ -18,13 +18,26 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
-#include <ttdriver.c>    /* driver interface     */
-#include <ttpload.c>     /* tables loader        */
-#include <ttgload.c>     /* glyph loader         */
-#include <ttobjs.c>      /* object manager       */
+#ifdef FT_FLAT_COMPILE
 
+#include "ttdriver.c"    /* driver interface     */
+#include "ttpload.c"     /* tables loader        */
+#include "ttgload.c"     /* glyph loader         */
+#include "ttobjs.c"      /* object manager       */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#include <ttinterp.c>    /* bytecode interpreter */
+#include "ttinterp.c"    /* bytecode interpreter */
+#endif
+
+#else
+
+#include <truetype/ttdriver.c>    /* driver interface     */
+#include <truetype/ttpload.c>     /* tables loader        */
+#include <truetype/ttgload.c>     /* glyph loader         */
+#include <truetype/ttobjs.c>      /* object manager       */
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#include <truetype/ttinterp.c>    /* bytecode interpreter */
+#endif
+
 #endif
 
 
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 8921349..5113d44 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -21,8 +21,14 @@
 #include <freetype/internal/sfnt.h>
 #include <freetype/ttnameid.h>
 
-#include <ttdriver.h>
-#include <ttgload.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttdriver.h"
+#include "ttgload.h"
+#else
+#include <truetype/ttdriver.h>
+#include <truetype/ttgload.h>
+#endif
+
 
 
   /*************************************************************************/
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 264947b..ba440fa 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -23,13 +23,14 @@
 #include <freetype/tttags.h>
 #include <freetype/ftoutln.h>
 
-#include <ttgload.h>
-
-#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#include <ttinterp.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttgload.h"
+#else
+#include <truetype/ttgload.h>
 #endif
 
 
+
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index cebead7..a3b1585 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -19,12 +19,23 @@
 #ifndef TTGLOAD_H
 #define TTGLOAD_H
 
-#include <ttobjs.h>
+#ifdef FT_FLAT_COMPILE
 
+#include "ttobjs.h"
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#include <ttinterp.h>
+#include "ttinterp.h"
 #endif
 
+#else
+
+#include <truetype/ttobjs.h>
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#include <truetype/ttinterp.h>
+#endif
+
+#endif
+
+
 #ifdef __cplusplus
   extern "C" {
 #endif
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index d503820..5b736d1 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -20,9 +20,14 @@
 #include <freetype/internal/ftcalc.h>
 #include <freetype/ftsystem.h>
 
-#include <ttobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttinterp.h"
+#else
+#include <truetype/ttinterp.h>
+#endif
+
+
 #include <freetype/internal/tterrors.h>
-#include <ttinterp.h>
 
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index cb18360..2aceca8 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -19,7 +19,12 @@
 #ifndef TTINTERP_H
 #define TTINTERP_H
 
-#include <ttobjs.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttobjs.h"
+#else
+#include <truetype/ttobjs.h>
+#endif
+
 
 
 #ifdef __cplusplus
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 38a80f2..747f67d 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -24,16 +24,28 @@
 
 #include <freetype/internal/sfnt.h>
 #include <freetype/internal/psnames.h>
-#include <ttobjs.h>
 
-#include <ttpload.h>
-#include <ttgload.h>
-#include <freetype/internal/tterrors.h>
+#ifdef FT_FLAT_COMPILE
+
+#include "ttgload.h"
+#include "ttpload.h"
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#include "ttinterp.h"
+#endif
+
+#else
 
+#include <truetype/ttgload.h>
+#include <truetype/ttpload.h>
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#include <ttinterp.h>
+#include <truetype/ttinterp.h>
 #endif
 
+#endif
+
+#include <freetype/internal/tterrors.h>
+
+
 
   /*************************************************************************/
   /*                                                                       */
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index d87bd40..d82dd45 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -21,7 +21,12 @@
 #include <freetype/internal/ftstream.h>
 #include <freetype/tttags.h>
 
-#include <ttpload.h>
+#ifdef FT_FLAT_COMPILE
+#include "ttpload.h"
+#else
+#include <truetype/ttpload.h>
+#endif
+
 #include <freetype/internal/tterrors.h>
 
 
diff --git a/src/type1/rules.mk b/src/type1/rules.mk
index 6b71841..b5872ac 100644
--- a/src/type1/rules.mk
+++ b/src/type1/rules.mk
@@ -19,14 +19,9 @@ T1_DIR  := $(SRC_)type1
 T1_DIR_ := $(T1_DIR)$(SEP)
 
 
-# additional include flags used when compiling the driver
-#
-T1_INCLUDE := $(T1_DIR)
-
 # compilation flags for the driver
 #
-T1_CFLAGS  := $(T1_INCLUDE:%=$I%)
-T1_COMPILE := $(FT_COMPILE) $(T1_CFLAGS)
+T1_COMPILE := $(FT_COMPILE)
 
 
 # Type1 driver sources (i.e., C files)
diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c
index 7cee611..1b2f8fd 100644
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -16,7 +16,12 @@
 /***************************************************************************/
 
 
-#include <t1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1afm.h"
+#else
+#include <type1/t1afm.h>
+#endif
+
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/t1types.h>
 
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 5dc9949..863cee7 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -16,9 +16,15 @@
 /***************************************************************************/
 
 
-#include <t1driver.h>
-#include <t1gload.h>
-#include <t1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1driver.h"
+#include "t1gload.h"
+#include "t1afm.h"
+#else
+#include <type1/t1driver.h>
+#include <type1/t1gload.h>
+#include <type1/t1afm.h>
+#endif
 
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 2a5bd6a..f979ab2 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -16,14 +16,26 @@
 /***************************************************************************/
 
 
-#include <t1gload.h>
+#ifdef FT_FLAT_COMPILE
+
+#include <type1/t1gload.h>
+#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
+#include <type1/t1hinter.h>
+#endif
+
+#else
+
+#include <type1/t1gload.h>
+#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
+#include <type1/t1hinter.h>
+#endif
+
+#endif
+
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/ftoutln.h>
 
-#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
-#include <t1hinter.h>
-#endif
 
 #include <string.h>     /* for strcmp() */
 
diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h
index 71f70af..2aa9c31 100644
--- a/src/type1/t1gload.h
+++ b/src/type1/t1gload.h
@@ -19,7 +19,12 @@
 #ifndef T1GLOAD_H
 #define T1GLOAD_H
 
-#include <t1objs.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1objs.h"
+#else
+#include <type1/t1objs.h>
+#endif
+
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/type1/t1hinter.c b/src/type1/t1hinter.c
index 2b6b6b3..02613cf 100644
--- a/src/type1/t1hinter.c
+++ b/src/type1/t1hinter.c
@@ -26,8 +26,14 @@
 
 
 #include <freetype/internal/ftdebug.h>
-#include <t1objs.h>
-#include <t1hinter.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1objs.h"
+#include "t1hinter.h"
+#else
+#include <type1/t1objs.h>
+#include <type1/t1hinter.h>
+#endif
+
 
 
   /*************************************************************************/
diff --git a/src/type1/t1hinter.h b/src/type1/t1hinter.h
index 82872e3..b63f156 100644
--- a/src/type1/t1hinter.h
+++ b/src/type1/t1hinter.h
@@ -19,8 +19,13 @@
 #ifndef T1HINTER_H
 #define T1HINTER_H
 
-#include <t1objs.h>
-#include <t1gload.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1objs.h"
+#include "t1gload.h"
+#else
+#include <type1/t1objs.h>
+#include <type1/t1gload.h>
+#endif
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index d646c8a..2d4741b 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -20,8 +20,14 @@
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/t1types.h>
 
-#include <t1tokens.h>
-#include <t1parse.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1tokens.h"
+#include "t1parse.h"
+#else
+#include <type1/t1tokens.h>
+#include <type1/t1parse.h>
+#endif
+
 
 #include <stdio.h>
 
diff --git a/src/type1/t1load.h b/src/type1/t1load.h
index b9ce9b0..508daed 100644
--- a/src/type1/t1load.h
+++ b/src/type1/t1load.h
@@ -20,7 +20,13 @@
 #define T1LOAD_H
 
 #include <freetype/internal/ftstream.h>
-#include <t1parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t1parse.h"
+#else
+#include <type1/t1parse.h>
+#endif
+
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index c5ab04c..dc48211 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -19,14 +19,28 @@
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
 
-#include <t1gload.h>
-#include <t1load.h>
-#include <t1afm.h>
+#ifdef FT_FLAT_COMPILE
 
+#include "t1gload.h"
+#include "t1load.h"
+#include "t1afm.h"
 #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
-#include <t1hinter.h>
+#include "t1hinter.h"
 #endif
 
+#else
+
+#include <type1/t1gload.h>
+#include <type1/t1load.h>
+#include <type1/t1afm.h>
+#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
+#include <type1/t1hinter.h>
+#endif
+
+#endif
+
+
+
 #include <freetype/internal/psnames.h>
 
 
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index 433928e..d70780f 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -18,7 +18,13 @@
 
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/t1types.h>
-#include <t1parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t1parse.h"
+#else
+#include <type1/t1parse.h>
+#endif
+
 
 #include <stdio.h>  /* for sscanf()  */
 #include <string.h> /* for strncpy() */
diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h
index 2b6380d..bfffaed 100644
--- a/src/type1/t1parse.h
+++ b/src/type1/t1parse.h
@@ -31,7 +31,13 @@
 #define T1PARSE_H
 
 #include <freetype/internal/ftstream.h>
-#include <t1tokens.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "t1tokens.h"
+#else
+#include <type1/t1tokens.h>
+#endif
+
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/type1/t1tokens.c b/src/type1/t1tokens.c
index 4487b49..1d7eea9 100644
--- a/src/type1/t1tokens.c
+++ b/src/type1/t1tokens.c
@@ -32,8 +32,14 @@
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/ftdebug.h>
 
-#include <t1tokens.h>
-#include <t1load.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1tokens.h"
+#include "t1load.h"
+#else
+#include <type1/t1tokens.h>
+#include <type1/t1load.h>
+#endif
+
 
 #include <string.h>     /* for strncmp() */
 
diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h
index 03ae056..25d55a3 100644
--- a/src/type1/t1tokens.h
+++ b/src/type1/t1tokens.h
@@ -19,7 +19,12 @@
 #ifndef T1TOKENS_H
 #define T1TOKENS_H
 
-#include <t1objs.h>
+#ifdef FT_FLAT_COMPILE
+#include "t1objs.h"
+#else
+#include <type1/t1objs.h>
+#endif
+
 
 
 #ifdef __cplusplus
diff --git a/src/type1/type1.c b/src/type1/type1.c
index 31ebb43..6d15b34 100644
--- a/src/type1/type1.c
+++ b/src/type1/type1.c
@@ -18,20 +18,39 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
-#include <t1driver.c>
-#include <t1objs.c>
-#include <t1load.c>
-#include <t1gload.c>
-#include <t1tokens.c>
-#include <t1parse.c>
+#ifdef FT_FLAT_COMPILE
 
+#include "t1driver.c"
+#include "t1objs.c"
+#include "t1load.c"
+#include "t1gload.c"
+#include "t1tokens.c"
+#include "t1parse.c"
 #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
-#include <t1hinter.c>
+#include "t1hinter.c"
 #endif
+#ifndef T1_CONFIG_OPTION_NO_AFM
+#include "t1afm.c"
+#endif
+
+#else /* FT_FLAT_COMPILE */
 
+#include <type1/t1driver.c>
+#include <type1/t1objs.c>
+#include <type1/t1load.c>
+#include <type1/t1gload.c>
+#include <type1/t1tokens.c>
+#include <type1/t1parse.c>
+#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
+#include <type1/t1hinter.c>
+#endif
 #ifndef T1_CONFIG_OPTION_NO_AFM
-#include <t1afm.c>
+#include <type1/t1afm.c>
 #endif
 
+#endif
+
+
+
 
 /* END */
diff --git a/src/type1z/rules.mk b/src/type1z/rules.mk
index 3eb9986..3411fd1 100644
--- a/src/type1z/rules.mk
+++ b/src/type1z/rules.mk
@@ -19,14 +19,9 @@ T1Z_DIR  := $(SRC_)type1z
 T1Z_DIR_ := $(T1Z_DIR)$(SEP)
 
 
-# additional include flags used when compiling the driver
-#
-T1Z_INCLUDE := $(SHARED) $(T1Z_DIR)
-
 # compilation flags for the driver
 #
-T1Z_CFLAGS  := $(T1Z_INCLUDE:%=$I%)
-T1Z_COMPILE := $(FT_COMPILE) $(T1Z_CFLAGS)
+T1Z_COMPILE := $(FT_COMPILE)
 
 
 # Type1 driver sources (i.e., C files)
diff --git a/src/type1z/type1z.c b/src/type1z/type1z.c
index 03dd827..5beee0e 100644
--- a/src/type1z/type1z.c
+++ b/src/type1z/type1z.c
@@ -18,14 +18,28 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
-#include <z1parse.c>
-#include <z1load.c>
-#include <z1objs.c>
-#include <z1driver.c>
-#include <z1gload.c>
+#ifdef FT_FLAT_COMPILE
 
+#include "z1parse.c"
+#include "z1load.c"
+#include "z1objs.c"
+#include "z1driver.c"
+#include "z1gload.c"
 #ifndef Z1_CONFIG_OPTION_NO_AFM
-#include <z1afm.c>
+#include "z1afm.c"
+#endif
+
+#else
+
+#include <type1z/z1parse.c>
+#include <type1z/z1load.c>
+#include <type1z/z1objs.c>
+#include <type1z/z1driver.c>
+#include <type1z/z1gload.c>
+#ifndef Z1_CONFIG_OPTION_NO_AFM
+#include <type1z/z1afm.c>
+#endif
+
 #endif
 
 
diff --git a/src/type1z/z1afm.c b/src/type1z/z1afm.c
index c758099..1ceeca2 100644
--- a/src/type1z/z1afm.c
+++ b/src/type1z/z1afm.c
@@ -16,7 +16,12 @@
 /***************************************************************************/
 
 
-#include <z1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1afm.h"
+#else
+#include <type1z/z1afm.h>
+#endif
+
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/t1types.h>
 
diff --git a/src/type1z/z1afm.h b/src/type1z/z1afm.h
index 4b95393..1a909b3 100644
--- a/src/type1z/z1afm.h
+++ b/src/type1z/z1afm.h
@@ -19,7 +19,12 @@
 #ifndef Z1AFM_H
 #define Z1AFM_H
 
-#include <z1objs.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1objs.h"
+#else
+#include <type1z/z1objs.h>
+#endif
+
 
 
 #ifdef __cplusplus
diff --git a/src/type1z/z1driver.c b/src/type1z/z1driver.c
index 286d9bd..1984b61 100644
--- a/src/type1z/z1driver.c
+++ b/src/type1z/z1driver.c
@@ -15,10 +15,18 @@
  *
  ******************************************************************/
 
-#include <z1driver.h>
-#include <z1gload.h>
-#include <z1load.h>
-#include <z1afm.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1driver.h"
+#include "z1gload.h"
+#include "z1load.h"
+#include "z1afm.h"
+#else
+#include <type1z/z1driver.h>
+#include <type1z/z1gload.h>
+#include <type1z/z1load.h>
+#include <type1z/z1afm.h>
+#endif
+
 
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
diff --git a/src/type1z/z1gload.c b/src/type1z/z1gload.c
index a65fc16..2dbe4a7 100644
--- a/src/type1z/z1gload.c
+++ b/src/type1z/z1gload.c
@@ -15,7 +15,12 @@
  *
  ******************************************************************/
 
-#include <z1gload.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1gload.h"
+#else
+#include <type1z/z1gload.h>
+#endif
+
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/ftoutln.h>
diff --git a/src/type1z/z1gload.h b/src/type1z/z1gload.h
index 5898602..da93d1a 100644
--- a/src/type1z/z1gload.h
+++ b/src/type1z/z1gload.h
@@ -35,7 +35,12 @@
 #ifndef Z1GLOAD_H
 #define Z1GLOAD_H
 
-#include <z1objs.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1objs.h"
+#else
+#include <type1z/z1objs.h>
+#endif
+
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/type1z/z1load.c b/src/type1z/z1load.c
index 11e8893..d1af029 100644
--- a/src/type1z/z1load.c
+++ b/src/type1z/z1load.c
@@ -65,7 +65,13 @@
 
 #include <freetype/internal/t1types.h>
 #include <freetype/internal/t1errors.h>
-#include <z1load.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "z1load.h"
+#else
+#include <type1z/z1load.h>
+#endif
+
 #include <stdio.h>
 
 #undef  FT_COMPONENT
@@ -631,7 +637,11 @@
 #define Z1_TOPDICT_NUM_FIXED2(n,f,m)   Z1_NEW_FIXED_TABLE2(n,f,m)
 
 /* including this file defines all field variables */
-#include <z1tokens.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1tokens.h"
+#else
+#include <type1z/z1tokens.h>
+#endif
 
  /*********************************************************************
   *
@@ -1203,7 +1213,11 @@
   static
   const Z1_KeyWord  t1_keywords[] =
   {
-#include <z1tokens.h>  
+#ifdef FT_FLAT_COMPILE
+#include "z1tokens.h"
+#else
+#include <type1z/z1tokens.h>
+#endif
     
     /* now add the special functions... */
     Z1_KEYWORD_CALLBACK( "FontName", parse_font_name ),
diff --git a/src/type1z/z1load.h b/src/type1z/z1load.h
index cedb44d..8e3dc04 100644
--- a/src/type1z/z1load.h
+++ b/src/type1z/z1load.h
@@ -21,7 +21,14 @@
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/t1types.h>
 #include <freetype/ftmm.h>
-#include <z1parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "z1parse.h"
+#else
+#include <type1z/z1parse.h>
+#endif
+
+
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/src/type1z/z1objs.c b/src/type1z/z1objs.c
index 054dbcc..edc6f9b 100644
--- a/src/type1z/z1objs.c
+++ b/src/type1z/z1objs.c
@@ -18,10 +18,18 @@
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
 
-#include <z1gload.h>
-#include <z1load.h>
+#ifdef FT_FLAT_COMPILE
+#include "z1gload.h"
+#include "z1load.h"
+#include "z1afm.h"
+#else
+#include <type1z/z1gload.h>
+#include <type1z/z1load.h>
+#include <type1z/z1afm.h>
+#endif
+
+
 #include <freetype/internal/psnames.h>
-#include <z1afm.h>
 
 /* Required by tracing mode */
 #undef   FT_COMPONENT
diff --git a/src/type1z/z1parse.c b/src/type1z/z1parse.c
index ed24458..7039bdb 100644
--- a/src/type1z/z1parse.c
+++ b/src/type1z/z1parse.c
@@ -33,7 +33,13 @@
 #include <freetype/internal/ftobjs.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/t1errors.h>
-#include <z1parse.h>
+
+#ifdef FT_FLAT_COMPILE
+#include "z1parse.h"
+#else
+#include <type1z/z1parse.h>
+#endif
+
 
 #undef FT_COMPONENT
 #define FT_COMPONENT  trace_t1load
diff --git a/src/winfonts/rules.mk b/src/winfonts/rules.mk
index ce41343..8396894 100644
--- a/src/winfonts/rules.mk
+++ b/src/winfonts/rules.mk
@@ -19,14 +19,7 @@ FNT_DIR  := $(SRC_)winfonts
 FNT_DIR_ := $(FNT_DIR)$(SEP)
 
 
-# additional include flags used when compiling the driver
-#
-FNT_INCLUDE := $(FNT_DIR)
-
-# compilation flags for the driver
-#
-FNT_CFLAGS  := $(FNT_INCLUDE:%=$I%)
-FNT_COMPILE := $(FT_COMPILE) $(FNT_CFLAGS)
+FNT_COMPILE := $(FT_COMPILE)
 
 
 # Windows driver sources (i.e., C files)
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 28e83c4..870bdb8 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -15,7 +15,12 @@
 /*                                                                         */
 /***************************************************************************/
 
-#include <winfnt.h>
+#ifdef FT_FLAT_COMPILE
+#include "winfnt.h"
+#else
+#include <winfonts/winfnt.h>
+#endif
+
 #include <freetype/fterrors.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/ftdebug.h>
@@ -170,6 +175,7 @@
          READ_Fields( winmz_header_fields, &mz_header ) )
       goto Exit;
 
+    error = FT_Err_Unknown_File_Format;
     if ( mz_header.magic == WINFNT_MZ_MAGIC )
     {
       /* yes, now look for a NE header in the file */
@@ -179,6 +185,7 @@
            READ_Fields( winne_header_fields, &ne_header ) )
         goto Exit;
       
+      error = FT_Err_Unknown_File_Format;
       if ( ne_header.magic == WINFNT_NE_MAGIC )
       {
         /* good, now look in the resource table for each FNT resource */