aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/config/cf/Imake.rules
blob: f53a15bbac2cf3f6c7d8d826942b03a520322aad (plain)
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
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
XCOMM ---------------------------------------------------------------------
XCOMM Imake rules for building libraries, programs, scripts, and data files
XCOMM ---------------------------------------------------------------------

/*
 *		   MACHINE-INDEPENDENT RULES; DO NOT MODIFY
 *
 * Warning, when defining rules: make sure you do not include both a trailing
 * backslash and double ampersand backslash or else you will get an extra
 * backslash in the Makefile.
 *
 * The following macros are defined for the various templates and Imakefiles
 * (for a list of the applicable make variables, see the template files):
 *
 * Concat			(a,b)
 * Concat3			(a,b,c)
 * Concat4			(a,b,c,d)
 * _Use				(a,b)
 * _UseCat			(a,b,c)
 * _MUse			(a,b)
 * _MUseCat			(a,b,c)
 * ProgramTargetName		(target)
 * HostProgramTargetName	(target)
 * RunProgram			(progvar,options)
 * RunProgramWithSetup		(setup,progvar,options)
 * RemoveFile			(file)
 * RemoveFiles			(files)
 * CenterLoadTarget		(target,srclist,libs,defines)
 * CenterProgramTarget		(program,srclist,objlist,locallibs,syslibs)
 * SentinelLinkTarget		(step,program,linklist)
 * SentinelProgramTarget	(program,deplist,linklist)
 * SentinelCplusplusProgramTarget	(program,deplist,linklist)
 * PurifyLinkTarget		(step,program,linklist)
 * PurifyProgramTarget		(program,deplist,linklist)
 * PurifyCplusplusProgramTarget	(program,deplist,linklist)
 * ProofLinkTarget		(step,program,linklist)
 * ProofProgramTarget		(program,deplist,linklist)
 * ProofCplusplusProgramTarget	(program,deplist,linklist)
 * ProofCleanTarget		()
 * RemoveTargetProgram		(program)
 * MakeDir			(dir)
 * InstallDirectory		(dir)
 * BuildIncludesTop		(srclist)
 * BuildIncludes		(srclist,dstsubdir,dstupdir)
 * LinkRule			(program,options,objects,libraries)
 * HostLinkRule			(program,options,objects,libraries)
 * NoCmpScript			(target)
 * NoConfigRec			(target)
 * NormalProgramTarget		(program,objects,deplibs,locallibs,syslibs)
 * SetUIDProgramTarget		(program,objects,deplibs,locallibs,syslibs)
 * SingleProgramTarget		(program,objects,locallibs,syslibs)
 * SimpleProgramTarget		(program)
 * ComplexProgramTarget		(program)
 * ComplexProgramTarget_1	(program,locallib,syslib)
 * ComplexProgramTarget_2	(program,locallib,syslib)
 * ComplexProgramTarget_3	(program,locallib,syslib)
 * ServerTargetWithFlags	(server,subdirs,objects,libs,syslibs,flags)
 * ServerTarget			(server,subdirs,objects,libs,syslibs)
 * MoveToBakFile		(file)
 * RMoveToBakFile		(file)
 * RanLibrary			(args)
 * LibraryTargetName		(libname)
 * LibraryTargetNameSuffix	(libname,suffix)
 * InstallNamedTarget		(step,srcname,flags,dest,dstname)
 * InstallTarget		(step,file,flags,dest)
 * InstallLibrary		(libname,dest)
 * MergeIntoInstalledLibrary	(tolib,fromlib)
 * InstallLibraryAlias		(libname,alias,dest)
 * InstallLintLibrary		(libname,dest)
 * InstallManPageLong		(file,destdir,dest)
 * InstallManPage		(file,destdir)
 * InstallManPageAliases	(file,destdir,aliases)
 * ManKeywordsTarget		(manpath)
 * InstallNamedNonExec		(srcname,dstname,dest)
 * InstallNonExecFile		(file,dest)
 * InstallNonExecFileNoClobber	(file,dest)
 * InstallNonExec		(file,dest)
 * InstallProgramWithFlags	(program,dest,flags)
 * InstallProgram		(program,dest)
 * InstallScript		(program,dest)
 * InstallNamedProg		(srcname,dstname,dest)
 * InstallNamedProgNoClobber	(srcname,dstname,dest)
 * MakeFlagsToShellFlags	(makeflags,shellcmd)
 * MakeNamedTargetSubdir	(dir,flags,subname)
 * LinkConfDirectoryLong	(mdir,cdir,rdir,ldir,opath,npath)
 * LinkConfDirectory		(mdir,cdir,rdir,ldir)
 * LinkConfFileLong		(cfile,lfile,opath,npath)
 * LinkConfFile			(cfile,lfile)
 * LinkFileList			(step,list,dir,sub)
 * LinkVarDirectory		(mdir,cdir,rdir,ldir)
 * InstallMultipleDestFlags	(step,list,dest,flags)
 * InstallMultipleDest		(step,list,dest)
 * InstallMultiple		(list,dest)
 * InstallMultipleFlags		(list,dest,flags)
 * InstallMultipleMan		(list,dest)
 * InstallMultipleManSuffix	(list,dest,suffix)
 * DependDependency		()
 * DependTarget			()
 * DependTarget3		(srcs1,srcs2,srcs3)
 * CleanTarget			()
 * TagsTarget			()
 * ImakeDependency		(target)
 * BuildMakefileTarget		(notused,imakeflags)
 * MakefileTarget		()
 * LibMkdir			(dir)
 * LibCleanDir			(dir)
 * LintLibReferences		(varname,libname,libsource)
 * UnsharedLibReferences	(varname,libname,libsource)
 * ProjectUnsharedLibReferences	(varname,libname,libsource,buildlibdir)
 * SharedLibDependencies	(libname,libsource,revname)
 * SharedDSLibDependencies	(libname,libsource,revname)
 * SharedLibReferences		(varname,libname,libsource,revname,rev)
 * SharedDSLibReferences	(varname,libname,libsource,revname,rev)
 * ObjectCompile		(options)
 * NormalLibObjCompile		(options)
 * NormalSharedLibObjCompile	(options)
 * NormalRelocLibObjCompile	(options)
 * LibObjCompile		(dir,options)
 * DebuggedLibObjCompile	(options)
 * ProfiledLibObjCompile	(options)
 * SharedLibObjCompile		(options)
 * NormalLibraryObjectRule	()
 * NormalFortranObjectRule	()
 * ObjectFromSpecialSource	(dst,src,flags)
 * SpecialObjectRule		(objs,depends,options)
 * SpecialCObjectRule		(basename,depends,options)
 * LexFile			(file)
 * M4File			(file,includes)
 * YaccFile			(file,flags)
 * YaccFileNoFlags		(file)
 * MakeLibrary			(libname,objlist)
 * LinkBuildLibrary		(lib)
 * LinkBuildSonameLibrary	(lib)
 * NormalLibraryTarget		(libname,objlist)
 * NormalLibraryTarget2		(libname,objlist1,objlist2)
 * NormalLibraryTarget3		(libname,objlist1,objlist2,objlist3)
 * NormalDepLibraryTarget	(libname,deplist,objlist)
 * UnsharedLibraryTarget	(libname,objlist,down,up)
 * UnsharedLibraryTarget3	(libname,objlist1,objlist2,objlist3,down,up)
 * SubdirLibraryRule		(objlist)
 * ProfiledLibraryTarget	(libname,objlist)
 * DebuggedLibraryTarget	(libname,objlist)
 * AliasedLibraryTarget		(libname,alias)
 * NormalRelocatableTarget	(objname,objlist)
 * ProfiledRelocatableTarget	(objname,objlist)
 * DebuggedRelocatableTarget	(objname,objlist)
 * LintLibraryTarget		(libname,srclist)
 * NormalLintTarget		(srclist)
 * LintTarget			()
 * LinkSourceFile		(src,dir)
 * LinkFile			(tofile,fromfile)
 * MakeSubincludesForBuild	(step,dir,srclist)
 * LangNamedTargetSubdirs	(lang,name,dirs,verb,flags,subname)
 * LangNamedMakeSubdirs		(lang,name,dirs)
 * LangMakeSubdirs		(lang,dirs)
 * NamedTargetSubdirs		(name,dirs,verb,flags,subname)
 * NamedMakeSubdirs		(name,dirs)
 * MakeSubdirs			(dirs)
 * DependSubdirs		(dirs)
 * ForceSubdirs			(dirs)
 * InstallSubdirs		(dirs)
 * InstallManSubdirs		(dirs)
 * IncludesSubdirs		(dirs)
 * NamedCleanSubdirs		(name,dirs)
 * CleanSubdirs			(dirs)
 * NamedTagSubdirs		(name,dirs)
 * TagSubdirs			(dirs)
 * MakeLintSubdirs		(dirs,target,subtarget)
 * LintSubdirs			(dirs)
 * MakeLintLibSubdirs		(dirs)
 * MakeMakeSubdirs		(dirs,target)
 * MakefileSubdirs		(dirs)
 * CppScriptTarget		(dst,src,defs,deplist)
 * MakeScriptFromCpp		(name,defs)
 * CppFileTarget		(dst,src,defs,deplist)
 * CppSourceFile		(dst,src,defs,deplist)
 * MakeDirectories		(step,dirs)
 * AllTarget			(depends)
 * StaticLibrary		(libpath,libname)
 * MakeMutex			(targets)
 * LinkBuildModule		(module,subdir)
 * LinkBuildNamedModule		(module,name,subdir)
 * DynamicModuleTarget		(module,modlist)
 * InstallDynamicModule		(module,dest,subdir)
 * InstallDynamicNamedModule	(module,instname,dest,subdir)
 * LinkerRuntimeLibraryPathFlag	(path)
 *
 *
 * The following are in specific <os>Lib.rules:
 *
 * SharedLibraryTarget		(libname,rev,solist,down,up)
 * SharedLibraryDataTarget	(libname,rev,salist)
 * InstallSharedLibrary		(libname,rev,dest)
 * InstallSharedLibraryData	(libname,rev,dest)
 * SharedDepModuleTarget	(name,deps,solist)
 *
 */

#define NullParameter

/* if [ -d ] or [ ! -d ] causes make to fail, define this as - */
#ifndef DirFailPrefix
#define DirFailPrefix
#endif

/*
 * NoCmpScript - suppress clearmake build script comparison.
 */
#ifndef NoCmpScript
#if HasClearmake
#define NoCmpScript(targ)						@@\
XCOMM special target for clearmake					@@\
.NO_CMP_SCRIPT: targ
#else
#define NoCmpScript(targ) /**/
#endif
#endif

/*
 * NoConfigRec - suppress using clearmake configuration records.
 */
#ifndef NoConfigRec
#if HasClearmake
#define NoConfigRec(targ)						@@\
XCOMM special target for clearmake					@@\
.NO_CONFIG_REC: targ
#else
#define NoConfigRec(targ) /**/
#endif
#endif

/*
 * Concat - concatenates two strings.
 */
#ifndef Concat
#if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
#define Concat(a,b)a##b
#else
#define Concat(a,b)a/**/b
#endif
#endif

/*
 * Concat3 - concatenates three strings.
 */
#ifndef Concat3
#if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
#define Concat3(a,b,c)a##b##c
#else
#define Concat3(a,b,c)a/**/b/**/c
#endif
#endif

/*
 * Concat4 - concatenates four strings.
 */
#ifndef Concat4
#if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
#define Concat4(a,b,c,d)a##b##c##d
#else
#define Concat4(a,b,c,d)a/**/b/**/c/**/d
#endif
#endif

/*
 * _XUse - makes a choice based on UseInstalledX11.
 */
#ifndef _XUse
# if defined(UseInstalled) || UseInstalledX11
#  define _XUse(a,b) a
# else
#  define _XUse(a,b) b
# endif
#endif /* _XUse */

/*
 * _Use - makes a choice based on UseInstalled.
 */
#ifndef _Use
# define _Use	_XUse
#endif /* _Use */

/*
 * _XUseCat - combination of _XUse and Concat.
 *           exists to avoid problems with some preprocessors
 */
#ifndef _XUseCat
# if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
#  if defined(UseInstalled) || UseInstalledX11
#   define _XUseCat(a,b,c) a##c
#  else
#   define _XUseCat(a,b,c) b##c
#  endif
# else
#  if defined(UseInstalled) || UseInstalledX11
#   define _XUseCat(a,b,c) a/**/c
#  else
#   define _XUseCat(a,b,c) b/**/c
#  endif
# endif
#endif /* _XUseCat */

/*
 * _UseCat - combination of _Use and Concat.
 *           exists to avoid problems with some preprocessors
 */
#ifndef _UseCat
# define _UseCat	_XUseCat
#endif /* _UseCat */

#ifndef ProgramTargetName
#define ProgramTargetName(target)target
#endif

#ifndef HostProgramTargetName
#define HostProgramTargetName(target)target
#endif

#ifndef RunProgram
#define RunProgram(progvar,options) $(progvar) options
#endif

#ifndef RunProgramWithSetup
#define RunProgramWithSetup(setup,progvar,options) setup $(progvar) options
#endif

#ifndef RunPerlScript
#define RunPerlScript(script,options) $(PERLENVSETUP) $(PERL) $(PERLOPTS) script options
#endif

#ifndef RemoveFile
#define RemoveFile(file) $(RM) file
#endif /* RemoveFile */

#ifndef RemoveFiles
#define RemoveFiles(files) $(RM) files
#endif /* RemoveFiles */

#if RemoveObsoleteFiles
#define RemoveOldFile(new,old,dir)					@@\
	@if [ -f new ]; then set -x; \					@@\
		RemoveFile($(DESTDIR)dir/old); \			@@\
	fi
#else
#define RemoveOldFile(new,old,dir) $(_NULLCMD_)
#endif

/*
 * CenterLoadTarget - generate rules to load files into CodeCenter
 */
#ifndef CenterLoadTarget
#if HasCodeCenter
#define CenterLoadTarget(target,srclist,libs,defines)			@@\
ProgramTargetName(target):: srclist					@@\
	XCOMM load defines srclist libs
#else
#define CenterLoadTarget(target,srclist,libs,defines) /**/
#endif
#endif /* CenterLoadTarget */

/*
 * CenterProgramTarget - generate rules to make CodeCenter read in sources
 * and objects.
 */
#ifndef CenterProgramTarget
#define CenterProgramTarget(program,srclist,objlist,locallibs,syslibs)	@@\
CenterLoadTarget(Concat(debug_,program),srclist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES)) @@\
									@@\
CenterLoadTarget(Concat(odebug_,program),objlist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES))
#endif /* CenterProgramTarget */

#ifndef SentinelLinkTarget
#if HasSentinel
#define SentinelLinkTarget(step,program,linklist)			@@\
ProgramTargetName(step.sentinel):					@@\
	RemoveTargetProgram($@)						@@\
	$(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o program.sentinel $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
#else
#define SentinelLinkTarget(step,program,linklist) /**/
#endif
#endif /* SentinelLinkTarget */

/*
 * SentinelProgramTarget - generate rules to make Sentinel image
 */
#ifndef SentinelProgramTarget
#if HasSentinel
#define	SentinelProgramTarget(program,deplist,linklist)			@@\
ProgramTargetName(program.sentinel): deplist				@@\
	RemoveTargetProgram($@)						@@\
	$(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
									@@\
clean clean.sentinel::							@@\
	RemoveFile(program.sentinel)
#else
#define	SentinelProgramTarget(program,deplist,linklist) /**/
#endif
#endif /* SentinelProgramTarget */

/*
 * SentinelCplusplusProgramTarget - generate rules to make Sentinel image
 */
#ifndef SentinelCplusplusProgramTarget
#if HasSentinel
#define	SentinelCplusplusProgramTarget(program,deplist,linklist)	@@\
ProgramTargetName(program.sentinel): deplist				@@\
	RemoveTargetProgram($@)						@@\
	$(CXXENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
									@@\
clean clean.sentinel::							@@\
	RemoveFile(program.sentinel)
#else
#define	SentinelCplusplusProgramTarget(program,deplist,linklist) /**/
#endif
#endif /* SentinelCplusplusProgramTarget */

#ifndef PurifyLinkTarget
#if HasPurify
#define PurifyLinkTarget(step,program,linklist)				@@\
ProgramTargetName(step.pure):						@@\
	RemoveTargetProgram($@)						@@\
	$(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o program.pure $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
#else
#define PurifyLinkTarget(step,program,linklist) /**/
#endif
#endif /* PurifyLinkTarget */

/*
 * PurifyProgramTarget - generate rules to make Purify'ed image
 */
#ifndef PurifyProgramTarget
#if HasPurify
#define	PurifyProgramTarget(program,deplist,linklist)			@@\
ProgramTargetName(program.pure): deplist				@@\
	RemoveTargetProgram($@)						@@\
	$(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
									@@\
clean clean.pure::							@@\
	RemoveFile(program.pure)
#else
#define	PurifyProgramTarget(program,deplist,linklist) /**/
#endif
#endif /* PurifyProgramTarget */

/*
 * PurifyCplusplusProgramTarget - generate rules to make Purify'ed image
 */
#ifndef PurifyCplusplusProgramTarget
#if HasPurify
#define	PurifyCplusplusProgramTarget(program,deplist,linklist)		@@\
ProgramTargetName(program.pure): deplist				@@\
	RemoveTargetProgram($@)						@@\
	$(CXXENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
									@@\
clean clean.pure::							@@\
	RemoveFile(program.pure)
#else
#define	PurifyCplusplusProgramTarget(program,deplist,linklist) /**/
#endif
#endif /* PurifyCplusplusProgramTarget */

#ifndef ProofLinkTarget
#if HasTestCenter
#define ProofLinkTarget(step,program,linklist)				@@\
ProgramTargetName(step.tc):						@@\
	RemoveTargetProgram($@)						@@\
	$(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o program.tc $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
#else
#define ProofLinkTarget(step,program,linklist) /**/
#endif
#endif /* ProofLinkTarget */

/*
 * ProofProgramTarget - generate rules to make Proof'ed image
 */
#ifndef ProofProgramTarget
#if HasTestCenter
#define	ProofProgramTarget(program,deplist,linklist)			@@\
ProgramTargetName(program.tc): deplist					@@\
	RemoveTargetProgram($@)						@@\
	$(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
									@@\
clean cleantc::								@@\
	RemoveFiles(program.tc program.tc.*.*)
#else
#define	ProofProgramTarget(program,deplist,linklist) /**/
#endif
#endif /* ProofProgramTarget */

/*
 * ProofCplusplusProgramTarget - generate rules to make Proof'ed image
 */
#ifndef ProofCplusplusProgramTarget
#if HasTestCenter
#define	ProofCplusplusProgramTarget(program,deplist,linklist)		@@\
ProgramTargetName(program.tc): deplist					@@\
	RemoveTargetProgram($@)						@@\
	$(CXXENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
									@@\
clean cleantc::								@@\
	RemoveFiles(program.tc program.tc.*.*)
#else
#define	ProofCplusplusProgramTarget(program,deplist,linklist) /**/
#endif
#endif /* ProofCplusplusProgramTarget */

#ifndef ProofCleanTarget
#if HasTestCenter
#define ProofCleanTarget()						@@\
clean cleantc::								@@\
	$(RM) -r TC.Cache
#else
#define ProofCleanTarget() /**/
#endif
#endif /* ProofCleanTarget */

#ifndef RemoveTargetProgram
#if RemoveTargetProgramByMoving
#define RemoveTargetProgram(program) \
-if [ -f program ]; then RemoveFile(Concat(program,~)); $(MV) program Concat(program,~); fi
#else
#define RemoveTargetProgram(program) RemoveFile(program)
#endif
#endif /* RemoveTargetProgram */

#ifndef MakeDir
#define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then \		@@\
		set +x; \						@@\
	else \								@@\
		if [ -h dir ]; then \					@@\
			(set -x; rm -f dir); \				@@\
		fi; \							@@\
		(set -x; $(MKDIRHIER) dir); \				@@\
	fi
#endif /* MakeDir */

#ifndef MakeDirInline
#define MakeDirInline(dir) if [ -d dir ]; then \			@@\
		:; \							@@\
	else \								@@\
		if [ -h dir ]; then \					@@\
			(set -x; rm -f dir); \				@@\
		fi; \							@@\
		(set -x; $(MKDIRHIER) dir); \				@@\
	fi
#endif /* MakeDirInline */

#ifndef InstallDirectory
#define InstallDirectory(dir)						@@\
install::								@@\
	MakeDir(dir)
#endif /* InstallDirectory */

#ifndef InstallCreateLink
# define InstallCreateLink(dest,from,to)				@@\
install::								@@\
	  cd $(DESTDIR)dest && \					@@\
	  $(LN) -sf from to
#endif

#ifndef BuildIncludesTop
#define BuildIncludesTop(srclist)					@@\
includes:: srclist							@@\
	MakeDir($(BUILDINCDIR))						@@\
	@(set -x; cd $(BUILDINCDIR) && for i in srclist; do \		@@\
		RemoveFile(`basename $$i`); \				@@\
		$(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$$i .; \		@@\
	done)
#endif /* BuildIncludesTop */

#ifndef BuildIncludes
#define BuildIncludes(srclist,dstsubdir,dstupdir)			@@\
includes:: srclist							@@\
	MakeDir($(BUILDINCDIR)/dstsubdir)				@@\
	@(set -x; cd $(BUILDINCDIR)/dstsubdir && for i in srclist; do \	@@\
		RemoveFile(`basename $$i`); \				@@\
		$(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \	@@\
	done)
#endif /* BuildIncludes */

/*
 * LinkBuildBinary - export a binary from the build tree.
 */
#ifndef LinkBuildBinary
#define LinkBuildBinary(binary)						@@\
all:: $(BUILDBINDIR)/binary binary					@@\
									@@\
$(BUILDBINDIR)/binary: binary						@@\
	MakeDir($(BUILDBINDIR))						@@\
	RemoveFile($@)							@@\
	cd $(BUILDBINDIR) && $(LN) $(BUILDBINTOP)/$(CURRENT_DIR)/binary .
#endif /* LinkBuildBinary */

#ifndef BuildInterfaces
#define BuildInterfaces(srclist,dstsubdir,dstupdir)			@@\
interfaces::								@@\
	MakeDir($(BUILDINCDIR)/dstsubdir)				@@\
	@(set -x; cd $(BUILDINCDIR)/dstsubdir && for i in srclist; do \	@@\
		RemoveFile($$i); \					@@\
		$(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \	@@\
	done)
#endif /* BuildInterfaces */

/*
 * LinkRule - link a program
 */
#ifndef LinkRule
#define LinkRule(program,options,objects,libraries) \
$(CCLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
#endif /* LinkRule */

/*
 * HostLinkRule - link a utility to be used on the build host
 * (differs from LinkRule if cross compiling)
 */
#ifndef HostLinkRule
#define HostLinkRule LinkRule
#endif

#ifndef CplusplusLinkRule
#define CplusplusLinkRule(program,options,objects,libraries) \
$(CXXLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
#endif /* CplusplusLinkRule */

/*
 * NormalProgramTarget - generate rules to compile and link the indicated
 * program; since it does not use any default object files, it may be used for
 * multiple programs in the same Imakefile.
 */
#ifndef NormalProgramTarget
#define	NormalProgramTarget(program,objects,deplibs,locallibs,syslibs)	@@\
ProgramTargetName(program): objects deplibs				@@\
	RemoveTargetProgram($@)						@@\
	LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs)	@@\
									@@\
SentinelProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
PurifyProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
ProofProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
									@@\
clean::									@@\
	RemoveFile(ProgramTargetName(program))
#endif /* NormalProgramTarget */


/*
 * NormalCplusplusProgramTarget - Like NormalTargetProgram, but uses
 * C++ linking rules.
 */
#ifndef NormalCplusplusProgramTarget
#define	NormalCplusplusProgramTarget(program,objects,deplibs,locallibs,syslibs)	@@\
ProgramTargetName(program): objects deplibs				@@\
	RemoveTargetProgram($@)						@@\
	CplusplusLinkRule($@,$(CXXLDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\
									@@\
SentinelCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
PurifyCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
ProofCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
									@@\
clean::									@@\
	RemoveFile(ProgramTargetName(program))
#endif /* NormalCplusplusProgramTarget */


#ifndef SetUIDProgramTarget
#define SetUIDProgramTarget NormalProgramTarget
#endif


/*
 * SingleProgramTarget - obsolete version of NormalProgramTarget that does
 * not have deplibs.
 */
#ifndef SingleProgramTarget
#define	SingleProgramTarget(program,objects,locallibs,syslibs)		@@\
NormalProgramTarget(program,objects,NullParameter,locallibs,syslibs)
#endif /* SingleProgramTarget */

/*
 * SimpleProgramTarget - generate rules for compiling and linking programs
 * that only have one C source file.  It should only be used in Imakefiles
 * that describe a single program.
 */
#ifndef SimpleProgramTarget
#define	SimpleProgramTarget(program)					@@\
           OBJS = program.o						@@\
           SRCS = program.c						@@\
									@@\
ComplexProgramTarget(program)
#endif /* SimpleProgramTarget */

#ifndef SimpleProgramTarget_1
#define	SimpleProgramTarget_1(program)					@@\
           OBJS1 = program.o						@@\
           SRCS1 = program.c						@@\
									@@\
ComplexProgramTarget_1(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_1 */
#ifndef SimpleProgramTarget_2
#define	SimpleProgramTarget_2(program)					@@\
           OBJS2 = program.o						@@\
           SRCS2 = program.c						@@\
									@@\
ComplexProgramTarget_2(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_2 */
#ifndef SimpleProgramTarget_3
#define	SimpleProgramTarget_3(program)					@@\
           OBJS3 = program.o						@@\
           SRCS3 = program.c						@@\
									@@\
ComplexProgramTarget_3(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_3 */
#ifndef SimpleProgramTarget_4
#define	SimpleProgramTarget_4(program)					@@\
           OBJS4 = program.o						@@\
           SRCS4 = program.c						@@\
									@@\
ComplexProgramTarget_4(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_4 */
#ifndef SimpleProgramTarget_5
#define	SimpleProgramTarget_5(program)					@@\
           OBJS5 = program.o						@@\
           SRCS5 = program.c						@@\
									@@\
ComplexProgramTarget_5(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_5 */
#ifndef SimpleProgramTarget_6
#define	SimpleProgramTarget_6(program)					@@\
           OBJS6 = program.o						@@\
           SRCS6 = program.c						@@\
									@@\
ComplexProgramTarget_6(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_6 */
#ifndef SimpleProgramTarget_7
#define	SimpleProgramTarget_7(program)					@@\
           OBJS7 = program.o						@@\
           SRCS7 = program.c						@@\
									@@\
ComplexProgramTarget_7(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_7 */
#ifndef SimpleProgramTarget_8
#define	SimpleProgramTarget_8(program)					@@\
           OBJS8 = program.o						@@\
           SRCS8 = program.c						@@\
									@@\
ComplexProgramTarget_8(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_8 */
#ifndef SimpleProgramTarget_9
#define	SimpleProgramTarget_9(program)					@@\
           OBJS9 = program.o						@@\
           SRCS9 = program.c						@@\
									@@\
ComplexProgramTarget_9(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_9 */
#ifndef SimpleProgramTarget_10
#define	SimpleProgramTarget_10(program)					@@\
           OBJS10 = program.o						@@\
           SRCS10 = program.c						@@\
									@@\
ComplexProgramTarget_10(program,$(LOCAL_LIBRARIES),NullParameter)
#endif /* SimpleProgramTarget_10 */

#ifndef SimpleCplusplusProgramTarget
#define SimpleCplusplusProgramTarget(program)				@@\
           OBJS = program.o						@@\
           SRCS = program.CCsuf						@@\
									@@\
ComplexCplusplusProgramTarget(program)
#endif /* SimpleCplusplusProgramTarget */

#ifndef ProgramTargetHelper
#define	ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib)	@@\
ProgramTargetName(program): $(objs) $(deplib)				@@\
	RemoveTargetProgram($@)						@@\
	LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib)	@@\
									@@\
CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)		@@\
SentinelProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
PurifyProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
ProofProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
									@@\
InstallProgram(program,$(BINDIR))					@@\
InstallManPage(program,$(MANDIR))
#endif /* ProgramTargetHelper */

#ifndef ProgramTargetHelperNoMan
#define ProgramTargetHelperNoMan(program,srcs,objs,deplib,locallib,syslib) @@\
ProgramTargetName(program): $(objs) $(deplib)				@@\
	RemoveTargetProgram($@)						@@\
	LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib)	@@\
									@@\
CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)		@@\
SentinelProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
PurifyProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
ProofProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
									@@\
InstallProgram(program,$(BINDIR))
#endif /* ProgramTargetHelperNoMan */

#ifndef CplusplusProgramTargetHelper
#define	CplusplusProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\
ProgramTargetName(program): $(objs) $(deplib)				@@\
	RemoveTargetProgram($@)						@@\
	CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
									@@\
CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)		@@\
SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
									@@\
InstallProgram(program,$(BINDIR))					@@\
InstallManPage(program,$(MANDIR))
#endif /* CplusplusProgramTargetHelper */

#ifndef CplusplusProgramTargetHelperNoMan
#define	CplusplusProgramTargetHelperNoMan(program,srcs,objs,deplib,locallib,syslib) @@\
ProgramTargetName(program): $(objs) $(deplib)				@@\
	RemoveTargetProgram($@)						@@\
	CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
									@@\
CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)		@@\
SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
									@@\
InstallProgram(program,$(BINDIR))					@@
#endif /* CplusplusProgramTargetHelperNoMan */

/*
 * ComplexProgramTarget - generate rules for compiling and linking the
 * program specified by $(OBJS) and $(SRCS), installing the program and its
 * man page, and generating dependencies.  It should only be used in
 * Imakefiles that describe a single program.
 */
#ifndef ComplexProgramTarget
#define	ComplexProgramTarget(program)					@@\
        PROGRAM = ProgramTargetName(program)				@@\
									@@\
AllTarget(ProgramTargetName(program))					@@\
									@@\
ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
									@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	RemoveFile(ProgramTargetName(program))
#endif /* ComplexProgramTarget */

#ifndef ComplexCplusplusProgramTarget
#define	ComplexCplusplusProgramTarget(program)				@@\
        PROGRAM = ProgramTargetName(program)				@@\
									@@\
AllTarget(ProgramTargetName(program))					@@\
									@@\
CplusplusProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
									@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	RemoveFile(ProgramTargetName(program))
#endif /* ComplexCplusplusProgramTarget */

/*
 * ComplexProgramTargetNoMan - generate rules for compiling and linking
 * the program specified by $(OBJS) and $(SRCS), installing the program
 * and generating dependencies.  It should only be used in Imakefiles
 * that describe a single program, and have no manual page.
 */
#ifndef ComplexProgramTargetNoMan
#define ComplexProgramTargetNoMan(program)				@@\
        PROGRAM = ProgramTargetName(program)				@@\
									@@\
AllTarget(ProgramTargetName(program))					@@\
									@@\
ProgramTargetHelperNoMan(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
									@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	RemoveFile(ProgramTargetName(program))
#endif /* ComplexProgramTargetNoMan */

#ifndef ComplexCplusplusProgramTarget
#define	ComplexCplusplusProgramTarget(program)				@@\
        PROGRAM = program						@@\
									@@\
AllTarget(program)							@@\
									@@\
CplusplusProgramTargetHelperNoMan(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
									@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	RemoveFile(ProgramTargetName(program))
#endif /* ComplexCplusplusProgramTarget */

/*
 * ComplexProgramTarget_1 - generate rules for compiling and linking the
 * program specified by $(OBJS1) and $(SRCS1), installing the program and its
 * man page, and generating dependencies for it and any programs described
 * by $(SRCS2) through $(SRCS10).  It should be used to build the primary
 * program in Imakefiles that describe multiple programs.
 */
#ifndef ComplexProgramTarget_1
#define	ComplexProgramTarget_1(program,locallib,syslib)			@@\
  OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \			@@\
         $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10)			@@\
  SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \			@@\
         $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10)			@@\
									@@\
AllTarget($(PROGRAMS))							@@\
									@@\
ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib)	@@\
									@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	RemoveFiles($(PROGRAMS))
#endif /* ComplexProgramTarget_1 */

#ifndef ComplexCplusplusProgramTarget_1
#define	ComplexCplusplusProgramTarget_1(program,locallib,syslib)	@@\
  OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \			@@\
         $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10)			@@\
  SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \			@@\
         $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10)			@@\
									@@\
AllTarget($(PROGRAMS))							@@\
									@@\
CplusplusProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib)@@\
									@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	RemoveFiles($(PROGRAMS))
#endif /* ComplexCplusplusProgramTarget_1 */

/*
 * ComplexProgramTarget_2 - generate rules for compiling and linking the
 * program specified by $(OBJS2) and $(SRCS2) and installing the program and
 * man page.  It should be used to build the second program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_2
#define	ComplexProgramTarget_2(program,locallib,syslib)			@@\
ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
#endif /* ComplexProgramTarget_2 */

#ifndef ComplexCplusplusProgramTarget_2
#define	ComplexCplusplusProgramTarget_2(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_2 */

/*
 * ComplexProgramTarget_3 - generate rules for compiling and linking the
 * program specified by $(OBJS3) and $(SRCS3) and installing the program and
 * man page.  It should be used to build the third program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_3
#define	ComplexProgramTarget_3(program,locallib,syslib)			@@\
ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
#endif /* ComplexProgramTarget_3 */

#ifndef ComplexCplusplusProgramTarget_3
#define	ComplexCplusplusProgramTarget_3(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_3 */

/*
 * ComplexProgramTarget_4 - generate rules for compiling and linking the
 * program specified by $(OBJS4) and $(SRCS4) and installing the program and
 * man page.  It should be used to build the third program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_4
#define	ComplexProgramTarget_4(program,locallib,syslib)			@@\
ProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib)
#endif /* ComplexProgramTarget_4 */

#ifndef ComplexCplusplusProgramTarget_4
#define	ComplexCplusplusProgramTarget_4(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_4 */

/*
 * ComplexProgramTarget_5 - generate rules for compiling and linking the
 * program specified by $(OBJS5) and $(SRCS5) and installing the program and
 * man page.  It should be used to build the third program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_5
#define	ComplexProgramTarget_5(program,locallib,syslib)			@@\
ProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib)
#endif /* ComplexProgramTarget_5 */

#ifndef ComplexCplusplusProgramTarget_5
#define	ComplexCplusplusProgramTarget_5(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_5 */

/*
 * ComplexProgramTarget_6 - generate rules for compiling and linking the
 * program specified by $(OBJS6) and $(SRCS6) and installing the program and
 * man page.  It should be used to build the third program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_6
#define	ComplexProgramTarget_6(program,locallib,syslib)			@@\
ProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib)
#endif /* ComplexProgramTarget_6 */

#ifndef ComplexCplusplusProgramTarget_6
#define	ComplexCplusplusProgramTarget_6(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_6 */

/*
 * ComplexProgramTarget_7 - generate rules for compiling and linking the
 * program specified by $(OBJS7) and $(SRCS7) and installing the program and
 * man page.  It should be used to build the third program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_7
#define	ComplexProgramTarget_7(program,locallib,syslib)			@@\
ProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib)
#endif /* ComplexProgramTarget_7 */

#ifndef ComplexCplusplusProgramTarget_7
#define	ComplexCplusplusProgramTarget_7(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_7 */

/*
 * ComplexProgramTarget_8 - generate rules for compiling and linking the
 * program specified by $(OBJS8) and $(SRCS8) and installing the program and
 * man page.  It should be used to build the third program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_8
#define	ComplexProgramTarget_8(program,locallib,syslib)			@@\
ProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib)
#endif /* ComplexProgramTarget_8 */

#ifndef ComplexCplusplusProgramTarget_8
#define	ComplexCplusplusProgramTarget_8(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_8 */

/*
 * ComplexProgramTarget_9 - generate rules for compiling and linking the
 * program specified by $(OBJS9) and $(SRCS9) and installing the program and
 * man page.  It should be used to build the third program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_9
#define	ComplexProgramTarget_9(program,locallib,syslib)			@@\
ProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib)
#endif /* ComplexProgramTarget_9 */

#ifndef ComplexCplusplusProgramTarget_9
#define	ComplexCplusplusProgramTarget_9(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_9 */

/*
 * ComplexProgramTarget_10 - generate rules for compiling and linking the
 * program specified by $(OBJS10) and $(SRCS10) and installing the program and
 * man page.  It should be used to build the third program in Imakefiles
 * describing more than one program.
 */
#ifndef ComplexProgramTarget_10
#define	ComplexProgramTarget_10(program,locallib,syslib)		@@\
ProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
#endif /* ComplexProgramTarget_10 */

#ifndef ComplexCplusplusProgramTarget_10
#define	ComplexCplusplusProgramTarget_10(program,locallib,syslib)	@@\
CplusplusProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
#endif /* ComplexCplusplusProgramTarget_10 */

#ifndef MoveToBakFile
#define MoveToBakFile(file) -@if [ -f file ]; then set -x; \		@@\
	$(MV) file file.bak; else exit 0; fi
#endif /* MoveToBakFile */

#ifndef RMoveToBakFile
#define RMoveToBakFile(file) -@if [ -f file ]; then set -x; \		@@\
	RemoveFile(file.bak); $(MV) file file.bak; \			@@\
	else exit 0; fi
#endif /* RMoveToBakFile */

/*
 * ServerTargetWithFlags - generate rules to compile, link, and relink a server
 */
#ifndef ServerTargetWithFlags
#define	ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\
AllTarget(ProgramTargetName(server))					@@\
ProgramTargetName(server): subdirs objects libs				@@\
	MoveToBakFile($@)						@@\
	LinkRule($@,$(SERVERLDOPTIONS),objects,libs $(LDLIBS) syslibs)	@@\
									@@\
Concat(load,server):							@@\
	MoveToBakFile(ProgramTargetName(server))			@@\
	LinkRule(ProgramTargetName(server),$(SERVERLDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
									@@\
loadX:: Concat(load,server)						@@\
									@@\
SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
									@@\
InstallProgramWithFlags(server,$(BINDIR),flags)				@@\
									@@\
clean::									@@\
	RemoveFile(ProgramTargetName(server))
#endif /* ServerTargetWithFlags */

/*
 * ServerTarget - rules to compile, link, and relink a normal server
 */
#ifndef ServerTarget
#define	ServerTarget(server,subdirs,objects,libs,syslibs)		@@\
ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_))
#endif /* ServerTarget */

#if DoRanlibCmd
#define RanLibrary(args) $(RANLIB) args
#else
#define RanLibrary(args) $(_NULLCMD_)
#endif

#ifndef LibraryTargetName
#define LibraryTargetName(libname)Concat(lib,libname.a)
#endif

/* This rule is used for libs in Xserver/Imakefile which are loaded, not
 * linked into the core module. Since modules are called libXXXX.a,
 * this rule mustn't be overriden by .cf files.
 */
#ifndef ModuleLibraryTargetName
#define ModuleLibraryTargetName(libname)Concat(lib,libname.a)
#endif

#ifndef LibraryTargetNameSuffix
#define LibraryTargetNameSuffix(libname,suffix)Concat3(lib,libname,suffix.a)
#endif

#ifndef InstallNamedInline
#define InstallNamedInline(srcname,flags,dest,dstname) $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname
#endif

#ifndef InstallNamedTarget
#define InstallNamedTarget(step,srcname,flags,dest,dstname)		@@\
step:: srcname								@@\
	MakeDir($(DESTDIR)dest)						@@\
	InstallNamedInline(srcname,flags,dest,dstname)
#endif /* InstallNamedTarget */

/*
 * InstallNamedTargetNoClobber - Like InstallNamedTarget, but doesn't
 * do the install if an installed version already exists.  Useful
 * for files that might have local customizations that you don't
 * want to clobber.  Config files are good candidates for this.
 */
#ifndef InstallNamedTargetNoClobber
#define InstallNamedTargetNoClobber(step,srcname,flags,dest,dstname)	@@\
step:: srcname								@@\
	MakeDir($(DESTDIR)dest)						@@\
	@if [ -f $(DESTDIR)dest/dstname ]; then \			@@\
	 echo "Not overwriting existing" $(DESTDIR)dest/dstname; \	@@\
	else set -x; \							@@\
	 $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname; fi
#endif /* InstallNamedTargetNoClobber */

#ifndef InstallTarget
#define InstallTarget(step,file,flags,dest)				@@\
InstallNamedTarget(step,file,flags,dest,file)
#endif /* InstallTarget */

#ifndef InstallInline
#define InstallInline(file,flags,dest) InstallNamedInline(file,flags,dest,file)
#endif

/*
 * InstallLibrary - generate rules to install the indicated library.
 */
#ifndef InstallLibrary
#define	InstallLibrary(libname,dest)					@@\
install:: LibraryTargetName(libname)					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\
	RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname))
#endif /* InstallLibrary */


/*
 * InstallDriverSDKLibrary - rule to install Driver SDK library.
 *                           (only used for XFree86). This is a no-op
 *                           rule so that Imakefiles on non-XFree86 systems
 *                           continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKLibrary
#define InstallDriverSDKLibrary(lib,dir)
#endif


/*
 * InstallDriverSDKNamedLibrary - rule to install Driver SDK library.
 *                         (only used for XFree86). This is a no-op
 *                         rule so that Imakefiles on non-XFree86 systems
 *                         continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKNamedLibrary
#define InstallDriverSDKNamedLibrary(lib,dlib,dir)
#endif


/*
 * InstallDriverSDKLibraryModule - rule to install Driver SDK library module.
 *                           (only used for XFree86). This is a no-op
 *                           rule so that Imakefiles on non-XFree86 systems
 *                           continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKLibraryModule
#define InstallDriverSDKLibraryModule(lib,dlib,dir)
#endif


/*
 * MergeIntoInstalledLibrary - generate rules to merge one library into another
 */
#ifndef MergeIntoInstalledLibrary
#define MergeIntoInstalledLibrary(tolib,fromlib)			@@\
install::  fromlib							@@\
	$(SCRIPTSRC)/mergelib $(DESTDIR)tolib fromlib
#endif /* MergeIntoInstalledLibrary */

/*
 * InstallLibraryAlias - generate rules to create a link from one library name
 * to another for the purposes of aliasing.
 */
#ifndef InstallLibraryAlias
#define	InstallLibraryAlias(libname,alias,dest)				@@\
install::								@@\
	-(cd $(DESTDIR)dest && ( \					@@\
		RemoveFile(LibraryTargetName(alias)); \			@@\
		$(LN) LibraryTargetName(libname) LibraryTargetName(alias)))
#endif /* InstallLibraryAlias */


/*
 * InstallLintLibrary - generate rules to install the indicated lint library.
 */
#ifndef InstallLintLibrary
#define	InstallLintLibrary(libname,dest)				@@\
InstallTarget(install.ln,Concat(llib-l,libname.ln),$(INSTLIBFLAGS),dest)
#endif /* InstallLintLibrary */


#if !CompressManPages
/*
 * InstallManPageLong - generate rules to install the indicated manual page,
 * giving it an alternate name.  This is used for installing man pages whose
 * base name without the .man suffix would normally be longer than 8 characters
 * (the limit for using source code control systems on files systems with
 * short file names).
 */
#ifndef InstallManPageLong
#define	InstallManPageLong(file,destdir,dest)				@@\
BuildInstallHtmlManPage(file,dest,$(MANSUFFIX))				@@\
									@@\
CppManTarget(file,$(EXTRAMANDEFS))					@@\
									@@\
InstallNamedTarget(install.man,file.$(MANNEWSUFFIX),$(INSTMANFLAGS),destdir,dest.$(MANSUFFIX))
#endif /* InstallManPageLong */


/*
 * InstallManPageAliases - generate rules to install manual page aliases.
 */
#ifndef InstallManPageAliases
#define	InstallManPageAliases(file,destdir,aliases)			@@\
InstallHtmlManPageAliases(file,aliases,$(MANSUFFIX))			@@\
									@@\
install.man::								@@\
	@(TMP="#tmp.$$$$"; \						@@\
	RemoveFile($${TMP}); \						@@\
	echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \	@@\
	for i in aliases; do (set -x; \					@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.$(MANSUFFIX)); \ @@\
	done; \								@@\
	RemoveFile($${TMP}))
#endif /* InstallManPageAliases */


/*
 * InstallGenManPageLong - More general rules for installing manual pages --
 * doesn't assume MANSUFFIX.
 */
#ifndef InstallGenManPageLong
#define	InstallGenManPageLong(file,destdir,dest,suffix)			@@\
BuildInstallHtmlManPage(file,dest,suffix)				@@\
									@@\
CppManTarget(file, $(EXTRAMANDEFS))					@@\
									@@\
install.man:: file.$(MANNEWSUFFIX)					@@\
	MakeDir($(DESTDIR)destdir)					@@\
	$(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \		@@\
		$(DESTDIR)destdir/dest.suffix
#endif /* InstallGenManPageLong */


/*
 * InstallGenManPageAliases - general equivalent of InstallManPageAliases
 */
#ifndef InstallGenManPageAliases
#define	InstallGenManPageAliases(file,destdir,suffix,aliases)		@@\
InstallHtmlManPageAliases(file,aliases,suffix)				@@\
									@@\
install.man::								@@\
	@(TMP="#tmp.$$$$"; \						@@\
	RemoveFile($${TMP}); \						@@\
	echo .so `basename destdir`/file.suffix > $${TMP}; \		@@\
	for i in aliases; do (set -x; \					@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.suffix); \ @@\
	done; \								@@\
	RemoveFile($${TMP}))
#endif /* InstallGenManPageAliases */

#else /* CompressManPages */

#ifndef InstallManPageLong
#define InstallManPageLong(file,destdir,dest)				@@\
BuildInstallHtmlManPage(file,dest,$(MANSUFFIX))				@@\
									@@\
CppManTarget(file, $(EXTRAMANDEFS))					@@\
									@@\
install.man:: file.$(MANNEWSUFFIX)					@@\
	MakeDir($(DESTDIR)destdir)					@@\
	$(RM) $(DESTDIR)destdir/dest.$(MANSUFFIX)*			@@\
	$(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \		@@\
	  $(DESTDIR)destdir/dest.$(MANSUFFIX)				@@\
	-$(COMPRESSMANCMD) $(DESTDIR)destdir/dest.$(MANSUFFIX)
#endif

#ifndef InstallGenManPageLong
#define InstallGenManPageLong(file,destdir,dest,suffix)			@@\
BuildInstallHtmlManPage(file,dest,suffix)				@@\
									@@\
CppManTarget(file, $(EXTRAMANDEFS))					@@\
									@@\
install.man:: file.$(MANNEWSUFFIX)					@@\
	MakeDir($(DESTDIR)destdir)					@@\
	$(RM) $(DESTDIR)destdir/dest.suffix*				@@\
	$(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \		@@\
	  $(DESTDIR)destdir/dest.suffix					@@\
	-$(COMPRESSMANCMD) $(DESTDIR)destdir/dest.suffix
#endif

#ifndef InstallMultipleMan
#define InstallMultipleMan(list,dest)					@@\
install.man:: list							@@\
	MakeDir($(DESTDIR)dest)						@@\
	@case '${MFLAGS}' in *[i]*) set +e;; esac; \			@@\
	for i in list; do \						@@\
		(MNAME=`echo $$i | cut -f1 -d.`; \			@@\
		set -x;	\						@@\
		$(RM) $(DESTDIR)dest/$${MNAME}*; \			@@\
		$(INSTALL) -c $(INSTMANFLAGS) $$i \			@@\
		  $(DESTDIR)dest/$${MNAME}.$(MANSUFFIX); \		@@\
		$(COMPRESSMANCMD) $(DESTDIR)dest/$${MNAME}.$(MANSUFFIX)); \ @@\
	done
#endif

/*
 * InstallManPageAliases - install soft links for aliases.
 */
#ifndef InstallManPageAliasesBase
#define InstallManPageAliasesBase(file,destdir,aliases)			@@\
install.man::								@@\
	@(SUFFIX=`echo $(DESTDIR)destdir/file.* | sed -e 's,.*/[^\.]*.,,'`; \ @@\
	for i in aliases; do (set -x; \					@@\
	$(RM) $(DESTDIR)destdir/$$i.*; \				@@\
	(cd $(DESTDIR)destdir; $(LN) file.$${SUFFIX} \			@@\
	$$i.$${SUFFIX})); \						@@\
	done)
#endif

#ifndef InstallManPageAliases
#define InstallManPageAliases(file,destdir,aliases)			@@\
InstallHtmlManPageAliases(file,aliases,$(MANSUFFIX))			@@\
									@@\
InstallManPageAliasesBase(file,destdir,aliases)
#endif


/*
 * InstallGenManPageAliases - install soft links for aliases.
 */
#ifndef InstallGenManPageAliases
#define InstallGenManPageAliases(file,destdir,suffix,aliases)		@@\
InstallHtmlManPageAliases(file,aliases,suffix)				@@\
									@@\
InstallManPageAliasesBase(file,destdir,aliases)
#endif

#endif /* CompressManPages */


/*
 * InstallManPage - generate rules to install the indicated manual page.
 */
#ifndef InstallManPage
#define	InstallManPage(file,destdir)					@@\
InstallManPageLong(file,destdir,file)
#endif /* InstallManPage */


/*
 * InstallGenManPage - general equivalent of InstallManPage
 */
#ifndef InstallGenManPage
#define	InstallGenManPage(file,destdir,suffix)				@@\
InstallGenManPageLong(file,destdir,file,suffix)
#endif /* InstallGenManPage */


/*
 * RmanDependency - generate rules to build the rman program if
 * this Imakefile is within the source tree.
 */
#ifndef RmanDependency
#ifdef UseInstalled
#define RmanDependency() /**/
#else
#define RmanDependency()						@@\
NoCmpScript(ProgramTargetName($(RMAN)))					@@\
									@@\
ProgramTargetName($(RMAN)):						@@\
	@echo "checking $(RMANBASENAME) over in $(TOP)/config/util first..."; \	@@\
	cd $(TOP)/config/util && $(MAKE) rmanonly; \			@@\
	echo "okay, continuing in $(CURRENT_DIR)"

#endif /* UseInstalled */
#endif /* RmanDependency */

#ifndef RmanCmdDependency
#ifdef UseInstalled
#define RmanCmdDependency	/**/
#else
#define RmanCmdDependency	ProgramTargetName($(RMAN))
#endif
#endif

#ifndef BuildInstallHtmlManPage
#if BuildHtmlManPages
#define BuildInstallHtmlManPage(file,dest,suffix)			@@\
AllTarget(dest.suffix.html)						@@\
									@@\
dest.suffix.html: file.$(MANNEWSUFFIX) RmanCmdDependency		@@\
	RemoveFiles(dest.suffix.html dest.suffix-html)			@@\
	RunProgram(RMAN,$(RMANOPTIONS) < file.$(MANNEWSUFFIX) \		@@\
	  > dest.suffix-html) && $(MV) dest.suffix-html $@		@@\
									@@\
install.man:: dest.suffix.html						@@\
	MakeDir($(DESTDIR)$(DOCHTMLDIR))				@@\
	@(SUF=`expr suffix \: '\(.\)'`; \				@@\
	 set -x; \							@@\
	 $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) dest.suffix.html $(DESTDIR)$(DOCHTMLDIR)/dest.$$SUF.html)	@@\
									@@\
clean::									@@\
	RemoveFiles(dest.suffix.html dest.suffix-html)
#else
#define BuildInstallHtmlManPage(file,dest,suffix) /**/
#endif
#endif

#ifndef InstallHtmlManPageAliases
#if BuildHtmlManPages
#define InstallHtmlManPageAliases(file,aliases,suffix)			@@\
install.man:: file.suffix.html						@@\
	MakeDir($(DESTDIR)$(DOCHTMLDIR))				@@\
	@SUF=`expr suffix \: '\(.\)'`; \				@@\
	for i in aliases; do (set -x; \					@@\
	  RemoveFile($(DESTDIR)$(DOCHTMLDIR)/$$i.$$SUF.html); \		@@\
	  (cd $(DESTDIR)$(DOCHTMLDIR); \				@@\
	    $(LN) file.$$SUF.html $$i.$$SUF.html)); \			@@\
	done
#else
#define InstallHtmlManPageAliases(file,aliases,suffix) /**/
#endif
#endif

#ifndef HtmlManIndex
#if BuildHtmlManPages
#define HtmlManIndex							@@\
html_index::								@@\
	MakeDir($(DESTDIR)$(DOCHTMLDIR))				@@\
	$(HTMLINDEXCMD) $(DESTDIR)$(DOCHTMLDIR)
#else
#define HtmlManIndex	html_index::
#endif
#endif


/*
 * ManKeywordsTarget - generate the database used by "man -k".
 * This rule updates the index in the directory "manpath", which
 * indexes all the manual pages in the section subdirectories under
 * it.  An update command is defined only on systems that have a
 * per MANPATH element index.  If the OS supports only one system-wide
 * database, we don't update it, because then we can't do cross
 * installations or use a non-empty DESTDIR for testing.
 */
#ifndef ManKeywordsTarget
#define ManKeywordsTarget(manpath) man_keywords::
#endif

/*
 * InstallNamedNonExec - generate rules to install a data file
 */
#ifndef InstallNamedNonExec
#define	InstallNamedNonExec(srcname,dstname,dest)			@@\
InstallNamedTarget(install,srcname,$(INSTDATFLAGS),dest,dstname)
#endif /* InstallNamedNonExec */


/*
 * InstallDriverSDKNamedNonExec - rule for installing server Driver SDK files.
 *                         (only used for XFree86). This is a no-op
 *                         rule so that Imakefiles on non-XFree86 systems
 *                         continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKNamedNonExec
#define InstallDriverSDKNamedNonExec(srcname,dstname,dest)
#endif


/*
 * InstallNonExecFile - generate rules to install a data file
 */
#ifndef InstallNonExecFile
#define InstallNonExecFile(file,dest)					@@\
InstallTarget(install,file,$(INSTDATFLAGS),dest)
#endif /* InstallNonExecFile */


/*
 * InstallNonExecFileNoClobber - install a data file once
 */
#ifndef InstallNonExecFileNoClobber
#define InstallNonExecFileNoClobber(file,dest)				@@\
InstallNamedTargetNoClobber(install,file,$(INSTDATFLAGS),dest,file)
#endif /* InstallNonExecFileNoClobber */


/*
 * InstallDriverSDKNonExecFile - rule for installing server Driver SDK files.
 *                         (only used for XFree86). This is a no-op
 *                         rule so that Imakefiles on non-XFree86 systems
 *                         continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKNonExecFile
#define InstallDriverSDKNonExecFile(file,dir)
#endif


/*
 * InstallNonExec - generate rules to install a data file, but does not
 * try to create the destination directory (deprecated)
 */
#ifndef InstallNonExec
#define	InstallNonExec(file,dest)					@@\
install:: file								@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) file $(DESTDIR)dest
#endif /* InstallNonExec */


/*
 * InstallProgramWithFlags - generate rules to install an executable program
 * using given install flags.
 */
#ifndef InstallProgramWithFlags
#if StripInstalledPrograms && CrossCompiling
#define InstallProgramWithFlags(program,dest,flags)			@@\
InstallTarget(install,ProgramTargetName(program),$(INSTPGMFLAGS) flags,dest) @@\
	CrossStripCmd $(DESTDIR)dest/ProgramTargetName(program)
#else
#define InstallProgramWithFlags(program,dest,flags)			@@\
InstallTarget(install,ProgramTargetName(program),$(INSTPGMFLAGS) flags,dest)
#endif /* StripInstalledPrograms && CrossCompiling */
#endif /* InstallProgramWithFlags */


/*
 * InstallProgram - generate rules to install an executable program using any
 * special install flags set in $(INSTALLFLAGS).
 */
#ifndef InstallProgram
#define	InstallProgram(program,dest)					@@\
InstallProgramWithFlags(program,dest,NullParameter)
#endif /* InstallProgram */



/*
 * InstallScript - install a shell script.
 */
#ifndef InstallScript
#define	InstallScript(program,dest)					@@\
InstallNamedTarget(install,program.script,$(INSTBINFLAGS),dest,program)
#endif /* InstallScript */


/*
 * InstallNamedProg - install a program with renaming and no stripping.
 */
#ifndef InstallNamedProg
#define InstallNamedProg(srcname,dstname,dest)				@@\
InstallNamedTarget(install,srcname,$(INSTBINFLAGS),dest,dstname)
#endif /* InstallNamedProg */


/*
 * InstallNamedProgNoClobber - Like InstallNamedProg, but doesn't
 * do the install if an installed version already exists.
 */
#ifndef InstallNamedProgNoClobber
#define InstallNamedProgNoClobber(srcname,dstname,dest)			@@\
InstallNamedTargetNoClobber(install,srcname,$(INSTBINFLAGS),dest,dstname)
#endif /* InstallNamedProgNoClobber */


/*
 * InstallDriverSDKNamedProg - rule for installing server Driver SDK files.
 *                         (only used for XFree86). This is a no-op
 *                         rule so that Imakefiles on non-XFree86 systems
 *                         continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKNamedProg
#define InstallDriverSDKNamedProg(srcname,dstname,dest)
#endif


/*
 * MakeFlagsToShellFlags - set variables before starting a loop.
 * makeflags is the set of "make" flags to check.
 * shellcmd is the shell command to execute if any of the flags are set.
 *
 * The usual use of this rule is to translate make's "don't quit on error"
 * flags into the equivalent for the shell.  To do this, "make -i" always
 * becomes "set +e".  "make -k" should also turn on "set +e" if the target
 * is building subdirectories.  That is, subdirectories are independent
 * and should appear to be multiple targets, even though they are
 * implemented in a loop in a single target.
 */
#ifndef MakeFlagsToShellFlags
#define MakeFlagsToShellFlags(makeflags,shellcmd)\
	for flag in ${MAKEFLAGS} ''; do \				@@\
	  case "$$flag" in *=*) ;; --*) ;; *[makeflags]*) shellcmd;; esac; done
#endif

/*
 * MakeNamedTargetSubdir - do make in a subdir.
 */
#ifndef MakeNamedTargetSubdir
#define MakeNamedTargetSubdir(dir,flags,subname)\
		(cd dir && $(MAKE) $(MFLAGS) $(PARALLELMFLAGS) \	@@\
			flags subname)
#endif

/*
 * LinkFileList - link a list of files from one place to another
 */
#ifndef LinkFileList
#define LinkFileList(step,list,dir,sub)					@@\
step::									@@\
	@MakeFlagsToShellFlags(i,set +e); \				@@\
	echo "	cd" dir; cd dir && \					@@\
	for i in list; do (set -x; $(LN) -f sub/$$i .); done
#endif


/*
 * LinkConfDirectoryLong
 *
 * Make links from opath (usually <ProjectRoot>/lib/X11) to npath
 * For example /usr/X11R6/lib/X11/xdm ==> /etc/X11/xdm so that X
 * binaries can be mounted from a read-only volume like a CD-ROM;
 * but files that may need to be edited can be stored locally on
 * read-write media. If someone has an existing installation, be
 * careful and move existing files to the new location in /etc.
 * XXX Need to make the installation script do this when installing
 * binary distributions.
 *
 * Since the link is used in the installation process, we need to
 * make the link relative in order to honor $(DESTDIR) if it is set.
 *
 * Note: The sed script used here is not completely general.  It assumes
 * that no elements of the path are '..', and that none start with '.'
 * that aren't just '.'.
 *
 * For a more general solution $(REVPATH) could be used.  Even though
 * it was intended for something a little different, it does do what is
 * required here.
 *
 */
#ifndef LinkConfDirectoryLong
#if UseSeparateConfDir && HasSymLinks
#define LinkConfDirectoryLong(mdir,cdir,rdir,ldir,opath,npath)		@@\
install::								@@\
	@MakeFlagsToShellFlags(i,set +e); \				@@\
	if [ -h Concat($(DESTDIR),npath/mdir) ]; then \			@@\
	  $(RM) Concat($(DESTDIR),npath/mdir); \			@@\
	fi								@@\
	MakeDir(Concat($(DESTDIR),opath/cdir))				@@\
	MakeDir(Concat($(DESTDIR),npath/mdir))				@@\
	@MakeFlagsToShellFlags(i,set +e); \				@@\
	if [ -d Concat($(DESTDIR),opath/cdir) ]; then \			@@\
	  RELPATH=`echo opath/cdir | \					@@\
		sed -e 's:^/::' -e 's:[^/.][^/]*:..:'g -e 's:/\.$$::'`; \ @@\
	  cd Concat($(DESTDIR),opath/cdir); \				@@\
	  if [ -d rdir -a ! -h rdir ]; then \				@@\
	    (cd rdir; tar cf - . | \					@@\
		(cd Concat($(DESTDIR),npath/mdir); \			@@\
		 tar xf -; exit 0); exit 0); \				@@\
	  fi; \								@@\
	  $(RM) -r rdir; \						@@\
	  $(LN) Concat($${RELPATH},npath/mdir) ldir; \			@@\
	fi
#else
#define LinkConfDirectoryLong(mdir,cdir,rdir,ldir,opath,npath)
#endif
#endif

#ifndef LinkConfDirectory
#define LinkConfDirectory(mdir,cdir,rdir,ldir) LinkConfDirectoryLong(mdir,cdir,rdir,ldir,$(LIBDIR),$(CONFDIR))
#endif

#ifndef LinkVarDirectory
#define LinkVarDirectory(mdir,cdir,rdir,ldir) LinkConfDirectoryLong(mdir,cdir,rdir,ldir,$(LIBDIR),$(VARDIR))
#endif

/*
 * LinkConfFileLong
 *
 * Make links from opath (<ProjectRoot>/lib/X11) to npath
 * For example /usr/X11R6/lib/X11/xxx ==> /etc/X11/xxx so that X binaries
 * can be mounted from a read-only volume like a CD-ROM;
 * but files that may need to be edited can be stored locally on
 * read-write media. If someone has an existing installation, be
 * careful and move existing files to the new location in /etc.
 * XXX Need to make the installation script do this when installing
 * binary distributions.
 *
 * Since the link is used in the installation process, we need to
 * make the link relative in order to honor $(DESTDIR) if it is set.
 */
#ifndef LinkConfFileLong
#if UseSeparateConfDir && HasSymLinks
#define LinkConfFileLong(cfile,lfile,opath,npath)			@@\
install::								@@\
	MakeDir(Concat($(DESTDIR),opath))				@@\
	MakeDir(Concat($(DESTDIR),npath))				@@\
	@MakeFlagsToShellFlags(i,set +e); \				@@\
	if [ -d Concat($(DESTDIR),opath) ]; then \			@@\
	  RELPATH=`echo opath | \					@@\
		sed -e 's:^.::' -e 's:[^/.][^/]*:..:'g`; \		@@\
	  cd Concat($(DESTDIR),opath); \				@@\
	  if [ -f lfile -a ! -h lfile ]; then \				@@\
	    cp -p lfile Concat($(DESTDIR),npath/cfile); \		@@\
	  fi; \								@@\
	  $(RM) -r lfile; \						@@\
	  $(LN) Concat($${RELPATH},npath/cfile) lfile; \		@@\
	fi
#else
#define LinkConfFileLong(cfile,lfile,opath,npath)
#endif
#endif


#ifndef LinkConfFile
#define LinkConfFile(cfile,lfile) LinkConfFileLong(cfile,lfile,$(LIBDIR),$(CONFDIR))
#endif

/*
 * InstallMultipleDestFlags - generate rules to install multiple files at
 * once during a particular step in the build using a specific set of install
 * flags.
 */
#ifndef InstallMultipleDestFlags
#define InstallMultipleDestFlags(step,list,dest,flags)			@@\
step:: list								@@\
	MakeDir($(DESTDIR)dest)						@@\
	@MakeFlagsToShellFlags(i,set +e); \				@@\
	for i in list; do \						@@\
		(set -x; $(INSTALL) $(INSTALLFLAGS) flags $$i $(DESTDIR)dest); \	@@\
	done
#endif /* InstallMultipleDestFlags */


/*
 * InstallDriverSDKMultipleDestFlags - rule for installing server Driver SDK
 *                         files. (only used for XFree86). This is a no-op
 *                         rule so that Imakefiles on non-XFree86 systems
 *                         continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKMultipleDestFlags
#define InstallDriverSDKMultipleDestFlags(list,dest,flags)
#endif


/*
 * InstallMultipleDest - generate rules to install multiple files at once
 * during a particular step in the build using any install flags set in
 * $(INSTDATFLAGS).
 */
#ifndef InstallMultipleDest
#define InstallMultipleDest(step,list,dest)				@@\
InstallMultipleDestFlags(step,list,dest,$(INSTDATFLAGS))
#endif /* InstallMultipleDest */

/*
 * InstallMultiple - generate rules to install multiple files at once
 * during the install step of the build using any install flags set in
 * $(INSTALLFLAGS).
 */
#ifndef InstallMultiple
#define	InstallMultiple(list,dest)					@@\
InstallMultipleDest(install,list,dest)
#endif /* InstallMultiple */


/*
 * InstallMultipleFlags - generate rules to install multiple files at once
 * during the install step of the build using the given install flags.
 */
#ifndef InstallMultipleFlags
#define InstallMultipleFlags(list,dest,flags)				@@\
InstallMultipleDestFlags(install,list,dest,flags)
#endif /* InstallMultipleFlags */


/*
 * InstallMultipleMan - generate rules to install a variety of manual pages
 * during the install.man step of the build.
 */
#ifndef InstallMultipleMan
#define InstallMultipleMan(list,dest)					@@\
InstallMultipleDestFlags(install.man,list,dest,$(INSTMANFLAGS))
#endif /* InstallMultipleMan */

/*
 * InstallMultipleManSuffix - generate rules to install multiple manual
 * pages dufing the install.man step of the build, where
 * the target files have the suffix given.
 */
#ifndef InstallMultipleManSuffix
#define InstallMultipleManSuffix(list,dest,suffix)			@@\
install.man::								@@\
	MakeDir($(DESTDIR)dest)						@@\
	@MakeFlagsToShellFlags(i,set +e); \				@@\
	for i in list; do \						@@\
	  (set -x; $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $$i.suffix $(DESTDIR)dest/$$i.$(MANSUFFIX)); \	@@\
	done
#endif /* InstallMultipleManSuffix */


/*
 * IncludeMakefile - rule to include another Makefile.
 * Must not generate an error or even a warning if the named file
 * is not present, since we use this to include Makefile.dep, which
 * may not be built yet.
 * This is defined non-null iff HasMakefileSafeInclude is YES.
 * The double-@ is to ensure no leading spaces on the line.
 */
#ifndef IncludeMakefile
#if HasClearmake
#define IncludeMakefile(file) @@sinclude file
#else
#if HasBsdMake
#define IncludeMakefile(file) @@# dependencies are in .depend
#else
#define IncludeMakefile(file) /**/
#endif
#endif
#endif

/*
 * DependDependencyStatement - Used by DependDependency to set up the
 * most specific dependency, which differs based on whether we support
 * a separate Makefile.dep on this platform.
 */
#ifndef DependDependencyStatement
#if HasMakefileSafeInclude
#define DependDependencyStatement()					@@\
DependFileName:: ProgramTargetName($(DEPEND))
#else
#define DependDependencyStatement()					@@\
depend:: ProgramTargetName($(DEPEND))
#endif
#endif

/*
 * DependDependency - generate rules to build the makedepend program if
 * this Imakefile is within the source tree.
 */
#ifndef DependDependency
#ifdef UseInstalled
#define DependDependency() /**/
#else
#define DependDependency()						@@\
DependDependencyStatement()						@@\
									@@\
NoCmpScript(ProgramTargetName($(DEPEND)))				@@\
									@@\
ProgramTargetName($(DEPEND)):						@@\
	echo "using system-wide depend, continuing in $(CURRENT_DIR)"

#endif /* UseInstalled */
#endif /* DependDependency */


/*
 * DependTarget - generate rules to compute dependencies for all files listed
 * in $(SRCS).
 */
#ifndef DependTarget
#if HasMakefileSafeInclude
#define DependTarget()							@@\
DependDependency()							@@\
									@@\
depend:: DependFileName							@@\
									@@\
DependFileName::							@@\
	RemoveFile($@)							@@\
	RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)) > $@
#else /* HasMakefileSafeInclude */
#define	DependTarget()							@@\
DependDependency()							@@\
									@@\
depend::								@@\
	RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS))
#endif /* HasMakefileSafeInclude else */
#endif /* DependTarget */

/*
 * DependTarget3 - generate rules to compute dependencies for all files given.
 */
#ifndef DependTarget3
#if HasMakefileSafeInclude
#define DependTarget3(srcs1,srcs2,srcs3)				@@\
DependDependency()							@@\
									@@\
depend:: DependFileName							@@\
									@@\
DependFileName::							@@\
	RemoveFile($@)							@@\
	RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1) > $@	@@\
	RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2) >> $@	@@\
	RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3) >> $@
#else /* HasMakefileSafeInclude */
#define	DependTarget3(srcs1,srcs2,srcs3)				@@\
DependDependency()							@@\
									@@\
depend::								@@\
	RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1)	@@\
	RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2)	@@\
	RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3)
#endif /* HasMakefileSafeInclude else */
#endif /* DependTarget3 */


/*
 * CleanTarget - generate rules to remove any garbage files
 */
#ifndef CleanTarget
#define	CleanTarget()							@@\
clean::									@@\
	$(RM) FilesToClean ExtraFilesToClean DocFilesToClean "#"*	@@\
									@@\
ProofCleanTarget()
#endif /* CleanTarget */


/*
 * TagsTarget - generate rules to compute tags files for C source code.
 */
#ifndef TagsTarget
#define	TagsTarget()							@@\
tags::									@@\
	$(TAGS) -w *.[ch]						@@\
	$(TAGS) -xw *.[ch] > TAGS
#endif /* TagsTarget */


/*
 * ImakeDependency - generate rules to compile imake if this Imakefile is
 * within the source tree.
 */
#ifndef ImakeDependency
#ifdef UseInstalled
#define ImakeDependency(target) /**/
#else
#define ImakeDependency(target)						@@\
target:: ProgramTargetName($(IMAKE))					@@\
									@@\
NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf)			@@\
									@@\
ProgramTargetName($(IMAKE)) $(IMAKE).Osuf:				@@\
	echo "using system-wide imake, continuing in $(CURRENT_DIR)"
#endif /* UseInstalled */
#endif /* ImakeDependency */


/*
 * BuildMakefileTarget - generate rules to build a Makefile from an Imakefile
 * and any special imake flags.  This is generally done automatically by the
 * template or by any special Imakefiles.  The first argument exists just
 * because imakeflags is usually empty and some preprocessors will complain
 * if an empty argument is passed as the sole argument to a macro.
 */
#ifndef BuildMakefileTarget
#define	BuildMakefileTarget(notused,imakeflags)				@@\
ImakeDependency(Makefile)						@@\
									@@\
Makefile::								@@\
	RMoveToBakFile(Makefile)					@@\
	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags

#endif /* BuildMakefileTarget */


/*
 * MakefileTarget - generate rules to build a normal Makefile.
 */
#ifndef MakefileTarget
#define MakefileTarget()						@@\
BuildMakefileTarget(Imakefile,NullParameter)
#endif /* MakefileTarget */


/*
 * LibMkdir - helper for creating library object subdirectories
 */
#ifndef LibMkdir
#define LibMkdir(dir) DirFailPrefix@if [ -d dir ]; then exit 0; else set -x; mkdir dir; fi
#endif

#ifndef LibMkdirLinkSubdirs
#define LibMkdirLinkSubdirs(dir) DirFailPrefix@if [ -d dir ]; then \	@@\
	    exit 0; \							@@\
	else \								@@\
	    echo "mkdir dir"; mkdir dir; \				@@\
	    for i in $(SUBDIRS); do \					@@\
	      j=`echo "$$i" | sed -e 's;[^/]\{1,\};..;g'`; \		@@\
	      if [ ! -d "dir/`dirname $$i`" ]; then \			@@\
		$(MKDIRHIER) "dir/`dirname $$i`"; \			@@\
	      fi; \							@@\
	      echo $(LN) "$$j/$$i/dir" "dir/$$i"; \			@@\
	      $(LN) "$$j/$$i/dir" "dir/$$i"; \				@@\
	    done; \							@@\
	fi
#endif

/*
 * LibCleanDir - helper for cleaning library object subdirectories
 */
#ifndef LibCleanDir
#define LibCleanDir(dir) -@if [ -d dir ]; then \			@@\
		set -x; $(RM) -r dir; else exit 0; fi
#endif

/*
 * LintLibReferences - variables for lint libraries
 */
#ifndef LintLibReferences
#define LintLibReferences(varname,libname,libsource)			@@\
Concat(LINT,varname) = _UseCat($(LINTLIBDIR)/llib-l,libsource/llib-,libname.ln)
#endif


/*
 * UnsharedLibReferences - variables for unshared libraries
 */
#ifndef UnsharedLibReferences
#define UnsharedLibReferences(varname,libname,libsource)		@@\
ProjectUnsharedLibReferences(varname,libname,libsource,$(BUILDLIBDIR))
#endif

/*
 * ProjectUnsharedLibReferences - variables for unshared libraries
 */
#ifndef ProjectUnsharedLibReferences
#define ProjectUnsharedLibReferences(varname,libname,libsource,buildlibdir)	@@\
Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/,buildlibdir/,LibraryTargetName(libname))	@@\
Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname)		@@\
LintLibReferences(varname,libname,libsource)
#endif

/*
 * SharedLibDependencies - shared library dependencies
 */
#ifndef SharedLibDependencies
#define SharedLibDependencies(libname,libsource,revname) /**/
#endif

/*
 * SharedDSLibDependencies - shared library dependencies with data separation
 */
#ifndef SharedDSLibDependencies
#define SharedDSLibDependencies(libname,libsource,revname) /**/
#endif

/*
 * SharedLibReferences - variables for shared libraries
 */
#ifndef SharedLibReferences
#define SharedLibReferences(varname,libname,libsource,revname,rev)	@@\
revname = rev								@@\
Concat3(DEP,varname,LIB) = SharedLibDependencies(libname,libsource,revname) @@\
Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname)		@@\
LintLibReferences(varname,libname,libsource)
#endif

/*
 * SharedDSLibReferences - variables for shared libraries with data separation
 */
#ifndef SharedDSLibReferences
#define SharedDSLibReferences(varname,libname,libsource,revname,rev)	@@\
revname = rev								@@\
Concat3(DEP,varname,LIB) = SharedDSLibDependencies(libname,libsource,revname) @@\
Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname)		@@\
LintLibReferences(varname,libname,libsource)
#endif

/*
 * CPPOnlyCompile - run C compiler's preprocessor only
 */
#ifndef CPPOnlyCompile
#define CPPOnlyCompile(src,options) RemoveFile($@)			@@\
	ClearmakeOSName \
	$(CC) -E $(CFLAGS) options src > $@
#endif

/*
 * ObjectCompile - compile fragment for a normal object file
 */
#ifndef ObjectCompile
#define ObjectCompile(options) RemoveFile($@)				@@\
	ClearmakeOSName \
	$(CC) -c $(CFLAGS) options $*.c
#endif

/*
 * CompileCToAsm - compile C file to assembler
 */
#ifndef CompileCToAsm
#define CompileCToAsm(options) RemoveFile($@)				@@\
	ClearmakeOSName \
	$(CC) -S $(CFLAGS) options $*.c
#endif


/*
 * CompileCplusplusToAsm - compile C++ file to assembler
 */
#ifndef CompileCplusplusToAsm
#define CompileCplusplusToAsm(options) RemoveFile($@)			@@\
	ClearmakeOSName \
	$(CC) -S $(CFLAGS) options $*.cc
#endif


#ifndef ObjectCplusplusCompile
#define ObjectCplusplusCompile(options) RemoveFile($@)			@@\
	ClearmakeOSName \
	$(CXX) -c $(CXXFLAGS) options $*.CCsuf
#endif

/*
 * NormalLibObjCompile - compile fragment for a normal library object file
 */
#ifndef NormalLibObjCompile
#define NormalLibObjCompile(options) ObjectCompile(options)
#endif

#ifndef NormalRelocLibObjCompile
# if !StaticNeedsPicForShared
#  define NormalRelocLibObjCompile(options) NormalLibObjCompile(options)
# else
#  define NormalRelocLibObjCompile(options) NormalLibObjCompile(options $(PICFLAGS))
# endif
#endif

#ifndef NormalLibObjCplusplusCompile
#define NormalLibObjCplusplusCompile(options) ObjectCplusplusCompile(options)
#endif

/*
 * NormalSharedLibObjCompile - compile fragment for shared objects
 */
#ifndef NormalSharedLibObjCompile
#define NormalSharedLibObjCompile(options) NormalLibObjCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS))
#endif

#ifndef NormalSharedLibObjCplusplusCompile
#define NormalSharedLibObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(CXXPICFLAGS))
#endif

/*
 * LibObjCompile - compile fragment for unshared/profiled/debugged objects
 */
#ifndef LibObjCompile
#if HasGcc || HasGcc2
#define LibObjCompile(dir,options) RemoveFiles($@ dir/$@)		@@\
	ClearmakeOSName \
	$(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \
	options $*.c -o dir/$@
#else
#define LibObjCompile(dir,options) RemoveFiles($@ dir/$@)		@@\
	ClearmakeOSName \
	$(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \
	options $*.c							@@\
	$(MV) $@ dir/$@
#endif
#endif

#ifndef LibObjCplusplusCompile
#if HasGcc || HasGcc2
#define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@)	@@\
	ClearmakeOSName \
	$(CXX) -c $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) \
	options $*.CCsuf -o dir/$@
#else
#define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@)	@@\
	ClearmakeOSName \
	$(CXX) -c $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) \
	options $*.CCsuf						@@\
	$(MV) $@ dir/$@
#endif
#endif

/*
 * DebuggedLibObjCompile - compile fragment for debugged objects
 */
#ifndef DebuggedLibObjCompile
#define DebuggedLibObjCompile(options) LibObjCompile(debugger,DebuggableCDebugFlags options)
#endif

#ifndef DebuggedLibObjCplusplusCompile
#define DebuggedLibObjCplusplusCompile(options) LibObjCplusplusCompile(debugger,DebuggableCplusplusDebugFlags options)
#endif

/*
 * ProfiledLibObjCompile - compile fragment for profiled objects
 */
#ifndef ProfiledLibObjCompile
#define ProfiledLibObjCompile(options) LibObjCompile(profiled,ProfiledCDebugFlags options)
#endif

#ifndef ProfiledLibObjCplusplusCompile
#define ProfiledLibObjCplusplusCompile(options) LibObjCplusplusCompile(profiled,ProfiledCplusplusDebugFlags options)
#endif

/*
 * UnsharedLibObjCompile - compile fragment for unshared objects
 */
#ifndef UnsharedLibObjCompile
#define UnsharedLibObjCompile(options) LibObjCompile(unshared,$(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) options)
#endif

#ifndef UnsharedLibObjCplusplusCompile
#define UnsharedLibObjCplusplusCompile(options) LibObjCplusplusCompile(unshared,$(CXXDEBUGFLAGS) $(CXXLIBDEBUGFLAGS) options)
#endif

/*
 * SharedLibObjCompile - compile fragment for shared objects
 */
#ifndef SharedLibObjCompile
#define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS))
#endif

/*
 * NormalLibraryObjectRule - for simple libraries
 */
#ifndef NormalLibraryObjectRule
#define	NormalLibraryObjectRule()					@@\
.c.Osuf:								@@\
	NormalLibObjCompile($(_NOOP_))
#endif /* NormalLibraryObjectRule */

#ifndef NormalCplusplusObjectRule
#define NormalCplusplusObjectRule()					@@\
.CCsuf.Osuf:								@@\
	NormalLibObjCplusplusCompile($(_NOOP_))
#endif

#ifndef NormalFortranObjectRule
#define NormalFortranObjectRule()					@@\
.f.Osuf:								@@\
	RemoveFile($@)							@@\
	ClearmakeOSName \
	$(FC) -c $(FCFLAGS) $*.f
#endif

/*
 * SpecialObjectRule - generate rules to compile a file with special flags.
 */
#ifndef SpecialObjectRule
#define SpecialObjectRule(objs,depends,options)				@@\
objs:	depends								@@\
	ObjectCompile(options)
#endif /* SpecialObjectRule */

#ifndef SpecialCplusplusObjectRule
#define SpecialCplusplusObjectRule(baseobj,basedep,options)		@@\
baseobj.Osuf:	basedep.CCsuf						@@\
	ObjectCplusplusCompile(options)
#endif /* SpecialCplusplusObjectRule */

/*
 * SpecialCObjectRule - generate rules to compile a C file with special flags.
 *			also handles CodeCenter rules
 */
#ifndef SpecialCObjectRule
#define SpecialCObjectRule(basename,depends,options)			@@\
SpecialObjectRule(basename.Osuf,basename.c depends,options)		@@\
									@@\
basename.i: basename.c depends						@@\
	CPPOnlyCompile(basename.c,options)				@@\
									@@\
basename.s: basename.c depends						@@\
	CompileCToAsm(options)						@@\
									@@\
CenterLoadTarget(debug_src,basename.c,NullParameter,$(ALLDEFINES) options)
#endif /* SpecialCObjectRule */


#ifndef ObjectFromSpecialSource
#define ObjectFromSpecialSource(dst,src,flags)				@@\
NoConfigRec(dst.c)							@@\
									@@\
dst.c:  src.c								@@\
	RemoveFile($@)							@@\
	$(LN) $? $@							@@\
									@@\
SpecialCObjectRule(dst,NullParameter,flags)				@@\
									@@\
includes:: dst.c							@@\
									@@\
depend::  dst.c								@@\
									@@\
clean::									@@\
	RemoveFile(dst.c)
#endif /* ObjectFromSpecialSource */

#ifndef CPPOnlyAsm
#define CPPOnlyAsm(basename,options) RemoveFile(basename.i)		@@\
	$(CPP) AsmDefines $(DEFINES) $(INCLUDES) options basename.S | \	@@\
		grep -v '^\#' > basename.i
#endif

#ifndef AssembleObject
#define AssembleObject(basename,flags) CPPOnlyAsm(basename,flags)	@@\
	RemoveFile(basename.o)						@@\
	$(AS) -o basename.o basename.i					@@\
	RemoveFile(basename.i)
#endif

#ifndef NormalAsmObjectRule
#define NormalAsmObjectRule()						@@\
.S.o:									@@\
	AssembleObject($*,$(_NOOP_))					@@\
									@@\
.S.i:									@@\
	CPPOnlyAsm($*,$(_NOOP_))
#endif

#ifndef ObjectFromSpecialAsmSource
#define ObjectFromSpecialAsmSource(dst,src,flags)			@@\
dst.S:  src.S								@@\
	RemoveFile($@)							@@\
	$(LN) $? $@							@@\
									@@\
dst.o:  dst.S								@@\
	AssembleObject(dst,flags)					@@\
									@@\
dst.i:  dst.S								@@\
	CPPOnlyAsm(dst,flags)						@@\
									@@\
depend:: dst.S								@@\
									@@\
clean::									@@\
	RemoveFile(dst.S)
#endif

#ifndef ObjectFromAsmSource
#define ObjectFromAsmSource(src,flags)					@@\
									@@\
src.o:  src.S								@@\
	AssembleObject(src,flags)					@@\
									@@\
src.i:  src.S								@@\
	CPPOnlyAsm(src,flags)						@@\
									@@\
depend:: src.S
#endif

#ifndef SwitchYYPrefix
#define SwitchYYPrefix(in,out,prefix) \
	sed 's/yy/prefix/g' in | sed 's/__REALLY_YY__/yy/' > out && RemoveFile(in)
#endif

#ifndef LexFilePrefix
#define LexFilePrefix(file,prefix)					@@\
file.c: file.l								@@\
	ClearmakeOSName \
	$(LEX) $(LFLAGS) file.l						@@\
	SwitchYYPrefix(lex.yy.c,file.c,prefix)				@@\
									@@\
depend:: file.c								@@\
									@@\
clean::									@@\
	RemoveFiles(lex.yy.c file.c)
#endif

#ifndef LexFileExplicit
#if HasClearmake		/* provide a place to hang ClearmakeOSName */
#define LexFileExplicit(file)						@@\
file.c: file.l								@@\
	ClearmakeOSName \
	$(LEX) $(LFLAGS) file.l						@@\
	$(MV) lex.yy.c file.c
#else
#define LexFileExplicit(file) /* the default rule is fine */
#endif
#endif

#ifndef LexFile
#define LexFile(file)							@@\
LexFileExplicit(file)							@@\
									@@\
depend:: file.c								@@\
									@@\
clean::									@@\
	RemoveFiles(lex.yy.c file.c)
#endif /* LexFile */


#ifndef M4File
#define M4File(file,includes)						@@\
file: file.m4 includes							@@\
	RemoveFile(file)						@@\
	$(M4) $(M4FLAGS) file.m4 >file					@@\
									@@\
depend:: file								@@\
									@@\
clean::									@@\
	RemoveFile(file)
#endif /* M4File */

#ifndef YaccFilePrefix
#if HasGnuMake
#define YaccFilePrefix(file,flags,prefix)				@@\
depend:: file.c								@@\
									@@\
file.h: file.c								@@\
									@@\
file.c: file.y								@@\
	ClearmakeOSName \
	$(YACC) flags file.y						@@\
	SwitchYYPrefix(y.tab.c,file.c,prefix)				@@\
	@if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \@@\
	else exit 0; fi							@@\
									@@\
clean::									@@\
	RemoveFiles(y.tab.c y.tab.h file.h file.c)
#else
#define YaccFilePrefix(file,flags,prefix)				@@\
depend:: file.c								@@\
									@@\
file.h file.c: file.y							@@\
	ClearmakeOSName \
	$(YACC) flags file.y						@@\
	SwitchYYPrefix(y.tab.c,file.c,prefix)				@@\
	@if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \	@@\
	else exit 0; fi							@@\
									@@\
clean::									@@\
	RemoveFiles(y.tab.c y.tab.h file.h file.c)
#endif
#endif /* YaccFile */

#ifndef YaccFile
#if HasGnuMake
#define YaccFile(file,flags)						@@\
depend:: file.c								@@\
									@@\
file.h: file.c								@@\
									@@\
file.c: file.y								@@\
	ClearmakeOSName \
	$(YACC) flags file.y						@@\
	$(MV) y.tab.c file.c						@@\
	@if [ -f y.tab.h ]; then set -x; $(MV) y.tab.h file.h; \	@@\
	else exit 0; fi							@@\
									@@\
clean::									@@\
	RemoveFiles(y.tab.c y.tab.h file.h file.c)
#else
#define YaccFile(file,flags)						@@\
depend:: file.c								@@\
									@@\
file.h file.c: file.y							@@\
	ClearmakeOSName \
	$(YACC) flags file.y						@@\
	$(MV) y.tab.c file.c						@@\
	@if [ -f y.tab.h ]; then set -x; $(MV) y.tab.h file.h; \	@@\
	else exit 0; fi							@@\
									@@\
clean::									@@\
	RemoveFiles(y.tab.c y.tab.h file.h file.c)
#endif
#endif /* YaccFile */

#ifndef YaccFileNoFlags
#define YaccFileNoFlags(file)						@@\
depend:: file.c								@@\
									@@\
file.c: file.y								@@\
	ClearmakeOSName \
	$(YACC) file.y							@@\
	$(MV) y.tab.c file.c						@@\
									@@\
clean::									@@\
	RemoveFiles(y.tab.c file.c)
#endif /* YaccFileNoFlags */


#ifndef MakeLibrary
#define MakeLibrary(libname,objlist) $(AR) libname objlist
#endif

#ifndef LinkBuildLibrary
#ifdef UseInstalled
#define LinkBuildLibrary(lib) $(_NULLCMD_)
#else
#define LinkBuildLibrary(lib) MakeDir($(BUILDLIBDIR))			@@\
	RemoveFile($(BUILDLIBDIR)/lib)					@@\
	cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .
#endif
#endif /* LinkBuildLibrary */

#ifndef LinkBuildLibraryMaybe
#ifdef UseInstalled
#define LinkBuildLibraryMaybe(lib,doit) $(_NULLCMD_)
#else
#define LinkBuildLibraryMaybe(lib,doit) MakeDir($(BUILDLIBDIR))		@@\
	@if doit; then (set -x; \					@@\
	  RemoveFile($(BUILDLIBDIR)/lib); \				@@\
	  cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .); fi
#endif
#endif /* LinkBuildLibraryMaybe */

#ifndef _LinkBuildLibrary /* will get redefined elsewhere */
#define _LinkBuildLibrary(lib) $(_NULLCMD_)
#endif /* _LinkBuildLibrary */

#ifndef LinkBuildSonameLibrary
#ifdef UseInstalled
#define LinkBuildSonameLibrary(lib) true
#else
#define LinkBuildSonameLibrary(lib) MakeDirInline($(BUILDLIBDIR));\	@@\
	(set -x; RemoveFile($(BUILDLIBDIR)/lib);\			@@\
	(cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .))
#endif
#endif /* LinkBuildSonameLibrary */

#ifndef LinkBuildLibraryInline
#define LinkBuildLibraryInline(lib) LinkBuildSonameLibrary(lib)
#endif /* LinkBuildLibraryInline */

/*
 * NormalLibraryTarget - generate rules to create a library.
 */
#ifndef NormalLibraryTarget
#define	NormalLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS)			@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist)						@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)
#endif /* NormalLibraryTarget */


/*
 * NormalLibraryTarget2 - generate rules to create a library in two steps.
 * This is used to create libraries with large numbers of files.
 */
#ifndef NormalLibraryTarget2
#define	NormalLibraryTarget2(libname,objlist1,objlist2)			@@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): objlist1 objlist2 $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist1)					@@\
	MakeLibrary($@,objlist2)					@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)
#endif /* NormalLibraryTarget2 */


/*
 * NormalLibraryTarget3 - generate rules to create a library in three steps.
 * This is used to create libraries with very large numbers of files.
 */
#ifndef NormalLibraryTarget3
#define	NormalLibraryTarget3(libname,objlist1,objlist2,objlist3)	@@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist1)					@@\
	MakeLibrary($@,objlist2)					@@\
	MakeLibrary($@,objlist3)					@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)
#endif /* NormalLibraryTarget3 */


/*
 * NormalDepLibraryTarget - generate rules to create a library.
 */
#ifndef NormalDepLibraryTarget
#define	NormalDepLibraryTarget(libname,deplist,objlist)			@@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): deplist $(EXTRALIBRARYDEPS)			@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist)						@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)
#endif /* NormalDepLibraryTarget */


/*
 * UnsharedLibraryTarget - generate rules to create a library.
 */
#ifndef UnsharedLibraryTarget
#define	UnsharedLibraryTarget(libname,objlist,down,up)			@@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS)			@@\
	RemoveFile($@)							@@\
	@(set -x; cd down && MakeLibrary(up/$@,objlist)) || exit 1;	@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)
#endif /* UnsharedLibraryTarget */


/*
 * UnsharedLibraryTarget3 - generate rules to create a library in three steps.
 * This is used to create libraries with very large numbers of files.
 */
#ifndef UnsharedLibraryTarget3
#define	UnsharedLibraryTarget3(libname,objlist1,objlist2,objlist3,down,up) @@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	(cd down && MakeLibrary(up/$@,objlist1))			@@\
	(cd down && MakeLibrary(up/$@,objlist2))			@@\
	(cd down && MakeLibrary(up/$@,objlist3))			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)
#endif /* UnsharedLibraryTarget3 */


/*
 * SubdirLibraryRule -
 */
#ifndef SubdirLibraryRule
#define	SubdirLibraryRule(objlist)					@@\
all:: DONE								@@\
									@@\
DONE: objlist								@@\
	RemoveFile($@)							@@\
	touch $@							@@\
									@@\
clean::									@@\
	RemoveFile(DONE)
#endif /* SubdirLibraryRule */


/*
 * ProfiledLibraryTarget - generate rules to create a profiled library.
 */
#ifndef ProfiledLibraryTarget
#define	ProfiledLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetNameSuffix(libname,_p))				@@\
									@@\
LibraryTargetNameSuffix(libname,_p): objlist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	cd profiled && MakeLibrary(../$@,objlist)			@@\
	RanLibrary($@)

#endif /* ProfiledLibraryTarget */


/*
 * ProfiledDepLibraryTarget - generate rules to create a profiled library.
 */
#ifndef ProfiledDepLibraryTarget
#define	ProfiledDepLibraryTarget(libname,deplist,objlist)		@@\
AllTarget(LibraryTargetNameSuffix(libname,_p))				@@\
									@@\
LibraryTargetNameSuffix(libname,_p): deplist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist)						@@\
	RanLibrary($@)

#endif /* ProfiledDepLibraryTarget */


/*
 * DebuggedLibraryTarget - generate rules to create a debuggable library.
 */
#ifndef DebuggedLibraryTarget
#define	DebuggedLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetNameSuffix(libname,_d))				@@\
									@@\
LibraryTargetNameSuffix(libname,_d): objlist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	cd debugger && MakeLibrary(../$@,objlist)			@@\
	RanLibrary($@)

#endif /* DebuggedLibraryTarget */


/*
 * DebuggedDepLibraryTarget - generate rules to create a debuggable library.
 */
#ifndef DebuggedDepLibraryTarget
#define	DebuggedDepLibraryTarget(libname,deplist,objlist)		@@\
AllTarget(LibraryTargetNameSuffix(libname,_d))				@@\
									@@\
LibraryTargetNameSuffix(libname,_d): deplist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist)						@@\
	RanLibrary($@)

#endif /* DebuggedDepLibraryTarget */


/*
 * AliasedLibraryTarget - generate rules to link one library to another.
 */
#ifndef AliasedLibraryTarget
#define	AliasedLibraryTarget(libname,alias)				@@\
AllTarget(LibraryTargetName(alias))					@@\
									@@\
LibraryTargetName(alias): LibraryTargetName(libname)			@@\
	RemoveFile($@)							@@\
	$(LN) LibraryTargetName(libname) $@				@@\
									@@\
clean::									@@\
	RemoveFile(LibraryTargetName(alias))
#endif /* AliasedLibraryTarget */


/*
 * NormalRelocatableTarget - generate rules to produce a relocatable object
 * file instead of a library.
 */
#ifndef NormalRelocatableTarget
#define	NormalRelocatableTarget(objname,objlist)			@@\
AllTarget(objname.Osuf)							@@\
									@@\
objname.Osuf: objlist $(EXTRALIBRARYDEPS)				@@\
	RemoveFile($@)							@@\
	$(LD) $(LDCOMBINEFLAGS) objlist -o $@
#endif /* NormalRelocatableTarget */


/*
 * NormalDepRelocatableTarget - generate rules to produce a relocatable object
 * file instead of a library.
 */
#ifndef NormalDepRelocatableTarget
#define	NormalDepRelocatableTarget(objname,deplist,objlist)		@@\
AllTarget(objname.Osuf)							@@\
									@@\
objname.Osuf: deplist $(EXTRALIBRARYDEPS)				@@\
	RemoveFile($@)							@@\
	$(LD) $(LDCOMBINEFLAGS) objlist -o $@
#endif /* NormalDepRelocatableTarget */


/*
 * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable
 * object file instead of a library.
 */
#ifndef ProfiledRelocatableTarget
#define	ProfiledRelocatableTarget(objname,objlist)			@@\
AllTarget(Concat(objname,_p.Osuf))					@@\
									@@\
Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS)			@@\
	RemoveFile($@)							@@\
	$(LD) -X -r objlist -o $@

#endif /* ProfiledRelocatableTarget */


/*
 * DebuggedRelocatableTarget - generate rules to produce a debuggable
 * relocatable object file instead of a library.
 */
#ifndef DebuggedRelocatableTarget
#define	DebuggedRelocatableTarget(objname,objlist)			@@\
AllTarget(Concat(objname,_d.Osuf))					@@\
									@@\
Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS)			@@\
	RemoveFile($@)							@@\
	$(LD) -X -r objlist -o $@

#endif /* DebuggedRelocatableTarget */


/*
 * LintLibraryTarget - generate rules to create a lint library.  Note that the
 * lint library is always forced to be newer than the library itself.
 */
#ifndef LintLibraryTarget
#define	LintLibraryTarget(libname,srclist)				@@\
lintlib:: Concat(llib-l,libname.ln)					@@\
									@@\
Concat(llib-l,libname.ln): srclist $(EXTRALIBRARYDEPS)			@@\
	RemoveFile($@)							@@\
	$(LINT) Concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srclist
#endif /* LintLibraryTarget */


/*
 * NormalLintTarget - generate rules to lint a set of sources.
 */
#ifndef NormalLintTarget
#define NormalLintTarget(srclist)					@@\
lint:									@@\
	$(LINT) $(LINTFLAGS) srclist $(LINTLIBS)			@@\
lint1:									@@\
	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
#endif /* NormalLintTarget */


/*
 * LintTarget - generate rules to lint $(SRCS)
 */
#ifndef LintTarget
#define LintTarget()							@@\
NormalLintTarget($(SRCS))
#endif


/*
 * LinkSourceFile - snag source file from some other directory
 */
#ifndef LinkSourceFile
#define LinkSourceFile(src,dir)						@@\
src:  dir/src								@@\
	RemoveFile($@)							@@\
	$(LN) $? $@							@@\
									@@\
NoConfigRec(src)							@@\
									@@\
includes:: src								@@\
									@@\
depend:: src								@@\
									@@\
clean::									@@\
	RemoveFile(src)
#endif


/*
 * LinkFile - link a file
 */
#ifndef LinkFile
#define LinkFile(tofile,fromfile)					@@\
tofile:: fromfile							@@\
	RemoveFile($@)							@@\
	$(LN) $? $@							@@\
									@@\
NoConfigRec(tofile)							@@\
									@@\
includes:: tofile							@@\
									@@\
depend:: tofile								@@\
									@@\
clean::									@@\
	RemoveFile(tofile)
#endif


#ifndef MakeSubincludesForBuild
#define MakeSubincludesForBuild(step,dir,srclist)			@@\
step::  dir srclist							@@\
	@-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \		@@\
		set -x; cd dir && RemoveFiles($$list))			@@\
	@for i in srclist; do \						@@\
		(set -x; cd dir && $(LN) ../$$i .); \			@@\
	done								@@\
									@@\
dir::									@@\
	$(MKDIRHIER) dir						@@\
									@@\
clean::									@@\
	@-(if [ -d dir ]; then \					@@\
		list=`echo srclist | sed -e 's/[^ ]*\///g'`; \		@@\
		set -x; cd dir && RemoveFile($$list); else exit 0; fi)
#endif


/*
 * LangNamedTargetSubdirs - recursively make a series of steps
 */
#ifndef LangNamedTargetSubdirs
#define LangNamedTargetSubdirs(lang,name,dirs,verb,flags,subname)	@@\
name::									@@\
	@MakeFlagsToShellFlags(ik,set +e); \				@@\
	for i in dirs ;\						@@\
	do \								@@\
		echo verb "in $(CURRENT_DIR)/$$i..."; \			@@\
		(cd $$i && LANG=lang $(MAKE) $(MFLAGS) flags subname);\ @@\
	done
#endif


/*
 * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
 * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
 * the following in the appropriate Imakefile
 *
 *         #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
 */
#ifndef LangNamedMakeSubdirs
#define LangNamedMakeSubdirs(lang,name,dirs) \
LangNamedTargetSubdirs(lang,name,dirs,"making" name,PassCDebugFlags,all)
#endif /* LangNamedMakeSubdirs */

#ifndef LangMakeSubdirs
#define LangMakeSubdirs(lang,dirs)					@@\
LangNamedMakeSubdirs(lang,all,dirs)
#endif /* LangMakeSubdirs */



/*
 * NamedTargetSubdirs - recursively make a series of steps
 */
#ifndef NamedTargetSubdirs
#define NamedTargetSubdirs(name,dirs,verb,flags,subname)		@@\
name::									@@\
	@MakeFlagsToShellFlags(ik,set +e); \				@@\
	for i in dirs ;\						@@\
	do \								@@\
		echo verb "in $(CURRENT_DIR)/$$i..."; \			@@\
		MakeNamedTargetSubdir($$i,flags,subname); \		@@\
	done
#endif


/*
 * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
 * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
 * the following in the appropriate Imakefile
 *
 *         #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
 */
#ifndef NamedMakeSubdirs
#define NamedMakeSubdirs(name,dirs) \
NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all)
#endif /* NamedMakeSubdirs */

#ifndef MakeSubdirs
#define MakeSubdirs(dirs)						@@\
NamedMakeSubdirs(all,dirs)
#endif /* MakeSubdirs */


/*
 * DependSubdirs - generate rules to recursively compute dependencies as
 * part of the make depend step.
 */
#ifndef DependSubdirs
#define DependSubdirs(dirs) \
NamedTargetSubdirs(depend,dirs,"depending",NullParameter,depend)
#endif /* DependSubdirs */


/*
 * ForceSubdirs - force make to build subdirectories
 */
#ifndef ForceSubdirs
#if !HasBsdMake
#define ForceSubdirs(dirs)						@@\
dirs: FRC								@@\
	@echo "making all in $(CURRENT_DIR)/$@..."			@@\
	@MakeNamedTargetSubdir($@,PassCDebugFlags,all)			@@\
									@@\
FRC:
#else
/* For BSD 4.4 make */
#define ForceSubdirs(dirs)						@@\
dirs:	.EXEC								@@\
	@cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \		@@\
	$(MAKE) $(MFLAGS) PassCDebugFlags all				@@\
									@@\
.EXEC:
#endif

#endif /* ForceSubdirs */

/*
 * InstallSubdirs - generate rules to recursively install programs and files.
 */
#ifndef InstallSubdirs
#define InstallSubdirs(dirs) \
NamedTargetSubdirs(install,dirs,"installing",DESTDIR=$(DESTDIR),install)
#endif /* InstallSubdirs */


/*
 * InstallManSubdirs - generate rules to recursively install manual pages.
 */
#ifndef InstallManSubdirs
#define InstallManSubdirs(dirs) \
NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR=$(DESTDIR),install.man)
#endif /* InstallManSubdirs */


/*
 * IncludesSubdirs - generate rules to recursively put include files in build
 */
#ifndef IncludesSubdirs
#define IncludesSubdirs(dirs) \
NamedTargetSubdirs(includes,dirs,including,NullParameter,includes)
#endif


/*
 * InstallDriverSDKSubdirs - generate rules to recursively install Driver
 *                         SDK (only used for XFree86). This is a no-op
 *                         rule so that Imakefiles on non-XFree86 systems
 *                         continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKSubdirs
#define InstallDriverSDKSubdirs(dirs)
#endif

/*
 * InstallDriverSDKObjectModule - generate rules to recursively install Driver
 *                         SDK (only used for XFree86). This is a no-op
 *                         rule so that Imakefiles on non-XFree86 systems
 *                         continue to build Makefiles correctly.
 */
#ifndef InstallDriverSDKObjectModule
#define InstallDriverSDKObjectModule(module,dest,subdir)
#endif
#ifndef InstallDriverSDKObjectSubModule
#define InstallDriverSDKObjectSubModule(module,dest,subdir)
#endif



/*
 * CleanSubdirs - generate rules to recursively clean out garbage files.
 */
#define BootstrapCleanSubdirs /**/	/* used at top-level */
#ifndef NamedCleanSubdirs
#define NamedCleanSubdirs(name,dirs) \
NamedTargetSubdirs(name,dirs,"cleaning",BootstrapCleanSubdirs,clean)
#endif /* NamedCleanSubdirs */

#ifndef CleanSubdirs
#define CleanSubdirs(dirs) \
NamedCleanSubdirs(clean,dirs)
#endif


/*
 * TagSubdirs - generate rules to recursively create tags files.
 */
#ifndef NamedTagSubdirs
#define NamedTagSubdirs(name,dirs) \
NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags)
#endif /* TagSubdirs */

#ifndef TagSubdirs
#define TagSubdirs(dirs) \
NamedTagSubdirs(tags,dirs)
#endif

/*
 * MakeLintSubdirs - generate rules to recursively lint directories as part
 * of the named step.
 */
#ifndef MakeLintSubdirs
#define MakeLintSubdirs(dirs,target,subtarget) \
NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR=$(DESTDIR) LINTOPTS='$(LINTOPTS)',subtarget)
#endif /* MakeLintSubdirs */


/*
 * LintSubdirs - generate rules to recursively lint directories as part of
 * the make lint step.
 */
#ifndef LintSubdirs
#define LintSubdirs(dirs)						@@\
MakeLintSubdirs(dirs,lint,lint)
#endif /* LintSubdirs */


/*
 * MakeLintLibSubdirs - generate rules to recursively create lint libraries.
 */
#ifndef MakeLintLibSubdirs
#define MakeLintLibSubdirs(dirs)					@@\
MakeLintSubdirs(dirs,lintlib,lintlib)
#endif /* MakeLintLibSubdirs */


/*
 * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part
 * of the specified step in the build.  If $(TOP) is set to an absolute path,
 * do not prepend the ../ prefix.  This makes running things outside of the
 * source tree much easier.
 * $(ONESUBDIR)/Makefile exists as a separate, explicit target so that
 * clearmake will know what its goal is and do wink-in.
 */
#ifndef MakeMakeSubdirs
#define MakeMakeSubdirs(dirs,target)					@@\
$(ONESUBDIR)/Makefile:							@@\
	@MakeFlagsToShellFlags(n,executeit="no"); \			@@\
	cd $(ONESUBDIR) && \						@@\
	if [ "$$executeit" != "no" ]; then \				@@\
		ImakeSubCmdHelper -DTOPDIR=$(IMAKETOP) -DCURDIR=$(ONECURDIR)$(ONESUBDIR); \ @@\
	fi;								@@\
									@@\
target::								@@\
	-@MakeFlagsToShellFlags(ik,set +e); \				@@\
	MakeFlagsToShellFlags(n,executeit="no"); \			@@\
	for i in dirs ;\						@@\
	do \								@@\
		case "$(CURRENT_DIR)" in \				@@\
		.) curdir= ;; \						@@\
		*) curdir=$(CURRENT_DIR)/ ;; \				@@\
		esac; \							@@\
		echo "making Makefiles in $$curdir$$i..."; \		@@\
		itmp=`echo $$i | sed -e 's;^\./;;g' -e 's;/\./;/;g'`; \	@@\
		curtmp="$(CURRENT_DIR)" \				@@\
		toptmp=""; \						@@\
		case "$$itmp" in \					@@\
		    ../?*) \						@@\
			while echo "$$itmp" | grep '^\.\./' > /dev/null;\	@@\
			  do \						@@\
			     toptmp="/`basename $$curtmp`$$toptmp"; \	@@\
			     curtmp="`dirname $$curtmp`"; \		@@\
			     itmp="`echo $$itmp | sed 's;\.\./;;'`"; \	@@\
			  done \					@@\
		    ;; \						@@\
		esac; \							@@\
		case "$$itmp" in \					@@\
		*/?*/?*/?*/?*)	newtop=../../../../..;; \		@@\
		*/?*/?*/?*)	newtop=../../../..;; \			@@\
		*/?*/?*)	newtop=../../..;; \			@@\
		*/?*)		newtop=../..;; \			@@\
		*)		newtop=..;; \				@@\
		esac; \							@@\
		newtop="$$newtop$$toptmp"; \				@@\
		case "$(TOP)" in \					@@\
		/?*) imaketop=$(TOP) \					@@\
		     imakeprefix= ;; \					@@\
		.) imaketop=$$newtop \					@@\
		   imakeprefix=$$newtop/ ;; \				@@\
		*) imaketop=$$newtop/$(TOP) \				@@\
		   imakeprefix=$$newtop/ ;; \				@@\
		esac; \							@@\
		RemoveFile($$i/Makefile.bak); \				@@\
		if [ -f $$i/Makefile ]; then \				@@\
			echo "	$(MV) Makefile Makefile.bak"; \		@@\
			if [ "$$executeit" != "no" ]; then \		@@\
				$(MV) $$i/Makefile $$i/Makefile.bak; \	@@\
			fi; \						@@\
		fi; \							@@\
		$(MAKE) $(MFLAGS) $(MAKE_OPTS) ONESUBDIR=$$i ONECURDIR=$$curdir IMAKETOP=$$imaketop IMAKEPREFIX=$$imakeprefix $$i/Makefile; \	@@\
		if [ -d $$i ] ; then \					@@\
			cd $$i; \					@@\
			$(MAKE) $(MFLAGS) Makefiles; \			@@\
			cd $$newtop; \					@@\
		else \							@@\
			exit 1; \					@@\
		fi; \							@@\
	done

#define ImakeSubCmdHelper $(IMAKE_CMD) -I$(IMAKEPREFIX)$(IRULESRC) \
			  $(IMAKE_DEFINES) $(IMAKE_WARNINGS)

#endif /* MakeMakeSubdirs */


/*
 * MakefileSubdirs - generate rules to create Makefiles.
 */
#ifndef MakefileSubdirs
#define MakefileSubdirs(dirs)						@@\
MakeMakeSubdirs(dirs,Makefiles)
#endif /* MakefileSubdirs */

/*
 * Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
 * to cpp, because that trick does not work on all ANSI C preprocessors.
 * Delete line numbers from the cpp output (-P is not portable, I guess).
 * Allow XCOMM to be preceded by whitespace and provide a means of generating
 * output lines with trailing backslashes.
 * Allow XHASH to always be substituted, even in cases where XCOMM isn't.
 */
#ifndef CppSedMagic
#define CppSedMagic sed -e '/^#  *[0-9][0-9]*  *.*$$/d' \
			-e '/^#line  *[0-9][0-9]*  *.*$$/d' \
			-e '/^[ 	]*XCOMM$$/s/XCOMM/#/' \
			-e '/^[ 	]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/#/' \
			-e '/^[ 	]*XHASH/s/XHASH/#/' \
			-e '/\@\@$$/s/\@\@$$/\\/'
#endif /* CppSedMagic */

#ifndef CppFileTarget
#define CppFileTarget(dst,src,defs,deplist)				@@\
dst::  src deplist							@@\
	RemoveFile($@)							@@\
	ClearmakeOSName \
	$(CPP) CppNoLineInfoOption defs <src | CppSedMagic >$@		@@\
									@@\
clean::									@@\
	RemoveFiles(dst)
#endif /* CppFileTarget */

/*
 * CppScriptTarget - generate rules to create a shell script by running the
 * input through cpp.  If the ExecableScripts configuration parameter is not
 * set, then make sure that the first line begins with a colon.
 */
#ifndef CppScriptTarget
#if ExecableScripts		/* can use #! instead of colon */
#define CppScriptTarget(dst,src,defs,deplist)				@@\
dst::	src deplist							@@\
	RemoveFile($@)							@@\
	ClearmakeOSName \
	$(CPP) CppNoLineInfoOption defs <src | CppSedMagic >$@		@@\
	chmod a+x $@							@@\
									@@\
clean::									@@\
	RemoveFiles(dst)
#else
#define CppScriptTarget(dst,src,defs,deplist)				@@\
dst::  src deplist							@@\
	RemoveFile($@)							@@\
	ClearmakeOSName \
	echo \: >$@							@@\
	sed '1d' src | $(CPP) CppNoLineInfoOption defs | CppSedMagic >>$@	@@\
	chmod a+x $@							@@\
									@@\
clean::									@@\
	RemoveFile(dst)
#endif /* ExecableScripts */
#endif /* CppScriptTarget */


/*
 * MakeScriptFromCpp - generate rules to create a script from a file with a
 * .cpp suffix.
 */
#ifndef MakeScriptFromCpp
#define MakeScriptFromCpp(name,defs)					@@\
CppScriptTarget(name,name.cpp,defs,NullParameter)
#endif /* MakeScriptFromCpp */

#ifndef CppSourceFile
#define CppSourceFile(dst,src,defs,deplist)				@@\
CppFileTarget(dst,src,defs,deplist)					@@\
									@@\
includes:: dst								@@\
									@@\
depend:: dst
#endif /* CppSourceFile */

/* Like CppFileTarget, but don't add any default defines */
#ifndef CppRawFileTarget
#define CppRawFileTarget(dst,src,defs,deplist)				@@\
dst::  src deplist							@@\
	RemoveFile($@)							@@\
	ClearmakeOSName \
	$(RAWCPP) CppNoLineInfoOption defs <src | CppSedMagic >$@	@@\
									@@\
clean::									@@\
	RemoveFiles(dst)
#endif /* CppFileTarget */

/*
 * CppManTarget - preprocess man pages.  OS-specific man sections are replaced.
 */
#ifndef CppManTarget
#define CppManTarget(name,defs)						@@\
AllTarget(name.$(MANNEWSUFFIX))						@@\
									@@\
name.$(MANNEWSUFFIX): name.$(MANSRCSUFFIX)				@@\
	RemoveFile($@)							@@\
	if test -z "$(PREPROCESSMANPAGES)" ; then \			@@\
	   cd `dirname name` && \					@@\
	   $(LN) `basename name.$(MANSRCSUFFIX)` `basename $@`; \	@@\
	else \								@@\
	     ClearmakeOSName \
	     $(RAWCPP) CppNoLineInfoOption $(MANDEFS) defs \		@@\
	     < name.$(MANSRCSUFFIX) | CppSedMagic >$@; \		@@\
	fi								@@\
									@@\
clean::									@@\
	RemoveFile(name.$(MANNEWSUFFIX))
#endif /* CppManTarget */

/*
 * MakeDirectories - generate rules to create a hierarchy of directories.
 */
#ifndef MakeDirectories
#define MakeDirectories(step,dirs)					@@\
step::									@@\
	DirFailPrefix@MakeFlagsToShellFlags(i,set +e); \		@@\
	for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \		@@\
		set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi; \ @@\
	done
#endif /* MakeDirectories */


/*
 * AllTarget - generate rules to build necessary things during make all.
 */
#ifndef AllTarget
#define AllTarget(depends)						@@\
all:: depends
#endif /* AllTarget */

#ifdef DefineOldLibraryRules
#include <oldlib.rules>
#endif

#ifndef StaticLibrary
#define StaticLibrary(libpath,libname) Concat3(libpath,/,LibraryTargetName(libname))
#endif

/*
 * MakeMutex - generate mutex rules for parallel make
 */
#ifndef MakeMutex
#ifdef MutexDirective
#define MakeMutex(targets)						@@\
MutexDirective:	targets
#endif /* MutexDirective */
#endif /* MakeMutex */

/*
 * Rules for dynamic modules.  These are primarily used by XFree86
 */

#ifndef LinkBuildModule
#ifdef UseInstalled
#define LinkBuildModule(module,subdir) $(_NULLCMD_)
#else
#define LinkBuildModule(module,subdir)\
	MakeDir($(BUILDMODULEDIR)/subdir)				@@\
	RemoveFile($(BUILDMODULEDIR)/subdir/module)			@@\
	@(UP="`$(REVPATH) subdir`"; set -x; \				@@\
	  cd $(BUILDMODULEDIR)/subdir && \				@@\
		$(LN) $(BUILDMODULETOP)/$${UP}$(CURRENT_DIR)/module .)
#endif
#endif /* LinkBuildModule */

#ifndef LinkBuildNamedModule
#ifdef UseInstalled
#define LinkBuildNamedModule(module,name,subdir) $(_NULLCMD_)
#else
#define LinkBuildNamedModule(module,name,subdir)\
	MakeDir($(BUILDMODULEDIR)/subdir)				@@\
	RemoveFile($(BUILDMODULEDIR)/subdir/name)			@@\
	@(UP="`$(REVPATH) subdir`"; set -x; \				@@\
	  cd $(BUILDMODULEDIR)/subdir && \				@@\
		$(LN) $(BUILDMODULETOP)/$${UP}$(CURRENT_DIR)/module name)
#endif
#endif /* LinkBuildNamedModule */

/*
 * ModuleObjectRule
 */
#ifndef ModuleObjectRule
#define ModuleObjectRule() NormalLibraryObjectRule()
#endif

/*
 * ObjectModuleTarget - build a module as a single object file
 */
#ifndef ObjectModuleTarget
#define ObjectModuleTarget(module,objects)				@@\
NormalRelocatableTarget(Concat(module,_drv), objects)
#endif

/*
 * LibraryModuleTarget
 */
#ifndef LibraryModuleTarget
#define LibraryModuleTarget(module, objects)				@@\
NormalLibraryTarget(module, objects)
#endif

/*
 * DepLibraryModuleTarget
 */
#ifndef DepLibraryModuleTarget
#define DepLibraryModuleTarget(module,deplist,objects)			@@\
NormalDepLibraryTarget(module, deplist, objects)
#endif

/*
 * DynamicModuleTarget - build a module to be dynamically loaded
 */
#ifndef DynamicModuleTarget
#define DynamicModuleTarget(module,modlist)				@@\
AllTarget(module)							@@\
									@@\
module: modlist								@@\
	RemoveFile($@)							@@\
	$(CC) -o $@ $(SHLIBLDFLAGS) $(NOSTDLIB) modlist $(POSTNOSTDLIB) @@\
									@@\
clean::									@@\
	RemoveFile(module)
#endif /* DynamicModuleTarget */

/*
 * DepDynamicModuleTarget - build a module to be dynamically loaded
 */
#ifndef DepDynamicModuleTarget
#define DepDynamicModuleTarget(module,deplist,modlist)			@@\
AllTarget(module)							@@\
									@@\
module: deplist								@@\
	RemoveFile($@)							@@\
	$(CC) -o $@ $(SHLIBLDFLAGS) $(NOSTDLIB) modlist $(POSTNOSTDLIB) @@\
									@@\
clean::									@@\
	RemoveFile(module)
#endif /* DepDynamicModuleTarget */

/*
 * InstallDynamicModule - install a dynamic module
 */
#ifndef InstallDynamicModule
#define InstallDynamicModule(module,dest,subdir)			@@\
AllTarget(module)							@@\
	LinkBuildModule(module,subdir)					@@\
									@@\
install:: module							@@\
	MakeDir($(DESTDIR)dest/subdir)					@@\
	$(INSTALL) -c $(INSTDATFLAGS) module $(DESTDIR)dest/subdir
#endif

#ifndef InstallDynamicNamedModule
#define InstallDynamicNamedModule(module,instname,dest,subdir)		@@\
AllTarget(module)							@@\
	LinkBuildNamedModule(module,instname,subdir)			@@\
									@@\
install:: module							@@\
	MakeDir($(DESTDIR)dest/subdir)					@@\
	$(INSTALL) -c $(INSTDATFLAGS) module $(DESTDIR)dest/subdir/instname
#endif

/* Shortcuts for installing driver module, one per class */
#ifndef InstallVideoObjectModule
#define InstallVideoObjectModule(module,dest)                          @@\
InstallObjectModule(module,dest,drivers)
#endif
#ifndef InstallInputObjectModule
#define InstallInputObjectModule(module,dest)                          @@\
InstallObjectModule(module,dest,input)
#endif
#ifndef InstallExtensionsObjectModule
#define InstallExtensionsObjectModule(module,dest)                     @@\
InstallObjectModule(module,dest,extensions)
#endif
#ifndef InstallFontsObjectModule
#define InstallFontsObjectModule(module,dest)                          @@\
InstallObjectModule(module,dest,fonts)
#endif
#ifndef InstallMultimediaObjectModule
#define InstallMultimediaObjectModule(module,dest)                     @@\
InstallObjectModule(module,dest,multimedia)
#endif

#ifndef InstallObjectModule
#define InstallObjectModule(module,dest,subdir)	/**/
#endif

#ifndef InstallLibraryModule
#define InstallLibraryModule(module,dest,subdir)	/**/
#endif

#ifndef InstallModuleManPage
#define InstallModuleManPage(module)					@@\
InstallGenManPage(module,$(DRIVERMANDIR),$(DRIVERMANSUFFIX))
#endif

#ifndef BuildObjectFromLibraryWithPath
#define BuildObjectFromLibraryWithPath(libpath,libname,objname)		@@\
AllTarget(objname.Osuf)							@@\
									@@\
objname.Osuf: Concat3(libpath,/lib,libname.a)				@@\
	@$(MKDIRHIER) tmp						@@\
	@$(CP) Concat3(libpath,/lib,libname.a) tmp			@@\
	@(cd tmp; set -x; ArExtCmd Concat(lib,libname.a); \		@@\
	  $(LD) $(LDCOMBINEFLAGS) *.Osuf -o ../$@; \			@@\
	  RemoveFiles(*.Osuf))						@@\
	@$(RM) -r tmp							@@\
									@@\
clean::									@@\
	RemoveFile(objname.Osuf)
#endif

#ifndef BuildObjectFromLibrary
#define BuildObjectFromLibrary(libname,objname) BuildObjectFromLibraryWithPath(.,libname,objname)
#endif

/*
 * LinkerRuntimeLibraryPathFlag - defined here to be a no-op for systems that
 * don't need it.   Overridden in system-specific config files for systems that
 * need it, usually with something like "Concat(-R,path)"
 */
#ifndef LinkerRuntimeLibraryPathFlag
# define LinkerRuntimeLibraryPathFlag(path)  /* */
#endif

/* Phony targets - GNU make has a feature to mark a target as phony,
 * which means that it wont consider that target to be the name of a
 * file.  In general this speeds up make, since it doesn't have to
 * look for those files when it sets out to create a phony target.
 * However, on cygwin, this is actually required for correct
 * operation, since the Win32 filesystems are case insensitive and the
 * install target conflicts with the INSTALL file present in some
 * (autotooled) directories.
 *
 * We probably don't need the #ifdef protection, since other make
 * implementations would just consider this a normal rule.  Better
 * safe than sorry, though.
 */
#if HasGnuMake
.PHONY: all interfaces install install.man install.lib install.sdk \
	depend includes clean
#endif