summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/Makefile.in
blob: d000b5df779d3cc05558cee762b67c2bb44f2f88 (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
# Makefile for GNU Ada Compiler (GNAT).
#   Copyright (C) 1994-2011 Free Software Foundation, Inc.

#This file is part of GCC.

#GCC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 3, or (at your option)
#any later version.

#GCC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with GCC; see the file COPYING3.  If not see
#<http://www.gnu.org/licenses/>.

# The makefile built from this file lives in the language subdirectory.
# Its purpose is to provide support for:
#
# 1) recursion where necessary, and only then (building .o's), and
# 2) building and debugging cc1 from the language subdirectory, and
# 3) nothing else.
#
# The parent makefile handles all other chores, with help from the
# language makefile fragment, of course.
#
# The targets for external use are:
# all, TAGS, ???mostlyclean, ???clean.

# This makefile will only work with Gnu make.
# The rules are written assuming a minimum subset of tools are available:
#
# Required:
#      MAKE:    Only Gnu make will work.
#      MV:      Must accept (at least) one, maybe wildcard, source argument,
#               a file or directory destination, and support creation/
#               modification date preservation.  Gnu mv -f works.
#      RM:      Must accept an arbitrary number of space separated file
#               arguments, or one wildcard argument. Gnu rm works.
#      RMDIR:   Must delete a directory and all its contents. Gnu rm -rf works.
#      ECHO:    Must support command line redirection. Any Unix-like
#               shell will typically provide this, otherwise a custom version
#               is trivial to write.
#      AR:      Gnu ar works.
#      MKDIR:   Gnu mkdir works.
#      CHMOD:   Gnu chmod works.
#      true:    Does nothing and returns a normal successful return code.
#      pwd:     Prints the current directory on stdout.
#      cd:      Change directory.
#
# Optional:
#      BISON:   Gnu bison works.
#      FLEX:    Gnu flex works.
#      Other miscellaneous tools for obscure targets.

# Suppress smart makes who think they know how to automake Yacc files
.y.c:

# Variables that exist for you to override.
# See below for how to change them for certain systems.

# Various ways of specifying flags for compilations:
# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
# BOOT_CFLAGS is the value of CFLAGS to pass
# to the stage2 and stage3 compilations
CFLAGS = -g
BOOT_CFLAGS = -O $(CFLAGS)
# These exists to be overridden by the t-* files, respectively.
T_CFLAGS =

CC = cc
BISON = bison
BISONFLAGS =
ECHO = echo
LEX = flex
LEXFLAGS =
CHMOD = chmod
LN = ln
LN_S = ln -s
CP = cp -p
MV = mv -f
RM = rm -f
RMDIR = rm -rf
MKDIR = mkdir -p
AR = ar
AR_FLAGS = rc
LS = ls
RANLIB = @RANLIB@
RANLIB_FLAGS = @ranlib_flags@
AWK = @AWK@

COMPILER = $(CC)
COMPILER_FLAGS = $(CFLAGS)

SHELL = @SHELL@
PWD_COMMAND = $${PWDCMD-pwd}
# How to copy preserving the date
INSTALL_DATA_DATE = cp -p
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
TEXI2PDF = texi2pdf
GNATBIND_FLAGS = -static -x
ADA_CFLAGS =
ADAFLAGS = -W -Wall -gnatpg -gnata
FORCE_DEBUG_ADAFLAGS = -g
NO_SIBLING_ADAFLAGS = -fno-optimize-sibling-calls
NO_REORDER_ADAFLAGS = -fno-toplevel-reorder
GNATLIBFLAGS = -W -Wall -gnatpg -nostdinc
GNATLIBCFLAGS = -g -O2
PICFLAG_FOR_TARGET = @PICFLAG_FOR_TARGET@
# Pretend that _Unwind_GetIPInfo is available for the target by default.  This
# should be autodetected during the configuration of libada and passed down to
# here, but we need something for --disable-libada and hope for the best.
GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET) \
	-fexceptions -DIN_RTS -DHAVE_GETIPINFO
ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
THREAD_KIND = native
THREADSLIB =
GMEM_LIB =
MISCLIB =
OUTPUT_OPTION = @OUTPUT_OPTION@

objext = .o
exeext =
arext  = .a
soext  = .so
shext  =
hyphen = -

# Define this as & to perform parallel make on a Sequent.
# Note that this has some bugs, and it seems currently necessary
# to compile all the gen* files first by hand to avoid erroneous results.
P =

# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
# It specifies -B./.
# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
GCC_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS)

# Tools to use when building a cross-compiler.
# These are used because `configure' appends `cross-make'
# to the makefile when making a cross-compiler.

# We don't use cross-make.  Instead we use the tools from the build tree,
# if they are available.
# program_transform_name and objdir are set by configure.in.
program_transform_name =
objdir = .

target_alias=@target_alias@
target=@target@
xmake_file = @xmake_file@
tmake_file = @tmake_file@
host_canonical=@host@
target_cpu_default=@target_cpu_default@
#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`

# Directory where sources are, from where we are.
VPATH = $(srcdir)/ada

fsrcdir := $(shell cd $(srcdir);${PWD_COMMAND})
fsrcpfx := $(shell cd $(srcdir);${PWD_COMMAND})/
fcurdir := $(shell ${PWD_COMMAND})
fcurpfx := $(shell ${PWD_COMMAND})/

# Top build directory, relative to here.
top_builddir = ../..

# Internationalization library.
LIBINTL = @LIBINTL@
LIBINTL_DEP = @LIBINTL_DEP@

# Character encoding conversion library.
LIBICONV = @LIBICONV@
LIBICONV_DEP = @LIBICONV_DEP@

# Any system libraries needed just for GNAT.
SYSLIBS = @GNAT_LIBEXC@

# List extra gnattools
EXTRA_GNATTOOLS =

# List of target dependent sources, overridden below as necessary
TARGET_ADA_SRCS =

# Type of tools build we are doing; default is not compiling tools.
TOOLSCASE =

# Multilib handling
MULTISUBDIR =
RTSDIR = rts$(subst /,_,$(MULTISUBDIR))

# Link flags used to build gnat tools.  By default we prefer to statically
# link with libgcc to avoid a dependency on shared libgcc (which is tricky
# to deal with as it may conflict with the libgcc provided by the system).
GCC_LINK_FLAGS=-static-libgcc

# End of variables for you to override.

all: all.indirect

# This tells GNU Make version 3 not to put all variables in the environment.
.NOEXPORT:

# target overrides
ifneq ($(tmake_file),)
include $(tmake_file)
endif

# host overrides
ifneq ($(xmake_file),)
include $(xmake_file)
endif

# Now figure out from those variables how to compile and link.

all.indirect: Makefile ../gnat1$(exeext)

# IN_GCC is meant to distinguish between code compiled into GCC itself, i.e.
# for the host, and the rest.  But we also use it for the tools (link.c) and
# even break the host/target wall by using it for the library (targext.c).
# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a cross
# compiler which does not use the native libraries and headers.
INTERNAL_CFLAGS = @CROSS@ -DIN_GCC

# This is the variable actually used when we compile.
ALL_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS)

# Likewise.
ALL_CPPFLAGS = $(CPPFLAGS)

# Used with $(COMPILER).
ALL_COMPILERFLAGS = $(ALL_CFLAGS)

# This is where we get libiberty.a from.
LIBIBERTY = ../../libiberty/libiberty.a

# How to link with both our special library facilities
# and the system's installed libraries.
LIBS = $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(SYSLIBS)
LIBDEPS = $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBIBERTY)
# Default is no TGT_LIB; one might be passed down or something
TGT_LIB =
TOOLS_LIBS = targext.o link.o ../../libcommon-target.a ../../libcommon.a \
  ../../../libcpp/libcpp.a $(LIBGNAT) $(LIBINTL) $(LIBICONV) \
  ../../../libiberty/libiberty.a $(SYSLIBS) $(TGT_LIB)

# Convert the target variable into a space separated list of architecture,
# manufacturer, and operating system and assign each of those to its own
# variable.

host:=$(subst -, ,$(host_canonical))
targ:=$(subst -, ,$(target))
arch:=$(word 1,$(targ))
ifeq ($(words $(targ)),2)
  manu:=
  osys:=$(word 2,$(targ))
else
  manu:=$(word 2,$(targ))
  osys:=$(word 3,$(targ))
endif

# Specify the directories to be searched for header files.
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
# subdirectory rather than in the source directory.
INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(srcdir)/config \
	-I$(srcdir)/../include

ADA_INCLUDES = -I- -I. -I$(srcdir)/ada

INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. -iquote $(fsrcdir)/ada \
	-I$(fsrcdir)/../include

ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
  # On Windows native the tconfig.h files used by C runtime files needs to have
  # the gcc source dir in its include dir list
  INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. -iquote $(fsrcdir)/ada \
        -I$(fsrcdir)/../include -I$(fsrcdir)
endif

ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada

# Avoid a lot of time thinking about remaking Makefile.in and *.def.
.SUFFIXES: .in .def

# Say how to compile Ada programs.
.SUFFIXES: .ada .adb .ads .asm

# Always use -I$(srcdir)/config when compiling.
.asm.o:
	$(CC) -c -x assembler $< $(OUTPUT_OPTION)

.c.o:
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
	  $(INCLUDES) $< $(OUTPUT_OPTION)

.adb.o:
	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)

.ads.o:
	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)

# how to regenerate this file
Makefile: ../config.status $(srcdir)/ada/gcc-interface/Makefile.in $(srcdir)/ada/Makefile.in $(srcdir)/version.c
	cd ..; \
	LANGUAGES="$(CONFIG_LANGUAGES)" \
	CONFIG_HEADERS= \
	CONFIG_FILES="ada/gcc-interface/Makefile ada/Makefile" $(SHELL) config.status

# This tells GNU make version 3 not to export all the variables
# defined in this file into the environment.
.NOEXPORT:

# Lists of files for various purposes.

GNATLINK_OBJS = gnatlink.o \
 a-except.o ali.o alloc.o butil.o casing.o csets.o debug.o fmap.o fname.o \
 gnatvsn.o hostparm.o indepsw.o interfac.o i-c.o i-cstrin.o namet.o opt.o \
 osint.o output.o rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
 sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \
 types.o validsw.o widechar.o

GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
 atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o errout.o \
 erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \
 gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \
 make.o makeusg.o makeutl.o mlib.o mlib-fil.o mlib-prj.o mlib-tgt.o \
 mlib-tgt-specific.o mlib-utl.o namet.o nlists.o opt.o osint.o osint-m.o \
 output.o prj.o prj-attr.o prj-attr-pm.o prj-com.o prj-dect.o prj-env.o \
 prj-conf.o prj-pp.o prj-err.o prj-ext.o prj-nmsc.o prj-pars.o prj-part.o \
 prj-proc.o prj-strt.o prj-tree.o prj-util.o restrict.o rident.o s-exctab.o \
 s-secsta.o s-stalib.o s-stoele.o scans.o scng.o sdefault.o sfn_scan.o \
 s-purexc.o s-htable.o scil_ll.o sem_aux.o sinfo.o sinput.o sinput-c.o \
 sinput-p.o snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o \
 switch.o switch-m.o table.o targparm.o tempdir.o tree_io.o types.o uintp.o \
 uname.o urealp.o usage.o widechar.o \
 $(EXTRA_GNATMAKE_OBJS)

# Make arch match the current multilib so that the RTS selection code
# picks up the right files. For a given target this must be coherent
# with MULTILIB_DIRNAMES defined in gcc/config/target/t-*.

ifeq ($(strip $(filter-out %x86_64, $(arch))),)
  ifeq ($(strip $(MULTISUBDIR)),/32)
    arch:=i686
  endif
endif

# ???: handle more multilib targets

# LIBGNAT_TARGET_PAIRS is a list of pairs of filenames.
# The members of each pair must be separated by a '<' and no whitespace.
# Each pair must be separated by some amount of whitespace from the following
# pair.

# Non-tasking case:

LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-dummy.ads \
s-inmaop.adb<s-inmaop-dummy.adb \
s-intman.adb<s-intman-dummy.adb \
s-osinte.ads<s-osinte-dummy.ads \
s-osprim.adb<s-osprim-posix.adb \
s-taprop.adb<s-taprop-dummy.adb \
s-taspri.ads<s-taspri-dummy.ads

# When using the GCC exception handling mechanism, we need to use an
# alternate body for a-exexpr.adb (a-exexpr-gcc.adb)

EH_MECHANISM=

# Default shared object option. Note that we rely on the fact that the "soname"
# option will always be present and last in this flag, so that we can have
# $(SO_OPTS)libgnat-x.xx

SO_OPTS = -Wl,-soname,

# Default gnatlib-shared target.
# By default, equivalent to gnatlib.
# Set to gnatlib-shared-default, gnatlib-shared-dual, or a platform specific
# target when supported.
GNATLIB_SHARED = gnatlib

# default value for gnatmake's target dependent file
MLIB_TGT = mlib-tgt

# By default, build socket support units. On platforms that do not support
# sockets, reset this variable to empty and add DUMMY_SOCKETS_TARGET_PAIRS
# to LIBGNAT_TARGET_PAIRS.

GNATRTL_SOCKETS_OBJS = g-soccon$(objext) g-socket$(objext) g-socthi$(objext) \
  g-soliop$(objext) g-sothco$(objext)

DUMMY_SOCKETS_TARGET_PAIRS = \
  g-socket.adb<g-socket-dummy.adb \
  g-socket.ads<g-socket-dummy.ads \
  g-socthi.adb<g-socthi-dummy.adb \
  g-socthi.ads<g-socthi-dummy.ads \
  g-sothco.adb<g-sothco-dummy.adb \
  g-sothco.ads<g-sothco-dummy.ads

# On platforms where atomic increment/decrement operations are supported,
# special version of Ada.Strings.Unbounded package can be used.

ATOMICS_TARGET_PAIRS = \
  a-stunau.adb<a-stunau-shared.adb \
  a-suteio.adb<a-suteio-shared.adb \
  a-strunb.ads<a-strunb-shared.ads \
  a-strunb.adb<a-strunb-shared.adb \
  a-stwiun.adb<a-stwiun-shared.adb \
  a-stwiun.ads<a-stwiun-shared.ads \
  a-swunau.adb<a-swunau-shared.adb \
  a-swuwti.adb<a-swuwti-shared.adb \
  a-stzunb.adb<a-stzunb-shared.adb \
  a-stzunb.ads<a-stzunb-shared.ads \
  a-szunau.adb<a-szunau-shared.adb \
  a-szuzti.adb<a-szuzti-shared.adb

ATOMICS_BUILTINS_TARGET_PAIRS = \
  s-atocou.adb<s-atocou-builtin.adb

# Special version of units for x86 and x86-64 platforms.

X86_TARGET_PAIRS = \
  a-numaux.ads<a-numaux-x86.ads \
  a-numaux.adb<a-numaux-x86.adb \
  g-bytswa.adb<g-bytswa-x86.adb \
  s-atocou.adb<s-atocou-x86.adb

X86_64_TARGET_PAIRS = \
  a-numaux.ads<a-numaux-x86.ads \
  a-numaux.adb<a-numaux-x86.adb \
  g-bytswa.adb<g-bytswa-x86.adb \
  s-atocou.adb<s-atocou-builtin.adb

LIB_VERSION = $(strip $(shell grep ' Library_Version :' $(fsrcpfx)ada/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))

# $(filter-out PATTERN...,TEXT) removes all PATTERN words from TEXT.
# $(strip STRING) removes leading and trailing spaces from STRING.
# If what's left is null then it's a match.

ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-vxworks.ads \
  a-numaux.ads<a-numaux-vxworks.ads \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-interr.adb<s-interr-hwint.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-vxworks.ads \
  s-parame.adb<s-parame-vxworks.adb \
  s-stchop.ads<s-stchop-limit.ads \
  s-stchop.adb<s-stchop-vxworks.adb \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-tpopsp.adb<s-tpopsp-vxworks.adb \
  s-vxwork.ads<s-vxwork-m68k.ads \
  g-socthi.ads<g-socthi-vxworks.ads \
  g-socthi.adb<g-socthi-vxworks.adb \
  g-stsifd.adb<g-stsifd-sockets.adb \
  system.ads<system-vxworks-m68k.ads

  TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb

  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
  EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o s-vxwext.o

  EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o

  ifeq ($(strip $(filter-out yes,$(TRACE))),)
    LIBGNAT_TARGET_PAIRS += \
    s-traces.adb<s-traces-default.adb \
    s-tratas.adb<s-tratas-default.adb \
    s-trafor.adb<s-trafor-default.adb \
    s-trafor.ads<s-trafor-default.ads \
    s-tfsetr.adb<s-tfsetr-vxworks.adb
  endif
endif

ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-vxworks.ads \
  a-numaux.ads<a-numaux-vxworks.ads \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-vxworks.ads \
  s-parame.adb<s-parame-vxworks.adb \
  s-stchop.ads<s-stchop-limit.ads \
  s-stchop.adb<s-stchop-vxworks.adb \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-vxwork.ads<s-vxwork-ppc.ads \
  g-socthi.ads<g-socthi-vxworks.ads \
  g-socthi.adb<g-socthi-vxworks.adb \
  g-stsifd.adb<g-stsifd-sockets.adb \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
  indepsw.adb<indepsw-gnu.adb

  ifeq ($(strip $(filter-out yes,$(TRACE))),)
    LIBGNAT_TARGET_PAIRS += \
    s-traces.adb<s-traces-default.adb \
    s-trafor.adb<s-trafor-default.adb \
    s-trafor.ads<s-trafor-default.ads \
    s-tratas.adb<s-tratas-default.adb \
    s-tfsetr.adb<s-tfsetr-vxworks.adb
  endif

  ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS += \
    s-vxwext.ads<s-vxwext-rtp.ads \
    s-vxwext.adb<s-vxwext-rtp.adb \
    s-tpopsp.adb<s-tpopsp-vxworks-rtp.adb \
    system.ads<system-vxworks-ppc-rtp.ads

    EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
  else
    ifeq ($(strip $(filter-out rtp-smp,$(THREAD_KIND))),)
      LIBGNAT_TARGET_PAIRS += \
      s-mudido.adb<s-mudido-affinity.adb \
      s-vxwext.ads<s-vxwext-rtp.ads \
      s-vxwext.adb<s-vxwext-rtp-smp.adb \
      s-tpopsp.adb<s-tpopsp-vxworks-tls.adb \
      system.ads<system-vxworks-ppc-rtp.ads

      EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
      EXTRA_LIBGNAT_OBJS+=affinity.o
      EXTRA_LIBGNAT_SRCS+=affinity.c
    else
      ifeq ($(strip $(filter-out kernel-smp,$(THREAD_KIND))),)
        LIBGNAT_TARGET_PAIRS += \
        s-interr.adb<s-interr-hwint.adb \
        s-mudido.adb<s-mudido-affinity.adb \
        s-tpopsp.adb<s-tpopsp-vxworks-tls.adb \
        s-vxwext.ads<s-vxwext-kernel.ads \
        s-vxwext.adb<s-vxwext-kernel-smp.adb \
        system.ads<system-vxworks-ppc-kernel.ads

        EH_MECHANISM=-gcc
        EXTRA_LIBGNAT_OBJS+=affinity.o
        EXTRA_LIBGNAT_SRCS+=affinity.c
      else
        LIBGNAT_TARGET_PAIRS += \
        s-interr.adb<s-interr-hwint.adb \
        s-tpopsp.adb<s-tpopsp-vxworks.adb

        ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
          EH_MECHANISM=-gcc
          LIBGNAT_TARGET_PAIRS += \
          s-vxwext.ads<s-vxwext-kernel.ads \
          s-vxwext.adb<s-vxwext-kernel.adb \
          system.ads<system-vxworks-ppc-kernel.ads
        else
          LIBGNAT_TARGET_PAIRS += \
          system.ads<system-vxworks-ppc.ads
        endif
      endif
      EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
      EXTRA_LIBGNAT_OBJS+=sigtramp-ppcvxw.o
      EXTRA_LIBGNAT_SRCS+=sigtramp-ppcvxw.c
    endif
  endif

  EXTRA_GNATRTL_TASKING_OBJS += s-vxwork.o s-vxwext.o

  EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
endif

# vxworks 653
ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(targ))),)
  # target pairs for vthreads runtime
  LIBGNAT_TARGET_PAIRS = \
  a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
  a-intnam.ads<a-intnam-vxworks.ads \
  a-numaux.ads<a-numaux-vxworks.ads \
  g-io.adb<g-io-vxworks-ppc-cert.adb \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-interr.adb<s-interr-hwint.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-ae653.ads \
  s-parame.adb<s-parame-vxworks.adb \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-tpopsp.adb<s-tpopsp-vxworks.adb \
  s-vxwext.adb<s-vxwext-noints.adb \
  s-vxwext.ads<s-vxwext-vthreads.ads \
  s-vxwork.ads<s-vxwork-ppc.ads \
  system.ads<system-vxworks-ppc-vthread.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
  indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
  EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o s-vxwext.o

  EXTRA_LIBGNAT_SRCS+=sigtramp-ppcvxw.c
  EXTRA_LIBGNAT_OBJS+=sigtramp-ppcvxw.o

  # Extra pairs for the vthreads runtime
  ifeq ($(strip $(filter-out vthreads,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS += \
    s-thread.adb<s-thread-ae653.adb \
    $(DUMMY_SOCKETS_TARGET_PAIRS)

    GNATRTL_SOCKETS_OBJS =
    EXTRA_GNATRTL_NONTASKING_OBJS += s-thread.o
  else
    LIBGNAT_TARGET_PAIRS += \
    g-socthi.ads<g-socthi-vxworks.ads \
    g-socthi.adb<g-socthi-vxworks.adb \
    g-stsifd.adb<g-stsifd-sockets.adb
  endif

  ifeq ($(strip $(filter-out yes,$(TRACE))),)
    LIBGNAT_TARGET_PAIRS += \
    s-traces.adb<s-traces-default.adb \
    s-trafor.adb<s-trafor-default.adb \
    s-trafor.ads<s-trafor-default.ads \
    s-tratas.adb<s-tratas-default.adb \
    s-tfsetr.adb<s-tfsetr-vxworks.adb
  endif
endif

# vxworks MILS
ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(targ))),)
  # target pairs for vthreads runtime
  LIBGNAT_TARGET_PAIRS = \
  a-elchha.adb<a-elchha-vx6-raven-cert.adb \
  a-intnam.ads<a-intnam-vxworks.ads \
  a-numaux.ads<a-numaux-vxworks.ads \
  g-io.adb<g-io-vxworks-ppc-cert.adb \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-interr.adb<s-interr-hwint.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-ae653.ads \
  s-parame.adb<s-parame-vxworks.adb \
  s-stchop.adb<s-stchop-vxworks.adb \
  s-stchop.ads<s-stchop-limit.ads \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-thread.adb<s-thread-ae653.adb \
  s-tpopsp.adb<s-tpopsp-vxworks.adb \
  s-vxwork.ads<s-vxwork-ppc.ads \
  system.ads<system-vxworks-ppc.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
  $(DUMMY_SOCKETS_TARGET_PAIRS)

  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
  indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-thread.o s-vxwexc.o
  EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o s-vxwext.o

  EXTRA_LIBGNAT_SRCS+=vx_stack_info.c sigtramp-ppcvxw.c
  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o sigtramp-ppcvxw.o
  GNATRTL_SOCKETS_OBJS =

  ifeq ($(strip $(filter-out yes,$(TRACE))),)
    LIBGNAT_TARGET_PAIRS += \
    s-traces.adb<s-traces-default.adb \
    s-trafor.adb<s-trafor-default.adb \
    s-trafor.ads<s-trafor-default.ads \
    s-tratas.adb<s-tratas-default.adb \
    s-tfsetr.adb<s-tfsetr-vxworks.adb
  endif
endif

# vxworksae / vxworks 653 for x86 (vxsim) - ?? vxworksmils not implemented
ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(targ))),)
  # target pairs for kernel + vthreads runtime
  LIBGNAT_TARGET_PAIRS = \
  a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
  a-intnam.ads<a-intnam-vxworks.ads \
  a-sytaco.ads<1asytaco.ads \
  a-sytaco.adb<1asytaco.adb \
  g-io.adb<g-io-vxworks-ppc-cert.adb \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-interr.adb<s-interr-hwint.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-ae653.ads \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-tpopsp.adb<s-tpopsp-vxworks.adb \
  s-vxwext.adb<s-vxwext-noints.adb \
  s-vxwext.ads<s-vxwext-vthreads.ads \
  s-vxwork.ads<s-vxwork-x86.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(X86_TARGET_PAIRS) \
  system.ads<system-vxworks-x86.ads

  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
  indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
  EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o s-vxwext.o

  # Extra pairs for the vthreads runtime
  ifeq ($(strip $(filter-out vthreads,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS += \
    s-thread.adb<s-thread-ae653.adb \
    $(DUMMY_SOCKETS_TARGET_PAIRS)

    GNATRTL_SOCKETS_OBJS =
    EXTRA_GNATRTL_NONTASKING_OBJS += s-thread.o
  else
    LIBGNAT_TARGET_PAIRS += \
    g-socthi.ads<g-socthi-vxworks.ads \
    g-socthi.adb<g-socthi-vxworks.adb \
    g-stsifd.adb<g-stsifd-sockets.adb
  endif

  ifeq ($(strip $(filter-out yes,$(TRACE))),)
    LIBGNAT_TARGET_PAIRS += \
    s-traces.adb<s-traces-default.adb \
    s-trafor.adb<s-trafor-default.adb \
    s-trafor.ads<s-trafor-default.ads \
    s-tratas.adb<s-tratas-default.adb \
    s-tfsetr.adb<s-tfsetr-vxworks.adb
  endif
endif

ifeq ($(strip $(filter-out sparc% wrs vx%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-vxworks.ads \
  a-numaux.ads<a-numaux-vxworks.ads \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-interr.adb<s-interr-hwint.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-vxworks.ads \
  s-parame.adb<s-parame-vxworks.adb \
  s-stchop.ads<s-stchop-limit.ads \
  s-stchop.adb<s-stchop-vxworks.adb \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-tpopsp.adb<s-tpopsp-vxworks.adb \
  s-vxwork.ads<s-vxwork-sparcv9.ads \
  g-socthi.ads<g-socthi-vxworks.ads \
  g-socthi.adb<g-socthi-vxworks.adb \
  g-stsifd.adb<g-stsifd-sockets.adb \
  system.ads<system-vxworks-sparcv9.ads   \

  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
  indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
  EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o s-vxwext.o

  EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
endif

ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-vxworks.ads \
  i-vxwork.ads<i-vxwork-x86.ads \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-vxworks.ads \
  s-parame.adb<s-parame-vxworks.adb \
  s-stchop.ads<s-stchop-limit.ads \
  s-stchop.adb<s-stchop-vxworks.adb \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-vxwork.ads<s-vxwork-x86.ads \
  g-socthi.ads<g-socthi-vxworks.ads \
  g-socthi.adb<g-socthi-vxworks.adb \
  g-stsifd.adb<g-stsifd-sockets.adb \
  $(ATOMICS_TARGET_PAIRS) \
  $(X86_TARGET_PAIRS)

  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
  indepsw.adb<indepsw-gnu.adb

  ifeq ($(strip $(filter-out yes,$(TRACE))),)
    LIBGNAT_TARGET_PAIRS += \
    s-traces.adb<s-traces-default.adb \
    s-trafor.adb<s-trafor-default.adb \
    s-trafor.ads<s-trafor-default.ads \
    s-tratas.adb<s-tratas-default.adb \
    s-tfsetr.adb<s-tfsetr-vxworks.adb
  endif

  ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS += \
    s-vxwext.ads<s-vxwext-rtp.ads \
    s-vxwext.adb<s-vxwext-rtp.adb \
    s-tpopsp.adb<s-tpopsp-vxworks-rtp.adb \
    system.ads<system-vxworks-x86-rtp.ads

    EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
  else
    ifeq ($(strip $(filter-out rtp-smp, $(THREAD_KIND))),)
      LIBGNAT_TARGET_PAIRS += \
      s-mudido.adb<s-mudido-affinity.adb \
      s-vxwext.ads<s-vxwext-rtp.ads \
      s-vxwext.adb<s-vxwext-rtp-smp.adb \
      s-tpopsp.adb<s-tpopsp-vxworks-tls.adb \
      system.ads<system-vxworks-x86-rtp.ads

      EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
      EXTRA_LIBGNAT_OBJS+=affinity.o
      EXTRA_LIBGNAT_SRCS+=affinity.c
    else
      ifeq ($(strip $(filter-out kernel-smp, $(THREAD_KIND))),)
        LIBGNAT_TARGET_PAIRS += \
        s-interr.adb<s-interr-hwint.adb \
        s-mudido.adb<s-mudido-affinity.adb \
        s-tpopsp.adb<s-tpopsp-vxworks-tls.adb \
        s-vxwext.ads<s-vxwext-kernel.ads \
        s-vxwext.adb<s-vxwext-kernel-smp.adb \
        system.ads<system-vxworks-x86-kernel.ads
        EXTRA_LIBGNAT_OBJS+=affinity.o
        EXTRA_LIBGNAT_SRCS+=affinity.c
      else
        LIBGNAT_TARGET_PAIRS += \
        s-interr.adb<s-interr-hwint.adb \
        s-tpopsp.adb<s-tpopsp-vxworks.adb

        ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
          LIBGNAT_TARGET_PAIRS += \
          s-vxwext.ads<s-vxwext-kernel.ads \
          s-vxwext.adb<s-vxwext-kernel.adb \
          system.ads<system-vxworks-x86-kernel.ads
        else
          LIBGNAT_TARGET_PAIRS += \
          system.ads<system-vxworks-x86.ads
        endif
      endif

      EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
    endif
  endif
  EXTRA_GNATRTL_TASKING_OBJS += s-vxwork.o s-vxwext.o

  EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
endif

ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-vxworks.ads \
  a-numaux.ads<a-numaux-vxworks.ads \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-interr.adb<s-interr-hwint.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-vxworks.ads \
  s-parame.adb<s-parame-vxworks.adb \
  s-stchop.ads<s-stchop-limit.ads \
  s-stchop.adb<s-stchop-vxworks.adb \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-tpopsp.adb<s-tpopsp-vxworks.adb \
  s-vxwork.ads<s-vxwork-arm.ads \
  g-socthi.ads<g-socthi-vxworks.ads \
  g-socthi.adb<g-socthi-vxworks.adb \
  g-stsifd.adb<g-stsifd-sockets.adb \
  system.ads<system-vxworks-arm.ads

  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
  indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
  EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o s-vxwext.o

  EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
endif

ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-vxworks.ads \
  a-numaux.ads<a-numaux-vxworks.ads \
  s-inmaop.adb<s-inmaop-vxworks.adb \
  s-interr.adb<s-interr-hwint.adb \
  s-intman.ads<s-intman-vxworks.ads \
  s-intman.adb<s-intman-vxworks.adb \
  s-osinte.adb<s-osinte-vxworks.adb \
  s-osinte.ads<s-osinte-vxworks.ads \
  s-osprim.adb<s-osprim-vxworks.adb \
  s-parame.ads<s-parame-vxworks.ads \
  s-parame.adb<s-parame-vxworks.adb \
  s-stchop.ads<s-stchop-limit.ads \
  s-stchop.adb<s-stchop-vxworks.adb \
  s-taprop.adb<s-taprop-vxworks.adb \
  s-tasinf.ads<s-tasinf-vxworks.ads \
  s-taspri.ads<s-taspri-vxworks.ads \
  s-tpopsp.adb<s-tpopsp-vxworks.adb \
  s-vxwork.ads<s-vxwork-mips.ads \
  g-socthi.ads<g-socthi-vxworks.ads \
  g-socthi.adb<g-socthi-vxworks.adb \
  g-stsifd.adb<g-stsifd-sockets.adb \
  system.ads<system-vxworks-mips.ads

  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
  indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
  EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o s-vxwext.o

  EXTRA_LIBGNAT_SRCS+=vx_stack_info.c
  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
endif

ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
  LIBGNAT_TARGET_PAIRS_COMMON = \
  a-intnam.ads<a-intnam-solaris.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-solaris.adb \
  s-mudido.adb<s-mudido-affinity.adb \
  s-osinte.adb<s-osinte-solaris.adb \
  s-osinte.ads<s-osinte-solaris.ads \
  s-osprim.adb<s-osprim-solaris.adb \
  s-taprop.adb<s-taprop-solaris.adb \
  s-tasinf.adb<s-tasinf-solaris.adb \
  s-tasinf.ads<s-tasinf-solaris.ads \
  s-taspri.ads<s-taspri-solaris.ads \
  s-tpopsp.adb<s-tpopsp-solaris.adb \
  g-soliop.ads<g-soliop-solaris.ads

  LIBGNAT_TARGET_PAIRS_32 = \
  system.ads<system-solaris-sparc.ads

  LIBGNAT_TARGET_PAIRS_64 = \
  system.ads<system-solaris-sparcv9.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
    ifeq ($(strip $(MULTISUBDIR)),/sparcv9)
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
    else
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
    endif
  else
    ifeq ($(strip $(MULTISUBDIR)),/sparcv8plus)
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
    else
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
    endif
  endif

  TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb

  EH_MECHANISM=-gcc
  THREADSLIB = -lposix4 -lthread
  MISCLIB = -lposix4 -lnsl -lsocket
  SO_OPTS = -Wl,-h,
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)

  ifeq ($(strip $(filter-out pthread PTHREAD,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS = \
    a-intnam.ads<a-intnam-solaris.ads \
    s-inmaop.adb<s-inmaop-posix.adb \
    s-intman.adb<s-intman-posix.adb \
    s-osinte.adb<s-osinte-posix.adb \
    s-osinte.ads<s-osinte-solaris-posix.ads \
    s-osprim.adb<s-osprim-solaris.adb \
    s-taprop.adb<s-taprop-posix.adb \
    s-taspri.ads<s-taspri-posix.ads \
    s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
    g-soliop.ads<g-soliop-solaris.ads \
    system.ads<system-solaris-sparc.ads

    THREADSLIB = -lposix4 -lpthread
  endif

  ifeq ($(strip $(filter-out m64,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_64)
  endif
endif

ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS_COMMON = \
  a-intnam.ads<a-intnam-solaris.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-solaris.adb \
  s-mudido.adb<s-mudido-affinity.adb \
  s-osinte.adb<s-osinte-solaris.adb \
  s-osinte.ads<s-osinte-solaris.ads \
  s-osprim.adb<s-osprim-solaris.adb \
  s-taprop.adb<s-taprop-solaris.adb \
  s-tasinf.adb<s-tasinf-solaris.adb \
  s-tasinf.ads<s-tasinf-solaris.ads \
  s-taspri.ads<s-taspri-solaris.ads \
  s-tpopsp.adb<s-tpopsp-solaris.adb \
  g-soliop.ads<g-soliop-solaris.ads \
  $(ATOMICS_TARGET_PAIRS)

  LIBGNAT_TARGET_PAIRS_32 = \
  $(X86_TARGET_PAIRS) \
  system.ads<system-solaris-x86.ads

  LIBGNAT_TARGET_PAIRS_64 = \
  $(X86_64_TARGET_PAIRS) \
  system.ads<system-solaris-x86_64.ads

  ifeq ($(strip $(filter-out %86 solaris2%,$(arch) $(osys))),)
    ifeq ($(strip $(MULTISUBDIR)),/amd64)
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
    else
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
    endif
  else
    ifeq ($(strip $(MULTISUBDIR)),/32)
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
    else
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
    endif
  endif

  TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb

  EH_MECHANISM=-gcc
  THREADSLIB = -lposix4 -lthread
  MISCLIB = -lposix4 -lnsl -lsocket
  SO_OPTS = -Wl,-h,
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-linux.ads \
  a-synbar.adb<a-synbar-posix.adb \
  a-synbar.ads<a-synbar-posix.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-tpopsp.adb<s-tpopsp-tls.adb \
  g-sercom.adb<g-sercom-linux.adb \
  a-exetim.adb<a-exetim-posix.adb \
  a-exetim.ads<a-exetim-default.ads \
  s-linux.ads<s-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  system.ads<system-linux-x86.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(X86_TARGET_PAIRS)

  ifeq ($(strip $(filter-out xenomai,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS += \
    s-osinte.ads<s-osinte-linux-xenomai.ads \
    s-osprim.adb<s-osprim-linux-xenomai.adb \
    s-taprop.adb<s-taprop-linux-xenomai.adb \
    s-taspri.ads<s-taspri-linux-xenomai.ads
  else
    LIBGNAT_TARGET_PAIRS += \
    s-mudido.adb<s-mudido-affinity.adb \
    s-osinte.ads<s-osinte-linux.ads \
    s-osprim.adb<s-osprim-posix.adb \
    s-taprop.adb<s-taprop-linux.adb \
    s-tasinf.ads<s-tasinf-linux.ads \
    s-tasinf.adb<s-tasinf-linux.adb \
    s-taspri.ads<s-taspri-posix.ads
  endif

  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread -lrt
  EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-freebsd.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  $(ATOMICS_TARGET_PAIRS) \
  $(X86_TARGET_PAIRS) \
  system.ads<system-freebsd-x86.ads

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-freebsd.ads \
  a-numaux.adb<a-numaux-x86.adb \
  a-numaux.ads<a-numaux-x86.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  system.ads<system-freebsd-x86_64.ads

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-freebsd.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-freebsd.adb \
  s-osinte.ads<s-osinte-freebsd.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-posix.adb \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-posix.adb \
  $(ATOMICS_TARGET_PAIRS) \
  $(X86_TARGET_PAIRS) \
  system.ads<system-freebsd-x86.ads

  TOOLS_TARGET_PAIRS = \
  mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
  GNATLIB_SHARED = gnatlib-shared-dual

  EH_MECHANISM=-gcc
  THREADSLIB= -lpthread
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-freebsd.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-freebsd.adb \
  s-osinte.ads<s-osinte-freebsd.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-posix.adb \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-posix.adb \
  g-trasym.adb<g-trasym-dwarf.adb \
  $(ATOMICS_TARGET_PAIRS) \
  $(X86_64_TARGET_PAIRS) \
  system.ads<system-freebsd-x86_64.ads

  TOOLS_TARGET_PAIRS = \
  mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
  GNATLIB_SHARED = gnatlib-shared-dual

  EH_MECHANISM=-gcc
  THREADSLIB= -lpthread
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS_COMMON = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb

  LIBGNAT_TARGET_PAIRS_32 = \
  system.ads<system-linux-s390.ads

  LIBGNAT_TARGET_PAIRS_64 = \
  system.ads<system-linux-s390x.ads

  ifeq ($(strip $(filter-out s390x,$(arch))),)
    ifeq ($(strip $(MULTISUBDIR)),/32)
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
    else
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
    endif
  else
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
  endif

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out mips sgi irix6%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-irix.ads \
  a-synbar.adb<a-synbar-posix.adb \
  a-synbar.ads<a-synbar-posix.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-irix.adb \
  s-mastop.adb<s-mastop-irix.adb \
  s-osinte.adb<s-osinte-irix.adb \
  s-osinte.ads<s-osinte-irix.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-proinf.adb<s-proinf-irix-athread.adb \
  s-proinf.ads<s-proinf-irix-athread.ads \
  s-taprop.adb<s-taprop-irix.adb \
  s-tasinf.ads<s-tasinf-irix.ads \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-posix.adb \
  s-traceb.adb<s-traceb-mastop.adb

  ifeq ($(strip $(MULTISUBDIR)),/64)
    LIBGNAT_TARGET_PAIRS += \
    system.ads<system-irix-n64.ads
  else
    ifeq ($(strip $(MULTISUBDIR)),/32)
      LIBGNAT_TARGET_PAIRS += \
      system.ads<system-irix-o32.ads
    else
      LIBGNAT_TARGET_PAIRS += \
      system.ads<system-irix-n32.ads
    endif
  endif

  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-default

  EH_MECHANISM=-gcc
  TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-irix.adb
  TGT_LIB = -lexc
  MISCLIB = -lexc
  LIBRARY_VERSION := $(LIB_VERSION)
  GMEM_LIB = gmemlib
endif

ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-excpol.adb<a-excpol-abort.adb \
  a-intnam.ads<a-intnam-hpux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-interr.adb<s-interr-sigaction.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-hpux-dce.adb \
  s-osinte.ads<s-osinte-hpux-dce.ads \
  s-parame.ads<s-parame-hpux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-hpux-dce.adb \
  s-taspri.ads<s-taspri-hpux-dce.ads \
  s-tpopsp.adb<s-tpopsp-posix.adb \
  system.ads<system-hpux.ads

  EH_MECHANISM=-gcc
endif

ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-hpux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-hpux.ads \
  s-parame.ads<s-parame-hpux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-traceb.adb<s-traceb-hpux.adb \
  s-taprop.adb<s-taprop-posix.adb \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  system.ads<system-hpux.ads

  TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-hpux.adb
  EH_MECHANISM=-gcc
  TGT_LIB = /usr/lib/libcl.a
  THREADSLIB = -lpthread
  GMEM_LIB = gmemlib
  soext = .sl
  SO_OPTS = -Wl,+h,
  GNATLIB_SHARED = gnatlib-shared-dual
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
  LIBGNAT_TARGET_PAIRS_COMMON = \
  a-intnam.ads<a-intnam-aix.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-aix.adb \
  s-osinte.ads<s-osinte-aix.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-posix.adb \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-posix.adb \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  LIBGNAT_TARGET_PAIRS_32 = \
  system.ads<system-aix.ads

  LIBGNAT_TARGET_PAIRS_64 = \
  system.ads<system-aix64.ads

  ifeq ($(findstring ppc64, \
	  $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) \
		   -print-multi-os-directory)), \
	ppc64)
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
    TOOLS_TARGET_PAIRS = \
    indepsw.adb<indepsw-aix.adb
  else
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
    TOOLS_TARGET_PAIRS = \
    indepsw.adb<indepsw-gnu.adb
  endif

  THREADSLIB = -lpthreads
  EH_MECHANISM=-gcc
  TOOLS_TARGET_PAIRS += \
  mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb

  GMEM_LIB = gmemlib
endif

ifeq ($(strip $(filter-out rtems%,$(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  system.ads<system-rtems.ads \
  a-intnam.ads<a-intnam-rtems.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-rtems.adb \
  s-osinte.ads<s-osinte-rtems.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-parame.adb<s-parame-rtems.adb \
  s-taprop.adb<s-taprop-posix.adb \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-rtems.adb \
  s-stchop.adb<s-stchop-rtems.adb \
  s-interr.adb<s-interr-hwint.adb
endif

ifeq ($(strip $(filter-out alpha% dec osf%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-tru64.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-mastop.adb<s-mastop-tru64.adb \
  s-osinte.adb<s-osinte-tru64.adb \
  s-osinte.ads<s-osinte-tru64.ads \
  s-osprim.adb<s-osprim-unix.adb \
  s-taprop.adb<s-taprop-tru64.adb \
  s-tasinf.ads<s-tasinf-tru64.ads \
  s-taspri.ads<s-taspri-tru64.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  s-traceb.adb<s-traceb-mastop.adb \
  system.ads<system-tru64.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-tru64.adb

  EH_MECHANISM=-gcc
  GMEM_LIB=gmemlib
  MISCLIB = -lexc
  THREADSLIB = -lpthread -lmach -lexc -lrt
  GNATLIB_SHARED = gnatlib-shared-default
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host))),)

soext  = .exe
hyphen = _
LN = cp -p
LN_S = cp -p

.SUFFIXES: .sym

.o.sym:
	@ gnu:[bin]vmssymvec $<
endif

ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
    a-caldel.adb<a-caldel-vms.adb \
    a-calend.adb<a-calend-vms.adb \
    a-calend.ads<a-calend-vms.ads \
    a-dirval.adb<a-dirval-vms.adb \
    a-excpol.adb<a-excpol-abort.adb \
    a-intnam.ads<a-intnam-vms.ads \
    a-numaux.ads<a-numaux-vms.ads \
    g-expect.adb<g-expect-vms.adb \
    g-socthi.ads<g-socthi-vms.ads \
    g-socthi.adb<g-socthi-vms.adb \
    g-stsifd.adb<g-stsifd-sockets.adb \
    i-cstrea.adb<i-cstrea-vms.adb \
    memtrack.adb<memtrack-vms_64.adb \
    s-auxdec.ads<s-auxdec-vms_64.ads \
    s-inmaop.adb<s-inmaop-vms.adb \
    s-interr.adb<s-interr-vms.adb \
    s-intman.adb<s-intman-vms.adb \
    s-intman.ads<s-intman-vms.ads \
    s-memory.adb<s-memory-vms_64.adb \
    s-memory.ads<s-memory-vms_64.ads \
    s-osprim.adb<s-osprim-vms.adb \
    s-osprim.ads<s-osprim-vms.ads \
    s-taprop.adb<s-taprop-vms.adb \
    s-tasdeb.adb<s-tasdeb-vms.adb \
    s-taspri.ads<s-taspri-vms.ads \
    s-tpopsp.adb<s-tpopsp-vms.adb \
    s-tpopde.adb<s-tpopde-vms.adb \
    s-tpopde.ads<s-tpopde-vms.ads

  ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
    LIBGNAT_TARGET_PAIRS += \
      g-enblsp.adb<g-enblsp-vms-ia64.adb \
      g-trasym.adb<g-trasym-vms-ia64.adb \
      s-asthan.adb<s-asthan-vms-ia64.adb \
      s-auxdec.adb<s-auxdec-vms-ia64.adb \
      s-osinte.adb<s-osinte-vms-ia64.adb \
      s-osinte.ads<s-osinte-vms-ia64.ads \
      s-vaflop.adb<s-vaflop-vms-ia64.adb \
      system.ads<system-vms-ia64.ads \
      s-parame.ads<s-parame-vms-ia64.ads \
      $(ATOMICS_TARGET_PAIRS) \
      $(ATOMICS_BUILTINS_TARGET_PAIRS)

    TOOLS_TARGET_PAIRS= \
      mlib-tgt-specific.adb<mlib-tgt-specific-vms-ia64.adb \
      symbols.adb<symbols-vms.adb \
      symbols-processing.adb<symbols-processing-vms-ia64.adb
  else
    ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
      LIBGNAT_TARGET_PAIRS += \
        g-enblsp.adb<g-enblsp-vms-alpha.adb \
        g-trasym.adb<g-trasym-vms-alpha.adb \
        s-asthan.adb<s-asthan-vms-alpha.adb \
        s-auxdec.adb<s-auxdec-vms-alpha.adb \
        s-osinte.adb<s-osinte-vms.adb \
        s-osinte.ads<s-osinte-vms.ads \
        s-traent.adb<s-traent-vms.adb \
        s-traent.ads<s-traent-vms.ads \
        s-vaflop.adb<s-vaflop-vms-alpha.adb \
        system.ads<system-vms_64.ads \
	s-parame.ads<s-parame-vms-alpha.ads \
        $(ATOMICS_TARGET_PAIRS) \
        $(ATOMICS_BUILTINS_TARGET_PAIRS)

    TOOLS_TARGET_PAIRS= \
      mlib-tgt-specific.adb<mlib-tgt-specific-vms-alpha.adb \
      symbols.adb<symbols-vms.adb \
      symbols-processing.adb<symbols-processing-vms-alpha.adb
    endif
  endif

adamsg.o: adamsg.msg
	-$(DECC) --cc=message adamsg.msg -o adamsg.o

  EXTRA_GNATMAKE_OBJS = mlib-tgt-vms_common.o

  GMEM_LIB = gmemlib
  EH_MECHANISM=-gcc
  GNATLIB_SHARED=gnatlib-shared-vms
  EXTRA_LIBGNAT_SRCS+=adamsg.msg
  EXTRA_LIBGNAT_OBJS+=adamsg.o
  EXTRA_GNATRTL_NONTASKING_OBJS+=s-po32gl.o
  EXTRA_GNATRTL_TASKING_OBJS=s-tpopde.o
  EXTRA_GNATTOOLS = \
     ../../gnatsym$(exeext)
  # This command transforms (YYYYMMDD) into YY,MMDD
  GSMATCH_VERSION := $(shell grep "^ *Gnat_Static_Version_String" $(fsrcpfx)ada/gnatvsn.ads | sed -e 's/.*(\(.*\)).*/\1/' -e 's/\(..\)\(..\)\(....\).*/\2,\3/')
  TOOLS_LIBS_LO := --for-linker=sys\\$$\$$library:trace.exe
  LIBRARY_VERSION := $(subst .,_,$(LIB_VERSION))
endif

ifeq ($(strip $(filter-out avr none powerpc% eabispe leon% erc32% unknown elf,$(targ))),)
  TOOLS_TARGET_PAIRS=\
  mlib-tgt-specific.adb<mlib-tgt-specific-xi.adb \
  indepsw.adb<indepsw-gnu.adb
endif

ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-dirval.adb<a-dirval-mingw.adb \
  a-excpol.adb<a-excpol-abort.adb \
  s-gloloc.adb<s-gloloc-mingw.adb \
  s-inmaop.adb<s-inmaop-dummy.adb \
  s-memory.adb<s-memory-mingw.adb \
  s-taspri.ads<s-taspri-mingw.ads \
  s-tasinf.adb<s-tasinf-mingw.adb \
  s-tasinf.ads<s-tasinf-mingw.ads \
  g-socthi.ads<g-socthi-mingw.ads \
  g-socthi.adb<g-socthi-mingw.adb \
  g-stsifd.adb<g-stsifd-sockets.adb \
  g-soliop.ads<g-soliop-mingw.ads \
  $(ATOMICS_TARGET_PAIRS)

  ifeq ($(strip $(filter-out rtx_w32 rtx_rtss,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS += \
    s-intman.adb<s-intman-dummy.adb \
    s-osinte.ads<s-osinte-rtx.ads \
    s-osprim.adb<s-osprim-rtx.adb \
    s-taprop.adb<s-taprop-rtx.adb \
    $(X86_TARGET_PAIRS)

    EXTRA_GNATRTL_NONTASKING_OBJS = s-win32.o

    ifeq ($(strip $(filter-out rtx_w32,$(THREAD_KIND))),)
       LIBGNAT_TARGET_PAIRS += system.ads<system-rtx.ads

       EH_MECHANISM=-gcc
    else
       LIBGNAT_TARGET_PAIRS += \
       system.ads<system-rtx-rtss.ads \
       s-parame.adb<s-parame-vxworks.adb

       EH_MECHANISM=
    endif

  else
    LIBGNAT_TARGET_PAIRS += \
    a-exetim.adb<a-exetim-mingw.adb \
    a-exetim.ads<a-exetim-mingw.ads \
    a-intnam.ads<a-intnam-mingw.ads \
    g-sercom.adb<g-sercom-mingw.adb \
    s-interr.adb<s-interr-sigaction.adb \
    s-intman.adb<s-intman-mingw.adb \
    s-mudido.adb<s-mudido-affinity.adb \
    s-osinte.ads<s-osinte-mingw.ads \
    s-osprim.adb<s-osprim-mingw.adb \
    s-taprop.adb<s-taprop-mingw.adb

    ifeq ($(strip $(filter-out x86_64%,$(arch))),)
      ifeq ($(strip $(MULTISUBDIR)),/32)
	LIBGNAT_TARGET_PAIRS += \
	  $(X86_TARGET_PAIRS) \
	  system.ads<system-mingw.ads
	SO_OPTS= -m32 -Wl,-soname,
      else
	LIBGNAT_TARGET_PAIRS += \
	  $(X86_64_TARGET_PAIRS) \
	  system.ads<system-mingw-x86_64.ads
	SO_OPTS = -m64 -Wl,-soname,
      endif
    else
      ifeq ($(strip $(MULTISUBDIR)),/64)
	LIBGNAT_TARGET_PAIRS += \
	  $(X86_64_TARGET_PAIRS) \
	  system.ads<system-mingw-x86_64.ads
	SO_OPTS = -m64 -Wl,-soname,
      else
	LIBGNAT_TARGET_PAIRS += \
	  $(X86_TARGET_PAIRS) \
	  system.ads<system-mingw.ads
	SO_OPTS = -m32 -Wl,-soname,
      endif
    endif

    EXTRA_GNATRTL_NONTASKING_OBJS = \
	s-win32.o s-winext.o g-regist.o g-sse.o g-ssvety.o
    EXTRA_GNATRTL_TASKING_OBJS = a-exetim.o

    MISCLIB = -lws2_32

    # ??? This will be replaced by gnatlib-shared-dual-win32 when GNAT
    # auto-import support for array/record will be done.
    GNATLIB_SHARED = gnatlib-shared-win32

    EH_MECHANISM=-gcc
  endif

  TOOLS_TARGET_PAIRS= \
  mlib-tgt-specific.adb<mlib-tgt-specific-mingw.adb \
  indepsw.adb<indepsw-mingw.adb

  GMEM_LIB = gmemlib
  EXTRA_GNATTOOLS = ../../gnatdll$(exeext)
  EXTRA_GNATMAKE_OBJS = mdll.o mdll-utl.o mdll-fil.o
  soext = .dll
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  system.ads<system-linux-mips.ads

  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS_COMMON = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux-mipsel.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  g-sercom.adb<g-sercom-linux.adb

  LIBGNAT_TARGET_PAIRS_32 = \
  system.ads<system-linux-mipsel.ads

  LIBGNAT_TARGET_PAIRS_64 = \
  system.ads<system-linux-mips64el.ads

  ifeq ($(strip $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) -print-multi-os-directory)),../lib64)
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
  else
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
  endif

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out mips64el linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS_COMMON = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux-mipsel.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  g-sercom.adb<g-sercom-linux.adb

  LIBGNAT_TARGET_PAIRS_32 = \
  system.ads<system-linux-mipsel.ads

  LIBGNAT_TARGET_PAIRS_64 = \
  system.ads<system-linux-mips64el.ads

  ifeq ($(strip $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) -print-multi-os-directory)),../lib64)
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
  else
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
  endif

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS_COMMON = \
  a-exetim.adb<a-exetim-posix.adb \
  a-exetim.ads<a-exetim-default.ads \
  a-intnam.ads<a-intnam-linux.ads \
  a-synbar.adb<a-synbar-posix.adb \
  a-synbar.ads<a-synbar-posix.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-tpopsp.adb<s-tpopsp-tls.adb \
  g-sercom.adb<g-sercom-linux.adb \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  ifeq ($(strip $(filter-out xenomai,$(THREAD_KIND))),)
    LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON)

    LIBGNAT_TARGET_PAIRS += \
    s-osinte.ads<s-osinte-linux-xenomai.ads \
    s-osprim.adb<s-osprim-linux-xenomai.adb \
    s-taprop.adb<s-taprop-linux-xenomai.adb \
    s-taspri.ads<s-taspri-linux-xenomai.ads \
    system.ads<system-linux-ppc.ads
  else
    LIBGNAT_TARGET_PAIRS_32 = \
    system.ads<system-linux-ppc.ads

    LIBGNAT_TARGET_PAIRS_64 = \
    system.ads<system-linux-ppc64.ads

    ifeq ($(strip $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) -print-multi-os-directory)),../lib64)
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
    else
      LIBGNAT_TARGET_PAIRS = \
      $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
    endif

    LIBGNAT_TARGET_PAIRS += \
    s-mudido.adb<s-mudido-affinity.adb \
    s-osinte.ads<s-osinte-linux.ads \
    s-osprim.adb<s-osprim-posix.adb \
    s-taprop.adb<s-taprop-linux.adb \
    s-tasinf.ads<s-tasinf-linux.ads \
    s-tasinf.adb<s-tasinf-linux.adb \
    s-taspri.ads<s-taspri-posix-noaltstack.ads
  endif

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread -lrt
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out arm% linux-gnueabi,$(arch) $(osys)-$(word 4,$(targ)))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb

  ifeq ($(strip $(filter-out arm%b,$(arch))),)
    LIBGNAT_TARGET_PAIRS += \
    system.ads<system-linux-armeb.ads
  else
    LIBGNAT_TARGET_PAIRS += \
    system.ads<system-linux-armel.ads
  endif

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
  EH_MECHANISM=
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS_COMMON = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux-sparc.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  s-tpopsp.adb<s-tpopsp-tls.adb

  LIBGNAT_TARGET_PAIRS_32 = \
  system.ads<system-linux-sparc.ads

  LIBGNAT_TARGET_PAIRS_64 = \
  system.ads<system-linux-sparcv9.ads

  ifeq ($(strip $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) -print-multi-os-directory)),../lib64)
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
  else
    LIBGNAT_TARGET_PAIRS = \
    $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
  endif

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux-hppa.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  system.ads<system-linux-hppa.ads

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
  EH_MECHANISM=-gcc
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  system.ads<system-linux-sh4.ads

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-linux.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
  EH_MECHANISM=-gcc
  MISCLIB=
  THREADSLIB = -lpthread
  GNATLIB_SHARED = gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-exetim.adb<a-exetim-posix.adb \
  a-exetim.ads<a-exetim-default.ads \
  a-intnam.ads<a-intnam-linux.ads \
  a-numaux.ads<a-numaux-libc-x86.ads \
  a-synbar.adb<a-synbar-posix.adb \
  a-synbar.ads<a-synbar-posix.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux.ads \
  s-mudido.adb<s-mudido-affinity.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-tpopsp.adb<s-tpopsp-tls.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  g-sercom.adb<g-sercom-linux.adb \
  system.ads<system-linux-ia64.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
  EH_MECHANISM=-gcc
  MISCLIB=
  THREADSLIB=-lpthread -lrt
  GNATLIB_SHARED=gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out ia64% hp hpux%,$(targ))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-hpux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-osinte.adb<s-osinte-posix.adb \
  s-osinte.ads<s-osinte-hpux.ads \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-posix.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  system.ads<system-hpux-ia64.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  TOOLS_TARGET_PAIRS = \
  mlib-tgt-specific.adb<mlib-tgt-specific-ia64-hpux.adb

  MISCLIB=
  THREADSLIB=-lpthread
  GNATLIB_SHARED=gnatlib-shared-dual
  GMEM_LIB = gmemlib
  soext = .sl
  SO_OPTS = -Wl,+h,
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-intnam.ads<a-intnam-linux.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux-alpha.ads \
  s-osinte.ads<s-osinte-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
  s-taspri.ads<s-taspri-posix-noaltstack.ads \
  system.ads<system-linux-alpha.ads \
  $(ATOMICS_TARGET_PAIRS) \
  $(ATOMICS_BUILTINS_TARGET_PAIRS)

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
  EH_MECHANISM=-gcc
  MISCLIB=
  THREADSLIB=-lpthread
  GNATLIB_SHARED=gnatlib-shared-dual
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
  LIBGNAT_TARGET_PAIRS = \
  a-exetim.adb<a-exetim-posix.adb \
  a-exetim.ads<a-exetim-default.ads \
  a-intnam.ads<a-intnam-linux.ads \
  a-synbar.adb<a-synbar-posix.adb \
  a-synbar.ads<a-synbar-posix.ads \
  s-inmaop.adb<s-inmaop-posix.adb \
  s-intman.adb<s-intman-posix.adb \
  s-linux.ads<s-linux.ads \
  s-mudido.adb<s-mudido-affinity.adb \
  s-osinte.ads<s-osinte-linux.ads \
  s-osinte.adb<s-osinte-posix.adb \
  s-osprim.adb<s-osprim-posix.adb \
  s-taprop.adb<s-taprop-linux.adb \
  s-tasinf.ads<s-tasinf-linux.ads \
  s-tasinf.adb<s-tasinf-linux.adb \
  s-tpopsp.adb<s-tpopsp-tls.adb \
  s-taspri.ads<s-taspri-posix.ads \
  g-sercom.adb<g-sercom-linux.adb \
  $(ATOMICS_TARGET_PAIRS) \
  $(X86_64_TARGET_PAIRS) \
  system.ads<system-linux-x86_64.ads

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
    indepsw.adb<indepsw-gnu.adb

  EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
  EH_MECHANISM=-gcc
  THREADSLIB=-lpthread -lrt
  GNATLIB_SHARED=gnatlib-shared-dual
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
endif

ifeq ($(strip $(filter-out darwin%,$(osys))),)
  SO_OPTS = -shared-libgcc
  LIBGNAT_TARGET_PAIRS = \
    a-intnam.ads<a-intnam-darwin.ads \
    s-inmaop.adb<s-inmaop-posix.adb \
    s-osinte.adb<s-osinte-darwin.adb \
    s-osinte.ads<s-osinte-darwin.ads \
    s-taprop.adb<s-taprop-posix.adb \
    s-taspri.ads<s-taspri-posix.ads \
    s-tpopsp.adb<s-tpopsp-posix-foreign.adb
  
  ifeq ($(strip $(filter-out %86,$(arch))),)
    LIBGNAT_TARGET_PAIRS += \
      s-intman.adb<s-intman-susv3.adb \
      s-osprim.adb<s-osprim-darwin.adb \
      $(ATOMICS_TARGET_PAIRS)

    ifeq ($(strip $(MULTISUBDIR)),/x86_64)
      LIBGNAT_TARGET_PAIRS += \
        $(X86_64_TARGET_PAIRS) \
        system.ads<system-darwin-x86_64.ads
      SO_OPTS += -m64
    else
      LIBGNAT_TARGET_PAIRS += \
        $(X86_TARGET_PAIRS) \
        system.ads<system-darwin-x86.ads
    endif
  endif

  ifeq ($(strip $(filter-out %x86_64,$(arch))),)
    LIBGNAT_TARGET_PAIRS += \
      s-intman.adb<s-intman-susv3.adb \
      s-osprim.adb<s-osprim-darwin.adb \
      $(ATOMICS_TARGET_PAIRS)

    ifeq ($(strip $(MULTISUBDIR)),/i386)
      LIBGNAT_TARGET_PAIRS += \
        $(X86_TARGET_PAIRS) \
        system.ads<system-darwin-x86.ads
      SO_OPTS += -m32
    else
      LIBGNAT_TARGET_PAIRS += \
        $(X86_64_TARGET_PAIRS) \
        system.ads<system-darwin-x86_64.ads
    endif
  endif

  ifeq ($(strip $(filter-out powerpc%,$(arch))),)
    LIBGNAT_TARGET_PAIRS += \
      s-intman.adb<s-intman-posix.adb \
      s-osprim.adb<s-osprim-posix.adb \
      a-numaux.ads<a-numaux-darwin.ads \
      a-numaux.adb<a-numaux-darwin.adb
    
    ifeq ($(strip $(MULTISUBDIR)),/ppc64)
      LIBGNAT_TARGET_PAIRS += \
        system.ads<system-darwin-ppc64.ads
        SO_OPTS += -m64
    else
      LIBGNAT_TARGET_PAIRS += \
      system.ads<system-darwin-ppc.ads
    endif
  endif

  TOOLS_TARGET_PAIRS =  \
    mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb \
    indepsw.adb<indepsw-darwin.adb

  EH_MECHANISM=-gcc
  GNATLIB_SHARED = gnatlib-shared-darwin
  RANLIB = ranlib -c
  GMEM_LIB = gmemlib
  LIBRARY_VERSION := $(LIB_VERSION)
  soext = .dylib
  GCC_LINK_FLAGS=
endif

ifneq ($(EH_MECHANISM),)
  LIBGNAT_TARGET_PAIRS += a-exexpr.adb<a-exexpr$(EH_MECHANISM).adb
  EXTRA_LIBGNAT_SRCS+=raise$(EH_MECHANISM).c
  EXTRA_LIBGNAT_OBJS+=raise$(EH_MECHANISM).o
endif

# Use the Ada 2005 version of Ada.Exceptions by default, unless specified
# explicitly already. The base files (a-except.ad?) are used only for building
# the compiler and other basic tools.
# These base versions lack Ada 2005 additions which would cause bootstrap
# problems if included in the compiler and other basic tools.

ifeq ($(filter a-except%,$(LIBGNAT_TARGET_PAIRS)),)
  LIBGNAT_TARGET_PAIRS += \
    a-except.ads<a-except-2005.ads \
    a-except.adb<a-except-2005.adb
endif

# The runtime library for gnat comprises two directories.  One contains the
# Ada source files that the compiler (gnat1) needs -- these files are listed
# by ADA_INCLUDE_SRCS -- and the other contains the object files and their
# corresponding .ali files for the parts written in Ada, libgnat.a for
# the parts of the runtime written in C, and libgthreads.a for the pthreads
# emulation library.  LIBGNAT_OBJS lists the objects that go into libgnat.a,
# while GNATRTL_OBJS lists the object files compiled from Ada sources that
# go into the directory.  The pthreads emulation is built in the threads
# subdirectory and copied.
LIBGNAT_SRCS = adadecode.c adadecode.h adaint.c adaint.h	\
  argv.c cio.c cstreams.c errno.c exit.c cal.c ctrl_c.c env.c env.h	\
  arit64.c raise.h raise.c sysdep.c aux-io.c init.c initialize.c	\
  locales.c seh_init.c final.c tracebak.c tb-alvms.c tb-alvxw.c         \
  tb-gcc.c expect.c mkdir.c socket.c gsocket.h targext.c $(EXTRA_LIBGNAT_SRCS)

LIBGNAT_OBJS = adadecode.o adaint.o argv.o cio.o cstreams.o ctrl_c.o	\
  errno.o exit.o env.o raise.o sysdep.o aux-io.o init.o initialize.o	\
  locales.o seh_init.o cal.o arit64.o final.o tracebak.o expect.o       \
  mkdir.o socket.o targext.o $(EXTRA_LIBGNAT_OBJS)

# NOTE ??? - when the -I option for compiling Ada code is made to work,
#  the library installation will change and there will be a
#  GNAT_RTL_SRCS.  Right now we count on being able to build GNATRTL_OBJS
#  from ADA_INCLUDE_SRCS.

# GNATRTL_NONTASKING_OBJS and GNATRTL_TASKING_OBJS can be found in
# the following include file:

include $(fsrcdir)/ada/Makefile.rtl

GNATRTL_OBJS = $(GNATRTL_NONTASKING_OBJS) $(GNATRTL_TASKING_OBJS) \
  memtrack.o

# Default run time files

ADA_INCLUDE_SRCS =\
 ada.ads calendar.ads directio.ads gnat.ads interfac.ads ioexcept.ads \
 machcode.ads text_io.ads unchconv.ads unchdeal.ads \
 sequenio.ads system.ads memtrack.adb \
 a-[a-o]*.adb a-[p-z]*.adb a-[a-o]*.ads a-[p-z]*.ads g-*.ad? i-*.ad? \
 s-[a-o]*.adb s-[p-z]*.adb s-[a-o]*.ads s-[p-z]*.ads

LIBGNAT=../$(RTSDIR)/libgnat.a

TOOLS_FLAGS_TO_PASS=		\
	"CC=$(CC)" 		\
	"CFLAGS=$(CFLAGS)"	\
	"LDFLAGS=$(LDFLAGS)"	\
	"ADAFLAGS=$(ADAFLAGS)"	\
	"INCLUDES=$(INCLUDES_FOR_SUBDIR)"\
	"ADA_INCLUDES=$(ADA_INCLUDES) $(ADA_INCLUDES_FOR_SUBDIR)"\
	"libsubdir=$(libsubdir)"	\
	"exeext=$(exeext)"	\
	"fsrcdir=$(fsrcdir)"	\
	"srcdir=$(fsrcdir)"	\
	"TOOLS_LIBS=$(TOOLS_LIBS) $(TGT_LIB)"	\
	"GNATMAKE=$(GNATMAKE)"	\
	"GNATLINK=$(GNATLINK)"	\
	"GNATBIND=$(GNATBIND)"

GCC_LINK=$(CC) $(GCC_LINK_FLAGS) $(ADA_INCLUDES)

# Build directory for the tools. Let's copy the target-dependent
# sources using the same mechanism as for gnatlib. The other sources are
# accessed using the vpath directive below
# Note: dummy target, stamp-tools is mainly handled by gnattools.

../stamp-tools:
	touch ../stamp-tools

# when compiling the tools, the runtime has to be first on the path so that
# it hides the runtime files lying with the rest of the sources
ifeq ($(TOOLSCASE),native)
  vpath %.ads ../$(RTSDIR) ../
  vpath %.adb ../$(RTSDIR) ../
  vpath %.c   ../$(RTSDIR) ../
  vpath %.h   ../$(RTSDIR) ../
endif

# in the cross tools case, everything is compiled with the native
# gnatmake/link. Therefore only -I needs to be modified in ADA_INCLUDES
ifeq ($(TOOLSCASE),cross)
  vpath %.ads ../
  vpath %.adb ../
  vpath %.c   ../
  vpath %.h   ../
endif

# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
# reasons: gnatmake should be built with a recent compiler, a recent compiler
# may not generate ALI files compatible with an old gnatmake so it is important
# to be able to build gnatmake without a version of gnatmake around. Once
# everything has been compiled once, gnatmake can be recompiled with itself
# (see target gnattools1-re)
gnattools1: ../stamp-tools ../stamp-gnatlib-$(RTSDIR)
	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
	  TOOLSCASE=native \
	  ../../gnatmake$(exeext) ../../gnatlink$(exeext)

# gnatmake/link can be built with recent gnatmake/link if they are available.
# This is especially convenient for building cross tools or for rebuilding
# the tools when the original bootstrap has already be done.
gnattools1-re: ../stamp-tools
	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
	  TOOLSCASE=cross INCLUDES="" gnatmake-re gnatlink-re

# these tools are built with gnatmake & are common to native and cross
gnattools2: ../stamp-tools
	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
	  TOOLSCASE=native common-tools $(EXTRA_GNATTOOLS)

# those tools are only built for the cross version
gnattools4: ../stamp-tools
ifeq ($(ENABLE_VXADDR2LINE),true)
	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
	  TOOLSCASE=cross top_buildir=../../.. \
	  ../../vxaddr2line$(exeext)
endif

common-tools: ../stamp-tools
	$(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \
	  --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \
	  gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
	  gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
	$(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)

../../gnatsym$(exeext): ../stamp-tools
	$(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)"
	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatsym
	$(GNATLINK) -v gnatsym -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)

../../gnatdll$(exeext): ../stamp-tools
	$(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)"
	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll
	$(GNATLINK) -v gnatdll -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)

../../vxaddr2line$(exeext): ../stamp-tools targext.o
	$(GNATMAKE) -c  $(ADA_INCLUDES) vxaddr2line --GCC="$(CC) $(ALL_ADAFLAGS)"
	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vxaddr2line
	$(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" targext.o $(CLIB)

gnatmake-re: ../stamp-tools link.o targext.o
	$(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)"
	$(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake
	$(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)

# Note the use of the "mv" command in order to allow gnatlink to be linked with
# with the former version of gnatlink itself which cannot override itself.
# gnatlink-re cannot be run at the same time as gnatmake-re, hence the
# dependency
gnatlink-re: ../stamp-tools link.o targext.o gnatmake-re
	$(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink
	$(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
		    --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
	$(MV)  ../../gnatlinknew$(exeext)  ../../gnatlink$(exeext)

# Needs to be built with CC=gcc
# Since the RTL should be built with the latest compiler, remove the
#  stamp target in the parent directory whenever gnat1 is rebuilt

# Likewise for the tools
../../gnatmake$(exeext): $(P) b_gnatm.o link.o targext.o $(GNATMAKE_OBJS)
	$(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) \
		    $(TOOLS_LIBS)

../../gnatlink$(exeext): $(P) b_gnatl.o link.o targext.o $(GNATLINK_OBJS)
	$(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \
		    $(TOOLS_LIBS)

../stamp-gnatlib-$(RTSDIR):
	@if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \
	then \
	  $(ECHO) You must first build the GNAT library: make gnatlib; \
	  false; \
	else \
	  true; \
	fi

install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
#	Create the directory before deleting it, in case the directory is
#	a list of directories (as it may be on VMS). This ensures we are
#	deleting the right one.
	-$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
	-$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
	$(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
	$(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
	-$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
	-$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
	for file in $(RTSDIR)/*.ali; do \
	    $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
	done
	-cd $(RTSDIR); for file in *$(arext);do \
	    $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
	    $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
	done
	-$(foreach file, $(EXTRA_ADALIB_FILES), \
	    $(INSTALL_DATA_DATE) $(RTSDIR)/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \
	) true
#     Install the shared libraries, if any, using $(INSTALL) instead
#     of $(INSTALL_DATA). The latter may force a mode inappropriate
#     for shared libraries on some targets, e.g. on HP-UX where the x
#     permission is required.
#     Also install the .dSYM directories if they exist (these directories
#     contain the debug information for the shared libraries on darwin)
	for file in gnat gnarl; do \
	   if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
	      $(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
			 $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
	   fi; \
	   if [ -f $(RTSDIR)/lib$${file}$(soext) ]; then \
	      $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
	      $(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(soext); \
	   fi; \
	   if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \
	      $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \
	        $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
	   fi; \
	done
# This copy must be done preserving the date on the original file.
	for file in $(RTSDIR)/*.ad?; do \
	    $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \
	done
	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads

../stamp-gnatlib2-$(RTSDIR):
	$(RM) $(RTSDIR)/s-*.ali
	$(RM) $(RTSDIR)/s-*$(objext)
	$(RM) $(RTSDIR)/a-*.ali
	$(RM) $(RTSDIR)/a-*$(objext)
	$(RM) $(RTSDIR)/*.ali
	$(RM) $(RTSDIR)/*$(objext)
	$(RM) $(RTSDIR)/*$(arext)
	$(RM) $(RTSDIR)/*$(soext)
	touch ../stamp-gnatlib2-$(RTSDIR)
	$(RM) ../stamp-gnatlib-$(RTSDIR)

# NOTE: The $(foreach ...) commands assume ";" is the valid separator between
#       successive target commands. Although the Gnu make documentation
#       implies this is true on all systems, I suspect it may not be, So care
#       has been taken to allow a sed script to look for ";)" and substitue
#       for ";" the appropriate character in the range of lines below
#       beginning with "GNULLI Begin" and ending with "GNULLI End"

# GNULLI Begin ###########################################################

../stamp-gnatlib1-$(RTSDIR): Makefile ../stamp-gnatlib2-$(RTSDIR)
	$(RMDIR) $(RTSDIR)
	$(MKDIR) $(RTSDIR)
	$(CHMOD) u+w $(RTSDIR)
# Copy target independent sources
	$(foreach f,$(ADA_INCLUDE_SRCS) $(LIBGNAT_SRCS), \
	  $(LN_S) $(fsrcpfx)ada/$(f) $(RTSDIR) ;) true
# Remove files to be replaced by target dependent sources
	$(RM) $(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
	                $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR))))
	for f in $(RTSDIR)/*-*-*.ads $(RTSDIR)/*-*-*.adb; do \
	  case "$$f" in \
	    $(RTSDIR)/s-stratt-*) ;; \
	    *) $(RM) $$f ;; \
	  esac; \
	done
# Copy new target dependent sources
	$(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
	          $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \
	                $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR)));)
# Copy tsystem.h
	$(CP) $(srcdir)/tsystem.h $(RTSDIR)
	$(RM) ../stamp-gnatlib-$(RTSDIR)
	touch ../stamp-gnatlib1-$(RTSDIR)

# GNULLI End #############################################################

ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
OSCONS_CPP=../../$(DECC) -E /comment=as_is -DNATIVE \
             -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c

OSCONS_EXTRACT=../../$(DECC) -DNATIVE \
                 -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c ; \
  ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
  ./s-oscons-tmplt.exe > s-oscons-tmplt.s

else
# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
# for running it from $(RTSDIR)
OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \
  | sed -e 's^\./xgcc^../../xgcc^' -e 's^-B./^-B../../^'`
OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
  -DTARGET=\"$(target)\" $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i
OSCONS_EXTRACT=$(OSCONS_CC) -S s-oscons-tmplt.i
endif

./bldtools/oscons/xoscons: xoscons.adb xutil.ads xutil.adb
	-$(MKDIR) ./bldtools/oscons
	$(RM) $(addprefix ./bldtools/oscons/,$(notdir $^))
	$(CP) $^ ./bldtools/oscons
	(cd ./bldtools/oscons ; gnatmake -q xoscons)

$(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons
	$(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s
	(cd $(RTSDIR) ; \
	    $(OSCONS_CPP) ; \
	    $(OSCONS_EXTRACT) ; \
	    ../bldtools/oscons/xoscons)

# Don't use semicolon separated shell commands that involve list expansions.
# The semicolon triggers a call to DCL on VMS and DCL can't handle command
# line lengths in excess of 256 characters.
# Example: cd $(RTSDIR); ar rc libfoo.a $(LONG_LIST_OF_OBJS)
# is guaranteed to overflow the buffer.

gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads
	$(MAKE) -C $(RTSDIR) \
		CC="`echo \"$(GCC_FOR_TARGET)\" \
		| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
	        INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
                CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
	        FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
		srcdir=$(fsrcdir) \
	        -f ../Makefile $(LIBGNAT_OBJS)
	$(MAKE) -C $(RTSDIR) \
		CC="`echo \"$(GCC_FOR_TARGET)\" \
		| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
	        ADA_INCLUDES="" \
                CFLAGS="$(GNATLIBCFLAGS)" \
	        ADAFLAGS="$(GNATLIBFLAGS)" \
	        FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
		srcdir=$(fsrcdir) \
	        -f ../Makefile \
	        $(GNATRTL_OBJS)
	$(RM) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnarl$(arext)
	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat$(arext) \
	   $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat$(arext)
	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl$(arext) \
	   $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS))
	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl$(arext)
        ifeq ($(GMEM_LIB),gmemlib)
		$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgmem$(arext) \
		  $(RTSDIR)/memtrack.o
		$(RANLIB_FOR_TARGET) $(RTSDIR)/libgmem$(arext)
        endif
	$(CHMOD) a-wx $(RTSDIR)/*.ali
	touch ../stamp-gnatlib-$(RTSDIR)

# Warning: this target assumes that LIBRARY_VERSION has been set correctly.
gnatlib-shared-default:
	$(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
             gnatlib
	$(RM) $(RTSDIR)/libgna*$(soext)
	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
		$(PICFLAG_FOR_TARGET) \
		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(MISCLIB) -lm
	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
		$(PICFLAG_FOR_TARGET) \
		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(GNATRTL_TASKING_OBJS) \
		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(THREADSLIB)
	cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
		libgnat$(soext)
	cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
		libgnarl$(soext)

gnatlib-shared-dual:
	$(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
             gnatlib-shared-default
	$(MV) $(RTSDIR)/libgna*$(soext) .
	$(RM) ../stamp-gnatlib2-$(RTSDIR)
	$(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
             gnatlib
	$(MV) libgna*$(soext) $(RTSDIR)

gnatlib-shared-dual-win32:
	$(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
             gnatlib-shared-win32
	$(MV) $(RTSDIR)/libgna*$(soext) .
	$(RM) ../stamp-gnatlib2-$(RTSDIR)
	$(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
             gnatlib
	$(MV) libgna*$(soext) $(RTSDIR)

# ??? we need to add the option to support auto-import of arrays/records to
# the GNATLIBFLAGS when this will be supported by GNAT. At this point we will
# use the gnatlib-shared-dual-win32 target to build the GNAT runtimes on
# Windows.
gnatlib-shared-win32:
	$(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
             gnatlib
	$(RM) $(RTSDIR)/libgna*$(soext)
	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
		$(PICFLAG_FOR_TARGET) \
		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
		$(PICFLAG_FOR_TARGET) \
		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(GNATRTL_TASKING_OBJS) \
		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)

gnatlib-shared-darwin:
	$(MAKE) $(FLAGS_TO_PASS) \
	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) -fno-common" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
	     gnatlib
	$(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext)
	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
		$(SO_OPTS) \
		-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(MISCLIB)
	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(GNATRTL_TASKING_OBJS) \
		$(SO_OPTS) \
		-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
		$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
	cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
		libgnat$(soext)
	cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
		libgnarl$(soext)
	cd $(RTSDIR); dsymutil libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
	cd $(RTSDIR); dsymutil libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext)

gnatlib-shared-vms:
	$(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
             gnatlib
	$(RM) $(RTSDIR)/libgna*$(soext)
	cd $(RTSDIR) && \
	../../gnatsym -s SYMVEC_$$$$.opt \
	$(LIBGNAT_OBJS) $(GNATRTL_NONTASKING_OBJS) && \
	../../xgcc -g -B../../ -shared -shared-libgcc \
	   -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) libgnat.a \
	   sys\$$library:trace.exe \
	   --for-linker=/noinform \
	   --for-linker=SYMVEC_$$$$.opt \
	   --for-linker=gsmatch=equal,$(GSMATCH_VERSION)
	cd $(RTSDIR) && \
	../../gnatsym -s SYMVEC_$$$$.opt \
	$(GNATRTL_TASKING_OBJS) && \
	../../xgcc -g -B../../ -shared -shared-libgcc \
	   -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
	   libgnarl.a libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
	   sys\$$library:trace.exe \
	   --for-linker=/noinform \
	   --for-linker=SYMVEC_$$$$.opt \
	   --for-linker=gsmatch=equal,$(GSMATCH_VERSION)

gnatlib-shared:
	$(MAKE) $(FLAGS_TO_PASS) \
             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
             $(GNATLIB_SHARED)

gnatlib-sjlj:
	$(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" \
	THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
	sed -e 's/ZCX_By_Default.*/ZCX_By_Default            : constant Boolean := False;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
	$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
	$(MAKE) $(FLAGS_TO_PASS) \
	     EH_MECHANISM="" \
	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib

gnatlib-zcx:
	$(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \
	  THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
	sed -e 's/ZCX_By_Default.*/ZCX_By_Default            : constant Boolean := True;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
	$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
	$(MAKE) $(FLAGS_TO_PASS) \
	     EH_MECHANISM="-gcc" \
	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
	     MULTISUBDIR="$(MULTISUBDIR)" \
	     THREAD_KIND="$(THREAD_KIND)" \
	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib

# Compiling object files from source files.

# Note that dependencies on obstack.h are not written
# because that file is not part of GCC.
# Dependencies on gvarargs.h are not written
# because all that file does, when not compiling with GCC,
# is include the system varargs.h.

b_gnatl.adb : $(GNATLINK_OBJS)
	$(GNATBIND) $(ADA_INCLUDES) -o b_gnatl.adb gnatlink.ali

b_gnatl.o : b_gnatl.adb
	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
	    $< $(OUTPUT_OPTION)

b_gnatm.adb : $(GNATMAKE_OBJS)
	$(GNATBIND) $(ADA_INCLUDES) -o b_gnatm.adb gnatmake.ali

b_gnatm.o : b_gnatm.adb
	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
	    $< $(OUTPUT_OPTION)

ADA_INCLUDE_DIR = $(libsubdir)/adainclude
ADA_RTL_OBJ_DIR = $(libsubdir)/adalib

# Special flags

# force no sibling call optimization on s-traceb.o so the number of stack
# frames to be skipped when computing a call chain is not modified by
# optimization.

s-traceb.o  : s-traceb.adb s-traceb.ads
	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) \
	      $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)

# force debugging information on s-tasdeb.o so that it is always
# possible to set conditional breakpoints on tasks.

s-tasdeb.o  : s-tasdeb.adb s-tasdeb.ads
	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
	      $< $(OUTPUT_OPTION)

# force debugging information on s-vaflop.o so that it is always
# possible to call the VAX float debug print routines.
# force at least -O so that the inline assembly works.

s-vaflop.o  : s-vaflop.adb s-vaflop.ads
	$(CC) -c -O $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
	      $< $(OUTPUT_OPTION)

# force no function reordering on a-except.o because of the exclusion bounds
# mechanism (see the source file for more detailed information).
# force debugging information on a-except.o so that it is always
# possible to set conditional breakpoints on exceptions.
# use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.

a-except.o  : a-except.adb a-except.ads
	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
	      $(NO_REORDER_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)

# compile s-excdeb.o without optimization and with debug info to let the
# debugger set breakpoints and inspect subprogram parameters on exception
# related events.

s-excdeb.o  : s-excdeb.adb s-excdeb.ads s-except.ads
	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
	      $< $(OUTPUT_OPTION)

# force debugging information on s-assert.o so that it is always
# possible to set breakpoint on assert failures.

s-assert.o  : s-assert.adb s-assert.ads
	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
	      $< $(OUTPUT_OPTION)

# force debugging information on a-tags.o so that the debugger can find
# the description of Ada.Tags.Type_Specific_Data.

a-tags.o  : a-tags.adb a-tags.ads
	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
	      $< $(OUTPUT_OPTION)

# need to keep the frame pointer in this file to pop the stack properly on
# some targets.
tracebak.o  : tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
	      $(INCLUDES) -fno-omit-frame-pointer $< $(OUTPUT_OPTION)

adadecode.o : adadecode.c adadecode.h
aux-io.o  : aux-io.c
argv.o    : argv.c
cal.o     : cal.c
deftarg.o : deftarg.c
errno.o   : errno.c
exit.o    : adaint.h exit.c
expect.o  : expect.c
final.o   : final.c
locales.o : locales.c
mkdir.o   : mkdir.c
socket.o  : socket.c gsocket.h
sysdep.o  : sysdep.c
raise.o   : raise.c raise.h
sigtramp-ppcvxw.o : sigtramp-ppcvxw.c sigtramp.h
vx_stack_info.o : vx_stack_info.c

raise-gcc.o : raise-gcc.c raise.h
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
		-iquote $(srcdir) -iquote $(srcdir)/../libgcc \
		$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)

cio.o     : cio.c
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)

init.o    : init.c adaint.h raise.h
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)

initialize.o : initialize.c raise.h
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)

link.o : link.c
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
		$< $(OUTPUT_OPTION)

targext.o : targext.c
	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
		-iquote $(srcdir) \
		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
		$< $(OUTPUT_OPTION)

# In GNU Make, ignore whether `stage*' exists.
.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4

force: