mirror of
https://github.com/mirror/make.git
synced 2026-08-20 00:43:29 +08:00
Compare commits
1326 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
673e04af3a | ||
|
|
bc8ac28654 | ||
|
|
95744a1491 | ||
|
|
78f280d541 | ||
|
|
44811ac351 | ||
|
|
6cf0e549f7 | ||
|
|
25d9818333 | ||
|
|
2a905c5e5a | ||
|
|
0ddf0df13c | ||
|
|
b4dcc6f6bd | ||
|
|
c8484a6170 | ||
|
|
7431536bed | ||
|
|
678b14fb7e | ||
|
|
efbe1b6411 | ||
|
|
5fb14db85f | ||
|
|
df99d7af1f | ||
|
|
db561cfc3e | ||
|
|
0feb1dd25f | ||
|
|
e2d8bf4aa4 | ||
|
|
dc27ebc311 | ||
|
|
989d9ecaae | ||
|
|
b0098dfd6a | ||
|
|
40a08e8a62 | ||
|
|
5e728dfa57 | ||
|
|
085eac4c74 | ||
|
|
085caaa900 | ||
|
|
cc28a52f40 | ||
|
|
1e38c11f3c | ||
|
|
58af8d9dd1 | ||
|
|
abe5f64440 | ||
|
|
68b9650616 | ||
|
|
5dfa403ec8 | ||
|
|
f7ecda9a35 | ||
|
|
e99a3aca7e | ||
|
|
73c52a3b12 | ||
|
|
4679c702de | ||
|
|
59cb26b58b | ||
|
|
386e27b622 | ||
|
|
68db062e1e | ||
|
|
a67e842fb1 | ||
|
|
712c43dde1 | ||
|
|
c0e8c1012d | ||
|
|
c97502625c | ||
|
|
9e443adaf6 | ||
|
|
dfefc77263 | ||
|
|
ee7af57e3c | ||
|
|
46a1497b8e | ||
|
|
4603f9f8c6 | ||
|
|
b2a22df721 | ||
|
|
89785948f6 | ||
|
|
8b2aca5930 | ||
|
|
b8ea37e31c | ||
|
|
e044fe76f6 | ||
|
|
557392f016 | ||
|
|
eaecc11501 | ||
|
|
b25f811f51 | ||
|
|
34b0c6b3b4 | ||
|
|
2de9513b20 | ||
|
|
8eb20e9d92 | ||
|
|
32979e8122 | ||
|
|
490f35dda4 | ||
|
|
a579af186b | ||
|
|
01d08292bc | ||
|
|
f9c4aae3bf | ||
|
|
74e456e107 | ||
|
|
f8b096b9fd | ||
|
|
527201342c | ||
|
|
5f1e98e59b | ||
|
|
f4020bfba8 | ||
|
|
4792e6f5c0 | ||
|
|
514eda2bda | ||
|
|
310f677b84 | ||
|
|
f323abd6b3 | ||
|
|
b07e961db1 | ||
|
|
5958f28900 | ||
|
|
fd504b4d84 | ||
|
|
1bb24cbbbb | ||
|
|
b255a75bab | ||
|
|
0569ceb303 | ||
|
|
8021c41954 | ||
|
|
edd7981e49 | ||
|
|
715363eb49 | ||
|
|
c36430699e | ||
|
|
5f99dee5b5 | ||
|
|
9521ecc573 | ||
|
|
cb69b06199 | ||
|
|
21fed1fbcc | ||
|
|
17aef36902 | ||
|
|
98f8d6286e | ||
|
|
d96d52d27d | ||
|
|
625b9f6ba2 | ||
|
|
8756e81616 | ||
|
|
3e141c8277 | ||
|
|
aaed50ac3f | ||
|
|
a89eb21084 | ||
|
|
4356ddddbc | ||
|
|
b8db661c24 | ||
|
|
a54c552d39 | ||
|
|
25d48503eb | ||
|
|
5df0d41985 | ||
|
|
737e056a89 | ||
|
|
8c13a20895 | ||
|
|
2a0707e1b8 | ||
|
|
d116acac75 | ||
|
|
6ab25d18b2 | ||
|
|
4061695ef6 | ||
|
|
e3200b9303 | ||
|
|
18a7013e55 | ||
|
|
624552badd | ||
|
|
76d037cb95 | ||
|
|
dfdf1bec21 | ||
|
|
caa2fe5d39 | ||
|
|
2f506a6d52 | ||
|
|
856d83462f | ||
|
|
e9fcf7ea88 | ||
|
|
bfa6ab6a0c | ||
|
|
4e6de57b8f | ||
|
|
41e6704efd | ||
|
|
ffea662953 | ||
|
|
db5cc03f75 | ||
|
|
cd851988e7 | ||
|
|
fb39f49937 | ||
|
|
dccc12dbee | ||
|
|
1305447ace | ||
|
|
5ed1a6399a | ||
|
|
3f614c58ed | ||
|
|
37cf6fdc18 | ||
|
|
808f1c1cd2 | ||
|
|
06021f945f | ||
|
|
ad61285598 | ||
|
|
10d6808977 | ||
|
|
21fbad8602 | ||
|
|
fa6d6f9150 | ||
|
|
ed02723506 | ||
|
|
692858922f | ||
|
|
9da3bccd89 | ||
|
|
16a5d4cf48 | ||
|
|
b1e6353edd | ||
|
|
e1c593016b | ||
|
|
10124ce95b | ||
|
|
6e19c6febb | ||
|
|
4314e2f987 | ||
|
|
0eab889a28 | ||
|
|
c51dd24814 | ||
|
|
41ea0f1556 | ||
|
|
ee6b27b728 | ||
|
|
af72fc38fe | ||
|
|
294c429f93 | ||
|
|
9409f5c54a | ||
|
|
78ac5bd9c7 | ||
|
|
030d31ba93 | ||
|
|
70465ffcfb | ||
|
|
ee2b67af6d | ||
|
|
0afe62e255 | ||
|
|
ee14af651f | ||
|
|
9fd3c2453b | ||
|
|
a4e66c61c0 | ||
|
|
8cfdca3e72 | ||
|
|
2c27d8dbdc | ||
|
|
d02b26a4b8 | ||
|
|
8b3f13f6ec | ||
|
|
e74b6ae5c2 | ||
|
|
f21ec15ffa | ||
|
|
3f49392b9c | ||
|
|
f9a914c035 | ||
|
|
b2fc502c55 | ||
|
|
d091a08961 | ||
|
|
eb3b7904f0 | ||
|
|
bbfb270092 | ||
|
|
c18253b59b | ||
|
|
41177916df | ||
|
|
7acd99c5e6 | ||
|
|
d6c62b351f | ||
|
|
c9c43b0871 | ||
|
|
13e8568f03 | ||
|
|
cebdba9dfa | ||
|
|
4ea152e71b | ||
|
|
443f39f4f7 | ||
|
|
675981bc4f | ||
|
|
11af972f87 | ||
|
|
d9c126da40 | ||
|
|
7170467928 | ||
|
|
81699266d3 | ||
|
|
cbdb3653da | ||
|
|
5d82479d89 | ||
|
|
ed0d607279 | ||
|
|
855bd6896d | ||
|
|
179ef370e8 | ||
|
|
01dc9a22f9 | ||
|
|
bc15ada5ed | ||
|
|
fce5e4a9b9 | ||
|
|
07a45cd0af | ||
|
|
226a132e31 | ||
|
|
b59f5f30b9 | ||
|
|
acdd73ea34 | ||
|
|
38b5b27eb5 | ||
|
|
e8325b9be2 | ||
|
|
f8eb0fc41b | ||
|
|
ea38e1fe78 | ||
|
|
ed276c008d | ||
|
|
910d25619e | ||
|
|
2ae5430550 | ||
|
|
e53ac8a6fc | ||
|
|
cb51d55ab2 | ||
|
|
0b4723a689 | ||
|
|
3f9ce84b4a | ||
|
|
bdbe8501c6 | ||
|
|
3a12be3a73 | ||
|
|
2346f99368 | ||
|
|
d855846472 | ||
|
|
b9f7d21e42 | ||
|
|
db089ad3e3 | ||
|
|
1331cca1fa | ||
|
|
fe05aaf7f2 | ||
|
|
cc35ff7381 | ||
|
|
a146085382 | ||
|
|
79fcb77ad1 | ||
|
|
3608635ec6 | ||
|
|
ca53696814 | ||
|
|
61dac07200 | ||
|
|
9e42026e08 | ||
|
|
b52ea79ee6 | ||
|
|
e483431569 | ||
|
|
28b622b8a1 | ||
|
|
cbfc50cb51 | ||
|
|
deb7cced6e | ||
|
|
f9af56ac67 | ||
|
|
3ba2e947ac | ||
|
|
13d0eeb8e5 | ||
|
|
d9f063656b | ||
|
|
aceefb74da | ||
|
|
f38d98e988 | ||
|
|
ff8ff73e65 | ||
|
|
8478b0c10a | ||
|
|
1adf3a07dc | ||
|
|
a5a27a893d | ||
|
|
595f7598ae | ||
|
|
8bc1a424e2 | ||
|
|
5e69859273 | ||
|
|
3a0f9ce0cb | ||
|
|
3aabdf96a1 | ||
|
|
55b99d4151 | ||
|
|
f3699ad75f | ||
|
|
0af0c8dba0 | ||
|
|
1280ee49bb | ||
|
|
8fc1187283 | ||
|
|
e8dcf11ae0 | ||
|
|
ce40d6af9f | ||
|
|
636435e5c2 | ||
|
|
0733d6947d | ||
|
|
b91d62feb3 | ||
|
|
f6d5cdba19 | ||
|
|
fcb29e5e96 | ||
|
|
d7a043b46c | ||
|
|
d85ab5953a | ||
|
|
93dd485ab6 | ||
|
|
5c350f4fd5 | ||
|
|
514c4bac33 | ||
|
|
8f24715a10 | ||
|
|
4c7f18cd09 | ||
|
|
c5af4810ff | ||
|
|
551c4322cb | ||
|
|
e33c50b1e2 | ||
|
|
bc1e6b66f1 | ||
|
|
bbd5e695f5 | ||
|
|
f3cfccf0b8 | ||
|
|
016e1beef5 | ||
|
|
21a8ec0d72 | ||
|
|
fecd9e661a | ||
|
|
2914c705e5 | ||
|
|
3f506aaf90 | ||
|
|
75ea6c3ce2 | ||
|
|
3fb9ebf83f | ||
|
|
b4890bdb1c | ||
|
|
2cbfa1024a | ||
|
|
258dad0f9a | ||
|
|
37358a9a82 | ||
|
|
e167e0a3c2 | ||
|
|
7879457545 | ||
|
|
d525f4dd72 | ||
|
|
bd19554ea7 | ||
|
|
fffc384bfc | ||
|
|
afd1d69e7d | ||
|
|
c1305a1a18 | ||
|
|
43d5fbfc88 | ||
|
|
a4642a6a57 | ||
|
|
11ca7f1ead | ||
|
|
4aa992616f | ||
|
|
ab0fb2fa6f | ||
|
|
e1dd3bfa4a | ||
|
|
86238ec9d3 | ||
|
|
2e9779fdb4 | ||
|
|
b61a13463d | ||
|
|
d3b9c35c8f | ||
|
|
c50b75b439 | ||
|
|
7376280c33 | ||
|
|
3c767901f6 | ||
|
|
c6dfff5f1b | ||
|
|
74540a1e91 | ||
|
|
5159db0aa4 | ||
|
|
e495d2380d | ||
|
|
1ed34a0118 | ||
|
|
e8f64b2c88 | ||
|
|
4867409da2 | ||
|
|
f801fc3521 | ||
|
|
b2c0446e71 | ||
|
|
8f98ceb724 | ||
|
|
dea9990bc8 | ||
|
|
e4c43aab3e | ||
|
|
e55ed78080 | ||
|
|
ca54a0b991 | ||
|
|
e25e2fb7f5 | ||
|
|
1a886b6359 | ||
|
|
b511712f25 | ||
|
|
30fcca501f | ||
|
|
806dc4f7c4 | ||
|
|
c0163410d2 | ||
|
|
eac1e9ee66 | ||
|
|
8ad5af7c28 | ||
|
|
857d7ad256 | ||
|
|
612a29e0dd | ||
|
|
462304918c | ||
|
|
9d36c92adb | ||
|
|
640c4ecd99 | ||
|
|
07f09cfd88 | ||
|
|
d37c9ba18a | ||
|
|
cc8d6cf343 | ||
|
|
4b17f0982b | ||
|
|
dc576b2051 | ||
|
|
a543a2ae9f | ||
|
|
0e352e4bf7 | ||
|
|
3f8bde0f25 | ||
|
|
4308542cb1 | ||
|
|
e622fcf22e | ||
|
|
1766b7fa59 | ||
|
|
fa999783d7 | ||
|
|
e97d6632b5 | ||
|
|
e3d013a79a | ||
|
|
9807a2869f | ||
|
|
e9521d3447 | ||
|
|
c62ca42327 | ||
|
|
2feb36f620 | ||
|
|
f40918e005 | ||
|
|
b13a443fa7 | ||
|
|
e938a511be | ||
|
|
a96d572aa6 | ||
|
|
990c39d973 | ||
|
|
24d37fb493 | ||
|
|
c1e20276cb | ||
|
|
9f71eaf6b5 | ||
|
|
03cd08cca2 | ||
|
|
dc44a79020 | ||
|
|
8ed6e13cfe | ||
|
|
b321e0f535 | ||
|
|
c1433e9495 | ||
|
|
e4a94e0210 | ||
|
|
9e97330bcb | ||
|
|
4969b416b8 | ||
|
|
0bd0301ae3 | ||
|
|
ff6efbadf5 | ||
|
|
0b3317d2e1 | ||
|
|
ca5a872280 | ||
|
|
4244f182f2 | ||
|
|
be6e6d74bb | ||
|
|
4c0fef3dd7 | ||
|
|
d3b65c3cb7 | ||
|
|
bc48185f8e | ||
|
|
6fcf219fa7 | ||
|
|
d2e23eefd2 | ||
|
|
55162a6730 | ||
|
|
021ea7e61c | ||
|
|
f663464925 | ||
|
|
5d435e0859 | ||
|
|
a2ab31ba62 | ||
|
|
da2ea1ea7f | ||
|
|
21a1b3b255 | ||
|
|
c8e76a708e | ||
|
|
461cffc4e9 | ||
|
|
cdd25d1fb3 | ||
|
|
9a3666d550 | ||
|
|
90dffad2cc | ||
|
|
c1f2ef6d09 | ||
|
|
51250a676d | ||
|
|
d2461a2409 | ||
|
|
fdea69c5fa | ||
|
|
7c7552336d | ||
|
|
535dcf6a22 | ||
|
|
84091971f9 | ||
|
|
61da194af9 | ||
|
|
30c1465265 | ||
|
|
b574b8ea5a | ||
|
|
710e8e6f6f | ||
|
|
4a8a7637f3 | ||
|
|
6348923799 | ||
|
|
660a23d649 | ||
|
|
5bd9836fba | ||
|
|
0cb47363e1 | ||
|
|
fff5a9ece0 | ||
|
|
e3a24fc596 | ||
|
|
bb38b0c253 | ||
|
|
d2ed03e72a | ||
|
|
e72213687f | ||
|
|
491d66a916 | ||
|
|
f4fb1be3d8 | ||
|
|
10abeb4a08 | ||
|
|
a369402d11 | ||
|
|
fe3962cf54 | ||
|
|
cf76b42f2b | ||
|
|
fb088e4526 | ||
|
|
f2804372bd | ||
|
|
c25db14264 | ||
|
|
e83c7d40cd | ||
|
|
65d0cd98a9 | ||
|
|
ec505152e0 | ||
|
|
0d2488a804 | ||
|
|
bc5f054132 | ||
|
|
e812d40f9f | ||
|
|
b12c639bb2 | ||
|
|
dd841ded6f | ||
|
|
3c9e8b266a | ||
|
|
e6bce5ef88 | ||
|
|
bdff21b09a | ||
|
|
408e868fd2 | ||
|
|
cf63c0c966 | ||
|
|
d2e496cc01 | ||
|
|
ac336f7a9c | ||
|
|
8f581d3bc0 | ||
|
|
b2522ec319 | ||
|
|
117d4e0f36 | ||
|
|
9b0a99a051 | ||
|
|
5c807f5457 | ||
|
|
7eeab2fbe1 | ||
|
|
f6716d5e74 | ||
|
|
be451f6d29 | ||
|
|
eb0dbf1993 | ||
|
|
5ebd380d7a | ||
|
|
cbfe6d75f6 | ||
|
|
716e804b5b | ||
|
|
4848c19870 | ||
|
|
bca4e882ba | ||
|
|
eb08818828 | ||
|
|
b86e35d2a6 | ||
|
|
f5b14eee67 | ||
|
|
118439508b | ||
|
|
f875c95115 | ||
|
|
f2c10dedf0 | ||
|
|
37c95f6d39 | ||
|
|
22846c7022 | ||
|
|
fd025b9089 | ||
|
|
6dc8e442f2 | ||
|
|
4e4b1ed670 | ||
|
|
3580cdedd8 | ||
|
|
108cca9aa5 | ||
|
|
98104e4d2e | ||
|
|
dc8983dc8b | ||
|
|
0513e29593 | ||
|
|
087ef58502 | ||
|
|
298a8363ff | ||
|
|
ebe1ed2e49 | ||
|
|
6a7b0d623b | ||
|
|
f0c1a986db | ||
|
|
e7defc873b | ||
|
|
4b4d5bcd0a | ||
|
|
d3fbc4f345 | ||
|
|
227cffec2b | ||
|
|
5d3189c952 | ||
|
|
c71c43c0b5 | ||
|
|
1944def8db | ||
|
|
4b7d940657 | ||
|
|
d68bb0895b | ||
|
|
29b051dc0c | ||
|
|
8e1432e250 | ||
|
|
015d472119 | ||
|
|
7aca4a343d | ||
|
|
92c245ab98 | ||
|
|
3bb79f5823 | ||
|
|
554f67bc64 | ||
|
|
5ee9dc7472 | ||
|
|
bb55335906 | ||
|
|
b5665419ba | ||
|
|
7f534ea595 | ||
|
|
23e64a0b13 | ||
|
|
1c0df127f8 | ||
|
|
68a5f2a17a | ||
|
|
50bb35c3e3 | ||
|
|
fc99c2260b | ||
|
|
f178779347 | ||
|
|
90829c3577 | ||
|
|
7c1f91ced2 | ||
|
|
b4ccaac8da | ||
|
|
2932fb1bca | ||
|
|
db98fe95a4 | ||
|
|
66784463c0 | ||
|
|
fe450df425 | ||
|
|
c9f149173f | ||
|
|
9ee5e4d17d | ||
|
|
96d67bce90 | ||
|
|
a0ab37fcd6 | ||
|
|
65b8056203 | ||
|
|
4f752036ac | ||
|
|
b8c55666a7 | ||
|
|
08e7a4fcdd | ||
|
|
386d0a7ffc | ||
|
|
c33908dea5 | ||
|
|
1bc63e8cc7 | ||
|
|
ad87633b72 | ||
|
|
21eecea26d | ||
|
|
d519e2c19b | ||
|
|
cf9bc4ae2f | ||
|
|
2a19159394 | ||
|
|
8e73c0981b | ||
|
|
f935610ca9 | ||
|
|
12113c5925 | ||
|
|
63160928cd | ||
|
|
48fe766053 | ||
|
|
acd7330a5f | ||
|
|
78454538f9 | ||
|
|
a7bafcee76 | ||
|
|
4394c7a32d | ||
|
|
38abf5e6c4 | ||
|
|
58c146fa50 | ||
|
|
e612cccef3 | ||
|
|
960650331a | ||
|
|
462e175970 | ||
|
|
a1749c85c8 | ||
|
|
c727af1bcc | ||
|
|
8cb881fa9e | ||
|
|
3aeb946943 | ||
|
|
9012e6a254 | ||
|
|
251b0fc75f | ||
|
|
f7a6c58f5b | ||
|
|
0ddf761563 | ||
|
|
58d81fe699 | ||
|
|
4daf275edd | ||
|
|
d27b2c3de5 | ||
|
|
7c456a7368 | ||
|
|
a8c24526e3 | ||
|
|
9e7e303ac8 | ||
|
|
a3d7dfa85c | ||
|
|
88054f8ad3 | ||
|
|
f5e7fb8ea0 | ||
|
|
7cb595fc60 | ||
|
|
4cbe738cfb | ||
|
|
0f83ab90e3 | ||
|
|
0e15559bbf | ||
|
|
eaba9405d7 | ||
|
|
492f92b9ec | ||
|
|
cc5be7c0cd | ||
|
|
f8300f1e1c | ||
|
|
7f71af7974 | ||
|
|
065ac461c5 | ||
|
|
f8c3e52b0f | ||
|
|
1775c102ad | ||
|
|
2a53aecb26 | ||
|
|
3087dcdb2e | ||
|
|
5174a5e5a1 | ||
|
|
b018db955c | ||
|
|
0da218acc1 | ||
|
|
9fc36f7358 | ||
|
|
ec2751c045 | ||
|
|
7b91e889b6 | ||
|
|
16667d15e0 | ||
|
|
b9337d3143 | ||
|
|
2bf7e9bcda | ||
|
|
b24a026b02 | ||
|
|
0ef3708713 | ||
|
|
2012e2877c | ||
|
|
ba45b6e5fa | ||
|
|
308e6149e6 | ||
|
|
cbbf3ee5ef | ||
|
|
8171a9ba6e | ||
|
|
8788690192 | ||
|
|
769061023a | ||
|
|
ba2c317cb7 | ||
|
|
aea1502a78 | ||
|
|
9dcfb711c1 | ||
|
|
4d8fff0ec0 | ||
|
|
3c954a048b | ||
|
|
2f8d1abe7c | ||
|
|
d2654362c5 | ||
|
|
1bafe5ed81 | ||
|
|
869ec1b877 | ||
|
|
3cc0c7306a | ||
|
|
c52575a837 | ||
|
|
6d00f337e5 | ||
|
|
b6e638af6d | ||
|
|
5fc2539281 | ||
|
|
0bab40c121 | ||
|
|
8980e49036 | ||
|
|
84b4d9cce4 | ||
|
|
92a67d1895 | ||
|
|
22cd0cd4e3 | ||
|
|
e75d998e50 | ||
|
|
ae087fbb2f | ||
|
|
714aeaf857 | ||
|
|
cbeeeafde9 | ||
|
|
572856fa8f | ||
|
|
1d9b68aef5 | ||
|
|
e813da324d | ||
|
|
b018243a45 | ||
|
|
9326e8fec5 | ||
|
|
5cf5f261d9 | ||
|
|
e22a936ca5 | ||
|
|
9f33e6cdcb | ||
|
|
16777bbe0f | ||
|
|
e851ef2303 | ||
|
|
1681a1f29a | ||
|
|
acb8140655 | ||
|
|
245d0b3772 | ||
|
|
96fb58e401 | ||
|
|
02d19fe9c1 | ||
|
|
32b80e7367 | ||
|
|
7c30adcd57 | ||
|
|
8153755c17 | ||
|
|
2a983b8ead | ||
|
|
bd395b5c02 | ||
|
|
d24f1f2330 | ||
|
|
cace096aba | ||
|
|
f0929a13c3 | ||
|
|
7a031cd4b2 | ||
|
|
fc8fa16253 | ||
|
|
ca3b88c66a | ||
|
|
f7f63b75b5 | ||
|
|
250e638f44 | ||
|
|
0a0130dcf2 | ||
|
|
aef2a1ccd0 | ||
|
|
2ef2fbe7a4 | ||
|
|
c3b30f576d | ||
|
|
c2cc8e33fb | ||
|
|
af7ef68647 | ||
|
|
9a6b8d1015 | ||
|
|
3296fa1dff | ||
|
|
5a4a5d3160 | ||
|
|
3a511f5874 | ||
|
|
2b8f817cfb | ||
|
|
7789ea8a3c | ||
|
|
5003c9b26b | ||
|
|
d92b741fce | ||
|
|
aa68ee5ce2 | ||
|
|
26c6ec1893 | ||
|
|
86d4d7425b | ||
|
|
f84518396b | ||
|
|
2e0e3d22ec | ||
|
|
d3fc910b29 | ||
|
|
9c32a4c3cd | ||
|
|
54462c9590 | ||
|
|
ae112a5cb5 | ||
|
|
4ac6d66244 | ||
|
|
08c71a7dbf | ||
|
|
5b5415bf87 | ||
|
|
f64cd37b29 | ||
|
|
8bd226777e | ||
|
|
e176cf73a5 | ||
|
|
d66f4e3407 | ||
|
|
4abb5e433f | ||
|
|
46a5b5adcc | ||
|
|
4694e31659 | ||
|
|
3d6b586776 | ||
|
|
c4cc2ec376 | ||
|
|
4a94240844 | ||
|
|
6fc0ab541e | ||
|
|
5b4a918d26 | ||
|
|
bd3309f09b | ||
|
|
122c9699fa | ||
|
|
e2f08f5dbf | ||
|
|
7089c07d4e | ||
|
|
f363e41c27 | ||
|
|
24cd5ede9e | ||
|
|
f4fac65746 | ||
|
|
f6b549870a | ||
|
|
074d147ef7 | ||
|
|
55f5d979ae | ||
|
|
00dc97cb8a | ||
|
|
9766fe1775 | ||
|
|
b5fb6b260e | ||
|
|
6382676838 | ||
|
|
14f2b39dff | ||
|
|
9697738544 | ||
|
|
4a9fdcd65f | ||
|
|
80091295df | ||
|
|
3c11aba3cd | ||
|
|
54fb272967 | ||
|
|
e12d722d99 | ||
|
|
8a5a2b9b8d | ||
|
|
0246a6dc63 | ||
|
|
60c868c193 | ||
|
|
1e71bdd085 | ||
|
|
b0a9db44b6 | ||
|
|
f846c07d43 | ||
|
|
dfc8da6e0e | ||
|
|
8960f971ca | ||
|
|
ff71fe9277 | ||
|
|
fe92d8e656 | ||
|
|
f0080188b7 | ||
|
|
5a55f43ddc | ||
|
|
63b6de85b5 | ||
|
|
29acbbea8d | ||
|
|
e66d29867e | ||
|
|
0bcabeb134 | ||
|
|
e90a315ebe | ||
|
|
b06b92566c | ||
|
|
8aa529e55e | ||
|
|
03acd42408 | ||
|
|
bc0276c3cb | ||
|
|
3d952e5879 | ||
|
|
3f15ef960a | ||
|
|
fa67064dc6 | ||
|
|
5340230f6b | ||
|
|
7162378126 | ||
|
|
534926ac7a | ||
|
|
5580266222 | ||
|
|
6c6f210456 | ||
|
|
c5c92b71ce | ||
|
|
369bb2a609 | ||
|
|
5c82e72caa | ||
|
|
ca5b7c487d | ||
|
|
9596950898 | ||
|
|
29de1a7e5a | ||
|
|
f1daf67200 | ||
|
|
e8c11d4e32 | ||
|
|
481e0e7d22 | ||
|
|
2b81718876 | ||
|
|
6ee7823efe | ||
|
|
683e4a5de9 | ||
|
|
548b4c9bf1 | ||
|
|
fba3960a6a | ||
|
|
0986bb2c43 | ||
|
|
5532d1d11d | ||
|
|
dab0d4214e | ||
|
|
088a491f10 | ||
|
|
681f7a3067 | ||
|
|
ada4528484 | ||
|
|
1386d961a9 | ||
|
|
828b45420a | ||
|
|
e9f008dc04 | ||
|
|
44ecfc2f36 | ||
|
|
e28495225d | ||
|
|
c190a98796 | ||
|
|
a03f503fb7 | ||
|
|
04789f11cd | ||
|
|
f02ced5786 | ||
|
|
2fae4442e2 | ||
|
|
f138f0eeff | ||
|
|
ea1e49e5a8 | ||
|
|
9bd8004ded | ||
|
|
596d50cb1c | ||
|
|
48f4ce2825 | ||
|
|
d8b7640a81 | ||
|
|
8c01d0459a | ||
|
|
e4dce6fa11 | ||
|
|
7831181410 | ||
|
|
2cc84f7c97 | ||
|
|
5136f317d2 | ||
|
|
ae7b53245a | ||
|
|
542a0f8112 | ||
|
|
2ed0333f3c | ||
|
|
791928d60b | ||
|
|
de21395cad | ||
|
|
5973c4e97a | ||
|
|
6dbdf2caa8 | ||
|
|
6ed99f4d40 | ||
|
|
3f0a207eaf | ||
|
|
07c6b685b7 | ||
|
|
0c1c2ff3d0 | ||
|
|
d1a988ce9f | ||
|
|
ae1278315f | ||
|
|
164dcdad22 | ||
|
|
f3bd744187 | ||
|
|
722018bdbe | ||
|
|
bfe005e8a0 | ||
|
|
f9b50f6436 | ||
|
|
28c125b725 | ||
|
|
ab9034ef4e | ||
|
|
19c3ead040 | ||
|
|
63b17f1d63 | ||
|
|
3e9cf581d1 | ||
|
|
e7b737dc5e | ||
|
|
1a56335cbf | ||
|
|
4b30933904 | ||
|
|
094f89cee5 | ||
|
|
36a66b6bec | ||
|
|
69105addb4 | ||
|
|
e4c66e2f88 | ||
|
|
d5ef06dee5 | ||
|
|
7c675f86e6 | ||
|
|
60a76e0d39 | ||
|
|
c88072ca74 | ||
|
|
a609f1f9c2 | ||
|
|
2413679845 | ||
|
|
b50f2fc0a6 | ||
|
|
4034f2bdfb | ||
|
|
b2361b3591 | ||
|
|
ed70d6422c | ||
|
|
17bc902648 | ||
|
|
db6a102206 | ||
|
|
ded09420ad | ||
|
|
078cc29e60 | ||
|
|
bede66b709 | ||
|
|
cc1433e808 | ||
|
|
4f1320fba2 | ||
|
|
b8a4e2bb0e | ||
|
|
720b21097c | ||
|
|
162269418e | ||
|
|
580e2a7391 | ||
|
|
d870f4df8c | ||
|
|
309a65a790 | ||
|
|
963f33c909 | ||
|
|
af73694245 | ||
|
|
a4f557cb63 | ||
|
|
d47d6051a3 | ||
|
|
87bb5a6259 | ||
|
|
708c7c90a3 | ||
|
|
573ddaf6da | ||
|
|
db545dffcc | ||
|
|
f7ee7d26a5 | ||
|
|
15d4ec2322 | ||
|
|
88ae51cb2e | ||
|
|
657338f0c9 | ||
|
|
fe356384aa | ||
|
|
69e442ec90 | ||
|
|
8b738924b0 | ||
|
|
afa97833cc | ||
|
|
3c516ccd35 | ||
|
|
dfaa02a8d5 | ||
|
|
50d1798203 | ||
|
|
85da8b0b54 | ||
|
|
ddd3143498 | ||
|
|
cd493b3d8f | ||
|
|
6a44c4b672 | ||
|
|
2603a60526 | ||
|
|
9a1a8d0dc6 | ||
|
|
7444af63fc | ||
|
|
ae0045f50e | ||
|
|
2c132055ef | ||
|
|
09e4a320e6 | ||
|
|
c1e3141433 | ||
|
|
c316ab7609 | ||
|
|
cf197b7550 | ||
|
|
c653200459 | ||
|
|
0b396e2587 | ||
|
|
6090eb3125 | ||
|
|
21c1a55665 | ||
|
|
c50958dd46 | ||
|
|
d56535498b | ||
|
|
81e8efbcdf | ||
|
|
c308b3a5f3 | ||
|
|
f48fcf5f45 | ||
|
|
4d36cfe6a3 | ||
|
|
2370f79846 | ||
|
|
b758dc3f8b | ||
|
|
e8a9cedc6a | ||
|
|
44078a3441 | ||
|
|
ce25808caa | ||
|
|
c2b69b5d9d | ||
|
|
6925f7153a | ||
|
|
5460cd5a00 | ||
|
|
2861ad6208 | ||
|
|
37d9554e31 | ||
|
|
633efa004c | ||
|
|
800a9e957d | ||
|
|
8ea8c0372a | ||
|
|
4dd2ed0ad1 | ||
|
|
bbf2720b4d | ||
|
|
5893545370 | ||
|
|
6ef5854e47 | ||
|
|
5c44db1b5f | ||
|
|
f0c68224d6 | ||
|
|
bb90ac7aef | ||
|
|
4694e3fe2e | ||
|
|
fae8065d7f | ||
|
|
099b4d5643 | ||
|
|
5e83d8b10a | ||
|
|
4c84e13064 | ||
|
|
ef028aa4c6 | ||
|
|
2bff7aa420 | ||
|
|
e07db8077c | ||
|
|
35ffa6973a | ||
|
|
402b400e52 | ||
|
|
6b6a4f1de2 | ||
|
|
ab6a618dac | ||
|
|
45572fa600 | ||
|
|
36a6a9eb7d | ||
|
|
7c91702697 | ||
|
|
71fceb51e3 | ||
|
|
9705781777 | ||
|
|
76ae16dee3 | ||
|
|
035157a2fd | ||
|
|
50a643208f | ||
|
|
92cd154b95 | ||
|
|
d07b95da6f | ||
|
|
2f22bfeaaa | ||
|
|
fcedb448bb | ||
|
|
5a4ab813f0 | ||
|
|
99369403b7 | ||
|
|
adde98d27b | ||
|
|
e2622b0fea | ||
|
|
99afb91aca | ||
|
|
1632e7feb3 | ||
|
|
9403ef9942 | ||
|
|
c8d4d2305d | ||
|
|
f341a61976 | ||
|
|
5778d6cdb9 | ||
|
|
f2bc0a0c93 | ||
|
|
d8817e2c39 | ||
|
|
5b45a568c0 | ||
|
|
d19c2ef049 | ||
|
|
c0c67164d5 | ||
|
|
93385de9ff | ||
|
|
9edb745a71 | ||
|
|
d315acf15e | ||
|
|
aa8a3b306d | ||
|
|
89b66be8b3 | ||
|
|
b313929074 | ||
|
|
8c6ef34e56 | ||
|
|
f4f6b2b97e | ||
|
|
c2dbc39224 | ||
|
|
2d89aa53df | ||
|
|
52930ae3a9 | ||
|
|
ede645439a | ||
|
|
95614c2e7c | ||
|
|
37fb62e217 | ||
|
|
555a705aaa | ||
|
|
123f70c521 | ||
|
|
02caa22338 | ||
|
|
38f78c7be1 | ||
|
|
fd5c585cab | ||
|
|
0aa6e8609e | ||
|
|
40463f4410 | ||
|
|
01e07f8ae2 | ||
|
|
f75288402e | ||
|
|
63fec5f467 | ||
|
|
b0a8c63bf2 | ||
|
|
2d038ae579 | ||
|
|
50f2c1fbd9 | ||
|
|
40507f313a | ||
|
|
11404035d1 | ||
|
|
3cc78a1a0f | ||
|
|
501241725a | ||
|
|
501732ca84 | ||
|
|
17d92fd05b | ||
|
|
d0d141ea5b | ||
|
|
97f458f27e | ||
|
|
da96d5b5bb | ||
|
|
68aec7ab65 | ||
|
|
c1d26a2bde | ||
|
|
dfdedfe97a | ||
|
|
8c4eb82fb8 | ||
|
|
2b42e280e8 | ||
|
|
289417e089 | ||
|
|
1faf31158c | ||
|
|
0a7da8a929 | ||
|
|
a3254ad7b3 | ||
|
|
b8b8ba69d4 | ||
|
|
081275c58e | ||
|
|
968e9fce6c | ||
|
|
b81f248c35 | ||
|
|
fa0cf27f72 | ||
|
|
4cbb8e0d70 | ||
|
|
4a970dc04e | ||
|
|
4125f8f08e | ||
|
|
45649948db | ||
|
|
7d8fafa4b7 | ||
|
|
9e258d2369 | ||
|
|
1ab478ef48 | ||
|
|
ecc3b33299 | ||
|
|
424bcccf98 | ||
|
|
d13ecbbb67 | ||
|
|
09fe55be99 | ||
|
|
1efb91cda6 | ||
|
|
3d72bcb583 | ||
|
|
2fbb3407dd | ||
|
|
9d58debbcc | ||
|
|
07a309961b | ||
|
|
eae9bb14a2 | ||
|
|
a401a5e46a | ||
|
|
019a25fa84 | ||
|
|
a8993377f7 | ||
|
|
8c9b95d07e | ||
|
|
db8c8b2ad8 | ||
|
|
55b9f37c35 | ||
|
|
815ee70d7d | ||
|
|
04b7426dfa | ||
|
|
0e4062c177 | ||
|
|
cff0af8d6d | ||
|
|
8b591a8b90 | ||
|
|
deefc22d2f | ||
|
|
a485ade084 | ||
|
|
b45d1ae3c2 | ||
|
|
7db4dd0dbd | ||
|
|
348caf1627 | ||
|
|
6683a1c8db | ||
|
|
d3543bc097 | ||
|
|
6247727678 | ||
|
|
67516d5331 | ||
|
|
e7f3e4a031 | ||
|
|
b0a49baf2f | ||
|
|
d9ffca6d79 | ||
|
|
dba6ec5d0c | ||
|
|
953f1c7df0 | ||
|
|
81acf8675a | ||
|
|
f31ff1c1c4 | ||
|
|
8140043344 | ||
|
|
29002aca14 | ||
|
|
a39f01fb1d | ||
|
|
b13de88757 | ||
|
|
b3747a6bdb | ||
|
|
112dd3508d | ||
|
|
46ccc784fe | ||
|
|
9603279fb8 | ||
|
|
e567c8d914 | ||
|
|
21d566bf51 | ||
|
|
313e5ec45d | ||
|
|
b0cafff1bf | ||
|
|
f683e78f53 | ||
|
|
be0d85ba3e | ||
|
|
6a0cfeb0f2 | ||
|
|
1f534482de | ||
|
|
144b6ecba5 | ||
|
|
53f7c27956 | ||
|
|
44251cbc0c | ||
|
|
a1849dfc5f | ||
|
|
e7930bea3a | ||
|
|
d8f06cf21f | ||
|
|
44653ac71b | ||
|
|
7f0fe7f44d | ||
|
|
47839c882d | ||
|
|
e547c81b9a | ||
|
|
b52b376cf1 | ||
|
|
e80a2e9424 | ||
|
|
e30c4023e1 | ||
|
|
5aa595c99b | ||
|
|
a301f9327a | ||
|
|
602d1e18af | ||
|
|
178a758738 | ||
|
|
381a6bbfb4 | ||
|
|
f4a089447d | ||
|
|
d080dd0182 | ||
|
|
37bfd879df | ||
|
|
4d345bdee3 | ||
|
|
e222f10616 | ||
|
|
9869db36e9 | ||
|
|
2ebdf6de85 | ||
|
|
db7633eac4 | ||
|
|
8fbb772041 | ||
|
|
3c660b4d55 | ||
|
|
0fad0bd5c5 | ||
|
|
1fa7491d02 | ||
|
|
1292aa1e4b | ||
|
|
0c61dffcb5 | ||
|
|
30016eef42 | ||
|
|
781ce7f4a8 | ||
|
|
c76d6785de | ||
|
|
81731a29d1 | ||
|
|
ad93a01fa6 | ||
|
|
423783c913 | ||
|
|
ccff1cc0d2 | ||
|
|
47707f76cb | ||
|
|
3241a91312 | ||
|
|
b732b99c0b | ||
|
|
b001b6a55a | ||
|
|
24c9aabe16 | ||
|
|
92df7dd504 | ||
|
|
fba924717c | ||
|
|
e07d203a2f | ||
|
|
92546f9ff9 | ||
|
|
849b2101e6 | ||
|
|
09a534168f | ||
|
|
a98a648754 | ||
|
|
f4c3f77b96 | ||
|
|
b95e47d401 | ||
|
|
8aff0091fc | ||
|
|
bc8c4949b7 | ||
|
|
f44c1d9366 | ||
|
|
5329b592b7 | ||
|
|
39e2dbb7b3 | ||
|
|
47db5afe4f | ||
|
|
19142fcfd4 | ||
|
|
2283b32986 | ||
|
|
2e5f56539d | ||
|
|
a63f4e1f9c | ||
|
|
1d2e7e6142 | ||
|
|
099b302768 | ||
|
|
c29174d96b | ||
|
|
cda455684c | ||
|
|
0858bbcfb5 | ||
|
|
f23e838c15 | ||
|
|
5814d65428 | ||
|
|
f8197823a4 | ||
|
|
b408ee65f6 | ||
|
|
0f045633a7 | ||
|
|
62e8630bdc | ||
|
|
eb7484abc4 | ||
|
|
8ef3af8bed | ||
|
|
4eb52d9a45 | ||
|
|
7817332cc1 | ||
|
|
e3fbb5828f | ||
|
|
45cf6ce658 | ||
|
|
69222204e6 | ||
|
|
dc2a270b71 | ||
|
|
9c7598db10 | ||
|
|
00fb56c2b9 | ||
|
|
e37b0392be | ||
|
|
7dba11957a | ||
|
|
517a17b6d9 | ||
|
|
9d3d0c6b79 | ||
|
|
bc1770c035 | ||
|
|
50cd0d5a12 | ||
|
|
8d6f98b83d | ||
|
|
8809c8ec38 | ||
|
|
6feabe12a7 | ||
|
|
41d94fb0e3 | ||
|
|
d425bd20a2 | ||
|
|
e7e9d84a54 | ||
|
|
c84a275871 | ||
|
|
8d1f6733a9 | ||
|
|
c355295fe0 | ||
|
|
9ef264a343 | ||
|
|
fec3694512 | ||
|
|
eaa2a12a44 | ||
|
|
1b3fc99e0f | ||
|
|
e293b96610 | ||
|
|
f2c51355ed | ||
|
|
7ab1580762 | ||
|
|
a819615113 | ||
|
|
f519275024 | ||
|
|
7a9130401f | ||
|
|
bfb4dddc2e | ||
|
|
6f322b59da | ||
|
|
320a119913 | ||
|
|
fcd3964082 | ||
|
|
eeb9b7065d | ||
|
|
2aed822bd7 | ||
|
|
add4780bf7 | ||
|
|
df884f9d9a | ||
|
|
498f1b50f7 | ||
|
|
29380252a8 | ||
|
|
ade465512f | ||
|
|
37fbe2a271 | ||
|
|
15614defd8 | ||
|
|
b5ee5f8539 | ||
|
|
febf5d0944 | ||
|
|
9e37e514d2 | ||
|
|
5c2f4a7d88 | ||
|
|
db8eb71a9c | ||
|
|
5780852aee | ||
|
|
6619d7d8ac | ||
|
|
82f7d51bde | ||
|
|
8407664cf6 | ||
|
|
b5b32c8f9a | ||
|
|
3dbe309fce | ||
|
|
87c5a97b91 | ||
|
|
83bb8c72a7 | ||
|
|
2172dfa41f | ||
|
|
ef46822708 | ||
|
|
78e7551083 | ||
|
|
d298fecfda | ||
|
|
d3ea420650 | ||
|
|
067777e77d | ||
|
|
5ccd482b90 | ||
|
|
3893d9217c | ||
|
|
efc335d4a1 | ||
|
|
b9f64130af | ||
|
|
0a4502e116 | ||
|
|
b6364d9ae4 | ||
|
|
59caea5674 | ||
|
|
2f5b18ba2f | ||
|
|
5631243fdd | ||
|
|
a61fc8acd1 | ||
|
|
b87ff76b7e | ||
|
|
1c9e851fe0 | ||
|
|
5382f6d197 | ||
|
|
8ca2f785e2 | ||
|
|
459c8137c0 | ||
|
|
9165d8e5d1 | ||
|
|
fcc5c80298 | ||
|
|
e309bb2f76 | ||
|
|
92dc493189 | ||
|
|
39f1bf9ce8 | ||
|
|
fe8bcf44ef | ||
|
|
56ccbcff9a | ||
|
|
72b7cf376b | ||
|
|
374e8d510a | ||
|
|
343ac48a2d | ||
|
|
85bab9477b | ||
|
|
835c266436 | ||
|
|
6b0a5fd941 | ||
|
|
1e9a5d4b8e | ||
|
|
b238874895 | ||
|
|
fc1ec6ab56 | ||
|
|
b4f6efcf69 | ||
|
|
b3cc9ddd66 | ||
|
|
3a34103bb6 | ||
|
|
6268af4ceb | ||
|
|
ecfe56b932 | ||
|
|
16d81de018 | ||
|
|
a5a036c101 | ||
|
|
792819609a | ||
|
|
3b69c7a484 | ||
|
|
8ed1c7446e | ||
|
|
8486a30c74 | ||
|
|
8696be1950 | ||
|
|
b43df925f8 | ||
|
|
cfe0c54e8c | ||
|
|
81db471695 | ||
|
|
eb5d80d39a | ||
|
|
ea3d4b3712 | ||
|
|
cf561391a1 | ||
|
|
276016fba7 | ||
|
|
d9dedc8f27 | ||
|
|
569cdeac4e | ||
|
|
48cabc8f9f | ||
|
|
69e9db54be | ||
|
|
1be71be2a2 | ||
|
|
2ebaa9f881 | ||
|
|
207db3747f | ||
|
|
a3bd6fa73f | ||
|
|
883239f29a | ||
|
|
e74b5d4fbf | ||
|
|
7a7b9644aa | ||
|
|
a2032ba51f | ||
|
|
b8d48ad379 | ||
|
|
fec655d5e9 | ||
|
|
9edeb3ad8e | ||
|
|
56f17eb659 | ||
|
|
d052fb99ee | ||
|
|
be3ab15f71 | ||
|
|
6a325039e2 | ||
|
|
08ab2b7f94 | ||
|
|
d724ba1739 | ||
|
|
687844b2fe | ||
|
|
8b8764b427 | ||
|
|
f959c6b5b5 | ||
|
|
7d375209b9 | ||
|
|
75448c19f4 | ||
|
|
a80e32c0fe | ||
|
|
02b78d7ed0 | ||
|
|
3fcefefce5 | ||
|
|
00da07ebd1 | ||
|
|
79a2237ed2 | ||
|
|
fb37865802 | ||
|
|
4ee750d034 | ||
|
|
a31b168049 | ||
|
|
22fda945cc | ||
|
|
c5f7787f37 | ||
|
|
7c92d87313 | ||
|
|
491a9d9cb4 | ||
|
|
71956239ac | ||
|
|
123c2494c3 | ||
|
|
d8742e9b3e | ||
|
|
a7ec3f0576 | ||
|
|
008dab1b25 | ||
|
|
d922934cf8 | ||
|
|
39d4bb0c7a | ||
|
|
feb8a001e1 | ||
|
|
9573cef0a8 | ||
|
|
bc8dd5d3f0 | ||
|
|
a4bfdb8264 | ||
|
|
ee200385e4 | ||
|
|
c7ba588030 | ||
|
|
8da2a78834 | ||
|
|
1fc97863a0 | ||
|
|
46677a6769 | ||
|
|
4f811a3de9 | ||
|
|
13f4412f2c | ||
|
|
edbca2344d | ||
|
|
794fb5ac89 | ||
|
|
f5c49a3f5c | ||
|
|
5adf3025db | ||
|
|
24e5b78f36 | ||
|
|
ba251262db | ||
|
|
0642eea2ab | ||
|
|
6858598bee | ||
|
|
87178cb5a4 | ||
|
|
3e08b8c56a | ||
|
|
ba26d609a1 | ||
|
|
7eda2f8293 | ||
|
|
cb14b4eb1e | ||
|
|
d2e5ab8c57 | ||
|
|
3798621e0b | ||
|
|
94527665c2 | ||
|
|
77497793e0 | ||
|
|
6a2935d67b | ||
|
|
ee02d42916 | ||
|
|
b859320606 | ||
|
|
1eadb68598 | ||
|
|
8ac061de69 | ||
|
|
45fa41ff5c | ||
|
|
bdb62b6fe9 | ||
|
|
12220aa8fd | ||
|
|
da136cba6f | ||
|
|
a4a1d4a78d | ||
|
|
6af05c6197 | ||
|
|
42289c5f18 | ||
|
|
fb0ffcddc8 | ||
|
|
97d38d0817 | ||
|
|
bd3a693fd4 | ||
|
|
4575aeb1e7 | ||
|
|
c6fec241bc | ||
|
|
b9c983dee3 | ||
|
|
1a51e308e5 | ||
|
|
462a5eabb4 | ||
|
|
59fdb0d242 | ||
|
|
19ca125ae7 | ||
|
|
47a8cea564 | ||
|
|
a7e692dc7a | ||
|
|
cd20a6a67f | ||
|
|
38892f2959 | ||
|
|
83fcf12d25 | ||
|
|
db3c60d235 | ||
|
|
2153102725 | ||
|
|
bf81164407 | ||
|
|
3206072ac3 | ||
|
|
c9be6b239c | ||
|
|
78079dd062 | ||
|
|
da1fb0f2e9 | ||
|
|
b85736329a | ||
|
|
b8342bbfa8 | ||
|
|
0bc8f78d4b | ||
|
|
03e57530fa | ||
|
|
6e427e1209 | ||
|
|
0bc6cc3735 | ||
|
|
6b7b5698e9 | ||
|
|
edacffc68d | ||
|
|
8d8b42b086 | ||
|
|
4f7ffc8c0f | ||
|
|
15c5b63713 |
17
.cvsignore
Normal file
17
.cvsignore
Normal file
@@ -0,0 +1,17 @@
|
||||
*.gz *.Z *.tar *.tgz
|
||||
=*
|
||||
TODO COPYING*
|
||||
make-3* make-test*
|
||||
*.info *.info-*
|
||||
stamp-*
|
||||
makebook*
|
||||
|
||||
.*gdbinit
|
||||
|
||||
*.dep *.dvi *.toc *.aux *.log
|
||||
*.cp *.cps *.fn *.fns *.vr *.vrs *.tp *.tps *.ky *.kys *.pg *.pgs
|
||||
|
||||
sun4 i386 i386-netbsd hp300-netbsd hp300 rs6000 sun3 news800 amiga
|
||||
hp700 hp834 mips sol2 i486-linux
|
||||
|
||||
customs
|
||||
339
COPYING
Normal file
339
COPYING
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
4980
ChangeLog.1
Normal file
4980
ChangeLog.1
Normal file
File diff suppressed because it is too large
Load Diff
294
GNUmakefile
Normal file
294
GNUmakefile
Normal file
@@ -0,0 +1,294 @@
|
||||
# GNU Make-specific makefile for GNU Make.
|
||||
|
||||
# Copyright (C) 1990, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
# This file is part of GNU Make.
|
||||
#
|
||||
# GNU Make 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 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
.PHONY: default
|
||||
default:
|
||||
|
||||
# Set `ARCH' to a string for the type of machine.
|
||||
ifndef ARCH
|
||||
ifdef machine
|
||||
ARCH = $(machine)
|
||||
endif # machine
|
||||
endif # not ARCH
|
||||
|
||||
override srcdir := .
|
||||
override CC := $(CC)
|
||||
|
||||
ifeq ($(ARCH),hp300)
|
||||
#customs=yes
|
||||
endif
|
||||
ifdef customs
|
||||
override REMOTE := cstms
|
||||
else
|
||||
override REMOTE := stub
|
||||
endif
|
||||
|
||||
# Get most of the information from the Unix-compatible makefile.
|
||||
include compatMakefile
|
||||
|
||||
MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES)
|
||||
|
||||
# Remove autoconf magic.
|
||||
prefix = /usr/local
|
||||
exec_prefix = $(prefix)
|
||||
extras := $(filter-out getloadavg.o @%@,$(extras)) getloadavg.o
|
||||
LOADLIBES := $(filter-out @%@,$(LOADLIBES))
|
||||
ALLOCA := $(filter-out @%@,$(ALLOCA))
|
||||
CPPFLAGS := $(filter-out @%@,$(defines) $(CPPFLAGS)) -DHAVE_CONFIG_H
|
||||
|
||||
ifdef AC_MACRODIR
|
||||
configure config.h.in: $(patsubst %,$(AC_MACRODIR)/%.m4,acspecific acgeneral)
|
||||
config.h.in: $(AC_MACRODIR)/acconfig.h
|
||||
endif
|
||||
configure: configure.in aclocal.m4
|
||||
autoconf $(ACFLAGS)
|
||||
test -d CVS && cvs commit -m'autoconf $(ACFLAGS)' $@
|
||||
config.h.in: configure.in aclocal.m4
|
||||
autoheader $(ACFLAGS)
|
||||
test -d CVS && cvs commit -m'autoheader $(ACFLAGS)' $@
|
||||
|
||||
ifdef customs
|
||||
defines := $(defines) -Ipmake/customs -Ipmake/lib/include
|
||||
LOADLIBES := $(addprefix pmake/customs/,customslib.o rpc.o xlog.o) \
|
||||
pmake/lib/sprite/libsprite.a
|
||||
endif
|
||||
|
||||
ifdef ARCH
|
||||
|
||||
ifndef no_libc
|
||||
libc_dir = /home/gd2/gnu/libc/$(ARCH)
|
||||
ifneq ($(wildcard $(libc_dir)),)
|
||||
ifneq ($(wildcard $(libc_dir)/works-for-make),)
|
||||
#CPPFLAGS := -I$(libc_dir)/include
|
||||
#LDFLAGS := -nostdlib $(libc_dir)/lib/start.o
|
||||
#LOADLIBES := $(LOADLIBES) \
|
||||
# $(libc_dir)/lib/mcheck-init.o \
|
||||
# $(libc_dir)/lib/libc.a \
|
||||
# -lgcc \
|
||||
# $(libc_dir)/lib/libc.a
|
||||
CC := $(CC) -b glibc
|
||||
|
||||
# getopt is in libc.
|
||||
GETOPT =
|
||||
#GETOPT_SRC = Don't clear this or dist will break.
|
||||
|
||||
# glob is in libc too.
|
||||
GLOB =
|
||||
|
||||
else
|
||||
|
||||
endif # works-for-make
|
||||
endif # $(libc_dir)
|
||||
endif # !no_libc
|
||||
|
||||
# We know the type of machine, so put the binaries in subdirectories.
|
||||
$(ARCH)/%.o: %.c
|
||||
$(COMPILE.c) -Iglob $< $(OUTPUT_OPTION)
|
||||
$(ARCH)/glob/libglob.a: FORCE
|
||||
$(MAKE) -C $(@D) $(@F)
|
||||
FORCE:
|
||||
objs := $(addprefix $(ARCH)/,$(objs))
|
||||
prog := $(ARCH)/make
|
||||
|
||||
archpfx = $(ARCH)/
|
||||
|
||||
$(archpfx)load.o: load.c
|
||||
$(COMPILE.c) $(LOAD_AVG) $< -o $@
|
||||
$(archpfx)load.dep: load.c
|
||||
$(mkdep) $(LOAD_AVG) $< | sed 's,$*\.o,& $@,' > $@
|
||||
|
||||
CPPFLAGS := -I$(ARCH) -Iglob -DHAVE_CONFIG_H $(filter-out @%@,$(CPPFLAGS))
|
||||
|
||||
ifneq "$(wildcard $(ARCH)/makefile)" ""
|
||||
include $(ARCH)/makefile
|
||||
endif
|
||||
objs := $(objs) $(addprefix $(ARCH)/,$(ALLOCA) $(extras))
|
||||
|
||||
else # Not ARCH
|
||||
prog := make
|
||||
endif
|
||||
|
||||
ifneq "$(findstring gcc,$(CC))" ""
|
||||
CFLAGS = -g -Wall -Wtraditional -Wid-clash-31 -Wpointer-arith \
|
||||
-Wbad-function-cast -Wconversion
|
||||
else
|
||||
CFLAGS = -g
|
||||
endif
|
||||
LDFLAGS = -g
|
||||
|
||||
# Define the command to make dependencies.
|
||||
ifneq "$(findstring gcc,$(CC))" ""
|
||||
# Don't include system directories.
|
||||
mkdep-nolib = $(CC) -MM $(CPPFLAGS)
|
||||
else
|
||||
mkdep-nolib = $(mkdep)
|
||||
endif
|
||||
mkdep = $(CC) -M $(CPPFLAGS)
|
||||
|
||||
depfiles = $(patsubst %.o,%.dep,$(filter %.o,$(objs)))
|
||||
|
||||
|
||||
.PHONY: default
|
||||
default: $(prog)
|
||||
|
||||
$(prog): $(objs) $(globdep) #$(addprefix $(ARCH)/,gmalloc.o mcheck.o)
|
||||
$(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new
|
||||
mv -f $@.new $@
|
||||
|
||||
libc-srcdir = ../libc
|
||||
globfiles = $(addprefix glob/,COPYING.LIB configure.in configure Makefile.in \
|
||||
Makefile.ami SCOPTIONS SMakefile \
|
||||
configure.bat glob.c fnmatch.c glob.h fnmatch.h)
|
||||
$(globfiles): stamp-glob ;
|
||||
stamp-glob: $(libc-srcdir)/posix/glob.tar
|
||||
-rm -f stamp-glob glob/*
|
||||
tar xvf $< glob
|
||||
cvs commit -m'Updated from libc' glob
|
||||
touch $@
|
||||
$(libc-srcdir)/posix/glob.tar: force
|
||||
$(MAKE) -C $(@D) $(@F) no_deps=t
|
||||
.PHONY: force
|
||||
force:
|
||||
|
||||
# Make the Unix-compatible Makefile to be distributed by appending
|
||||
# the automatically-generated dependencies to compatMakefile.
|
||||
ifeq ($(mkdep),$(mkdep-nolib))
|
||||
nolib-deps = $(depfiles)
|
||||
else
|
||||
%.dep: %.c
|
||||
$(mkdep-nolib) $< | sed -e 's,$*\.o,$(@:.dep=.o) $@,' > $(@:.dep=.dtm)
|
||||
mv -f $(@:.dep=.dtm) $@
|
||||
nolib-deps = $(patsubst $(archpfx)%,%,$(depfiles))
|
||||
endif
|
||||
# The distributed Makefile.in should contain deps for remote-stub only.
|
||||
Makefile.in: compatMakefile $(nolib-deps:remote-%.dep=remote-stub.dep)
|
||||
(sed 's/^MAKE[ ]*=.*$$/@SET_MAKE@/' $<; \
|
||||
echo '# Automatically generated dependencies.'; \
|
||||
sed -e 's/ [^ ]*\.dep//' -e 's=$(archpfx)==' $(filter-out $<,$^) \
|
||||
) > $@
|
||||
cvs commit -mRegenerated $@
|
||||
|
||||
.SUFFIXES: .dep
|
||||
# Maintain the automatically-generated dependencies.
|
||||
ifndef no_deps
|
||||
-include $(depfiles)
|
||||
endif
|
||||
$(archpfx)%.dep: %.c
|
||||
$(mkdep) $< | sed 's,$*\.o,$(@:.dep=.o) $@,' > $@
|
||||
|
||||
ETAGS = etags -T # for v19 etags
|
||||
|
||||
# Run the tests.
|
||||
.PHONY: tests
|
||||
testdir := $(shell ls -d1 make-test-?.? | sort -n +0.10 -0.11 +0.12 | tail -1l)
|
||||
tests:# $(testdir)/run_make_tests.pl $(prog)
|
||||
# cd $(<D); MAKELEVEL=0 perl $(<F)
|
||||
|
||||
build.sh.in: build.template compatMakefile
|
||||
sed -e 's@%objs%@$(filter-out remote-% $(GLOB) $(ALLOCA) $(extras),\
|
||||
$(patsubst $(archpfx)%,%,$(objs)))\
|
||||
$(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
|
||||
$< > $@.new
|
||||
chmod a+x $@.new
|
||||
mv -f $@.new $@
|
||||
cvs commit -mRegenerated $@
|
||||
|
||||
# Make the distribution tar files.
|
||||
|
||||
.PHONY: dist
|
||||
# Figure out the version number from the source of `version.c'.
|
||||
version := \
|
||||
$(strip $(shell sed -e '/=/!d' -e 's/^.*"\(.*\)";$$/\1/' < version.c))
|
||||
tarfiles := make # make-doc
|
||||
tarfiles := $(addsuffix -$(version).tar,$(tarfiles))
|
||||
tarfiles := $(tarfiles:%=%.gz) # no more compress $(tarfiles:%=%.Z)
|
||||
# Depend on default and doc so we don't ship anything that won't compile.
|
||||
dist: cvs-mark default info dvi tests tarfiles
|
||||
.PHONY: tarfiles
|
||||
tarfiles: $(tarfiles)
|
||||
|
||||
vmsfiles = config.h-vms makefile.com makefile.vms readme.vms \
|
||||
vmsdir.h vmsfunctions.c vmsify.c
|
||||
amigafiles = README.Amiga config.ami Makefile.ami SCOPTIONS SMakefile \
|
||||
amiga.c amiga.h make.lnk
|
||||
distfiles=README INSTALL COPYING ChangeLog NEWS \
|
||||
configure Makefile.in configure.in build.sh.in mkinstalldirs \
|
||||
configh.dos configure.bat \
|
||||
$(amigafiles) $(vmsfiles) \
|
||||
aclocal.m4 acconfig.h $(srcs) remote-*.c $(globfiles) \
|
||||
make.texinfo make-stds.texi \
|
||||
make.?? make.??s make.toc make.aux make.man texinfo.tex TAGS tags \
|
||||
install-sh \
|
||||
make.info make.info*
|
||||
|
||||
ifndef dist-flavor
|
||||
dist-flavor = alpha
|
||||
endif
|
||||
.PHONY: cvs-mark
|
||||
cvs-mark: $(distfiles)
|
||||
cvs tag -F make-$(subst .,-,$(version))
|
||||
|
||||
dist: local-inst
|
||||
.PHONY: local-inst
|
||||
local-inst: $(prog)
|
||||
install -c -g kmem -o $(USER) -m 2755 $< /usr/local/gnubin/make
|
||||
|
||||
# Put the alpha distribution files in the anonymous FTP directory.
|
||||
alpha-files = $(tarfiles) GNUmakefile compatMakefile $(testdir).tar.Z
|
||||
dist: alpha
|
||||
.PHONY: alpha
|
||||
alpha-dir := ~ftp/gnu
|
||||
alpha-files := $(addprefix $(alpha-dir)/,$(alpha-files))
|
||||
alpha: $(alpha-dir) $(alpha-files)
|
||||
$(alpha-dir)/%: %
|
||||
@rm -f $@
|
||||
cp $< $@
|
||||
|
||||
# Implicit rule to make README and README-doc.
|
||||
%: %.template version.c
|
||||
rm -f $@
|
||||
sed 's/VERSION/$(version)/' < $< > $@
|
||||
# Make sure I don't edit it by accident.
|
||||
chmod a-w $@
|
||||
cvs commit -m'Regenerated for $(version)' $@
|
||||
|
||||
define make-tar
|
||||
@rm -fr make-$(version)
|
||||
ln -s . make-$(version)
|
||||
tar cvhof $@ $(addprefix make-$(version)/,$^)
|
||||
rm -f make-$(version)
|
||||
endef
|
||||
|
||||
%.Z: %; compress -c $< > $@
|
||||
%.gz: %; gzip -9 -c -v $< > $@
|
||||
|
||||
make-$(version).tar: $(distfiles)
|
||||
$(make-tar)
|
||||
|
||||
ifneq (,)
|
||||
tests := $(filter-out %~,$(wildcard tests/*))
|
||||
make-tests-$(version).tar.Z: $(tests)
|
||||
@rm -fr make-tests-$(version)
|
||||
ln -s tests make-tests-$(version)
|
||||
tar cvhf $(@:.Z=) $(patsubst tests/%,make-tests-$(version)/%,$^)
|
||||
rm -f make-tests-$(version)
|
||||
compress -f $(@:.Z=)
|
||||
endif
|
||||
|
||||
$(archpfx)loadtest: $(archpfx)load.o
|
||||
181
INSTALL
Normal file
181
INSTALL
Normal file
@@ -0,0 +1,181 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
309
Makefile.ami
Normal file
309
Makefile.ami
Normal file
@@ -0,0 +1,309 @@
|
||||
# NOTE: If you have no `make' program at all to process this makefile, run
|
||||
# `build.sh' instead.
|
||||
#
|
||||
# Copyright (C) 1988, 89, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
# This file is part of GNU Make.
|
||||
#
|
||||
# GNU Make 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 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Makefile for GNU Make
|
||||
#
|
||||
|
||||
# Ultrix 2.2 make doesn't expand the value of VPATH.
|
||||
VPATH = /make-3.74/
|
||||
# This must repeat the value, because configure will remove `VPATH = .'.
|
||||
srcdir = /make-3.74/
|
||||
|
||||
CC = sc
|
||||
RM = delete
|
||||
|
||||
CFLAGS =
|
||||
CPPFLAGS =
|
||||
LDFLAGS =
|
||||
|
||||
# Define these for your system as follows:
|
||||
# -DNO_ARCHIVES To disable `ar' archive support.
|
||||
# -DNO_FLOAT To avoid using floating-point numbers.
|
||||
# -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2.
|
||||
# Some compilers apparently accept this
|
||||
# without complaint but produce losing code,
|
||||
# so beware.
|
||||
# NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
|
||||
# See also `config.h'.
|
||||
defines =
|
||||
|
||||
# Which flavor of remote job execution support to use.
|
||||
# The code is found in `remote-$(REMOTE).c'.
|
||||
REMOTE = stub
|
||||
|
||||
# If you are using the GNU C library, or have the GNU getopt functions in
|
||||
# your C library, you can comment these out.
|
||||
GETOPT = getopt.o getopt1.o
|
||||
GETOPT_SRC = $(srcdir)getopt.c $(srcdir)getopt1.c $(srcdir)getopt.h
|
||||
|
||||
# If you are using the GNU C library, or have the GNU glob functions in
|
||||
# your C library, you can comment this out. GNU make uses special hooks
|
||||
# into the glob functions to be more efficient (by using make's directory
|
||||
# cache for globbing), so you must use the GNU functions even if your
|
||||
# system's C library has the 1003.2 glob functions already. Also, the glob
|
||||
# functions in the AIX and HPUX C libraries are said to be buggy.
|
||||
GLOB = glob/glob.lib
|
||||
|
||||
# If your system doesn't have alloca, or the one provided is bad, define this.
|
||||
ALLOCA = alloca.o
|
||||
ALLOCA_SRC = $(srcdir)alloca.c
|
||||
|
||||
# If your system needs extra libraries loaded in, define them here.
|
||||
# System V probably need -lPW for alloca. HP-UX 7.0's alloca in
|
||||
# libPW.a is broken on HP9000s300 and HP9000s400 machines. Use
|
||||
# alloca.c instead on those machines.
|
||||
LOADLIBES =
|
||||
|
||||
# Any extra object files your system needs.
|
||||
extras = amiga.o
|
||||
|
||||
# Common prefix for machine-independent installed files.
|
||||
prefix =
|
||||
# Common prefix for machine-dependent installed files.
|
||||
exec_prefix =
|
||||
|
||||
# Directory to install `make' in.
|
||||
bindir = sc:c
|
||||
# Directory to find libraries in for `-lXXX'.
|
||||
libdir = lib:
|
||||
# Directory to search by default for included makefiles.
|
||||
includedir = include:
|
||||
# Directory to install the Info files in.
|
||||
infodir = doc:
|
||||
# Directory to install the man page in.
|
||||
mandir = t:
|
||||
# Number to put on the man page filename.
|
||||
manext = 1
|
||||
# Prefix to put on installed `make' binary file name.
|
||||
binprefix =
|
||||
# Prefix to put on installed `make' man page file name.
|
||||
manprefix = $(binprefix)
|
||||
|
||||
# Whether or not make needs to be installed setgid.
|
||||
# The value should be either `true' or `false'.
|
||||
# On many systems, the getloadavg function (used to implement the `-l'
|
||||
# switch) will not work unless make is installed setgid kmem.
|
||||
install_setgid = false
|
||||
# Install make setgid to this group so it can read /dev/kmem.
|
||||
group = sys
|
||||
|
||||
# Program to install `make'.
|
||||
INSTALL_PROGRAM = copy
|
||||
# Program to install the man page.
|
||||
INSTALL_DATA = copy
|
||||
# Generic install program.
|
||||
INSTALL = copy
|
||||
|
||||
# Program to format Texinfo source into Info files.
|
||||
MAKEINFO = makeinfo
|
||||
# Program to format Texinfo source into DVI files.
|
||||
TEXI2DVI = texi2dvi
|
||||
|
||||
# Programs to make tags files.
|
||||
ETAGS = etags -w
|
||||
CTAGS = ctags -w
|
||||
|
||||
objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \
|
||||
rule.o implicit.o default.o variable.o expand.o function.o \
|
||||
vpath.o version.o ar.o arscan.o signame.o remote-$(REMOTE).o \
|
||||
$(GETOPT) $(ALLOCA) $(extras)
|
||||
srcs = $(srcdir)commands.c $(srcdir)job.c $(srcdir)dir.c \
|
||||
$(srcdir)file.c $(srcdir)getloadavg.c $(srcdir)misc.c \
|
||||
$(srcdir)main.c $(srcdir)read.c $(srcdir)remake.c \
|
||||
$(srcdir)rule.c $(srcdir)implicit.c $(srcdir)default.c \
|
||||
$(srcdir)variable.c $(srcdir)expand.c $(srcdir)function.c \
|
||||
$(srcdir)vpath.c $(srcdir)version.c \
|
||||
$(srcdir)remote-$(REMOTE).c \
|
||||
$(srcdir)ar.c $(srcdir)arscan.c \
|
||||
$(srcdir)signame.c $(srcdir)signame.h $(GETOPT_SRC) \
|
||||
$(srcdir)commands.h $(srcdir)dep.h $(srcdir)filedep.h \
|
||||
$(srcdir)job.h $(srcdir)make.h $(srcdir)rule.h \
|
||||
$(srcdir)variable.h $(ALLOCA_SRC) $(srcdir)config.h.in
|
||||
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
|
||||
|
||||
all: make
|
||||
info: make.info
|
||||
dvi: make.dvi
|
||||
# Some makes apparently use .PHONY as the default goal if it is before `all'.
|
||||
.PHONY: all check info dvi
|
||||
|
||||
make.info: make.texinfo
|
||||
$(MAKEINFO) -I$(srcdir) $(srcdir)make.texinfo -o make.info
|
||||
|
||||
make.dvi: make.texinfo
|
||||
$(TEXI2DVI) $(srcdir)make.texinfo
|
||||
|
||||
make.ps: make.dvi
|
||||
dvi2ps make.dvi > make.ps
|
||||
|
||||
make: $(objs) $(GLOB)
|
||||
$(CC) Link $(LDFLAGS) $(objs) Lib $(GLOB) $(LOADLIBES) To make.new
|
||||
-delete make
|
||||
rename make.new make
|
||||
|
||||
TMPFILE = t:Make$$
|
||||
|
||||
$(GLOB):
|
||||
cd glob @@\
|
||||
$(MAKE) -$(MAKEFLAGS) -f Makefile
|
||||
|
||||
# -I. is needed to find config.h in the build directory.
|
||||
OUTPUT_OPTION =
|
||||
.c.o:
|
||||
$(CC) $(defines) IDir "" IDir glob \
|
||||
$(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
|
||||
# For some losing Unix makes.
|
||||
SHELL = /bin/sh
|
||||
#@SET_MAKE@
|
||||
|
||||
glob/libglob.a: FORCE config.h
|
||||
cd glob; $(MAKE) libglob.a
|
||||
FORCE:
|
||||
|
||||
tagsrcs = $(srcs) $(srcdir)remote-*.c
|
||||
|
||||
.PHONY: install installdirs
|
||||
install: installdirs \
|
||||
$(bindir)$(binprefix)make $(infodir)make.info \
|
||||
$(mandir)$(manprefix)make.$(manext)
|
||||
|
||||
installdirs:
|
||||
$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(mandir)
|
||||
|
||||
$(bindir)$(binprefix)make: make
|
||||
$(INSTALL_PROGRAM) make $@.new
|
||||
@if $(install_setgid); then \
|
||||
if chgrp $(group) $@.new && chmod g+s $@.new; then \
|
||||
echo "chgrp $(group) $@.new && chmod g+s $@.new"; \
|
||||
else \
|
||||
echo "$@ needs to be owned by group $(group) and setgid;"; \
|
||||
echo "otherwise the \`-l' option will probably not work."; \
|
||||
echo "You may need special privileges to install $@."; \
|
||||
fi; \
|
||||
else true; fi
|
||||
# Some systems can't deal with renaming onto a running binary.
|
||||
-$(RM) $@.old
|
||||
-mv $@ $@.old
|
||||
mv $@.new $@
|
||||
|
||||
$(infodir)make.info: make.info
|
||||
if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
|
||||
for file in $${dir}/make.info*; do \
|
||||
name="`basename $$file`"; \
|
||||
$(INSTALL_DATA) $$file \
|
||||
`echo $@ | sed "s,make.info\$$,$$name,"`; \
|
||||
done
|
||||
# Run install-info only if it exists.
|
||||
# Use `if' instead of just prepending `-' to the
|
||||
# line so we notice real errors from install-info.
|
||||
# We use `$(SHELL) -c' because some shells do not
|
||||
# fail gracefully when there is an unknown command.
|
||||
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
|
||||
install-info --infodir=$(infodir) $$dir/make.info; \
|
||||
else true; fi
|
||||
|
||||
$(mandir)$(manprefix)make.$(manext): make.man
|
||||
$(INSTALL_DATA) $(srcdir)make.man $@
|
||||
|
||||
|
||||
loadavg: loadavg.c config.h
|
||||
$(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
|
||||
loadavg.c $(LOADLIBES) -o $@
|
||||
# We copy getloadavg.c into a different file rather than compiling it
|
||||
# directly because some compilers clobber getloadavg.o in the process.
|
||||
loadavg.c: getloadavg.c
|
||||
ln $(srcdir)getloadavg.c loadavg.c || \
|
||||
cp $(srcdir)getloadavg.c loadavg.c
|
||||
check-loadavg: loadavg
|
||||
@echo The system uptime program believes the load average to be:
|
||||
-uptime
|
||||
@echo The GNU load average checking code believes:
|
||||
./loadavg
|
||||
check: check-loadavg
|
||||
|
||||
|
||||
.PHONY: clean realclean distclean mostlyclean
|
||||
clean: glob-clean
|
||||
-$(RM) make loadavg "#?.o" core make.dvi
|
||||
|
||||
distclean: clean glob-realclean
|
||||
-$(RM) Makefile config.h config.status build.sh stamp-config
|
||||
-$(RM) config.log config.cache
|
||||
-$(RM) TAGS tags
|
||||
-$(RM) make.?? make.??s make.log make.toc make.*aux
|
||||
-$(RM) loadavg.c
|
||||
|
||||
realclean: distclean
|
||||
-$(RM) make.info*
|
||||
mostlyclean: clean
|
||||
|
||||
.PHONY: glob-clean glob-realclean
|
||||
glob-clean glob-realclean:
|
||||
cd glob @@\
|
||||
$(MAKE) $@
|
||||
|
||||
# This tells versions [3.59,3.63) of GNU make not to export all variables.
|
||||
.NOEXPORT:
|
||||
|
||||
# The automatically generated dependencies below may omit config.h
|
||||
# because it is included with ``#include <config.h>'' rather than
|
||||
# ``#include "config.h"''. So we add the explicit dependency to make sure.
|
||||
$(objs): config.h
|
||||
|
||||
# Automatically generated dependencies will be put at the end of the file.
|
||||
|
||||
# Automatically generated dependencies.
|
||||
commands.o: commands.c make.h dep.h filedef.h variable.h job.h \
|
||||
commands.h
|
||||
job.o: job.c make.h job.h filedef.h commands.h variable.h
|
||||
dir.o: dir.c make.h
|
||||
file.o: file.c make.h dep.h filedef.h job.h commands.h variable.h
|
||||
misc.o: misc.c make.h dep.h
|
||||
main.o: main.c make.h dep.h filedef.h variable.h job.h commands.h \
|
||||
getopt.h
|
||||
read.o: read.c make.h dep.h filedef.h job.h commands.h variable.h \
|
||||
glob/glob.h
|
||||
remake.o: remake.c make.h filedef.h job.h commands.h dep.h
|
||||
rule.o: rule.c make.h dep.h filedef.h job.h commands.h variable.h \
|
||||
rule.h
|
||||
implicit.o: implicit.c make.h rule.h dep.h filedef.h
|
||||
default.o: default.c make.h rule.h dep.h filedef.h job.h commands.h \
|
||||
variable.h
|
||||
variable.o: variable.c make.h dep.h filedef.h job.h commands.h \
|
||||
variable.h
|
||||
expand.o: expand.c make.h filedef.h job.h commands.h variable.h
|
||||
function.o: function.c make.h filedef.h variable.h dep.h job.h \
|
||||
commands.h amiga.h
|
||||
vpath.o: vpath.c make.h filedef.h variable.h
|
||||
version.o: version.c
|
||||
ar.o: ar.c make.h filedef.h dep.h
|
||||
arscan.o: arscan.c make.h
|
||||
signame.o: signame.c signame.h
|
||||
remote-stub.o: remote-stub.c make.h filedef.h job.h commands.h
|
||||
getopt.o: getopt.c
|
||||
getopt1.o : getopt1.c getopt.h
|
||||
getloadavg.o: getloadavg.c
|
||||
amiga.o: amiga.c make.h variable.h amiga.h
|
||||
303
Makefile.in
Normal file
303
Makefile.in
Normal file
@@ -0,0 +1,303 @@
|
||||
# NOTE: If you have no `make' program at all to process this makefile, run
|
||||
# `build.sh' instead.
|
||||
#
|
||||
# Copyright (C) 1988,89,91,92,93,94,95,96 Free Software Foundation, Inc.
|
||||
# This file is part of GNU Make.
|
||||
#
|
||||
# GNU Make 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 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Makefile for GNU Make
|
||||
#
|
||||
|
||||
# Ultrix 2.2 make doesn't expand the value of VPATH.
|
||||
VPATH = @srcdir@
|
||||
# This must repeat the value, because configure will remove `VPATH = .'.
|
||||
srcdir = @srcdir@
|
||||
|
||||
CC = @CC@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
# Define these for your system as follows:
|
||||
# -DNO_ARCHIVES To disable `ar' archive support.
|
||||
# -DNO_FLOAT To avoid using floating-point numbers.
|
||||
# -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2.
|
||||
# Some compilers apparently accept this
|
||||
# without complaint but produce losing code,
|
||||
# so beware.
|
||||
# NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
|
||||
# See also `config.h'.
|
||||
defines = @DEFS@ -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\"
|
||||
|
||||
# Which flavor of remote job execution support to use.
|
||||
# The code is found in `remote-$(REMOTE).c'.
|
||||
REMOTE = @REMOTE@
|
||||
|
||||
# If your system doesn't have alloca, or the one provided is bad, define this.
|
||||
ALLOCA = @ALLOCA@
|
||||
ALLOCA_SRC = $(srcdir)/alloca.c
|
||||
|
||||
# If your system needs extra libraries loaded in, define them here.
|
||||
# System V probably need -lPW for alloca. HP-UX 7.0's alloca in
|
||||
# libPW.a is broken on HP9000s300 and HP9000s400 machines. Use
|
||||
# alloca.c instead on those machines.
|
||||
LOADLIBES = @LIBS@
|
||||
|
||||
# Any extra object files your system needs.
|
||||
extras = @LIBOBJS@
|
||||
|
||||
# Common prefix for machine-independent installed files.
|
||||
prefix = @prefix@
|
||||
# Common prefix for machine-dependent installed files.
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
# Directory to install `make' in.
|
||||
bindir = $(exec_prefix)/bin
|
||||
# Directory to find libraries in for `-lXXX'.
|
||||
libdir = $(exec_prefix)/lib
|
||||
# Directory to search by default for included makefiles.
|
||||
includedir = $(prefix)/include
|
||||
# Directory to install the Info files in.
|
||||
infodir = $(prefix)/info
|
||||
# Directory to install the man page in.
|
||||
mandir = $(prefix)/man/man$(manext)
|
||||
# Number to put on the man page filename.
|
||||
manext = 1
|
||||
# Prefix to put on installed `make' binary file name.
|
||||
binprefix =
|
||||
# Prefix to put on installed `make' man page file name.
|
||||
manprefix = $(binprefix)
|
||||
|
||||
# Whether or not make needs to be installed setgid.
|
||||
# The value should be either `true' or `false'.
|
||||
# On many systems, the getloadavg function (used to implement the `-l'
|
||||
# switch) will not work unless make is installed setgid kmem.
|
||||
install_setgid = @NEED_SETGID@
|
||||
# Install make setgid to this group so it can read /dev/kmem.
|
||||
group = @KMEM_GROUP@
|
||||
|
||||
# Program to install `make'.
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
# Program to install the man page.
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
# Generic install program.
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
# Program to format Texinfo source into Info files.
|
||||
MAKEINFO = makeinfo
|
||||
# Program to format Texinfo source into DVI files.
|
||||
TEXI2DVI = texi2dvi
|
||||
|
||||
# Programs to make tags files.
|
||||
ETAGS = etags -w
|
||||
CTAGS = ctags -w
|
||||
|
||||
objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \
|
||||
rule.o implicit.o default.o variable.o expand.o function.o \
|
||||
vpath.o version.o ar.o arscan.o signame.o remote-$(REMOTE).o \
|
||||
getopt.o getopt1.o glob/libglob.a \
|
||||
$(ALLOCA) $(extras)
|
||||
srcs = $(srcdir)/commands.c $(srcdir)/job.c $(srcdir)/dir.c \
|
||||
$(srcdir)/file.c $(srcdir)/getloadavg.c $(srcdir)/misc.c \
|
||||
$(srcdir)/main.c $(srcdir)/read.c $(srcdir)/remake.c \
|
||||
$(srcdir)/rule.c $(srcdir)/implicit.c $(srcdir)/default.c \
|
||||
$(srcdir)/variable.c $(srcdir)/expand.c $(srcdir)/function.c \
|
||||
$(srcdir)/vpath.c $(srcdir)/version.c \
|
||||
$(srcdir)/remote-$(REMOTE).c \
|
||||
$(srcdir)/ar.c $(srcdir)/arscan.c \
|
||||
$(srcdir)/signame.c $(srcdir)/signame.h \
|
||||
$(srcdir)/getopt.c $(srcdir)/getopt1.c $(srcdir)/getopt.h \
|
||||
$(srcdir)/commands.h $(srcdir)/dep.h $(srcdir)/filedef.h \
|
||||
$(srcdir)/job.h $(srcdir)/make.h $(srcdir)/rule.h \
|
||||
$(srcdir)/variable.h $(ALLOCA_SRC) $(srcdir)/config.h.in
|
||||
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
|
||||
|
||||
all: make
|
||||
info: make.info
|
||||
dvi: make.dvi
|
||||
# Some makes apparently use .PHONY as the default goal if it is before `all'.
|
||||
.PHONY: all check info dvi
|
||||
|
||||
make.info: make.texinfo
|
||||
$(MAKEINFO) -I$(srcdir) $(srcdir)/make.texinfo -o make.info
|
||||
|
||||
make.dvi: make.texinfo
|
||||
$(TEXI2DVI) $(srcdir)/make.texinfo
|
||||
|
||||
make.ps: make.dvi
|
||||
dvi2ps make.dvi > make.ps
|
||||
|
||||
make: $(objs)
|
||||
$(CC) $(LDFLAGS) $(objs) $(LOADLIBES) -o make.new
|
||||
mv -f make.new make
|
||||
|
||||
# -I. is needed to find config.h in the build directory.
|
||||
.c.o:
|
||||
$(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \
|
||||
$(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
|
||||
# For some losing Unix makes.
|
||||
SHELL = /bin/sh
|
||||
@SET_MAKE@
|
||||
|
||||
glob/libglob.a: FORCE config.h
|
||||
cd glob; $(MAKE) libglob.a
|
||||
FORCE:
|
||||
|
||||
tagsrcs = $(srcs) $(srcdir)/remote-*.c
|
||||
TAGS: $(tagsrcs)
|
||||
$(ETAGS) $(tagsrcs)
|
||||
tags: $(tagsrcs)
|
||||
$(CTAGS) $(tagsrcs)
|
||||
|
||||
.PHONY: install installdirs
|
||||
install: installdirs \
|
||||
$(bindir)/$(binprefix)make $(infodir)/make.info \
|
||||
$(mandir)/$(manprefix)make.$(manext)
|
||||
|
||||
installdirs:
|
||||
$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(mandir)
|
||||
|
||||
$(bindir)/$(binprefix)make: make
|
||||
$(INSTALL_PROGRAM) make $@.new
|
||||
@if $(install_setgid); then \
|
||||
if chgrp $(group) $@.new && chmod g+s $@.new; then \
|
||||
echo "chgrp $(group) $@.new && chmod g+s $@.new"; \
|
||||
else \
|
||||
echo "$@ needs to be owned by group $(group) and setgid;"; \
|
||||
echo "otherwise the \`-l' option will probably not work."; \
|
||||
echo "You may need special privileges to install $@."; \
|
||||
fi; \
|
||||
else true; fi
|
||||
# Some systems can't deal with renaming onto a running binary.
|
||||
-rm -f $@.old
|
||||
-mv $@ $@.old
|
||||
mv $@.new $@
|
||||
|
||||
$(infodir)/make.info: make.info
|
||||
if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
|
||||
for file in $${dir}/make.info*; do \
|
||||
name="`basename $$file`"; \
|
||||
$(INSTALL_DATA) $$file \
|
||||
`echo $@ | sed "s,make.info\$$,$$name,"`; \
|
||||
done
|
||||
# Run install-info only if it exists.
|
||||
# Use `if' instead of just prepending `-' to the
|
||||
# line so we notice real errors from install-info.
|
||||
# We use `$(SHELL) -c' because some shells do not
|
||||
# fail gracefully when there is an unknown command.
|
||||
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
|
||||
install-info --infodir=$(infodir) $$dir/make.info; \
|
||||
else true; fi
|
||||
|
||||
$(mandir)/$(manprefix)make.$(manext): make.man
|
||||
$(INSTALL_DATA) $(srcdir)/make.man $@
|
||||
|
||||
|
||||
loadavg: loadavg.c config.h
|
||||
$(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
|
||||
loadavg.c $(LOADLIBES) -o $@
|
||||
# We copy getloadavg.c into a different file rather than compiling it
|
||||
# directly because some compilers clobber getloadavg.o in the process.
|
||||
loadavg.c: getloadavg.c
|
||||
ln $(srcdir)/getloadavg.c loadavg.c || \
|
||||
cp $(srcdir)/getloadavg.c loadavg.c
|
||||
check-loadavg: loadavg
|
||||
@echo The system uptime program believes the load average to be:
|
||||
-uptime
|
||||
@echo The GNU load average checking code believes:
|
||||
./loadavg
|
||||
check: check-loadavg
|
||||
|
||||
|
||||
.PHONY: clean realclean distclean mostlyclean
|
||||
clean: glob-clean
|
||||
-rm -f make loadavg *.o core make.dvi
|
||||
distclean: clean glob-realclean
|
||||
-rm -f Makefile config.h config.status build.sh stamp-config
|
||||
-rm -f config.log config.cache
|
||||
-rm -f TAGS tags
|
||||
-rm -f make.?? make.??s make.log make.toc make.*aux
|
||||
-rm -f loadavg.c
|
||||
realclean: distclean
|
||||
-rm -f make.info*
|
||||
mostlyclean: clean
|
||||
|
||||
.PHONY: glob-clean glob-realclean
|
||||
glob-clean glob-realclean:
|
||||
cd glob; $(MAKE) $@
|
||||
|
||||
Makefile: config.status $(srcdir)/Makefile.in
|
||||
$(SHELL) config.status
|
||||
glob/Makefile: config.status $(srcdir)/glob/Makefile.in
|
||||
$(SHELL) config.status
|
||||
config.h: stamp-config ;
|
||||
stamp-config: config.status $(srcdir)/config.h.in
|
||||
$(SHELL) config.status
|
||||
touch stamp-config
|
||||
|
||||
#configure: configure.in aclocal.m4
|
||||
# cd $(srcdir) && autoconf $(ACFLAGS)
|
||||
#config.h.in: configure.in aclocal.m4
|
||||
# cd $(srcdir) && autoheader $(ACFLAGS)
|
||||
|
||||
# This tells versions [3.59,3.63) of GNU make not to export all variables.
|
||||
.NOEXPORT:
|
||||
|
||||
# The automatically generated dependencies below may omit config.h
|
||||
# because it is included with ``#include <config.h>'' rather than
|
||||
# ``#include "config.h"''. So we add the explicit dependency to make sure.
|
||||
$(objs): config.h
|
||||
|
||||
# Automatically generated dependencies will be put at the end of the file.
|
||||
|
||||
# Automatically generated dependencies.
|
||||
commands.o: commands.c make.h dep.h filedef.h variable.h job.h \
|
||||
commands.h
|
||||
job.o: job.c make.h job.h filedef.h commands.h variable.h
|
||||
dir.o: dir.c make.h
|
||||
file.o: file.c make.h dep.h filedef.h job.h commands.h variable.h
|
||||
misc.o: misc.c make.h dep.h
|
||||
main.o: main.c make.h dep.h filedef.h variable.h job.h commands.h \
|
||||
getopt.h
|
||||
read.o: read.c make.h dep.h filedef.h job.h commands.h variable.h \
|
||||
glob/glob.h
|
||||
remake.o: remake.c make.h filedef.h job.h commands.h dep.h
|
||||
rule.o: rule.c make.h dep.h filedef.h job.h commands.h variable.h \
|
||||
rule.h
|
||||
implicit.o: implicit.c make.h rule.h dep.h filedef.h
|
||||
default.o: default.c make.h rule.h dep.h filedef.h job.h commands.h \
|
||||
variable.h
|
||||
variable.o: variable.c make.h dep.h filedef.h job.h commands.h \
|
||||
variable.h
|
||||
expand.o: expand.c make.h filedef.h job.h commands.h variable.h
|
||||
function.o: function.c make.h filedef.h variable.h dep.h job.h \
|
||||
commands.h
|
||||
vpath.o: vpath.c make.h filedef.h variable.h
|
||||
version.o: version.c
|
||||
ar.o: ar.c make.h filedef.h dep.h
|
||||
arscan.o: arscan.c make.h
|
||||
signame.o: signame.c signame.h
|
||||
remote-stub.o: remote-stub.c make.h filedef.h job.h commands.h
|
||||
getopt.o: getopt.c
|
||||
getopt1.o: getopt1.c getopt.h
|
||||
getloadavg.o: getloadavg.c
|
||||
574
NEWS
Normal file
574
NEWS
Normal file
@@ -0,0 +1,574 @@
|
||||
GNU make NEWS -- history of user-visible changes. 9 May 1996
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
|
||||
Please send GNU make bug reports to bug-gnu-utils@prep.ai.mit.edu.
|
||||
|
||||
Version 3.75
|
||||
|
||||
* The directory messages printed by `-w' and implicitly in sub-makes,
|
||||
are now omitted if Make runs no commands and has no other messages to print.
|
||||
|
||||
* Make now detects files that for whatever reason have modification times
|
||||
in the future and gives an error. Files with such impossible timestamps
|
||||
can result from unsynchronized clocks, or archived distributions
|
||||
containing bogus timestamps; they confuse Make's dependency engine
|
||||
thoroughly.
|
||||
|
||||
* The new directive `sinclude' is now recognized as another name for
|
||||
`-include', for compatibility with some other Makes.
|
||||
|
||||
* Aaron Digulla has contributed a port to AmigaDOS. See README.Amiga for
|
||||
details, and direct all Amiga-related questions to <digulla@fh-konstanz.de>.
|
||||
|
||||
Version 3.73
|
||||
|
||||
* Converted to use Autoconf version 2, so `configure' has some new options.
|
||||
See INSTALL for details.
|
||||
|
||||
* You can now send a SIGUSR1 signal to Make to toggle printing of debugging
|
||||
output enabled by -d, at any time during the run.
|
||||
|
||||
Version 3.72
|
||||
|
||||
* DJ Delorie has ported Make to MS-DOS using the GO32 extender.
|
||||
He is maintaining the DOS port, not the GNU Make maintainer;
|
||||
please direct bugs and questions for DOS to <djgpp@sun.soe.clarkson.edu>.
|
||||
MS-DOS binaries are available for FTP from oak.oakland.edu:pub/msdos/djgpp.
|
||||
|
||||
* The `MAKEFLAGS' variable (in the environment or in a makefile) can now
|
||||
contain variable definitions itself; these are treated just like
|
||||
command-line variable definitions. Make will automatically insert any
|
||||
variable definitions from the environment value of `MAKEFLAGS' or from
|
||||
the command line, into the `MAKEFLAGS' value exported to children. The
|
||||
`MAKEOVERRIDES' variable previously included in the value of `$(MAKE)'
|
||||
for sub-makes is now included in `MAKEFLAGS' instead. As before, you can
|
||||
reset `MAKEOVERRIDES' in your makefile to avoid putting all the variables
|
||||
in the environment when its size is limited.
|
||||
|
||||
* If `.DELETE_ON_ERROR' appears as a target, Make will delete the target of
|
||||
a rule if it has changed when its commands exit with a nonzero status,
|
||||
just as when the commands get a signal.
|
||||
|
||||
* The automatic variable `$+' is new. It lists all the dependencies like
|
||||
`$^', but preserves duplicates listed in the makefile. This is useful
|
||||
for linking rules, where library files sometimes need to be listed twice
|
||||
in the link order.
|
||||
|
||||
* You can now specify the `.IGNORE' and `.SILENT' special targets with
|
||||
dependencies to limit their effects to those files. If a file appears as
|
||||
a dependency of `.IGNORE', then errors will be ignored while running the
|
||||
commands to update that file. Likewise if a file appears as a dependency
|
||||
of `.SILENT', then the commands to update that file will not be printed
|
||||
before they are run. (This change was made to conform to POSIX.2.)
|
||||
|
||||
Version 3.71
|
||||
|
||||
* The automatic variables `$(@D)', `$(%D)', `$(*D)', `$(<D)', `$(?D)', and
|
||||
`$(^D)' now omit the trailing slash from the directory name. (This change
|
||||
was made to comply with POSIX.2.)
|
||||
|
||||
* The source distribution now includes the Info files for the Make manual.
|
||||
There is no longer a separate distribution containing Info and DVI files.
|
||||
|
||||
* You can now set the variables `binprefix' and/or `manprefix' in
|
||||
Makefile.in (or on the command line when installing) to install GNU make
|
||||
under a name other than `make' (i.e., ``make binprefix=g install''
|
||||
installs GNU make as `gmake').
|
||||
|
||||
* The built-in Texinfo rules use the new variables `TEXI2DVI_FLAGS' for
|
||||
flags to the `texi2dvi' script, and `MAKEINFO_FLAGS' for flags to the
|
||||
Makeinfo program.
|
||||
|
||||
* The exit status of Make when it runs into errors is now 2 instead of 1.
|
||||
The exit status is 1 only when using -q and some target is not up to date.
|
||||
(This change was made to comply with POSIX.2.)
|
||||
|
||||
Version 3.70
|
||||
|
||||
* It is no longer a fatal error to have a NUL character in a makefile.
|
||||
You should never put a NUL in a makefile because it can have strange
|
||||
results, but otherwise empty lines full of NULs (such as produced by
|
||||
the `xmkmf' program) will always work fine.
|
||||
|
||||
* The error messages for nonexistent included makefiles now refer to the
|
||||
makefile name and line number where the `include' appeared, so Emacs's
|
||||
C-x ` command takes you there (in case it's a typo you need to fix).
|
||||
|
||||
Version 3.69
|
||||
|
||||
* Implicit rule search for archive member references is now done in the
|
||||
opposite order from previous versions: the whole target name `LIB(MEM)'
|
||||
first, and just the member name and parentheses `(MEM)' second.
|
||||
|
||||
* Make now gives an error for an unterminated variable or function reference.
|
||||
For example, `$(foo' with no matching `)' or `${bar' with no matching `}'.
|
||||
|
||||
* The new default variable `MAKE_VERSION' gives the version number of
|
||||
Make, and a string describing the remote job support compiled in (if any).
|
||||
Thus the value (in this release) is something like `3.69' or `3.69-Customs'.
|
||||
|
||||
* Commands in an invocation of the `shell' function are no longer run with
|
||||
a modified environment like target commands are. As in versions before
|
||||
3.68, they now run with the environment that `make' started with. We
|
||||
have reversed the change made in version 3.68 because it turned out to
|
||||
cause a paradoxical situation in cases like:
|
||||
|
||||
export variable = $(shell echo value)
|
||||
|
||||
When Make attempted to put this variable in the environment for a target
|
||||
command, it would try expand the value by running the shell command
|
||||
`echo value'. In version 3.68, because it constructed an environment
|
||||
for that shell command in the same way, Make would begin to go into an
|
||||
infinite loop and then get a fatal error when it detected the loop.
|
||||
|
||||
* The commands given for `.DEFAULT' are now used for phony targets with no
|
||||
commands.
|
||||
|
||||
Version 3.68
|
||||
|
||||
* You can list several archive member names inside parenthesis:
|
||||
`lib(mem1 mem2 mem3)' is equivalent to `lib(mem1) lib(mem2) lib(mem3)'.
|
||||
|
||||
* You can use wildcards inside archive member references. For example,
|
||||
`lib(*.o)' expands to all existing members of `lib' whose names end in
|
||||
`.o' (e.g. `lib(a.o) lib(b.o)'); `*.a(*.o)' expands to all such members
|
||||
of all existing files whose names end in `.a' (e.g. `foo.a(a.o)
|
||||
foo.a(b.o) bar.a(c.o) bar.a(d.o)'.
|
||||
|
||||
* A suffix rule `.X.a' now produces two pattern rules:
|
||||
(%.o): %.X # Previous versions produced only this.
|
||||
%.a: %.X # Now produces this as well, just like other suffixes.
|
||||
|
||||
* The new flag `--warn-undefined-variables' says to issue a warning message
|
||||
whenever Make expands a reference to an undefined variable.
|
||||
|
||||
* The new `-include' directive is just like `include' except that there is
|
||||
no error (not even a warning) for a nonexistent makefile.
|
||||
|
||||
* Commands in an invocation of the `shell' function are now run with a
|
||||
modified environment like target commands are, so you can use `export' et
|
||||
al to set up variables for them. They used to run with the environment
|
||||
that `make' started with.
|
||||
|
||||
Version 3.66
|
||||
|
||||
* `make --version' (or `make -v') now exits immediately after printing
|
||||
the version number.
|
||||
|
||||
Version 3.65
|
||||
|
||||
* Make now supports long-named members in `ar' archive files.
|
||||
|
||||
Version 3.64
|
||||
|
||||
* Make now supports the `+=' syntax for a variable definition which appends
|
||||
to the variable's previous value. See the section `Appending More Text
|
||||
to Variables' in the manual for full details.
|
||||
|
||||
* The new option `--no-print-directory' inhibits the `-w' or
|
||||
`--print-directory' feature. Make turns on `--print-directory'
|
||||
automatically if you use `-C' or `--directory', and in sub-makes; some
|
||||
users have found this behavior undesirable.
|
||||
|
||||
* The built-in implicit rules now support the alternative extension
|
||||
`.txinfo' for Texinfo files, just like `.texinfo' and `.texi'.
|
||||
|
||||
Version 3.63
|
||||
|
||||
* Make now uses a standard GNU `configure' script. See the new file
|
||||
INSTALL for the new (and much simpler) installation procedure.
|
||||
|
||||
* There is now a shell script to build Make the first time, if you have no
|
||||
other `make' program. `build.sh' is created by `configure'; see README.
|
||||
|
||||
* GNU Make now completely conforms to the POSIX.2 specification for `make'.
|
||||
|
||||
* Elements of the `$^' and `$?' automatic variables that are archive
|
||||
member references now list only the member name, as in Unix and POSIX.2.
|
||||
|
||||
* You should no longer ever need to specify the `-w' switch, which prints
|
||||
the current directory before and after Make runs. The `-C' switch to
|
||||
change directory, and recursive use of Make, now set `-w' automatically.
|
||||
|
||||
* Multiple double-colon rules for the same target will no longer have their
|
||||
commands run simultaneously under -j, as this could result in the two
|
||||
commands trying to change the file at the same time and interfering with
|
||||
one another.
|
||||
|
||||
* The `SHELL' variable is now never taken from the environment.
|
||||
Each makefile that wants a shell other than the default (/bin/sh) must
|
||||
set SHELL itself. SHELL is always exported to child processes.
|
||||
This change was made for compatibility with POSIX.2.
|
||||
|
||||
* Make now accepts long options. There is now an informative usage message
|
||||
that tells you what all the options are and what they do. Try `make --help'.
|
||||
|
||||
* There are two new directives: `export' and `unexport'. All variables are
|
||||
no longer automatically put into the environments of the commands that
|
||||
Make runs. Instead, only variables specified on the command line or in
|
||||
the environment are exported by default. To export others, use:
|
||||
export VARIABLE
|
||||
or you can define variables with:
|
||||
export VARIABLE = VALUE
|
||||
or:
|
||||
export VARIABLE := VALUE
|
||||
You can use just:
|
||||
export
|
||||
or:
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
to get the old behavior. See the node `Variables/Recursion' in the manual
|
||||
for a full description.
|
||||
|
||||
* The commands from the `.DEFAULT' special target are only applied to
|
||||
targets which have no rules at all, not all targets with no commands.
|
||||
This change was made for compatibility with Unix make.
|
||||
|
||||
* All fatal error messages now contain `***', so they are easy to find in
|
||||
compilation logs.
|
||||
|
||||
* Dependency file names like `-lNAME' are now replaced with the actual file
|
||||
name found, as with files found by normal directory search (VPATH).
|
||||
The library file `libNAME.a' may now be found in the current directory,
|
||||
which is checked before VPATH; the standard set of directories (/lib,
|
||||
/usr/lib, /usr/local/lib) is now checked last.
|
||||
See the node `Libraries/Search' in the manual for full details.
|
||||
|
||||
* A single `include' directive can now specify more than one makefile to
|
||||
include, like this:
|
||||
include file1 file2
|
||||
You can also use shell file name patterns in an `include' directive:
|
||||
include *.mk
|
||||
|
||||
* The default directories to search for included makefiles, and for
|
||||
libraries specified with `-lNAME', are now set by configuration.
|
||||
|
||||
* You can now use blanks as well as colons to separate the directories in a
|
||||
search path for the `vpath' directive or the `VPATH' variable.
|
||||
|
||||
* You can now use variables and functions in the left hand side of a
|
||||
variable assignment, as in "$(foo)bar = value".
|
||||
|
||||
* The `MAKE' variable is always defined as `$(MAKE_COMMAND) $(MAKEOVERRIDES)'.
|
||||
The `MAKE_COMMAND' variable is now defined to the name with which make
|
||||
was invoked.
|
||||
|
||||
* The built-in rules for C++ compilation now use the variables `$(CXX)' and
|
||||
`$(CXXFLAGS)' instead of `$(C++)' and `$(C++FLAGS)'. The old names had
|
||||
problems with shells that cannot have `+' in environment variable names.
|
||||
|
||||
* The value of a recursively expanded variable is now expanded when putting
|
||||
it into the environment for child processes. This change was made for
|
||||
compatibility with Unix make.
|
||||
|
||||
* A rule with no targets before the `:' is now accepted and ignored.
|
||||
This change was made for compatibility with SunOS 4 make.
|
||||
We do not recommend that you write your makefiles to take advantage of this.
|
||||
|
||||
* The `-I' switch can now be used in MAKEFLAGS, and are put there
|
||||
automatically just like other switches.
|
||||
|
||||
Version 3.61
|
||||
|
||||
* Built-in rules for C++ source files with the `.C' suffix.
|
||||
We still recommend that you use `.cc' instead.
|
||||
|
||||
* If commands are given too many times for a single target,
|
||||
the last set given is used, and a warning message is printed.
|
||||
|
||||
* Error messages about makefiles are in standard GNU error format,
|
||||
so C-x ` in Emacs works on them.
|
||||
|
||||
* Dependencies of pattern rules which contain no % need not actually exist
|
||||
if they can be created (just like dependencies which do have a %).
|
||||
|
||||
Version 3.60
|
||||
|
||||
* A message is always printed when Make decides there is nothing to be done.
|
||||
It used to be that no message was printed for top-level phony targets
|
||||
(because "`phony' is up to date" isn't quite right). Now a different
|
||||
message "Nothing to be done for `phony'" is printed in that case.
|
||||
|
||||
* Archives on AIX now supposedly work.
|
||||
|
||||
* When the commands specified for .DEFAULT are used to update a target,
|
||||
the $< automatic variable is given the same value as $@ for that target.
|
||||
This is how Unix make behaves, and this behavior is mandated by POSIX.2.
|
||||
|
||||
Version 3.59
|
||||
|
||||
* The -n, -q, and -t options are not put in the `MAKEFLAGS' and `MFLAG'
|
||||
variables while remaking makefiles, so recursive makes done while remaking
|
||||
makefiles will behave properly.
|
||||
|
||||
* If the special target `.NOEXPORT' is specified in a makefile,
|
||||
only variables that came from the environment and variables
|
||||
defined on the command line are exported.
|
||||
|
||||
Version 3.58
|
||||
|
||||
* Suffix rules may have dependencies (which are ignored).
|
||||
|
||||
Version 3.57
|
||||
|
||||
* Dependencies of the form `-lLIB' are searched for as /usr/local/lib/libLIB.a
|
||||
as well as libLIB.a in /usr/lib, /lib, the current directory, and VPATH.
|
||||
|
||||
Version 3.55
|
||||
|
||||
* There is now a Unix man page for GNU Make. It is certainly not a replacement
|
||||
for the Texinfo manual, but it documents the basic functionality and the
|
||||
switches. For full documentation, you should still read the Texinfo manual.
|
||||
Thanks to Dennis Morse of Stanford University for contributing the initial
|
||||
version of this.
|
||||
|
||||
* Variables which are defined by default (e.g., `CC') will no longer be put
|
||||
into the environment for child processes. (If these variables are reset by the
|
||||
environment, makefiles, or the command line, they will still go into the
|
||||
environment.)
|
||||
|
||||
* Makefiles which have commands but no dependencies (and thus are always
|
||||
considered out of date and in need of remaking), will not be remade (if they
|
||||
were being remade only because they were makefiles). This means that GNU
|
||||
Make will no longer go into an infinite loop when fed the makefiles that
|
||||
`imake' (necessary to build X Windows) produces.
|
||||
|
||||
* There is no longer a warning for using the `vpath' directive with an explicit
|
||||
pathname (instead of a `%' pattern).
|
||||
|
||||
Version 3.51
|
||||
|
||||
* When removing intermediate files, only one `rm' command line is printed,
|
||||
listing all file names.
|
||||
|
||||
* There are now automatic variables `$(^D)', `$(^F)', `$(?D)', and `$(?F)'.
|
||||
These are the directory-only and file-only versions of `$^' and `$?'.
|
||||
|
||||
* Library dependencies given as `-lNAME' will use "libNAME.a" in the current
|
||||
directory if it exists.
|
||||
|
||||
* The automatic variable `$($/)' is no longer defined.
|
||||
|
||||
* Leading `+' characters on a command line make that line be executed even
|
||||
under -n, -t, or -q (as if the line contained `$(MAKE)').
|
||||
|
||||
* For command lines containing `$(MAKE)', `${MAKE}', or leading `+' characters,
|
||||
only those lines are executed, not their entire rules.
|
||||
(This is how Unix make behaves for lines containing `$(MAKE)' or `${MAKE}'.)
|
||||
|
||||
Version 3.50
|
||||
|
||||
* Filenames in rules will now have ~ and ~USER expanded.
|
||||
|
||||
* The `-p' output has been changed so it can be used as a makefile.
|
||||
(All information that isn't specified by makefiles is prefaced with comment
|
||||
characters.)
|
||||
|
||||
Version 3.49
|
||||
|
||||
* The % character can be quoted with backslash in implicit pattern rules,
|
||||
static pattern rules, `vpath' directives, and `patsubst', `filter', and
|
||||
`filter-out' functions. A warning is issued if a `vpath' directive's
|
||||
pattern contains no %.
|
||||
|
||||
* The `wildcard' variable expansion function now expands ~ and ~USER.
|
||||
|
||||
* Messages indicating failed commands now contain the target name:
|
||||
make: *** [target] Error 1
|
||||
|
||||
* The `-p' output format has been changed somewhat to look more like
|
||||
makefile rules and to give all information that Make has about files.
|
||||
|
||||
Version 3.48
|
||||
|
||||
Version 3.47
|
||||
|
||||
* The `-l' switch with no argument removes any previous load-average limit.
|
||||
|
||||
* When the `-w' switch is in effect, and Make has updated makefiles,
|
||||
it will write a `Leaving directory' messagfe before re-executing itself.
|
||||
This makes the `directory change tracking' changes to Emacs's compilation
|
||||
commands work properly.
|
||||
|
||||
Version 3.46
|
||||
|
||||
* The automatic variable `$*' is now defined for explicit rules,
|
||||
as it is in Unix make.
|
||||
|
||||
Version 3.45
|
||||
|
||||
* The `-j' switch is now put in the MAKEFLAGS and MFLAGS variables when
|
||||
specified without an argument (indicating infinite jobs).
|
||||
The `-l' switch is not always put in the MAKEFLAGS and MFLAGS variables.
|
||||
|
||||
* Make no longer checks hashed directories after running commands.
|
||||
The behavior implemented in 3.41 caused too much slowdown.
|
||||
|
||||
Version 3.44
|
||||
|
||||
* A dependency is NOT considered newer than its dependent if
|
||||
they have the same modification time. The behavior implemented
|
||||
in 3.43 conflicts with RCS.
|
||||
|
||||
Version 3.43
|
||||
|
||||
* Dependency loops are no longer fatal errors.
|
||||
|
||||
* A dependency is considered newer than its dependent if
|
||||
they have the same modification time.
|
||||
|
||||
Version 3.42
|
||||
|
||||
* The variables F77 and F77FLAGS are now set by default to $(FC) and
|
||||
$(FFLAGS). Makefiles designed for System V make may use these variables in
|
||||
explicit rules and expect them to be set. Unfortunately, there is no way to
|
||||
make setting these affect the Fortran implicit rules unless FC and FFLAGS
|
||||
are not used (and these are used by BSD make).
|
||||
|
||||
Version 3.41
|
||||
|
||||
* Make now checks to see if its hashed directories are changed by commands.
|
||||
Other makes that hash directories (Sun, 4.3 BSD) don't do this.
|
||||
|
||||
Version 3.39
|
||||
|
||||
* The `shell' function no longer captures standard error output.
|
||||
|
||||
Version 3.32
|
||||
|
||||
* A file beginning with a dot can be the default target if it also contains
|
||||
a slash (e.g., `../bin/foo'). (Unix make allows this as well.)
|
||||
|
||||
Version 3.31
|
||||
|
||||
* Archive member names are truncated to 15 characters.
|
||||
|
||||
* Yet more USG stuff.
|
||||
|
||||
* Minimal support for Microport System V (a 16-bit machine and a
|
||||
brain-damaged compiler). This has even lower priority than other USG
|
||||
support, so if it gets beyond trivial, I will take it out completely.
|
||||
|
||||
* Revamped default implicit rules (not much visible change).
|
||||
|
||||
* The -d and -p options can come from the environment.
|
||||
|
||||
Version 3.30
|
||||
|
||||
* Improved support for USG and HPUX (hopefully).
|
||||
|
||||
* A variable reference like `$(foo:a=b)', if `a' contains a `%', is
|
||||
equivalent to `$(patsubst a,b,$(foo))'.
|
||||
|
||||
* Defining .DEFAULT with no deps or commands clears its commands.
|
||||
|
||||
* New default implicit rules for .S (cpp, then as), and .sh (copy and make
|
||||
executable). All default implicit rules that use cpp (even indirectly), use
|
||||
$(CPPFLAGS).
|
||||
|
||||
Version 3.29
|
||||
|
||||
* Giving the -j option with no arguments gives you infinite jobs.
|
||||
|
||||
Version 3.28
|
||||
|
||||
* New option: "-l LOAD" says not to start any new jobs while others are
|
||||
running if the load average is not below LOAD (a floating-point number).
|
||||
|
||||
* There is support in place for implementations of remote command execution
|
||||
in Make. See the file remote.c.
|
||||
|
||||
Version 3.26
|
||||
|
||||
* No more than 10 directories will be kept open at once.
|
||||
(This number can be changed by redefining MAX_OPEN_DIRECTORIES in dir.c.)
|
||||
|
||||
Version 3.25
|
||||
|
||||
* Archive files will have their modification times recorded before doing
|
||||
anything that might change their modification times by updating an archive
|
||||
member.
|
||||
|
||||
Version 3.20
|
||||
|
||||
* The `MAKELEVEL' variable is defined for use by makefiles.
|
||||
|
||||
Version 3.19
|
||||
|
||||
* The recursion level indications in error messages are much shorter than
|
||||
they were in version 3.14.
|
||||
|
||||
Version 3.18
|
||||
|
||||
* Leading spaces before directives are ignored (as documented).
|
||||
|
||||
* Included makefiles can determine the default goal target.
|
||||
(System V Make does it this way, so we are being compatible).
|
||||
|
||||
Version 3.14.
|
||||
|
||||
* Variables that are defaults built into Make will not be put in the
|
||||
environment for children. This just saves some environment space and,
|
||||
except under -e, will be transparent to sub-makes.
|
||||
|
||||
* Error messages from sub-makes will indicate the level of recursion.
|
||||
|
||||
* Hopefully some speed-up for large directories due to a change in the
|
||||
directory hashing scheme.
|
||||
|
||||
* One child will always get a standard input that is usable.
|
||||
|
||||
* Default makefiles that don't exist will be remade and read in.
|
||||
|
||||
Version 3.13.
|
||||
|
||||
* Count parentheses inside expansion function calls so you can
|
||||
have nested calls: `$(sort $(foreach x,a b,$(x)))'.
|
||||
|
||||
Version 3.12.
|
||||
|
||||
* Several bug fixes, including USG and Sun386i support.
|
||||
|
||||
* `shell' function to expand shell commands a la `
|
||||
|
||||
* If the `-d' flag is given, version information will be printed.
|
||||
|
||||
* The `-c' option has been renamed to `-C' for compatibility with tar.
|
||||
|
||||
* The `-p' option no longer inhibits other normal operation.
|
||||
|
||||
* Makefiles will be updated and re-read if necessary.
|
||||
|
||||
* Can now run several commands at once (parallelism), -j option.
|
||||
|
||||
* Error messages will contain the level of Make recursion, if any.
|
||||
|
||||
* The `MAKEFLAGS' and `MFLAGS' variables will be scanned for options after
|
||||
makefiles are read.
|
||||
|
||||
* A double-colon rule with no dependencies will always have its commands run.
|
||||
(This is how both the BSD and System V versions of Make do it.)
|
||||
|
||||
Version 3.05
|
||||
|
||||
(Changes from versions 1 through 3.05 were never recorded. Sorry.)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Copyright information:
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to anyone to make or distribute verbatim copies
|
||||
of this document as received, in any medium, provided that the
|
||||
copyright notice and this permission notice are preserved,
|
||||
thus giving the recipient permission to redistribute in turn.
|
||||
|
||||
Permission is granted to distribute modified versions
|
||||
of this document, or of portions of it,
|
||||
under the above conditions, provided also that they
|
||||
carry prominent notices stating who last changed them.
|
||||
|
||||
Local variables:
|
||||
version-control: never
|
||||
end:
|
||||
32
README
Normal file
32
README
Normal file
@@ -0,0 +1,32 @@
|
||||
This directory contains the 3.74.4 test release of GNU Make.
|
||||
All bugs reported for previous test releases have been fixed.
|
||||
Some bugs surely remain.
|
||||
|
||||
For general building and installation instructions, see the file INSTALL.
|
||||
If you need to build GNU Make and have no other `make' program to use,
|
||||
you can use the shell script `build.sh' instead. To do this, first run
|
||||
`configure' as described in INSTALL. Then, instead of typing `make' to
|
||||
build the program, type `sh build.sh'. This should compile the program
|
||||
in the current directory. Then you will have a Make program that you can
|
||||
use for `make install', or whatever else.
|
||||
|
||||
Some systems' Make programs are broken and cannot process the Makefile for
|
||||
GNU Make. If you get errors from your system's Make when building GNU
|
||||
Make, try using `build.sh' instead.
|
||||
|
||||
It has been reported that the XLC 1.2 compiler on AIX 3.2 is buggy such
|
||||
that if you compile make with `cc -O' on AIX 3.2, it will not work correctly.
|
||||
It is said that using `cc' without `-O' does work.
|
||||
|
||||
One area that is often a problem in configuration and porting is the code
|
||||
to check the system's current load average. To make it easier to test and
|
||||
debug this code, you can do `make check-loadavg' to see if it works
|
||||
properly on your system. (You must run `configure' beforehand, but you
|
||||
need not build Make itself to run this test.)
|
||||
|
||||
See the file NEWS for what has changed since previous releases.
|
||||
|
||||
GNU Make is fully documented in make.texinfo. See the section entitled
|
||||
`Problems and Bugs' for information on submitting bug reports.
|
||||
|
||||
GNU Make is free software. See the file COPYING for copying conditions.
|
||||
61
README.Amiga
Normal file
61
README.Amiga
Normal file
@@ -0,0 +1,61 @@
|
||||
Short: Port of GNU make with SAS/C (no ixemul.library required)
|
||||
Author: GNU, Amiga port by Aaron "Optimizer" Digulla
|
||||
Uploader: Aaron "Optimizer" Digulla (digulla@fh-konstanz.de)
|
||||
Type: dev/c
|
||||
|
||||
This is a pure Amiga port of GNU make 3.74. It needs no extra libraries or
|
||||
anything. It has the following features (in addition to any features of
|
||||
GNU make):
|
||||
|
||||
- Runs Amiga-Commands with SystemTags() (Execute)
|
||||
- Can run multi-line statements
|
||||
- Allows to use Device-Names in targets:
|
||||
|
||||
c:make : make.o
|
||||
|
||||
is ok. To distinguish between device-names and target : or ::, MAKE
|
||||
looks for spaces. If there are any around :, it's taken as a target
|
||||
delimiter, if there are none, it's taken as the name of a device. Note
|
||||
that "make:make.o" tries to create "make.o" on the device "make:".
|
||||
- Replaces @@ by a newline in any command line:
|
||||
|
||||
if exists make @@\
|
||||
delete make.bak quiet @@\
|
||||
rename make make.bak @@\
|
||||
endif @@\
|
||||
$(CC) Link Make.o To make
|
||||
|
||||
works. Note that the @@ must stand alone (ie. "make@@\" is illegal).
|
||||
Also be carefull that there is a space after the "\" (ie, at the
|
||||
beginning of the next line).
|
||||
- Can be made resident to save space and time
|
||||
- Amiga specific wildcards can be used in $(wildcard ...)
|
||||
|
||||
BUGS:
|
||||
- The line
|
||||
|
||||
dummy.h : src/*.c
|
||||
|
||||
tries to make dummy.h from "src/*.c" (ie. no wildcard-expansion takes
|
||||
place). You have to use "$(wildcard src/*.c)" instead.
|
||||
|
||||
COMPILING FROM SCRATCH
|
||||
----------------------
|
||||
|
||||
To recompile, you need SAS/C 6.51. make itself is not neccessary, there
|
||||
is an smakefile.
|
||||
|
||||
1. Copy config.ami to config.h
|
||||
2. If you use make to compie, copy Makefile.ami to Makefile and
|
||||
glob/Makefile.ami to glob/Makefile. Copy make into the current
|
||||
directory.
|
||||
|
||||
3. Run smake/make
|
||||
|
||||
INSTALLATION
|
||||
|
||||
Copy make somewhere in your search path (eg. sc:c or sc:bin).
|
||||
If you plan to use recursive makes, install make resident:
|
||||
|
||||
Resident make Add
|
||||
|
||||
32
README.template
Normal file
32
README.template
Normal file
@@ -0,0 +1,32 @@
|
||||
This directory contains the VERSION test release of GNU Make.
|
||||
All bugs reported for previous test releases have been fixed.
|
||||
Some bugs surely remain.
|
||||
|
||||
For general building and installation instructions, see the file INSTALL.
|
||||
If you need to build GNU Make and have no other `make' program to use,
|
||||
you can use the shell script `build.sh' instead. To do this, first run
|
||||
`configure' as described in INSTALL. Then, instead of typing `make' to
|
||||
build the program, type `sh build.sh'. This should compile the program
|
||||
in the current directory. Then you will have a Make program that you can
|
||||
use for `make install', or whatever else.
|
||||
|
||||
Some systems' Make programs are broken and cannot process the Makefile for
|
||||
GNU Make. If you get errors from your system's Make when building GNU
|
||||
Make, try using `build.sh' instead.
|
||||
|
||||
It has been reported that the XLC 1.2 compiler on AIX 3.2 is buggy such
|
||||
that if you compile make with `cc -O' on AIX 3.2, it will not work correctly.
|
||||
It is said that using `cc' without `-O' does work.
|
||||
|
||||
One area that is often a problem in configuration and porting is the code
|
||||
to check the system's current load average. To make it easier to test and
|
||||
debug this code, you can do `make check-loadavg' to see if it works
|
||||
properly on your system. (You must run `configure' beforehand, but you
|
||||
need not build Make itself to run this test.)
|
||||
|
||||
See the file NEWS for what has changed since previous releases.
|
||||
|
||||
GNU Make is fully documented in make.texinfo. See the section entitled
|
||||
`Problems and Bugs' for information on submitting bug reports.
|
||||
|
||||
GNU Make is free software. See the file COPYING for copying conditions.
|
||||
13
SCOPTIONS
Normal file
13
SCOPTIONS
Normal file
@@ -0,0 +1,13 @@
|
||||
ERRORREXX
|
||||
OPTIMIZE
|
||||
NOVERSION
|
||||
OPTIMIZERTIME
|
||||
OPTIMIZERALIAS
|
||||
DEFINE INCLUDEDIR="include:"
|
||||
DEFINE LIBDIR="lib:"
|
||||
DEFINE NO_ALLOCA
|
||||
DEFINE NO_FLOAT
|
||||
DEFINE NO_ARCHIVES
|
||||
IGNORE=161
|
||||
IGNORE=100
|
||||
STARTUP=cres
|
||||
276
SMakefile.template
Normal file
276
SMakefile.template
Normal file
@@ -0,0 +1,276 @@
|
||||
# NOTE: If you have no `make' program at all to process this makefile, run
|
||||
# `build.sh' instead.
|
||||
#
|
||||
# Copyright (C) 1988, 89, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
# This file is part of GNU Make.
|
||||
#
|
||||
# GNU Make 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 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Makefile for GNU Make
|
||||
#
|
||||
|
||||
# Ultrix 2.2 make doesn't expand the value of VPATH.
|
||||
VPATH = /make-3.74/
|
||||
# This must repeat the value, because configure will remove `VPATH = .'.
|
||||
srcdir = /make-3.74/
|
||||
|
||||
CC = sc
|
||||
RM = delete
|
||||
MAKE = smake
|
||||
|
||||
CFLAGS =
|
||||
CPPFLAGS =
|
||||
LDFLAGS =
|
||||
|
||||
# Define these for your system as follows:
|
||||
# -DNO_ARCHIVES To disable `ar' archive support.
|
||||
# -DNO_FLOAT To avoid using floating-point numbers.
|
||||
# -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2.
|
||||
# Some compilers apparently accept this
|
||||
# without complaint but produce losing code,
|
||||
# so beware.
|
||||
# NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
|
||||
# See also `config.h'.
|
||||
defines =
|
||||
|
||||
# Which flavor of remote job execution support to use.
|
||||
# The code is found in `remote-$(REMOTE).c'.
|
||||
REMOTE = stub
|
||||
|
||||
# If you are using the GNU C library, or have the GNU getopt functions in
|
||||
# your C library, you can comment these out.
|
||||
GETOPT = getopt.o getopt1.o
|
||||
GETOPT_SRC = $(srcdir)getopt.c $(srcdir)getopt1.c $(srcdir)getopt.h
|
||||
|
||||
# If you are using the GNU C library, or have the GNU glob functions in
|
||||
# your C library, you can comment this out. GNU make uses special hooks
|
||||
# into the glob functions to be more efficient (by using make's directory
|
||||
# cache for globbing), so you must use the GNU functions even if your
|
||||
# system's C library has the 1003.2 glob functions already. Also, the glob
|
||||
# functions in the AIX and HPUX C libraries are said to be buggy.
|
||||
GLOB = Lib glob/glob.lib
|
||||
|
||||
# If your system doesn't have alloca, or the one provided is bad, define this.
|
||||
ALLOCA = alloca.o
|
||||
ALLOCA_SRC = $(srcdir)alloca.c
|
||||
|
||||
# If your system needs extra libraries loaded in, define them here.
|
||||
# System V probably need -lPW for alloca. HP-UX 7.0's alloca in
|
||||
# libPW.a is broken on HP9000s300 and HP9000s400 machines. Use
|
||||
# alloca.c instead on those machines.
|
||||
LOADLIBES =
|
||||
|
||||
# Any extra object files your system needs.
|
||||
extras = amiga.o
|
||||
|
||||
# Common prefix for machine-independent installed files.
|
||||
prefix =
|
||||
# Common prefix for machine-dependent installed files.
|
||||
exec_prefix =
|
||||
|
||||
# Directory to install `make' in.
|
||||
bindir = sc:c
|
||||
# Directory to find libraries in for `-lXXX'.
|
||||
libdir = lib:
|
||||
# Directory to search by default for included makefiles.
|
||||
includedir = include:
|
||||
# Directory to install the Info files in.
|
||||
infodir = doc:
|
||||
# Directory to install the man page in.
|
||||
mandir = t:
|
||||
# Number to put on the man page filename.
|
||||
manext = 1
|
||||
# Prefix to put on installed `make' binary file name.
|
||||
binprefix =
|
||||
# Prefix to put on installed `make' man page file name.
|
||||
manprefix = $(binprefix)
|
||||
|
||||
# Whether or not make needs to be installed setgid.
|
||||
# The value should be either `true' or `false'.
|
||||
# On many systems, the getloadavg function (used to implement the `-l'
|
||||
# switch) will not work unless make is installed setgid kmem.
|
||||
install_setgid = false
|
||||
# Install make setgid to this group so it can read /dev/kmem.
|
||||
group = sys
|
||||
|
||||
# Program to install `make'.
|
||||
INSTALL_PROGRAM = copy
|
||||
# Program to install the man page.
|
||||
INSTALL_DATA = copy
|
||||
# Generic install program.
|
||||
INSTALL = copy
|
||||
|
||||
# Program to format Texinfo source into Info files.
|
||||
MAKEINFO = makeinfo
|
||||
# Program to format Texinfo source into DVI files.
|
||||
TEXI2DVI = texi2dvi
|
||||
|
||||
# Programs to make tags files.
|
||||
ETAGS = etags -w
|
||||
CTAGS = ctags -w
|
||||
|
||||
objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \
|
||||
rule.o implicit.o default.o variable.o expand.o function.o \
|
||||
vpath.o version.o ar.o arscan.o signame.o remote-$(REMOTE).o \
|
||||
$(GLOB) $(GETOPT) $(ALLOCA) $(extras)
|
||||
srcs = $(srcdir)commands.c $(srcdir)job.c $(srcdir)dir.c \
|
||||
$(srcdir)file.c $(srcdir)getloadavg.c $(srcdir)misc.c \
|
||||
$(srcdir)main.c $(srcdir)read.c $(srcdir)remake.c \
|
||||
$(srcdir)rule.c $(srcdir)implicit.c $(srcdir)default.c \
|
||||
$(srcdir)variable.c $(srcdir)expand.c $(srcdir)function.c \
|
||||
$(srcdir)vpath.c $(srcdir)version.c \
|
||||
$(srcdir)remote-$(REMOTE).c \
|
||||
$(srcdir)ar.c $(srcdir)arscan.c \
|
||||
$(srcdir)signame.c $(srcdir)signame.h $(GETOPT_SRC) \
|
||||
$(srcdir)commands.h $(srcdir)dep.h $(srcdir)file.h \
|
||||
$(srcdir)job.h $(srcdir)make.h $(srcdir)rule.h \
|
||||
$(srcdir)variable.h $(ALLOCA_SRC) $(srcdir)config.h.in
|
||||
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
|
||||
|
||||
all: make
|
||||
info: make.info
|
||||
dvi: make.dvi
|
||||
# Some makes apparently use .PHONY as the default goal if it is before `all'.
|
||||
.PHONY: all check info dvi
|
||||
|
||||
make.info: make.texinfo
|
||||
$(MAKEINFO) -I$(srcdir) $(srcdir)make.texinfo -o make.info
|
||||
|
||||
make.dvi: make.texinfo
|
||||
$(TEXI2DVI) $(srcdir)make.texinfo
|
||||
|
||||
make.ps: make.dvi
|
||||
dvi2ps make.dvi > make.ps
|
||||
|
||||
make: $(objs) glob/glob.lib
|
||||
$(CC) Link $(LDFLAGS) $(objs) $(LOADLIBES) To make.new
|
||||
-delete quiet make
|
||||
rename make.new make
|
||||
|
||||
# -I. is needed to find config.h in the build directory.
|
||||
.c.o:
|
||||
$(CC) $(defines) IDir "" IDir $(srcdir)glob \
|
||||
$(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
|
||||
glob/glob.lib:
|
||||
execute <<
|
||||
cd glob
|
||||
smake
|
||||
<
|
||||
|
||||
tagsrcs = $(srcs) $(srcdir)remote-*.c
|
||||
TAGS: $(tagsrcs)
|
||||
$(ETAGS) $(tagsrcs)
|
||||
tags: $(tagsrcs)
|
||||
$(CTAGS) $(tagsrcs)
|
||||
|
||||
.PHONY: install installdirs
|
||||
install:
|
||||
copy make sc:c
|
||||
|
||||
loadavg: loadavg.c config.h
|
||||
$(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
|
||||
loadavg.c $(LOADLIBES) -o $@
|
||||
|
||||
clean: glob-clean
|
||||
-$(RM) -f make loadavg *.o core make.dvi
|
||||
|
||||
distclean: clean glob-realclean
|
||||
-$(RM) -f Makefile config.h config.status build.sh stamp-config
|
||||
-$(RM) -f config.log config.cache
|
||||
-$(RM) -f TAGS tags
|
||||
-$(RM) -f make.?? make.??s make.log make.toc make.*aux
|
||||
-$(RM) -f loadavg.c
|
||||
|
||||
realclean: distclean
|
||||
-$(RM) -f make.info*
|
||||
|
||||
mostlyclean: clean
|
||||
|
||||
.PHONY: glob-clean glob-realclean
|
||||
|
||||
glob-clean glob-realclean:
|
||||
execute <<
|
||||
cd glob
|
||||
smake $@
|
||||
<
|
||||
|
||||
# The automatically generated dependencies below may omit config.h
|
||||
# because it is included with ``#include <config.h>'' rather than
|
||||
# ``#include "config.h"''. So we add the explicit dependency to make sure.
|
||||
$(objs): config.h
|
||||
|
||||
# Automatically generated dependencies will be put at the end of the file.
|
||||
|
||||
# Automatically generated dependencies.
|
||||
commands.o: commands.c make.h dep.h filedef.h variable.h job.h \
|
||||
commands.h
|
||||
|
||||
job.o: job.c make.h job.h filedef.h commands.h variable.h
|
||||
|
||||
dir.o: dir.c make.h
|
||||
|
||||
file.o: file.c make.h dep.h filedef.h job.h commands.h variable.h
|
||||
|
||||
misc.o: misc.c make.h dep.h
|
||||
|
||||
main.o: main.c make.h dep.h filedef.h variable.h job.h commands.h \
|
||||
getopt.h
|
||||
|
||||
read.o: read.c make.h dep.h filedef.h job.h commands.h variable.h \
|
||||
glob/glob.h
|
||||
|
||||
remake.o: remake.c make.h filedef.h job.h commands.h dep.h
|
||||
|
||||
rule.o: rule.c make.h dep.h filedef.h job.h commands.h variable.h \
|
||||
rule.h
|
||||
|
||||
implicit.o: implicit.c make.h rule.h dep.h filedef.h
|
||||
|
||||
default.o: default.c make.h rule.h dep.h filedef.h job.h commands.h \
|
||||
variable.h
|
||||
|
||||
variable.o: variable.c make.h dep.h filedef.h job.h commands.h \
|
||||
variable.h
|
||||
|
||||
expand.o: expand.c make.h filedef.h job.h commands.h variable.h
|
||||
|
||||
function.o: function.c make.h filedef.h variable.h dep.h job.h \
|
||||
commands.h amiga.h
|
||||
|
||||
vpath.o: vpath.c make.h filedef.h variable.h
|
||||
|
||||
version.o: version.c
|
||||
|
||||
ar.o: ar.c make.h filedef.h dep.h
|
||||
|
||||
arscan.o: arscan.c make.h
|
||||
|
||||
signame.o: signame.c signame.h
|
||||
|
||||
remote-stub.o: remote-stub.c make.h filedef.h job.h commands.h
|
||||
|
||||
getopt.o: getopt.c
|
||||
|
||||
getopt1.o : getopt1.c getopt.h
|
||||
|
||||
getloadavg.o: getloadavg.c
|
||||
|
||||
amiga.o: amiga.c make.h variable.h amiga.h
|
||||
|
||||
14
acconfig.h
Normal file
14
acconfig.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/* Define to the name of the SCCS `get' command. */
|
||||
#undef SCCS_GET
|
||||
|
||||
/* Define this if the SCCS `get' command understands the `-G<file>' option. */
|
||||
#undef SCCS_GET_MINUS_G
|
||||
|
||||
/* Define this if the C library defines the variable `sys_siglist'. */
|
||||
#undef HAVE_SYS_SIGLIST
|
||||
|
||||
/* Define this if the C library defines the variable `_sys_siglist'. */
|
||||
#undef HAVE__SYS_SIGLIST
|
||||
|
||||
/* Define this if you have the `union wait' type in <sys/wait.h>. */
|
||||
#undef HAVE_UNION_WAIT
|
||||
19
aclocal.m4
vendored
Normal file
19
aclocal.m4
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
dnl
|
||||
dnl Check for a symbol
|
||||
dnl
|
||||
AC_DEFUN(AC_CHECK_SYMBOL, [dnl
|
||||
AC_MSG_CHECKING(for $1)
|
||||
AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
|
||||
AC_TRY_LINK(,
|
||||
changequote(,)dnl
|
||||
extern char *$1[]; puts(*$1);,
|
||||
changequote([,])dnl
|
||||
ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
|
||||
if test "$ac_cv_check_symbol_$1" = yes; then
|
||||
changequote(,)dnl
|
||||
ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
|
||||
changequote([,])dnl
|
||||
AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
|
||||
dnl
|
||||
504
alloca.c
Normal file
504
alloca.c
Normal file
@@ -0,0 +1,504 @@
|
||||
/* alloca.c -- allocate automatically reclaimed memory
|
||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||
|
||||
This implementation of the PWB library alloca function,
|
||||
which is used to allocate space off the run-time stack so
|
||||
that it is automatically reclaimed upon procedure exit,
|
||||
was inspired by discussions with J. Q. Johnson of Cornell.
|
||||
J.Otto Tennant <jot@cray.com> contributed the Cray support.
|
||||
|
||||
There are some preprocessor constants that can
|
||||
be defined when compiling for your specific system, for
|
||||
improved efficiency; however, the defaults should be okay.
|
||||
|
||||
The general concept of this implementation is to keep
|
||||
track of all alloca-allocated blocks, and reclaim any
|
||||
that are found to be deeper in the stack than the current
|
||||
invocation. This heuristic does not reclaim storage as
|
||||
soon as it becomes invalid, but it will do so eventually.
|
||||
|
||||
As a special case, alloca(0) reclaims storage without
|
||||
allocating any. It is a good idea to use alloca(0) in
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef emacs
|
||||
#include "blockinput.h"
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
#ifndef alloca
|
||||
|
||||
#ifdef emacs
|
||||
#ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
#ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
#endif /* STACK_DIRECTION undefined */
|
||||
#endif /* static */
|
||||
#endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
#else
|
||||
#define ADDRESS_FUNCTION(arg) &(arg)
|
||||
#endif
|
||||
|
||||
#if __STDC__
|
||||
typedef void *pointer;
|
||||
#else
|
||||
typedef char *pointer;
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/* Different portions of Emacs need to call different versions of
|
||||
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||
ordinary malloc isn't protected from input signals. On the other
|
||||
hand, the utilities in lib-src need alloca to call malloc; some of
|
||||
them are very simple, and don't have an xmalloc routine.
|
||||
|
||||
Non-Emacs programs expect this to call use xmalloc.
|
||||
|
||||
Callers below should use malloc. */
|
||||
|
||||
#ifndef emacs
|
||||
#define malloc xmalloc
|
||||
#endif
|
||||
extern pointer malloc ();
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
growth for your system; otherwise it will be automatically
|
||||
deduced at run-time.
|
||||
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
#ifndef STACK_DIRECTION
|
||||
#define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
#endif
|
||||
|
||||
#if STACK_DIRECTION != 0
|
||||
|
||||
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
#else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
#define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction ()
|
||||
{
|
||||
static char *addr = NULL; /* Address of first `dummy', once known. */
|
||||
auto char dummy; /* To get stack address. */
|
||||
|
||||
if (addr == NULL)
|
||||
{ /* Initial entry. */
|
||||
addr = ADDRESS_FUNCTION (dummy);
|
||||
|
||||
find_stack_direction (); /* Recurse once. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second entry. */
|
||||
if (ADDRESS_FUNCTION (dummy) > addr)
|
||||
stack_dir = 1; /* Stack grew upward. */
|
||||
else
|
||||
stack_dir = -1; /* Stack grew downward. */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
(b) keep track of stack depth.
|
||||
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
#ifndef ALIGN_SIZE
|
||||
#define ALIGN_SIZE sizeof(double)
|
||||
#endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||
struct
|
||||
{
|
||||
union hdr *next; /* For chaining headers. */
|
||||
char *deep; /* For stack depth measure. */
|
||||
} h;
|
||||
} header;
|
||||
|
||||
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
|
||||
/* Return a pointer to at least SIZE bytes of storage,
|
||||
which will be automatically reclaimed upon exit from
|
||||
the procedure that called alloca. Originally, this space
|
||||
was supposed to be taken from the current stack frame of the
|
||||
caller, but that method cannot be made to work for some
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
pointer
|
||||
alloca (size)
|
||||
unsigned size;
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
#if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
#endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
#ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
#endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||
{
|
||||
register header *np = hp->h.next;
|
||||
|
||||
free ((pointer) hp); /* Collect garbage. */
|
||||
|
||||
hp = np; /* -> next header. */
|
||||
}
|
||||
else
|
||||
break; /* Rest are not deeper. */
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
#ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return NULL; /* No allocation required. */
|
||||
|
||||
/* Allocate combined header + user data storage. */
|
||||
|
||||
{
|
||||
register pointer new = malloc (sizeof (header) + size);
|
||||
/* Address of header. */
|
||||
|
||||
if (new == 0)
|
||||
abort();
|
||||
|
||||
((header *) new)->h.next = last_alloca_header;
|
||||
((header *) new)->h.deep = depth;
|
||||
|
||||
last_alloca_header = (header *) new;
|
||||
|
||||
/* User storage begins just after header. */
|
||||
|
||||
return (pointer) ((char *) new + sizeof (header));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef CRAY_STACK
|
||||
#define CRAY_STACK
|
||||
#ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
long shgrow:32; /* Number of times stack has grown. */
|
||||
long shaseg:32; /* Size of increments to stack. */
|
||||
long shhwm:32; /* High water mark of stack. */
|
||||
long shsize:32; /* Current size of stack (all segments). */
|
||||
};
|
||||
|
||||
/* The stack segment linkage control information occurs at
|
||||
the high-address end of a stack segment. (The stack
|
||||
grows from low addresses to high addresses.) The initial
|
||||
part of the stack segment linkage control information is
|
||||
0200 (octal) words. This provides for register storage
|
||||
for the routine which overflows the stack. */
|
||||
|
||||
struct stack_segment_linkage
|
||||
{
|
||||
long ss[0200]; /* 0200 overflow words. */
|
||||
long sssize:32; /* Number of words in this segment. */
|
||||
long ssbase:32; /* Offset to stack base. */
|
||||
long:32;
|
||||
long sspseg:32; /* Offset to linkage control of previous
|
||||
segment of stack. */
|
||||
long:32;
|
||||
long sstcpt:32; /* Pointer to task common address block. */
|
||||
long sscsnm; /* Private control structure number for
|
||||
microtasking. */
|
||||
long ssusr1; /* Reserved for user. */
|
||||
long ssusr2; /* Reserved for user. */
|
||||
long sstpid; /* Process ID for pid based multi-tasking. */
|
||||
long ssgvup; /* Pointer to multitasking thread giveup. */
|
||||
long sscray[7]; /* Reserved for Cray Research. */
|
||||
long ssa0;
|
||||
long ssa1;
|
||||
long ssa2;
|
||||
long ssa3;
|
||||
long ssa4;
|
||||
long ssa5;
|
||||
long ssa6;
|
||||
long ssa7;
|
||||
long sss0;
|
||||
long sss1;
|
||||
long sss2;
|
||||
long sss3;
|
||||
long sss4;
|
||||
long sss5;
|
||||
long sss6;
|
||||
long sss7;
|
||||
};
|
||||
|
||||
#else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
{
|
||||
long now; /* Current total stack size. */
|
||||
long maxc; /* Amount of contiguous space which would
|
||||
be required to satisfy the maximum
|
||||
stack demand to date. */
|
||||
long high_water; /* Stack high-water mark. */
|
||||
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
||||
long hits; /* Number of internal buffer hits. */
|
||||
long extends; /* Number of block extensions. */
|
||||
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
||||
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
||||
long stko_free; /* Number of deallocations by $STKRETN. */
|
||||
long stkm_free; /* Number of deallocations by $STKMRET. */
|
||||
long segments; /* Current number of stack segments. */
|
||||
long maxs; /* Maximum number of stack segments so far. */
|
||||
long pad_size; /* Stack pad size. */
|
||||
long current_address; /* Current stack segment address. */
|
||||
long current_size; /* Current stack segment size. This
|
||||
number is actually corrupted by STKSTAT to
|
||||
include the fifteen word trailer area. */
|
||||
long initial_address; /* Address of initial segment. */
|
||||
long initial_size; /* Size of initial segment. */
|
||||
};
|
||||
|
||||
/* The following structure describes the data structure which trails
|
||||
any stack segment. I think that the description in 'asdef' is
|
||||
out of date. I only describe the parts that I am sure about. */
|
||||
|
||||
struct stk_trailer
|
||||
{
|
||||
long this_address; /* Address of this block. */
|
||||
long this_size; /* Size of this block (does not include
|
||||
this trailer). */
|
||||
long unknown2;
|
||||
long unknown3;
|
||||
long link; /* Address of trailer block of previous
|
||||
segment. */
|
||||
long unknown5;
|
||||
long unknown6;
|
||||
long unknown7;
|
||||
long unknown8;
|
||||
long unknown9;
|
||||
long unknown10;
|
||||
long unknown11;
|
||||
long unknown12;
|
||||
long unknown13;
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
#endif /* CRAY2 */
|
||||
#endif /* not CRAY_STACK */
|
||||
|
||||
#ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
static long
|
||||
i00afunc (long *address)
|
||||
{
|
||||
struct stk_stat status;
|
||||
struct stk_trailer *trailer;
|
||||
long *block, size;
|
||||
long result = 0;
|
||||
|
||||
/* We want to iterate through all of the segments. The first
|
||||
step is to get the stack status structure. We could do this
|
||||
more quickly and more directly, perhaps, by referencing the
|
||||
$LM00 common block, but I know that this works. */
|
||||
|
||||
STKSTAT (&status);
|
||||
|
||||
/* Set up the iteration. */
|
||||
|
||||
trailer = (struct stk_trailer *) (status.current_address
|
||||
+ status.current_size
|
||||
- 15);
|
||||
|
||||
/* There must be at least one stack segment. Therefore it is
|
||||
a fatal error if "trailer" is null. */
|
||||
|
||||
if (trailer == 0)
|
||||
abort ();
|
||||
|
||||
/* Discard segments that do not contain our argument address. */
|
||||
|
||||
while (trailer != 0)
|
||||
{
|
||||
block = (long *) trailer->this_address;
|
||||
size = trailer->this_size;
|
||||
if (block == 0 || size == 0)
|
||||
abort ();
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
if ((block <= address) && (address < (block + size)))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the result to the offset in this segment and add the sizes
|
||||
of all predecessor segments. */
|
||||
|
||||
result = address - block;
|
||||
|
||||
if (trailer == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (trailer->this_size <= 0)
|
||||
abort ();
|
||||
result += trailer->this_size;
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
}
|
||||
while (trailer != 0);
|
||||
|
||||
/* We are done. Note that if you present a bogus address (one
|
||||
not in any segment), you will get a different number back, formed
|
||||
from subtracting the address of the first block. This is probably
|
||||
not what you want. */
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
routine is to linearize, in some sense, stack addresses
|
||||
for alloca. */
|
||||
|
||||
static long
|
||||
i00afunc (long address)
|
||||
{
|
||||
long stkl = 0;
|
||||
|
||||
long size, pseg, this_segment, stack;
|
||||
long result = 0;
|
||||
|
||||
struct stack_segment_linkage *ssptr;
|
||||
|
||||
/* Register B67 contains the address of the end of the
|
||||
current stack segment. If you (as a subprogram) store
|
||||
your registers on the stack and find that you are past
|
||||
the contents of B67, you have overflowed the segment.
|
||||
|
||||
B67 also points to the stack segment linkage control
|
||||
area, which is what we are really interested in. */
|
||||
|
||||
stkl = CRAY_STACKSEG_END ();
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
|
||||
/* If one subtracts 'size' from the end of the segment,
|
||||
one has the address of the first word of the segment.
|
||||
|
||||
If this is not the first segment, 'pseg' will be
|
||||
nonzero. */
|
||||
|
||||
pseg = ssptr->sspseg;
|
||||
size = ssptr->sssize;
|
||||
|
||||
this_segment = stkl - size;
|
||||
|
||||
/* It is possible that calling this routine itself caused
|
||||
a stack overflow. Discard stack segments which do not
|
||||
contain the target address. */
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
#endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
this_segment = stkl - size;
|
||||
}
|
||||
|
||||
result = address - this_segment;
|
||||
|
||||
/* If you subtract pseg from the current end of the stack,
|
||||
you get the address of the previous stack segment's end.
|
||||
This seems a little convoluted to me, but I'll bet you save
|
||||
a cycle somewhere. */
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
#endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
result += size;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
#endif /* not CRAY2 */
|
||||
#endif /* CRAY */
|
||||
|
||||
#endif /* no alloca */
|
||||
#endif /* not GCC version 2 */
|
||||
122
amiga.c
Normal file
122
amiga.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/* Running commands on Amiga
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "variable.h"
|
||||
#include "amiga.h"
|
||||
#include <assert.h>
|
||||
#include <exec/memory.h>
|
||||
#include <dos/dostags.h>
|
||||
#include <proto/exec.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
static const char Amiga_version[] = "$VER: Make 3.74.3 (12.05.96) \n"
|
||||
"Amiga Port by A. Digulla (digulla@home.lake.de)";
|
||||
|
||||
int
|
||||
MyExecute (argv)
|
||||
char ** argv;
|
||||
{
|
||||
char * buffer, * ptr;
|
||||
char ** aptr;
|
||||
int len = 0;
|
||||
int status;
|
||||
|
||||
for (aptr=argv; *aptr; aptr++)
|
||||
{
|
||||
len += strlen (*aptr) + 4;
|
||||
}
|
||||
|
||||
buffer = AllocMem (len, MEMF_ANY);
|
||||
|
||||
if (!buffer)
|
||||
fatal ("MyExecute: Cannot allocate space for calling a command");
|
||||
|
||||
ptr = buffer;
|
||||
|
||||
for (aptr=argv; *aptr; aptr++)
|
||||
{
|
||||
if (((*aptr)[0] == ';' && !(*aptr)[1]))
|
||||
{
|
||||
*ptr ++ = '"';
|
||||
strcpy (ptr, *aptr);
|
||||
ptr += strlen (ptr);
|
||||
*ptr ++ = '"';
|
||||
}
|
||||
else if ((*aptr)[0] == '@' && (*aptr)[1] == '@' && !(*aptr)[2])
|
||||
{
|
||||
*ptr ++ = '\n';
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (ptr, *aptr);
|
||||
ptr += strlen (ptr);
|
||||
}
|
||||
*ptr ++ = ' ';
|
||||
*ptr = 0;
|
||||
}
|
||||
|
||||
ptr[-1] = '\n';
|
||||
|
||||
status = SystemTags (buffer,
|
||||
SYS_UserShell, TRUE,
|
||||
TAG_END);
|
||||
|
||||
FreeMem (buffer, len);
|
||||
|
||||
if (SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
|
||||
status = 20;
|
||||
|
||||
/* Warnings don't count */
|
||||
if (status == 5)
|
||||
status = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
char *
|
||||
wildcard_expansion (wc, o)
|
||||
char * wc, * o;
|
||||
{
|
||||
# define PATH_SIZE 1024
|
||||
struct AnchorPath * apath;
|
||||
|
||||
if ( (apath = AllocMem (sizeof (struct AnchorPath) + PATH_SIZE,
|
||||
MEMF_CLEAR))
|
||||
)
|
||||
{
|
||||
apath->ap_Strlen = PATH_SIZE;
|
||||
|
||||
if (MatchFirst (wc, apath) == 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
o = variable_buffer_output (o, apath->ap_Buf,
|
||||
strlen (apath->ap_Buf));
|
||||
o = variable_buffer_output (o, " ",1);
|
||||
} while (MatchNext (apath) == 0);
|
||||
}
|
||||
|
||||
MatchEnd (apath);
|
||||
FreeMem (apath, sizeof (struct AnchorPath) + PATH_SIZE);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
21
amiga.h
Normal file
21
amiga.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Definitions for amiga specific things
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
extern int MyExecute PARAMS ((char ** argv));
|
||||
extern char * wildcard_expansion PARAMS ((char * wc, char * o));
|
||||
|
||||
433
ar.c
Normal file
433
ar.c
Normal file
@@ -0,0 +1,433 @@
|
||||
/* Interface to `ar' archives for GNU Make.
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
|
||||
#include "filedef.h"
|
||||
#include "dep.h"
|
||||
#include <fnmatch.h>
|
||||
|
||||
/* Defined in arscan.c. */
|
||||
extern long int ar_scan PARAMS ((char *archive, long int (*function) (), long int arg));
|
||||
extern int ar_member_touch PARAMS ((char *arname, char *memname));
|
||||
extern int ar_name_equal PARAMS ((char *name, char *mem, int truncated));
|
||||
|
||||
|
||||
/* Return nonzero if NAME is an archive-member reference, zero if not.
|
||||
An archive-member reference is a name like `lib(member)'.
|
||||
If a name like `lib((entry))' is used, a fatal error is signaled at
|
||||
the attempt to use this unsupported feature. */
|
||||
|
||||
int
|
||||
ar_name (name)
|
||||
char *name;
|
||||
{
|
||||
char *p = index (name, '('), *end = name + strlen (name) - 1;
|
||||
|
||||
if (p == 0 || p == name || *end != ')')
|
||||
return 0;
|
||||
|
||||
if (p[1] == '(' && end[-1] == ')')
|
||||
fatal ("attempt to use unsupported feature: `%s'", name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Parse the archive-member reference NAME into the archive and member names.
|
||||
Put the malloc'd archive name in *ARNAME_P if ARNAME_P is non-nil;
|
||||
put the malloc'd member name in *MEMNAME_P if MEMNAME_P is non-nil. */
|
||||
|
||||
void
|
||||
ar_parse_name (name, arname_p, memname_p)
|
||||
char *name, **arname_p, **memname_p;
|
||||
{
|
||||
char *p = index (name, '('), *end = name + strlen (name) - 1;
|
||||
|
||||
if (arname_p != 0)
|
||||
*arname_p = savestring (name, p - name);
|
||||
|
||||
if (memname_p != 0)
|
||||
*memname_p = savestring (p + 1, end - (p + 1));
|
||||
}
|
||||
|
||||
#ifdef VMS
|
||||
#include <lbrdef.h>
|
||||
#include <mhddef.h>
|
||||
#include <credef.h>
|
||||
#include <descrip.h>
|
||||
#include <ctype.h>
|
||||
#if __DECC
|
||||
#include <lbr$routines.h>
|
||||
#endif
|
||||
|
||||
#define uppercasify(str) {char *str1; for (str1 = str; *str1; str1++) *str1 = _toupper(*str1);}
|
||||
|
||||
#define LBR$_KEYNOTFND 2527330 /* This isn't in any .h file anywhere so I got it from a MACRO library */
|
||||
|
||||
time_t
|
||||
ar_member_date (name)
|
||||
char *name;
|
||||
{
|
||||
static char *arname;
|
||||
static char *memname;
|
||||
char *p,*q;
|
||||
long int val;
|
||||
static struct {
|
||||
struct mhddef mhd;
|
||||
struct credef cre;
|
||||
char garbage[256];
|
||||
} buf;
|
||||
int func=LBR$C_READ,
|
||||
type=LBR$C_TYP_OBJ,
|
||||
rfa[2],
|
||||
lidx,
|
||||
status;
|
||||
$DESCRIPTOR(bufdesc,(char *)&buf);
|
||||
$DESCRIPTOR(libdesc,arname);
|
||||
$DESCRIPTOR(moddesc,memname);
|
||||
|
||||
/* This "file" is an archive member. */
|
||||
p = index (name, '(');
|
||||
arname = savestring (name, p - name);
|
||||
val = strlen (p) - 2;
|
||||
/*
|
||||
if (val > 15)
|
||||
val = 15;
|
||||
*/
|
||||
memname = savestring (p + 1, val);
|
||||
#ifdef OLDWAY
|
||||
p = rindex (memname, ')');
|
||||
if (p != 0) {
|
||||
q = rindex(p,'.');
|
||||
if (q)
|
||||
*q = '\0'; /* to get rid of extension */
|
||||
}
|
||||
#endif
|
||||
|
||||
q = rindex(memname,'.');
|
||||
if (q)
|
||||
*q = '\0'; /* to get rid of extension */
|
||||
|
||||
uppercasify(memname);
|
||||
|
||||
/* Make sure we know the modtime of the archive itself because
|
||||
we are likely to be called just before commands to remake a
|
||||
member are run, and they will change the archive itself. */
|
||||
(void) f_mtime (enter_file (arname));
|
||||
|
||||
libdesc.dsc$a_pointer = arname;
|
||||
libdesc.dsc$w_length = strlen(arname);
|
||||
moddesc.dsc$a_pointer = memname;
|
||||
moddesc.dsc$w_length = strlen(memname);
|
||||
|
||||
if (!((status = lbr$ini_control(&lidx,&func,&type,0)) & 1)) {
|
||||
printf("Error in lbr$ini_control, %d\n",status);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (!((status = lbr$open(&lidx,&libdesc,0,0,0,0,0)) & 1)) {
|
||||
printf("Error opening library %s to lookup member %s, %d\n",arname, memname ,status);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (!((status = lbr$lookup_key(&lidx,&moddesc,rfa)) & 1)) {
|
||||
if (status != LBR$_KEYNOTFND)
|
||||
printf("Error looking up module %s in library %s, %d\n",memname, arname ,status);
|
||||
lbr$close(&lidx);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (!((status = lbr$set_module(&lidx,rfa,&bufdesc,&bufdesc,0)) & 1)) {
|
||||
printf("Error getting module info, %d\n",status);
|
||||
lbr$close(&lidx);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
lbr$close(&lidx);
|
||||
|
||||
val = SHELL$FIX_TIME(&buf.mhd.mhd$l_datim);
|
||||
|
||||
free (arname);
|
||||
free (memname);
|
||||
return (val <= 0 ? (time_t) -1 : (time_t) val);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static long int ar_member_date_1 PARAMS ((int desc, char *mem, int truncated, long int hdrpos,
|
||||
long int datapos, long int size, long int date, int uid, int gid, int mode, char *name));
|
||||
|
||||
/* Return the modtime of NAME. */
|
||||
|
||||
time_t
|
||||
ar_member_date (name)
|
||||
char *name;
|
||||
{
|
||||
char *arname;
|
||||
int arname_used = 0;
|
||||
char *memname;
|
||||
long int val;
|
||||
|
||||
ar_parse_name (name, &arname, &memname);
|
||||
|
||||
/* Make sure we know the modtime of the archive itself because we are
|
||||
likely to be called just before commands to remake a member are run,
|
||||
and they will change the archive itself.
|
||||
|
||||
But we must be careful not to enter_file the archive itself if it does
|
||||
not exist, because pattern_search assumes that files found in the data
|
||||
base exist or can be made. */
|
||||
{
|
||||
struct file *arfile;
|
||||
arfile = lookup_file (arname);
|
||||
if (arfile == 0 && file_exists_p (arname))
|
||||
{
|
||||
arfile = enter_file (arname);
|
||||
arname_used = 1;
|
||||
}
|
||||
|
||||
if (arfile != 0)
|
||||
(void) f_mtime (arfile, 0);
|
||||
}
|
||||
|
||||
val = ar_scan (arname, ar_member_date_1, (long int) memname);
|
||||
|
||||
if (!arname_used)
|
||||
free (arname);
|
||||
free (memname);
|
||||
|
||||
return (val <= 0 ? (time_t) -1 : (time_t) val);
|
||||
}
|
||||
|
||||
/* This function is called by `ar_scan' to find which member to look at. */
|
||||
|
||||
/* ARGSUSED */
|
||||
static long int
|
||||
ar_member_date_1 (desc, mem, truncated,
|
||||
hdrpos, datapos, size, date, uid, gid, mode, name)
|
||||
int desc;
|
||||
char *mem;
|
||||
int truncated;
|
||||
long int hdrpos, datapos, size, date;
|
||||
int uid, gid, mode;
|
||||
char *name;
|
||||
{
|
||||
return ar_name_equal (name, mem, truncated) ? date : 0;
|
||||
}
|
||||
#endif /* !VMS */
|
||||
|
||||
/* Set the archive-member NAME's modtime to now. */
|
||||
|
||||
#ifdef VMS
|
||||
int
|
||||
ar_touch (name)
|
||||
char *name;
|
||||
{
|
||||
error ("touch archive member is not available on VMS");
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
int
|
||||
ar_touch (name)
|
||||
char *name;
|
||||
{
|
||||
char *arname, *memname;
|
||||
int arname_used = 0;
|
||||
register int val;
|
||||
|
||||
ar_parse_name (name, &arname, &memname);
|
||||
|
||||
/* Make sure we know the modtime of the archive itself before we
|
||||
touch the member, since this will change the archive itself. */
|
||||
{
|
||||
struct file *arfile;
|
||||
arfile = lookup_file (arname);
|
||||
if (arfile == 0)
|
||||
{
|
||||
arfile = enter_file (arname);
|
||||
arname_used = 1;
|
||||
}
|
||||
|
||||
(void) f_mtime (arfile, 0);
|
||||
}
|
||||
|
||||
val = 1;
|
||||
switch (ar_member_touch (arname, memname))
|
||||
{
|
||||
case -1:
|
||||
error ("touch: Archive `%s' does not exist", arname);
|
||||
break;
|
||||
case -2:
|
||||
error ("touch: `%s' is not a valid archive", arname);
|
||||
break;
|
||||
case -3:
|
||||
perror_with_name ("touch: ", arname);
|
||||
break;
|
||||
case 1:
|
||||
error ("touch: Member `%s' does not exist in `%s'", memname, arname);
|
||||
break;
|
||||
case 0:
|
||||
val = 0;
|
||||
break;
|
||||
default:
|
||||
error ("touch: Bad return code from ar_member_touch on `%s'", name);
|
||||
}
|
||||
|
||||
if (!arname_used)
|
||||
free (arname);
|
||||
free (memname);
|
||||
|
||||
return val;
|
||||
}
|
||||
#endif /* !VMS */
|
||||
|
||||
/* State of an `ar_glob' run, passed to `ar_glob_match'. */
|
||||
|
||||
struct ar_glob_state
|
||||
{
|
||||
char *arname;
|
||||
char *pattern;
|
||||
unsigned int size;
|
||||
struct nameseq *chain;
|
||||
unsigned int n;
|
||||
};
|
||||
|
||||
/* This function is called by `ar_scan' to match one archive
|
||||
element against the pattern in STATE. */
|
||||
|
||||
static long int
|
||||
ar_glob_match (desc, mem, truncated,
|
||||
hdrpos, datapos, size, date, uid, gid, mode,
|
||||
state)
|
||||
int desc;
|
||||
char *mem;
|
||||
int truncated;
|
||||
long int hdrpos, datapos, size, date;
|
||||
int uid, gid, mode;
|
||||
struct ar_glob_state *state;
|
||||
{
|
||||
if (fnmatch (state->pattern, mem, FNM_PATHNAME|FNM_PERIOD) == 0)
|
||||
{
|
||||
/* We have a match. Add it to the chain. */
|
||||
struct nameseq *new = (struct nameseq *) xmalloc (state->size);
|
||||
new->name = concat (state->arname, mem, ")");
|
||||
new->next = state->chain;
|
||||
state->chain = new;
|
||||
++state->n;
|
||||
}
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/* Alphabetic sorting function for `qsort'. */
|
||||
|
||||
static int
|
||||
ar_glob_alphacompare (a, b)
|
||||
char **a, **b;
|
||||
{
|
||||
return strcmp (*a, *b);
|
||||
}
|
||||
|
||||
/* Return nonzero if PATTERN contains any metacharacters.
|
||||
Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
|
||||
static int
|
||||
glob_pattern_p (pattern, quote)
|
||||
const char *pattern;
|
||||
const int quote;
|
||||
{
|
||||
register const char *p;
|
||||
int open = 0;
|
||||
|
||||
for (p = pattern; *p != '\0'; ++p)
|
||||
switch (*p)
|
||||
{
|
||||
case '?':
|
||||
case '*':
|
||||
return 1;
|
||||
|
||||
case '\\':
|
||||
if (quote)
|
||||
++p;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
open = 1;
|
||||
break;
|
||||
|
||||
case ']':
|
||||
if (open)
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Glob for MEMBER_PATTERN in archive ARNAME.
|
||||
Return a malloc'd chain of matching elements (or nil if none). */
|
||||
|
||||
struct nameseq *
|
||||
ar_glob (arname, member_pattern, size)
|
||||
char *arname, *member_pattern;
|
||||
unsigned int size;
|
||||
{
|
||||
struct ar_glob_state state;
|
||||
char **names;
|
||||
struct nameseq *n;
|
||||
unsigned int i;
|
||||
|
||||
if (! glob_pattern_p (member_pattern, 1))
|
||||
return 0;
|
||||
|
||||
/* Scan the archive for matches.
|
||||
ar_glob_match will accumulate them in STATE.chain. */
|
||||
i = strlen (arname);
|
||||
state.arname = (char *) alloca (i + 2);
|
||||
bcopy (arname, state.arname, i);
|
||||
state.arname[i] = '(';
|
||||
state.arname[i + 1] = '\0';
|
||||
state.pattern = member_pattern;
|
||||
state.size = size;
|
||||
state.chain = 0;
|
||||
state.n = 0;
|
||||
(void) ar_scan (arname, ar_glob_match, (long int) &state);
|
||||
|
||||
if (state.chain == 0)
|
||||
return 0;
|
||||
|
||||
/* Now put the names into a vector for sorting. */
|
||||
names = (char **) alloca (state.n * sizeof (char *));
|
||||
i = 0;
|
||||
for (n = state.chain; n != 0; n = n->next)
|
||||
names[i++] = n->name;
|
||||
|
||||
/* Sort them alphabetically. */
|
||||
qsort ((char *) names, i, sizeof (*names), ar_glob_alphacompare);
|
||||
|
||||
/* Put them back into the chain in the sorted order. */
|
||||
i = 0;
|
||||
for (n = state.chain; n != 0; n = n->next)
|
||||
n->name = names[i++];
|
||||
|
||||
return state.chain;
|
||||
}
|
||||
|
||||
#endif /* Not NO_ARCHIVES. */
|
||||
568
arscan.c
Normal file
568
arscan.c
Normal file
@@ -0,0 +1,568 @@
|
||||
/* Library function for scanning an archive file.
|
||||
Copyright (C) 1987, 89, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
|
||||
/* SCO Unix's compiler defines both of these. */
|
||||
#ifdef M_UNIX
|
||||
#undef M_XENIX
|
||||
#endif
|
||||
|
||||
/* On the sun386i and in System V rel 3, ar.h defines two different archive
|
||||
formats depending upon whether you have defined PORTAR (normal) or PORT5AR
|
||||
(System V Release 1). There is no default, one or the other must be defined
|
||||
to have a nonzero value. */
|
||||
|
||||
#if (!defined (PORTAR) || PORTAR == 0) && (!defined (PORT5AR) || PORT5AR == 0)
|
||||
#undef PORTAR
|
||||
#ifdef M_XENIX
|
||||
/* According to Jim Sievert <jas1@rsvl.unisys.com>, for SCO XENIX defining
|
||||
PORTAR to 1 gets the wrong archive format, and defining it to 0 gets the
|
||||
right one. */
|
||||
#define PORTAR 0
|
||||
#else
|
||||
#define PORTAR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <ar.h>
|
||||
|
||||
/* Cray's <ar.h> apparently defines this. */
|
||||
#ifndef AR_HDR_SIZE
|
||||
#define AR_HDR_SIZE (sizeof (struct ar_hdr))
|
||||
#endif
|
||||
|
||||
/* Takes three arguments ARCHIVE, FUNCTION and ARG.
|
||||
|
||||
Open the archive named ARCHIVE, find its members one by one,
|
||||
and for each one call FUNCTION with the following arguments:
|
||||
archive file descriptor for reading the data,
|
||||
member name,
|
||||
member name might be truncated flag,
|
||||
member header position in file,
|
||||
member data position in file,
|
||||
member data size,
|
||||
member date,
|
||||
member uid,
|
||||
member gid,
|
||||
member protection mode,
|
||||
ARG.
|
||||
|
||||
The descriptor is poised to read the data of the member
|
||||
when FUNCTION is called. It does not matter how much
|
||||
data FUNCTION reads.
|
||||
|
||||
If FUNCTION returns nonzero, we immediately return
|
||||
what FUNCTION returned.
|
||||
|
||||
Returns -1 if archive does not exist,
|
||||
Returns -2 if archive has invalid format.
|
||||
Returns 0 if have scanned successfully. */
|
||||
|
||||
long int
|
||||
ar_scan (archive, function, arg)
|
||||
char *archive;
|
||||
long int (*function) ();
|
||||
long int arg;
|
||||
{
|
||||
#ifdef AIAMAG
|
||||
FL_HDR fl_header;
|
||||
#else
|
||||
int long_name = 0;
|
||||
#endif
|
||||
char *namemap = 0;
|
||||
register int desc = open (archive, O_RDONLY, 0);
|
||||
if (desc < 0)
|
||||
return -1;
|
||||
#ifdef SARMAG
|
||||
{
|
||||
char buf[SARMAG];
|
||||
register int nread = read (desc, buf, SARMAG);
|
||||
if (nread != SARMAG || bcmp (buf, ARMAG, SARMAG))
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef AIAMAG
|
||||
{
|
||||
register int nread = read (desc, (char *) &fl_header, FL_HSZ);
|
||||
if (nread != FL_HSZ || bcmp (fl_header.fl_magic, AIAMAG, SAIAMAG))
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
#ifndef M_XENIX
|
||||
int buf;
|
||||
#else
|
||||
unsigned short int buf;
|
||||
#endif
|
||||
register int nread = read(desc, &buf, sizeof (buf));
|
||||
if (nread != sizeof (buf) || buf != ARMAG)
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Now find the members one by one. */
|
||||
{
|
||||
#ifdef SARMAG
|
||||
register long int member_offset = SARMAG;
|
||||
#else
|
||||
#ifdef AIAMAG
|
||||
long int member_offset;
|
||||
long int last_member_offset;
|
||||
|
||||
sscanf (fl_header.fl_fstmoff, "%12ld", &member_offset);
|
||||
sscanf (fl_header.fl_lstmoff, "%12ld", &last_member_offset);
|
||||
|
||||
if (member_offset == 0)
|
||||
{
|
||||
/* Empty archive. */
|
||||
close (desc);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#ifndef M_XENIX
|
||||
register long int member_offset = sizeof (int);
|
||||
#else /* Xenix. */
|
||||
register long int member_offset = sizeof (unsigned short int);
|
||||
#endif /* Not Xenix. */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
register int nread;
|
||||
struct ar_hdr member_header;
|
||||
#ifdef AIAMAG
|
||||
char name[256];
|
||||
int name_len;
|
||||
long int dateval;
|
||||
int uidval, gidval;
|
||||
long int data_offset;
|
||||
#else
|
||||
char namebuf[sizeof member_header.ar_name + 1];
|
||||
char *name;
|
||||
int is_namemap; /* Nonzero if this entry maps long names. */
|
||||
#endif
|
||||
long int eltsize;
|
||||
int eltmode;
|
||||
long int fnval;
|
||||
|
||||
if (lseek (desc, member_offset, 0) < 0)
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
|
||||
#ifdef AIAMAG
|
||||
#define AR_MEMHDR (AR_HDR_SIZE - sizeof (member_header._ar_name))
|
||||
nread = read (desc, (char *) &member_header, AR_MEMHDR);
|
||||
|
||||
if (nread != AR_MEMHDR)
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
|
||||
sscanf (member_header.ar_namlen, "%4d", &name_len);
|
||||
nread = read (desc, name, name_len);
|
||||
|
||||
if (nread != name_len)
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
|
||||
name[name_len] = 0;
|
||||
|
||||
sscanf (member_header.ar_date, "%12ld", &dateval);
|
||||
sscanf (member_header.ar_uid, "%12d", &uidval);
|
||||
sscanf (member_header.ar_gid, "%12d", &gidval);
|
||||
sscanf (member_header.ar_mode, "%12o", &eltmode);
|
||||
sscanf (member_header.ar_size, "%12ld", &eltsize);
|
||||
|
||||
if ((data_offset = member_offset + AR_MEMHDR + name_len + 2) % 2)
|
||||
++data_offset;
|
||||
|
||||
fnval =
|
||||
(*function) (desc, name, 0,
|
||||
member_offset, data_offset, eltsize,
|
||||
dateval, uidval, gidval,
|
||||
eltmode, arg);
|
||||
|
||||
#else /* Not AIAMAG. */
|
||||
nread = read (desc, (char *) &member_header, AR_HDR_SIZE);
|
||||
if (nread == 0)
|
||||
/* No data left means end of file; that is OK. */
|
||||
break;
|
||||
|
||||
if (nread != AR_HDR_SIZE
|
||||
#ifdef ARFMAG
|
||||
|| bcmp (member_header.ar_fmag, ARFMAG, 2)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
|
||||
name = namebuf;
|
||||
bcopy (member_header.ar_name, name, sizeof member_header.ar_name);
|
||||
{
|
||||
register char *p = name + sizeof member_header.ar_name;
|
||||
do
|
||||
*p = '\0';
|
||||
while (p > name && *--p == ' ');
|
||||
|
||||
#ifndef AIAMAG
|
||||
/* If the member name is "//" or "ARFILENAMES/" this may be
|
||||
a list of file name mappings. The maximum file name
|
||||
length supported by the standard archive format is 14
|
||||
characters. This member will actually always be the
|
||||
first or second entry in the archive, but we don't check
|
||||
that. */
|
||||
is_namemap = (!strcmp (name, "//")
|
||||
|| !strcmp (name, "ARFILENAMES/"));
|
||||
#endif /* Not AIAMAG. */
|
||||
/* On some systems, there is a slash after each member name. */
|
||||
if (*p == '/')
|
||||
*p = '\0';
|
||||
|
||||
#ifndef AIAMAG
|
||||
/* If the member name starts with a space or a slash, this
|
||||
is an index into the file name mappings (used by GNU ar).
|
||||
Otherwise if the member name looks like #1/NUMBER the
|
||||
real member name appears in the element data (used by
|
||||
4.4BSD). */
|
||||
if (! is_namemap
|
||||
&& (name[0] == ' ' || name[0] == '/')
|
||||
&& namemap != 0)
|
||||
{
|
||||
name = namemap + atoi (name + 1);
|
||||
long_name = 1;
|
||||
}
|
||||
else if (name[0] == '#'
|
||||
&& name[1] == '1'
|
||||
&& name[2] == '/')
|
||||
{
|
||||
int namesize = atoi (name + 3);
|
||||
|
||||
name = (char *) alloca (namesize + 1);
|
||||
nread = read (desc, name, namesize);
|
||||
if (nread != namesize)
|
||||
{
|
||||
close (desc);
|
||||
return -2;
|
||||
}
|
||||
name[namesize] = '\0';
|
||||
|
||||
long_name = 1;
|
||||
}
|
||||
#endif /* Not AIAMAG. */
|
||||
}
|
||||
|
||||
#ifndef M_XENIX
|
||||
sscanf (member_header.ar_mode, "%o", &eltmode);
|
||||
eltsize = atol (member_header.ar_size);
|
||||
#else /* Xenix. */
|
||||
eltmode = (unsigned short int) member_header.ar_mode;
|
||||
eltsize = member_header.ar_size;
|
||||
#endif /* Not Xenix. */
|
||||
|
||||
fnval =
|
||||
(*function) (desc, name, ! long_name, member_offset,
|
||||
member_offset + AR_HDR_SIZE, eltsize,
|
||||
#ifndef M_XENIX
|
||||
atol (member_header.ar_date),
|
||||
atoi (member_header.ar_uid),
|
||||
atoi (member_header.ar_gid),
|
||||
#else /* Xenix. */
|
||||
member_header.ar_date,
|
||||
member_header.ar_uid,
|
||||
member_header.ar_gid,
|
||||
#endif /* Not Xenix. */
|
||||
eltmode, arg);
|
||||
|
||||
#endif /* AIAMAG. */
|
||||
|
||||
if (fnval)
|
||||
{
|
||||
(void) close (desc);
|
||||
return fnval;
|
||||
}
|
||||
|
||||
#ifdef AIAMAG
|
||||
if (member_offset == last_member_offset)
|
||||
/* End of the chain. */
|
||||
break;
|
||||
|
||||
sscanf (member_header.ar_nxtmem, "%12ld", &member_offset);
|
||||
|
||||
if (lseek (desc, member_offset, 0) != member_offset)
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
#else
|
||||
|
||||
/* If this member maps archive names, we must read it in. The
|
||||
name map will always precede any members whose names must
|
||||
be mapped. */
|
||||
if (is_namemap)
|
||||
{
|
||||
char *clear;
|
||||
char *limit;
|
||||
|
||||
namemap = (char *) alloca (eltsize);
|
||||
nread = read (desc, namemap, eltsize);
|
||||
if (nread != eltsize)
|
||||
{
|
||||
(void) close (desc);
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* The names are separated by newlines. Some formats have
|
||||
a trailing slash. Null terminate the strings for
|
||||
convenience. */
|
||||
limit = namemap + eltsize;
|
||||
for (clear = namemap; clear < limit; clear++)
|
||||
{
|
||||
if (*clear == '\n')
|
||||
{
|
||||
*clear = '\0';
|
||||
if (clear[-1] == '/')
|
||||
clear[-1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
is_namemap = 0;
|
||||
}
|
||||
|
||||
member_offset += AR_HDR_SIZE + eltsize;
|
||||
if (member_offset % 2 != 0)
|
||||
member_offset++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
close (desc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return nonzero iff NAME matches MEM.
|
||||
If TRUNCATED is nonzero, MEM may be truncated to
|
||||
sizeof (struct ar_hdr.ar_name) - 1. */
|
||||
|
||||
int
|
||||
ar_name_equal (name, mem, truncated)
|
||||
char *name, *mem;
|
||||
int truncated;
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = rindex (name, '/');
|
||||
if (p != 0)
|
||||
name = p + 1;
|
||||
|
||||
/* We no longer use this kludge, since we
|
||||
now support long archive member names. */
|
||||
|
||||
#if 0 && !defined (AIAMAG) && !defined (APOLLO)
|
||||
|
||||
{
|
||||
/* `reallylongname.o' matches `reallylongnam.o'.
|
||||
If member names have a trailing slash, that's `reallylongna.o'. */
|
||||
|
||||
struct ar_hdr h;
|
||||
unsigned int max = sizeof (h.ar_name);
|
||||
unsigned int namelen, memlen;
|
||||
|
||||
if (strncmp (name, mem, max - 3))
|
||||
return 0;
|
||||
|
||||
namelen = strlen (name);
|
||||
memlen = strlen (mem);
|
||||
|
||||
if (namelen > memlen && memlen >= max - 1
|
||||
&& name[namelen - 2] == '.' && name[namelen - 1] == 'o'
|
||||
&& mem[memlen - 2] == '.' && mem[memlen - 1] == 'o')
|
||||
return 1;
|
||||
|
||||
if (namelen != memlen)
|
||||
return 0;
|
||||
|
||||
return (namelen < max - 3 || !strcmp (name + max - 3, mem + max - 3));
|
||||
}
|
||||
|
||||
#else /* AIX or APOLLO. */
|
||||
|
||||
if (truncated)
|
||||
{
|
||||
#ifdef AIAMAG
|
||||
/* TRUNCATED should never be set on this system. */
|
||||
abort ();
|
||||
#else
|
||||
struct ar_hdr hdr;
|
||||
return !strncmp (name, mem,
|
||||
sizeof (hdr.ar_name) -
|
||||
#if !defined (__hpux) && !defined (cray)
|
||||
1
|
||||
#else
|
||||
2
|
||||
#endif /* !__hpux && !cray */
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
return !strcmp (name, mem);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static long int
|
||||
ar_member_pos (desc, mem, truncated,
|
||||
hdrpos, datapos, size, date, uid, gid, mode, name)
|
||||
int desc;
|
||||
char *mem;
|
||||
int truncated;
|
||||
long int hdrpos, datapos, size, date;
|
||||
int uid, gid, mode;
|
||||
char *name;
|
||||
{
|
||||
if (!ar_name_equal (name, mem, truncated))
|
||||
return 0;
|
||||
return hdrpos;
|
||||
}
|
||||
|
||||
/* Set date of member MEMNAME in archive ARNAME to current time.
|
||||
Returns 0 if successful,
|
||||
-1 if file ARNAME does not exist,
|
||||
-2 if not a valid archive,
|
||||
-3 if other random system call error (including file read-only),
|
||||
1 if valid but member MEMNAME does not exist. */
|
||||
|
||||
int
|
||||
ar_member_touch (arname, memname)
|
||||
char *arname, *memname;
|
||||
{
|
||||
register long int pos = ar_scan (arname, ar_member_pos, (long int) memname);
|
||||
register int fd;
|
||||
struct ar_hdr ar_hdr;
|
||||
register int i;
|
||||
struct stat statbuf;
|
||||
|
||||
if (pos < 0)
|
||||
return (int) pos;
|
||||
if (!pos)
|
||||
return 1;
|
||||
|
||||
fd = open (arname, O_RDWR, 0666);
|
||||
if (fd < 0)
|
||||
return -3;
|
||||
/* Read in this member's header */
|
||||
if (lseek (fd, pos, 0) < 0)
|
||||
goto lose;
|
||||
if (AR_HDR_SIZE != read (fd, (char *) &ar_hdr, AR_HDR_SIZE))
|
||||
goto lose;
|
||||
/* Write back the header, thus touching the archive file. */
|
||||
if (lseek (fd, pos, 0) < 0)
|
||||
goto lose;
|
||||
if (AR_HDR_SIZE != write (fd, (char *) &ar_hdr, AR_HDR_SIZE))
|
||||
goto lose;
|
||||
/* The file's mtime is the time we we want. */
|
||||
#ifdef EINTR
|
||||
while (fstat (fd, &statbuf) < 0 && errno == EINTR);
|
||||
#else
|
||||
fstat (fd, &statbuf);
|
||||
#endif
|
||||
#if defined(ARFMAG) || defined(AIAMAG)
|
||||
/* Advance member's time to that time */
|
||||
for (i = 0; i < sizeof ar_hdr.ar_date; i++)
|
||||
ar_hdr.ar_date[i] = ' ';
|
||||
sprintf (ar_hdr.ar_date, "%ld", (long int) statbuf.st_mtime);
|
||||
#ifdef AIAMAG
|
||||
ar_hdr.ar_date[strlen(ar_hdr.ar_date)] = ' ';
|
||||
#endif
|
||||
#else
|
||||
ar_hdr.ar_date = statbuf.st_mtime;
|
||||
#endif
|
||||
/* Write back this member's header */
|
||||
if (lseek (fd, pos, 0) < 0)
|
||||
goto lose;
|
||||
if (AR_HDR_SIZE != write (fd, (char *) &ar_hdr, AR_HDR_SIZE))
|
||||
goto lose;
|
||||
close (fd);
|
||||
return 0;
|
||||
|
||||
lose:
|
||||
i = errno;
|
||||
close (fd);
|
||||
errno = i;
|
||||
return -3;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
long int
|
||||
describe_member (desc, name, truncated,
|
||||
hdrpos, datapos, size, date, uid, gid, mode)
|
||||
int desc;
|
||||
char *name;
|
||||
int truncated;
|
||||
long int hdrpos, datapos, size, date;
|
||||
int uid, gid, mode;
|
||||
{
|
||||
extern char *ctime ();
|
||||
|
||||
printf ("Member `%s'%s: %ld bytes at %ld (%ld).\n",
|
||||
name, truncated ? " (name might be truncated)" : "",
|
||||
size, hdrpos, datapos);
|
||||
printf (" Date %s", ctime (&date));
|
||||
printf (" uid = %d, gid = %d, mode = 0%o.\n", uid, gid, mode);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
ar_scan (argv[1], describe_member);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* TEST. */
|
||||
|
||||
#endif /* NO_ARCHIVES. */
|
||||
69
build.sh.in
Normal file
69
build.sh.in
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
# Shell script to build GNU Make in the absence of any `make' program.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
# This file is part of GNU Make.
|
||||
#
|
||||
# GNU Make 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 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
# See Makefile.in for comments describing these variables.
|
||||
|
||||
srcdir='@srcdir@'
|
||||
CC='@CC@'
|
||||
CFLAGS='@CFLAGS@'
|
||||
CPPFLAGS='@CPPFLAGS@'
|
||||
LDFLAGS='@LDFLAGS@'
|
||||
defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"'
|
||||
ALLOCA='@ALLOCA@'
|
||||
LOADLIBES='@LIBS@'
|
||||
extras='@LIBOBJS@'
|
||||
REMOTE='@REMOTE@'
|
||||
|
||||
# Common prefix for machine-independent installed files.
|
||||
prefix='@prefix@'
|
||||
# Common prefix for machine-dependent installed files.
|
||||
exec_prefix='@exec_prefix@'
|
||||
# Directory to find libraries in for `-lXXX'.
|
||||
libdir=${exec_prefix}/lib
|
||||
# Directory to search by default for included makefiles.
|
||||
includedir=${prefix}/include
|
||||
|
||||
# Exit as soon as any command fails.
|
||||
set -e
|
||||
|
||||
# These are all the objects we need to link together.
|
||||
objs="commands.o job.o dir.o file.o misc.o main.o read.o remake.o rule.o implicit.o default.o variable.o expand.o function.o vpath.o version.o ar.o arscan.o signame.o getopt.o getopt1.o glob/libglob.a glob/glob.o glob/fnmatch.o remote-${REMOTE}.o ${extras} ${ALLOCA}"
|
||||
|
||||
# Compile the source files into those objects.
|
||||
for file in `echo ${objs} | sed 's/\.o/.c/g'`; do
|
||||
echo compiling ${file}...
|
||||
$CC $defines $CPPFLAGS $CFLAGS \
|
||||
-c -I. -I${srcdir} -I${srcdir}/glob ${srcdir}/$file
|
||||
done
|
||||
|
||||
# The object files were actually all put in the current directory.
|
||||
# Remove the source directory names from the list.
|
||||
srcobjs="$objs"
|
||||
objs=
|
||||
for obj in $srcobjs; do
|
||||
objs="$objs `basename $obj`"
|
||||
done
|
||||
|
||||
# Link all the objects together.
|
||||
echo linking make...
|
||||
$CC $LDFLAGS $objs $LOADLIBES -o make.new
|
||||
echo done
|
||||
mv -f make.new make
|
||||
69
build.template
Normal file
69
build.template
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
# Shell script to build GNU Make in the absence of any `make' program.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
# This file is part of GNU Make.
|
||||
#
|
||||
# GNU Make 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 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
# See Makefile.in for comments describing these variables.
|
||||
|
||||
srcdir='@srcdir@'
|
||||
CC='@CC@'
|
||||
CFLAGS='@CFLAGS@'
|
||||
CPPFLAGS='@CPPFLAGS@'
|
||||
LDFLAGS='@LDFLAGS@'
|
||||
defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"'
|
||||
ALLOCA='@ALLOCA@'
|
||||
LOADLIBES='@LIBS@'
|
||||
extras='@LIBOBJS@'
|
||||
REMOTE='@REMOTE@'
|
||||
|
||||
# Common prefix for machine-independent installed files.
|
||||
prefix='@prefix@'
|
||||
# Common prefix for machine-dependent installed files.
|
||||
exec_prefix='@exec_prefix@'
|
||||
# Directory to find libraries in for `-lXXX'.
|
||||
libdir=${exec_prefix}/lib
|
||||
# Directory to search by default for included makefiles.
|
||||
includedir=${prefix}/include
|
||||
|
||||
# Exit as soon as any command fails.
|
||||
set -e
|
||||
|
||||
# These are all the objects we need to link together.
|
||||
objs="%objs% remote-${REMOTE}.o ${extras} ${ALLOCA}"
|
||||
|
||||
# Compile the source files into those objects.
|
||||
for file in `echo ${objs} | sed 's/\.o/.c/g'`; do
|
||||
echo compiling ${file}...
|
||||
$CC $defines $CPPFLAGS $CFLAGS \
|
||||
-c -I. -I${srcdir} -I${srcdir}/glob ${srcdir}/$file
|
||||
done
|
||||
|
||||
# The object files were actually all put in the current directory.
|
||||
# Remove the source directory names from the list.
|
||||
srcobjs="$objs"
|
||||
objs=
|
||||
for obj in $srcobjs; do
|
||||
objs="$objs `basename $obj`"
|
||||
done
|
||||
|
||||
# Link all the objects together.
|
||||
echo linking make...
|
||||
$CC $LDFLAGS $objs $LOADLIBES -o make.new
|
||||
echo done
|
||||
mv -f make.new make
|
||||
548
commands.c
Normal file
548
commands.c
Normal file
@@ -0,0 +1,548 @@
|
||||
/* Command processing for GNU Make.
|
||||
Copyright (C) 1988, 89, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "dep.h"
|
||||
#include "filedef.h"
|
||||
#include "variable.h"
|
||||
#include "job.h"
|
||||
#include "commands.h"
|
||||
|
||||
extern int remote_kill PARAMS ((int id, int sig));
|
||||
|
||||
#ifndef HAVE_UNISTD_H
|
||||
extern int getpid ();
|
||||
#endif
|
||||
|
||||
/* Set FILE's automatic variables up. */
|
||||
|
||||
static void
|
||||
set_file_variables (file)
|
||||
register struct file *file;
|
||||
{
|
||||
register char *p;
|
||||
char *at, *percent, *star, *less;
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
/* If the target is an archive member `lib(member)',
|
||||
then $@ is `lib' and $% is `member'. */
|
||||
|
||||
if (ar_name (file->name))
|
||||
{
|
||||
unsigned int len;
|
||||
p = index (file->name, '(');
|
||||
at = (char *) alloca (p - file->name + 1);
|
||||
bcopy (file->name, at, p - file->name);
|
||||
at[p - file->name] = '\0';
|
||||
len = strlen (p + 1);
|
||||
percent = (char *) alloca (len);
|
||||
bcopy (p + 1, percent, len - 1);
|
||||
percent[len - 1] = '\0';
|
||||
}
|
||||
else
|
||||
#endif /* NO_ARCHIVES. */
|
||||
{
|
||||
at = file->name;
|
||||
percent = "";
|
||||
}
|
||||
|
||||
/* $* is the stem from an implicit or static pattern rule. */
|
||||
if (file->stem == 0)
|
||||
{
|
||||
/* In Unix make, $* is set to the target name with
|
||||
any suffix in the .SUFFIXES list stripped off for
|
||||
explicit rules. We store this in the `stem' member. */
|
||||
register struct dep *d;
|
||||
char *name;
|
||||
unsigned int len;
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
if (ar_name (file->name))
|
||||
{
|
||||
name = index (file->name, '(') + 1;
|
||||
len = strlen (name) - 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
name = file->name;
|
||||
len = strlen (name);
|
||||
}
|
||||
|
||||
for (d = enter_file (".SUFFIXES")->deps; d != 0; d = d->next)
|
||||
{
|
||||
unsigned int slen = strlen (dep_name (d));
|
||||
if (len > slen && !strncmp (dep_name (d), name + (len - slen), slen))
|
||||
{
|
||||
file->stem = savestring (name, len - slen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (d == 0)
|
||||
file->stem = "";
|
||||
}
|
||||
star = file->stem;
|
||||
|
||||
/* $< is the first dependency. */
|
||||
less = file->deps != 0 ? dep_name (file->deps) : "";
|
||||
|
||||
if (file->cmds == default_file->cmds)
|
||||
/* This file got its commands from .DEFAULT.
|
||||
In this case $< is the same as $@. */
|
||||
less = at;
|
||||
|
||||
#define DEFINE_VARIABLE(name, len, value) \
|
||||
(void) define_variable_for_file (name, len, value, o_automatic, 0, file)
|
||||
|
||||
/* Define the variables. */
|
||||
|
||||
DEFINE_VARIABLE ("<", 1, less);
|
||||
DEFINE_VARIABLE ("*", 1, star);
|
||||
DEFINE_VARIABLE ("@", 1, at);
|
||||
DEFINE_VARIABLE ("%", 1, percent);
|
||||
|
||||
/* Compute the values for $^, $+, and $?. */
|
||||
|
||||
{
|
||||
register unsigned int qmark_len, plus_len;
|
||||
char *caret_value, *plus_value;
|
||||
register char *cp;
|
||||
char *qmark_value;
|
||||
register char *qp;
|
||||
register struct dep *d;
|
||||
unsigned int len;
|
||||
|
||||
/* Compute first the value for $+, which is supposed to contain
|
||||
duplicate dependencies as they were listed in the makefile. */
|
||||
|
||||
plus_len = 0;
|
||||
for (d = file->deps; d != 0; d = d->next)
|
||||
plus_len += strlen (dep_name (d)) + 1;
|
||||
|
||||
len = plus_len == 0 ? 1 : plus_len;
|
||||
cp = plus_value = (char *) alloca (len);
|
||||
|
||||
qmark_len = plus_len; /* Will be this or less. */
|
||||
for (d = file->deps; d != 0; d = d->next)
|
||||
{
|
||||
char *c = dep_name (d);
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
if (ar_name (c))
|
||||
{
|
||||
c = index (c, '(') + 1;
|
||||
len = strlen (c) - 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
len = strlen (c);
|
||||
|
||||
bcopy (c, cp, len);
|
||||
cp += len;
|
||||
#if VMS
|
||||
*cp++ = ',';
|
||||
#else
|
||||
*cp++ = ' ';
|
||||
#endif
|
||||
if (! d->changed)
|
||||
qmark_len -= len + 1; /* Don't space in $? for this one. */
|
||||
}
|
||||
|
||||
/* Kill the last space and define the variable. */
|
||||
|
||||
cp[cp > plus_value ? -1 : 0] = '\0';
|
||||
DEFINE_VARIABLE ("+", 1, plus_value);
|
||||
|
||||
/* Make sure that no dependencies are repeated. This does not
|
||||
really matter for the purpose of updating targets, but it
|
||||
might make some names be listed twice for $^ and $?. */
|
||||
|
||||
uniquize_deps (file->deps);
|
||||
|
||||
/* Compute the values for $^ and $?. */
|
||||
|
||||
cp = caret_value = plus_value; /* Reuse the buffer; it's big enough. */
|
||||
len = qmark_len == 0 ? 1 : qmark_len;
|
||||
qp = qmark_value = (char *) alloca (len);
|
||||
|
||||
for (d = file->deps; d != 0; d = d->next)
|
||||
{
|
||||
char *c = dep_name (d);
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
if (ar_name (c))
|
||||
{
|
||||
c = index (c, '(') + 1;
|
||||
len = strlen (c) - 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
len = strlen (c);
|
||||
|
||||
bcopy (c, cp, len);
|
||||
cp += len;
|
||||
#if VMS
|
||||
*cp++ = ',';
|
||||
#else
|
||||
*cp++ = ' ';
|
||||
#endif
|
||||
if (d->changed)
|
||||
{
|
||||
bcopy (c, qp, len);
|
||||
qp += len;
|
||||
#if VMS
|
||||
*qp++ = ',';
|
||||
#else
|
||||
*qp++ = ' ';
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Kill the last spaces and define the variables. */
|
||||
|
||||
cp[cp > caret_value ? -1 : 0] = '\0';
|
||||
DEFINE_VARIABLE ("^", 1, caret_value);
|
||||
|
||||
qp[qp > qmark_value ? -1 : 0] = '\0';
|
||||
DEFINE_VARIABLE ("?", 1, qmark_value);
|
||||
}
|
||||
|
||||
#undef DEFINE_VARIABLE
|
||||
}
|
||||
|
||||
/* Chop CMDS up into individual command lines if necessary.
|
||||
Also set the `lines_flag' and `any_recurse' members. */
|
||||
|
||||
void
|
||||
chop_commands (cmds)
|
||||
register struct commands *cmds;
|
||||
{
|
||||
if (cmds != 0 && cmds->command_lines == 0)
|
||||
{
|
||||
/* Chop CMDS->commands up into lines in CMDS->command_lines.
|
||||
Also set the corresponding CMDS->lines_flags elements,
|
||||
and the CMDS->any_recurse flag. */
|
||||
register char *p;
|
||||
unsigned int nlines, idx;
|
||||
char **lines;
|
||||
|
||||
nlines = 5;
|
||||
lines = (char **) xmalloc (5 * sizeof (char *));
|
||||
idx = 0;
|
||||
p = cmds->commands;
|
||||
while (*p != '\0')
|
||||
{
|
||||
char *end = p;
|
||||
find_end:;
|
||||
end = index (end, '\n');
|
||||
if (end == 0)
|
||||
end = p + strlen (p);
|
||||
else if (end > p && end[-1] == '\\')
|
||||
{
|
||||
int backslash = 1;
|
||||
register char *b;
|
||||
for (b = end - 2; b >= p && *b == '\\'; --b)
|
||||
backslash = !backslash;
|
||||
if (backslash)
|
||||
{
|
||||
++end;
|
||||
goto find_end;
|
||||
}
|
||||
}
|
||||
|
||||
if (idx == nlines)
|
||||
{
|
||||
nlines += 2;
|
||||
lines = (char **) xrealloc ((char *) lines,
|
||||
nlines * sizeof (char *));
|
||||
}
|
||||
lines[idx++] = savestring (p, end - p);
|
||||
p = end;
|
||||
if (*p != '\0')
|
||||
++p;
|
||||
}
|
||||
|
||||
if (idx != nlines)
|
||||
{
|
||||
nlines = idx;
|
||||
lines = (char **) xrealloc ((char *) lines,
|
||||
nlines * sizeof (char *));
|
||||
}
|
||||
|
||||
cmds->ncommand_lines = nlines;
|
||||
cmds->command_lines = lines;
|
||||
|
||||
cmds->any_recurse = 0;
|
||||
cmds->lines_flags = (char *) xmalloc (nlines);
|
||||
for (idx = 0; idx < nlines; ++idx)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
for (p = lines[idx];
|
||||
isblank (*p) || *p == '-' || *p == '@' || *p == '+';
|
||||
++p)
|
||||
switch (*p)
|
||||
{
|
||||
case '+':
|
||||
flags |= COMMANDS_RECURSE;
|
||||
break;
|
||||
case '@':
|
||||
flags |= COMMANDS_SILENT;
|
||||
break;
|
||||
case '-':
|
||||
flags |= COMMANDS_NOERROR;
|
||||
break;
|
||||
}
|
||||
if (!(flags & COMMANDS_RECURSE))
|
||||
{
|
||||
unsigned int len = strlen (p);
|
||||
if (sindex (p, len, "$(MAKE)", 7) != 0
|
||||
|| sindex (p, len, "${MAKE}", 7) != 0)
|
||||
flags |= COMMANDS_RECURSE;
|
||||
}
|
||||
|
||||
cmds->lines_flags[idx] = flags;
|
||||
cmds->any_recurse |= flags & COMMANDS_RECURSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Execute the commands to remake FILE. If they are currently executing,
|
||||
return or have already finished executing, just return. Otherwise,
|
||||
fork off a child process to run the first command line in the sequence. */
|
||||
|
||||
void
|
||||
execute_file_commands (file)
|
||||
struct file *file;
|
||||
{
|
||||
register char *p;
|
||||
|
||||
/* Don't go through all the preparations if
|
||||
the commands are nothing but whitespace. */
|
||||
|
||||
for (p = file->cmds->commands; *p != '\0'; ++p)
|
||||
if (!isspace (*p) && *p != '-' && *p != '@')
|
||||
break;
|
||||
if (*p == '\0')
|
||||
{
|
||||
/* We are all out of commands.
|
||||
If we have gotten this far, all the previous commands
|
||||
have run successfully, so we have winning update status. */
|
||||
file->update_status = 0;
|
||||
notice_finished_file (file);
|
||||
return;
|
||||
}
|
||||
|
||||
/* First set the automatic variables according to this file. */
|
||||
|
||||
initialize_file_variables (file);
|
||||
|
||||
set_file_variables (file);
|
||||
|
||||
/* Start the commands running. */
|
||||
new_job (file);
|
||||
}
|
||||
|
||||
/* This is set while we are inside fatal_error_signal,
|
||||
so things can avoid nonreentrant operations. */
|
||||
|
||||
int handling_fatal_signal = 0;
|
||||
|
||||
/* Handle fatal signals. */
|
||||
|
||||
RETSIGTYPE
|
||||
fatal_error_signal (sig)
|
||||
int sig;
|
||||
{
|
||||
#if defined(__MSDOS__) || defined(_AMIGA)
|
||||
remove_intermediates (1);
|
||||
#ifdef _AMIGA
|
||||
if (sig == SIGINT)
|
||||
fputs ("*** Break.\n", stderr);
|
||||
|
||||
exit (10);
|
||||
#else
|
||||
exit (1);
|
||||
#endif
|
||||
#else /* Not MSDOS. */
|
||||
handling_fatal_signal = 1;
|
||||
|
||||
/* Set the handling for this signal to the default.
|
||||
It is blocked now while we run this handler. */
|
||||
signal (sig, SIG_DFL);
|
||||
|
||||
/* A termination signal won't be sent to the entire
|
||||
process group, but it means we want to kill the children. */
|
||||
|
||||
if (sig == SIGTERM)
|
||||
{
|
||||
register struct child *c;
|
||||
for (c = children; c != 0; c = c->next)
|
||||
if (!c->remote)
|
||||
(void) kill (c->pid, SIGTERM);
|
||||
}
|
||||
|
||||
/* If we got a signal that means the user
|
||||
wanted to kill make, remove pending targets. */
|
||||
|
||||
if (sig == SIGTERM || sig == SIGINT
|
||||
#ifdef SIGHUP
|
||||
|| sig == SIGHUP
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
|| sig == SIGQUIT
|
||||
#endif
|
||||
)
|
||||
{
|
||||
register struct child *c;
|
||||
|
||||
/* Remote children won't automatically get signals sent
|
||||
to the process group, so we must send them. */
|
||||
for (c = children; c != 0; c = c->next)
|
||||
if (c->remote)
|
||||
(void) remote_kill (c->pid, sig);
|
||||
|
||||
for (c = children; c != 0; c = c->next)
|
||||
delete_child_targets (c);
|
||||
|
||||
/* Clean up the children. We don't just use the call below because
|
||||
we don't want to print the "Waiting for children" message. */
|
||||
while (job_slots_used > 0)
|
||||
reap_children (1, 0);
|
||||
}
|
||||
else
|
||||
/* Wait for our children to die. */
|
||||
while (job_slots_used > 0)
|
||||
reap_children (1, 1);
|
||||
|
||||
/* Delete any non-precious intermediate files that were made. */
|
||||
|
||||
remove_intermediates (1);
|
||||
|
||||
#ifdef SIGQUIT
|
||||
if (sig == SIGQUIT)
|
||||
/* We don't want to send ourselves SIGQUIT, because it will
|
||||
cause a core dump. Just exit instead. */
|
||||
exit (EXIT_FAILURE);
|
||||
#endif
|
||||
|
||||
/* Signal the same code; this time it will really be fatal. The signal
|
||||
will be unblocked when we return and arrive then to kill us. */
|
||||
if (kill (getpid (), sig) < 0)
|
||||
pfatal_with_name ("kill");
|
||||
#endif /* MSDOS. */
|
||||
}
|
||||
|
||||
/* Delete FILE unless it's precious or not actually a file (phony),
|
||||
and it has changed on disk since we last stat'd it. */
|
||||
|
||||
static void
|
||||
delete_target (file, on_behalf_of)
|
||||
struct file *file;
|
||||
char *on_behalf_of;
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (file->precious || file->phony)
|
||||
return;
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
if (ar_name (file->name))
|
||||
{
|
||||
if (ar_member_date (file->name) != file->last_mtime)
|
||||
{
|
||||
if (on_behalf_of)
|
||||
error ("*** [%s] Archive member `%s' may be bogus; not deleted",
|
||||
on_behalf_of, file->name);
|
||||
else
|
||||
error ("*** Archive member `%s' may be bogus; not deleted",
|
||||
file->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (stat (file->name, &st) == 0
|
||||
&& S_ISREG (st.st_mode)
|
||||
&& (time_t) st.st_mtime != file->last_mtime)
|
||||
{
|
||||
if (on_behalf_of)
|
||||
error ("*** [%s] Deleting file `%s'", on_behalf_of, file->name);
|
||||
else
|
||||
error ("*** Deleting file `%s'", file->name);
|
||||
if (unlink (file->name) < 0
|
||||
&& errno != ENOENT) /* It disappeared; so what. */
|
||||
perror_with_name ("unlink: ", file->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Delete all non-precious targets of CHILD unless they were already deleted.
|
||||
Set the flag in CHILD to say they've been deleted. */
|
||||
|
||||
void
|
||||
delete_child_targets (child)
|
||||
struct child *child;
|
||||
{
|
||||
struct dep *d;
|
||||
|
||||
if (child->deleted)
|
||||
return;
|
||||
|
||||
/* Delete the target file if it changed. */
|
||||
delete_target (child->file, (char *) 0);
|
||||
|
||||
/* Also remove any non-precious targets listed in the `also_make' member. */
|
||||
for (d = child->file->also_make; d != 0; d = d->next)
|
||||
delete_target (d->file, child->file->name);
|
||||
|
||||
child->deleted = 1;
|
||||
}
|
||||
|
||||
/* Print out the commands in CMDS. */
|
||||
|
||||
void
|
||||
print_commands (cmds)
|
||||
register struct commands *cmds;
|
||||
{
|
||||
register char *s;
|
||||
|
||||
fputs ("# commands to execute", stdout);
|
||||
|
||||
if (cmds->filename == 0)
|
||||
puts (" (built-in):");
|
||||
else
|
||||
printf (" (from `%s', line %u):\n", cmds->filename, cmds->lineno);
|
||||
|
||||
s = cmds->commands;
|
||||
while (*s != '\0')
|
||||
{
|
||||
char *end;
|
||||
|
||||
while (isspace (*s))
|
||||
++s;
|
||||
|
||||
end = index (s, '\n');
|
||||
if (end == 0)
|
||||
end = s + strlen (s);
|
||||
|
||||
printf ("\t%.*s\n", (int) (end - s), s);
|
||||
|
||||
s = end;
|
||||
}
|
||||
}
|
||||
42
commands.h
Normal file
42
commands.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* Definition of data structures describing shell commands for GNU Make.
|
||||
Copyright (C) 1988, 1989, 1991, 1993 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Structure that gives the commands to make a file
|
||||
and information about where these commands came from. */
|
||||
|
||||
struct commands
|
||||
{
|
||||
char *filename; /* File that contains commands. */
|
||||
unsigned int lineno; /* Line number in file. */
|
||||
char *commands; /* Commands text. */
|
||||
unsigned int ncommand_lines;/* Number of command lines. */
|
||||
char **command_lines; /* Commands chopped up into lines. */
|
||||
char *lines_flags; /* One set of flag bits for each line. */
|
||||
int any_recurse; /* Nonzero if any `lines_recurse' elt has */
|
||||
/* the COMMANDS_RECURSE bit set. */
|
||||
};
|
||||
|
||||
/* Bits in `lines_flags'. */
|
||||
#define COMMANDS_RECURSE 1 /* Recurses: + or $(MAKE). */
|
||||
#define COMMANDS_SILENT 2 /* Silent: @. */
|
||||
#define COMMANDS_NOERROR 4 /* No errors: -. */
|
||||
|
||||
extern void execute_file_commands PARAMS ((struct file *file));
|
||||
extern void print_commands PARAMS ((struct commands *cmds));
|
||||
extern void delete_child_targets PARAMS ((struct child *child));
|
||||
extern void chop_commands PARAMS ((struct commands *cmds));
|
||||
272
compatMakefile
Normal file
272
compatMakefile
Normal file
@@ -0,0 +1,272 @@
|
||||
# NOTE: If you have no `make' program at all to process this makefile, run
|
||||
# `build.sh' instead.
|
||||
#
|
||||
# Copyright (C) 1988,89,91,92,93,94,95,96 Free Software Foundation, Inc.
|
||||
# This file is part of GNU Make.
|
||||
#
|
||||
# GNU Make 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 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Makefile for GNU Make
|
||||
#
|
||||
|
||||
# Ultrix 2.2 make doesn't expand the value of VPATH.
|
||||
VPATH = @srcdir@
|
||||
# This must repeat the value, because configure will remove `VPATH = .'.
|
||||
srcdir = @srcdir@
|
||||
|
||||
CC = @CC@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
# Define these for your system as follows:
|
||||
# -DNO_ARCHIVES To disable `ar' archive support.
|
||||
# -DNO_FLOAT To avoid using floating-point numbers.
|
||||
# -DENUM_BITFIELDS If the compiler isn't GCC but groks enum foo:2.
|
||||
# Some compilers apparently accept this
|
||||
# without complaint but produce losing code,
|
||||
# so beware.
|
||||
# NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
|
||||
# See also `config.h'.
|
||||
defines = @DEFS@ -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\"
|
||||
|
||||
# Which flavor of remote job execution support to use.
|
||||
# The code is found in `remote-$(REMOTE).c'.
|
||||
REMOTE = @REMOTE@
|
||||
|
||||
# If your system doesn't have alloca, or the one provided is bad, define this.
|
||||
ALLOCA = @ALLOCA@
|
||||
ALLOCA_SRC = $(srcdir)/alloca.c
|
||||
|
||||
# If your system needs extra libraries loaded in, define them here.
|
||||
# System V probably need -lPW for alloca. HP-UX 7.0's alloca in
|
||||
# libPW.a is broken on HP9000s300 and HP9000s400 machines. Use
|
||||
# alloca.c instead on those machines.
|
||||
LOADLIBES = @LIBS@
|
||||
|
||||
# Any extra object files your system needs.
|
||||
extras = @LIBOBJS@
|
||||
|
||||
# Common prefix for machine-independent installed files.
|
||||
prefix = @prefix@
|
||||
# Common prefix for machine-dependent installed files.
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
# Directory to install `make' in.
|
||||
bindir = $(exec_prefix)/bin
|
||||
# Directory to find libraries in for `-lXXX'.
|
||||
libdir = $(exec_prefix)/lib
|
||||
# Directory to search by default for included makefiles.
|
||||
includedir = $(prefix)/include
|
||||
# Directory to install the Info files in.
|
||||
infodir = $(prefix)/info
|
||||
# Directory to install the man page in.
|
||||
mandir = $(prefix)/man/man$(manext)
|
||||
# Number to put on the man page filename.
|
||||
manext = 1
|
||||
# Prefix to put on installed `make' binary file name.
|
||||
binprefix =
|
||||
# Prefix to put on installed `make' man page file name.
|
||||
manprefix = $(binprefix)
|
||||
|
||||
# Whether or not make needs to be installed setgid.
|
||||
# The value should be either `true' or `false'.
|
||||
# On many systems, the getloadavg function (used to implement the `-l'
|
||||
# switch) will not work unless make is installed setgid kmem.
|
||||
install_setgid = @NEED_SETGID@
|
||||
# Install make setgid to this group so it can read /dev/kmem.
|
||||
group = @KMEM_GROUP@
|
||||
|
||||
# Program to install `make'.
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
# Program to install the man page.
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
# Generic install program.
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
# Program to format Texinfo source into Info files.
|
||||
MAKEINFO = makeinfo
|
||||
# Program to format Texinfo source into DVI files.
|
||||
TEXI2DVI = texi2dvi
|
||||
|
||||
# Programs to make tags files.
|
||||
ETAGS = etags -w
|
||||
CTAGS = ctags -w
|
||||
|
||||
objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \
|
||||
rule.o implicit.o default.o variable.o expand.o function.o \
|
||||
vpath.o version.o ar.o arscan.o signame.o remote-$(REMOTE).o \
|
||||
getopt.o getopt1.o glob/libglob.a \
|
||||
$(ALLOCA) $(extras)
|
||||
srcs = $(srcdir)/commands.c $(srcdir)/job.c $(srcdir)/dir.c \
|
||||
$(srcdir)/file.c $(srcdir)/getloadavg.c $(srcdir)/misc.c \
|
||||
$(srcdir)/main.c $(srcdir)/read.c $(srcdir)/remake.c \
|
||||
$(srcdir)/rule.c $(srcdir)/implicit.c $(srcdir)/default.c \
|
||||
$(srcdir)/variable.c $(srcdir)/expand.c $(srcdir)/function.c \
|
||||
$(srcdir)/vpath.c $(srcdir)/version.c \
|
||||
$(srcdir)/remote-$(REMOTE).c \
|
||||
$(srcdir)/ar.c $(srcdir)/arscan.c \
|
||||
$(srcdir)/signame.c $(srcdir)/signame.h \
|
||||
$(srcdir)/getopt.c $(srcdir)/getopt1.c $(srcdir)/getopt.h \
|
||||
$(srcdir)/commands.h $(srcdir)/dep.h $(srcdir)/filedef.h \
|
||||
$(srcdir)/job.h $(srcdir)/make.h $(srcdir)/rule.h \
|
||||
$(srcdir)/variable.h $(ALLOCA_SRC) $(srcdir)/config.h.in
|
||||
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
|
||||
|
||||
all: make
|
||||
info: make.info
|
||||
dvi: make.dvi
|
||||
# Some makes apparently use .PHONY as the default goal if it is before `all'.
|
||||
.PHONY: all check info dvi
|
||||
|
||||
make.info: make.texinfo
|
||||
$(MAKEINFO) -I$(srcdir) $(srcdir)/make.texinfo -o make.info
|
||||
|
||||
make.dvi: make.texinfo
|
||||
$(TEXI2DVI) $(srcdir)/make.texinfo
|
||||
|
||||
make.ps: make.dvi
|
||||
dvi2ps make.dvi > make.ps
|
||||
|
||||
make: $(objs)
|
||||
$(CC) $(LDFLAGS) $(objs) $(LOADLIBES) -o make.new
|
||||
mv -f make.new make
|
||||
|
||||
# -I. is needed to find config.h in the build directory.
|
||||
.c.o:
|
||||
$(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \
|
||||
$(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
|
||||
# For some losing Unix makes.
|
||||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
|
||||
glob/libglob.a: FORCE config.h
|
||||
cd glob; $(MAKE) libglob.a
|
||||
FORCE:
|
||||
|
||||
tagsrcs = $(srcs) $(srcdir)/remote-*.c
|
||||
TAGS: $(tagsrcs)
|
||||
$(ETAGS) $(tagsrcs)
|
||||
tags: $(tagsrcs)
|
||||
$(CTAGS) $(tagsrcs)
|
||||
|
||||
.PHONY: install installdirs
|
||||
install: installdirs \
|
||||
$(bindir)/$(binprefix)make $(infodir)/make.info \
|
||||
$(mandir)/$(manprefix)make.$(manext)
|
||||
|
||||
installdirs:
|
||||
$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(mandir)
|
||||
|
||||
$(bindir)/$(binprefix)make: make
|
||||
$(INSTALL_PROGRAM) make $@.new
|
||||
@if $(install_setgid); then \
|
||||
if chgrp $(group) $@.new && chmod g+s $@.new; then \
|
||||
echo "chgrp $(group) $@.new && chmod g+s $@.new"; \
|
||||
else \
|
||||
echo "$@ needs to be owned by group $(group) and setgid;"; \
|
||||
echo "otherwise the \`-l' option will probably not work."; \
|
||||
echo "You may need special privileges to install $@."; \
|
||||
fi; \
|
||||
else true; fi
|
||||
# Some systems can't deal with renaming onto a running binary.
|
||||
-rm -f $@.old
|
||||
-mv $@ $@.old
|
||||
mv $@.new $@
|
||||
|
||||
$(infodir)/make.info: make.info
|
||||
if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
|
||||
for file in $${dir}/make.info*; do \
|
||||
name="`basename $$file`"; \
|
||||
$(INSTALL_DATA) $$file \
|
||||
`echo $@ | sed "s,make.info\$$,$$name,"`; \
|
||||
done
|
||||
# Run install-info only if it exists.
|
||||
# Use `if' instead of just prepending `-' to the
|
||||
# line so we notice real errors from install-info.
|
||||
# We use `$(SHELL) -c' because some shells do not
|
||||
# fail gracefully when there is an unknown command.
|
||||
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \
|
||||
install-info --infodir=$(infodir) $$dir/make.info; \
|
||||
else true; fi
|
||||
|
||||
$(mandir)/$(manprefix)make.$(manext): make.man
|
||||
$(INSTALL_DATA) $(srcdir)/make.man $@
|
||||
|
||||
|
||||
loadavg: loadavg.c config.h
|
||||
$(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
|
||||
loadavg.c $(LOADLIBES) -o $@
|
||||
# We copy getloadavg.c into a different file rather than compiling it
|
||||
# directly because some compilers clobber getloadavg.o in the process.
|
||||
loadavg.c: getloadavg.c
|
||||
ln $(srcdir)/getloadavg.c loadavg.c || \
|
||||
cp $(srcdir)/getloadavg.c loadavg.c
|
||||
check-loadavg: loadavg
|
||||
@echo The system uptime program believes the load average to be:
|
||||
-uptime
|
||||
@echo The GNU load average checking code believes:
|
||||
./loadavg
|
||||
check: check-loadavg
|
||||
|
||||
|
||||
.PHONY: clean realclean distclean mostlyclean
|
||||
clean: glob-clean
|
||||
-rm -f make loadavg *.o core make.dvi
|
||||
distclean: clean glob-realclean
|
||||
-rm -f Makefile config.h config.status build.sh stamp-config
|
||||
-rm -f config.log config.cache
|
||||
-rm -f TAGS tags
|
||||
-rm -f make.?? make.??s make.log make.toc make.*aux
|
||||
-rm -f loadavg.c
|
||||
realclean: distclean
|
||||
-rm -f make.info*
|
||||
mostlyclean: clean
|
||||
|
||||
.PHONY: glob-clean glob-realclean
|
||||
glob-clean glob-realclean:
|
||||
cd glob; $(MAKE) $@
|
||||
|
||||
Makefile: config.status $(srcdir)/Makefile.in
|
||||
$(SHELL) config.status
|
||||
glob/Makefile: config.status $(srcdir)/glob/Makefile.in
|
||||
$(SHELL) config.status
|
||||
config.h: stamp-config ;
|
||||
stamp-config: config.status $(srcdir)/config.h.in
|
||||
$(SHELL) config.status
|
||||
touch stamp-config
|
||||
|
||||
#configure: configure.in aclocal.m4
|
||||
# cd $(srcdir) && autoconf $(ACFLAGS)
|
||||
#config.h.in: configure.in aclocal.m4
|
||||
# cd $(srcdir) && autoheader $(ACFLAGS)
|
||||
|
||||
# This tells versions [3.59,3.63) of GNU make not to export all variables.
|
||||
.NOEXPORT:
|
||||
|
||||
# The automatically generated dependencies below may omit config.h
|
||||
# because it is included with ``#include <config.h>'' rather than
|
||||
# ``#include "config.h"''. So we add the explicit dependency to make sure.
|
||||
$(objs): config.h
|
||||
|
||||
# Automatically generated dependencies will be put at the end of the file.
|
||||
|
||||
271
config.ami.template
Normal file
271
config.ami.template
Normal file
@@ -0,0 +1,271 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
#undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#define C_ALLOCA
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define for DGUX with <sys/dg_sys_info.h>. */
|
||||
#undef DGUX
|
||||
|
||||
/* Define if the `getloadavg' function needs to be run setuid or setgid. */
|
||||
#undef GETLOADAVG_PRIVILEGED
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#define gid_t int
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define if your system has its own `getloadavg' function. */
|
||||
#undef HAVE_GETLOADAVG
|
||||
|
||||
/* Define if you have the getmntent function. */
|
||||
#undef HAVE_GETMNTENT
|
||||
|
||||
/* Define if the `long double' type works. */
|
||||
#undef HAVE_LONG_DOUBLE
|
||||
|
||||
/* Define if you support file names longer than 14 characters. */
|
||||
#define HAVE_LONG_FILE_NAMES
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if system calls automatically restart after interruption
|
||||
by a signal. */
|
||||
#undef HAVE_RESTARTABLE_SYSCALLS
|
||||
|
||||
/* Define if your struct stat has st_blksize. */
|
||||
#undef HAVE_ST_BLKSIZE
|
||||
|
||||
/* Define if your struct stat has st_blocks. */
|
||||
#undef HAVE_ST_BLOCKS
|
||||
|
||||
/* Define if you have the strcoll function and it is properly defined. */
|
||||
#define HAVE_STRCOLL
|
||||
|
||||
/* Define if your struct stat has st_rdev. */
|
||||
#define HAVE_ST_RDEV
|
||||
|
||||
/* Define if you have the strftime function. */
|
||||
#define HAVE_STRFTIME
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define if your struct tm has tm_zone. */
|
||||
#undef HAVE_TM_ZONE
|
||||
|
||||
/* Define if you don't have tm_zone but do have the external array
|
||||
tzname. */
|
||||
#define HAVE_TZNAME
|
||||
/* #define tzname __tzname */
|
||||
|
||||
/* Define if you have <unistd.h>. */
|
||||
#define HAVE_UNISTD_H
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#undef HAVE_UTIME_NULL
|
||||
|
||||
/* Define if you have <vfork.h>. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF
|
||||
|
||||
/* Define if you have the wait3 system call. */
|
||||
#undef HAVE_WAIT3
|
||||
|
||||
/* Define if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define if your struct nlist has an n_un member. */
|
||||
#undef NLIST_NAME_UNION
|
||||
|
||||
/* Define if you have <nlist.h>. */
|
||||
#undef NLIST_STRUCT
|
||||
|
||||
/* Define if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#define pid_t int
|
||||
|
||||
/* Define if the system does not provide POSIX.1 features except
|
||||
with this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if the setvbuf function takes the buffering type as its second
|
||||
argument and the buffer pointer as the third, as on System V
|
||||
before release 3. */
|
||||
#undef SETVBUF_REVERSED
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#define STACK_DIRECTION -1
|
||||
|
||||
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
#undef STAT_MACROS_BROKEN
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS
|
||||
|
||||
/* Define on System V Release 4. */
|
||||
#undef SVR4
|
||||
|
||||
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||
#undef SYS_SIGLIST_DECLARED
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#define uid_t int
|
||||
|
||||
/* Define for Encore UMAX. */
|
||||
#undef UMAX
|
||||
|
||||
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
|
||||
instead of <sys/cpustats.h>. */
|
||||
#undef UMAX4_3
|
||||
|
||||
/* Define vfork as fork if vfork does not work. */
|
||||
#undef vfork
|
||||
|
||||
/* Define to the name of the SCCS `get' command. */
|
||||
#define SCCS_GET "get"
|
||||
|
||||
/* Define this if the SCCS `get' command understands the `-G<file>' option. */
|
||||
#undef SCCS_GET_MINUS_G
|
||||
|
||||
/* Define this if the C library defines the variable `sys_siglist'. */
|
||||
#undef HAVE_SYS_SIGLIST
|
||||
|
||||
/* Define this if the C library defines the variable `_sys_siglist'. */
|
||||
#undef HAVE__SYS_SIGLIST
|
||||
|
||||
/* Define this if you have the `union wait' type in <sys/wait.h>. */
|
||||
#undef HAVE_UNION_WAIT
|
||||
|
||||
/* Define this if the POSIX.1 call `sysconf (_SC_OPEN_MAX)' works properly. */
|
||||
#undef HAVE_SYSCONF_OPEN_MAX
|
||||
|
||||
/* Define if you have the dup2 function. */
|
||||
#undef HAVE_DUP2
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#define HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getdtablesize function. */
|
||||
#undef HAVE_GETDTABLESIZE
|
||||
|
||||
/* Define if you have the getgroups function. */
|
||||
#undef HAVE_GETGROUPS
|
||||
|
||||
/* Define if you have the mktemp function. */
|
||||
#define HAVE_MKTEMP
|
||||
|
||||
/* Define if you have the psignal function. */
|
||||
#undef HAVE_PSIGNAL
|
||||
|
||||
/* Define if you have the setegid function. */
|
||||
#undef HAVE_SETEGID
|
||||
|
||||
/* Define if you have the seteuid function. */
|
||||
#undef HAVE_SETEUID
|
||||
|
||||
/* Define if you have the setlinebuf function. */
|
||||
#undef HAVE_SETLINEBUF
|
||||
|
||||
/* Define if you have the setregid function. */
|
||||
#undef HAVE_SETREGID
|
||||
|
||||
/* Define if you have the setreuid function. */
|
||||
#undef HAVE_SETREUID
|
||||
|
||||
/* Define if you have the sigsetmask function. */
|
||||
#undef HAVE_SIGSETMASK
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR
|
||||
|
||||
/* Define if you have the strsignal function. */
|
||||
#undef HAVE_STRSIGNAL
|
||||
|
||||
/* Define if you have the wait3 function. */
|
||||
#undef HAVE_WAIT3
|
||||
|
||||
/* Define if you have the waitpid function. */
|
||||
#undef HAVE_WAITPID
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#define HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <mach/mach.h> header file. */
|
||||
#undef HAVE_MACH_MACH_H
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#define HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <sys/timeb.h> header file. */
|
||||
#undef HAVE_SYS_TIMEB_H
|
||||
|
||||
/* Define if you have the <sys/wait.h> header file. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the dgc library (-ldgc). */
|
||||
#undef HAVE_LIBDGC
|
||||
|
||||
/* Define if you have the sun library (-lsun). */
|
||||
#undef HAVE_LIBSUN
|
||||
292
config.h-vms.template
Normal file
292
config.h-vms.template
Normal file
@@ -0,0 +1,292 @@
|
||||
/* config.h-vms. Generated by hand by Klaus Kämpf <kkaempf@didymus.rmi.de> */
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define for DGUX with <sys/dg_sys_info.h>. */
|
||||
/* #undef DGUX */
|
||||
|
||||
/* Define if the `getloadavg' function needs to be run setuid or setgid. */
|
||||
/* #undef GETLOADAVG_PRIVILEGED 1 */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef gid_t */
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
/* #undef HAVE_ALLOCA_H 1 */
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define if your system has its own `getloadavg' function. */
|
||||
/* #undef HAVE_GETLOADAVG */
|
||||
|
||||
/* Define if you have the getmntent function. */
|
||||
/* #undef HAVE_GETMNTENT */
|
||||
|
||||
/* Define if the `long double' type works. */
|
||||
/* #undef HAVE_LONG_DOUBLE */
|
||||
|
||||
/* Define if you support file names longer than 14 characters. */
|
||||
#define HAVE_LONG_FILE_NAMES 1
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
/* #undef HAVE_MMAP */
|
||||
|
||||
/* Define if system calls automatically restart after interruption
|
||||
by a signal. */
|
||||
/* #undef HAVE_RESTARTABLE_SYSCALLS */
|
||||
|
||||
/* Define if your struct stat has st_blksize. */
|
||||
/* #undef HAVE_ST_BLKSIZE */
|
||||
|
||||
/* Define if your struct stat has st_blocks. */
|
||||
/* #undef HAVE_ST_BLOCKS */
|
||||
|
||||
/* Define if you have the strcoll function and it is properly defined. */
|
||||
/* #undef HAVE_STRCOLL 1 */
|
||||
|
||||
/* Define if your struct stat has st_rdev. */
|
||||
/* #undef HAVE_ST_RDEV */
|
||||
|
||||
/* Define if you have the strftime function. */
|
||||
/* #undef HAVE_STRFTIME */
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
/* #undef HAVE_SYS_WAIT_H 1 */
|
||||
|
||||
/* Define if your struct tm has tm_zone. */
|
||||
/* #undef HAVE_TM_ZONE */
|
||||
|
||||
/* Define if you don't have tm_zone but do have the external array
|
||||
tzname. */
|
||||
/* #undef HAVE_TZNAME */
|
||||
|
||||
/* Define if you have <unistd.h>. */
|
||||
#ifdef __DECC
|
||||
#define HAVE_UNISTD_H 1
|
||||
#endif
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
/* #undef HAVE_UTIME_NULL */
|
||||
|
||||
/* Define if you have <vfork.h>. */
|
||||
/* #undef HAVE_VFORK_H 1 */
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define if you have the wait3 system call. */
|
||||
/* #undef HAVE_WAIT3 1 */
|
||||
|
||||
/* Define if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
/* Define if your struct nlist has an n_un member. */
|
||||
/* #undef NLIST_NAME_UNION */
|
||||
|
||||
/* Define if you have <nlist.h>. */
|
||||
/* #undef NLIST_STRUCT 1 */
|
||||
|
||||
/* Define if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#define pid_t int
|
||||
|
||||
/* Define if the system does not provide POSIX.1 features except
|
||||
with this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if the setvbuf function takes the buffering type as its second
|
||||
argument and the buffer pointer as the third, as on System V
|
||||
before release 3. */
|
||||
/* #undef SETVBUF_REVERSED 1 */
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
/* #undef STAT_MACROS_BROKEN */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
/* #undef STDC_HEADERS */
|
||||
|
||||
/* Define on System V Release 4. */
|
||||
/* #undef SVR4 */
|
||||
|
||||
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||
/* #undef SYS_SIGLIST_DECLARED */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#define uid_t int
|
||||
|
||||
/* Define for Encore UMAX. */
|
||||
/* #undef UMAX */
|
||||
|
||||
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
|
||||
instead of <sys/cpustats.h>. */
|
||||
/* #undef UMAX4_3 */
|
||||
|
||||
/* Define vfork as fork if vfork does not work. */
|
||||
/* #undef vfork */
|
||||
|
||||
/* Define to the name of the SCCS `get' command. */
|
||||
/* #undef SCCS_GET "/usr/sccs/get" */
|
||||
|
||||
/* Define this if the SCCS `get' command understands the `-G<file>' option. */
|
||||
/* #undef SCCS_GET_MINUS_G 1 */
|
||||
|
||||
/* Define this if the C library defines the variable `sys_siglist'. */
|
||||
/* #undefine HAVE_SYS_SIGLIST 1 */
|
||||
|
||||
/* Define this if the C library defines the variable `_sys_siglist'. */
|
||||
/* #undef HAVE__SYS_SIGLIST */
|
||||
|
||||
/* Define this if you have the `union wait' type in <sys/wait.h>. */
|
||||
/* #undef HAVE_UNION_WAIT */
|
||||
|
||||
/* Define this if the POSIX.1 call `sysconf (_SC_OPEN_MAX)' works properly. */
|
||||
/* #undef HAVE_SYSCONF_OPEN_MAX */
|
||||
|
||||
/* Define if you have the dup2 function. */
|
||||
#define HAVE_DUP2 1
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#define HAVE_GETCWD 1
|
||||
|
||||
/* Define if you have the getdtablesize function. */
|
||||
/* #undef HAVE_GETDTABLESIZE 1 */
|
||||
|
||||
/* Define if you have the getgroups function. */
|
||||
/* #undef HAVE_GETGROUPS 1 */
|
||||
|
||||
/* Define if you have the mktemp function. */
|
||||
#define HAVE_MKTEMP 1
|
||||
|
||||
/* Define if you have the psignal function. */
|
||||
/* #undef HAVE_PSIGNAL 1 */
|
||||
|
||||
/* Define if you have the setegid function. */
|
||||
/* #undef HAVE_SETEGID 1 */
|
||||
|
||||
/* Define if you have the seteuid function. */
|
||||
/* #undef HAVE_SETEUID 1 */
|
||||
|
||||
/* Define if you have the setlinebuf function. */
|
||||
/* #undef HAVE_SETLINEBUF 1 */
|
||||
|
||||
/* Define if you have the setregid function. */
|
||||
/* #undefine HAVE_SETREGID 1 */
|
||||
|
||||
/* Define if you have the setreuid function. */
|
||||
/* #define HAVE_SETREUID 1 */
|
||||
|
||||
/* Define if you have the sigsetmask function. */
|
||||
#define HAVE_SIGSETMASK 1
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the strsignal function. */
|
||||
/* #undef HAVE_STRSIGNAL */
|
||||
|
||||
/* Define if you have the wait3 function. */
|
||||
/* #define HAVE_WAIT3 1 */
|
||||
|
||||
/* Define if you have the waitpid function. */
|
||||
/* #undef HAVE_WAITPID 1 */
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
/* #unddef HAVE_DIRENT_H 1 */
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#ifdef __DECC
|
||||
#define HAVE_FCNTL_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define if you have the <mach/mach.h> header file. */
|
||||
/* #undef HAVE_MACH_MACH_H */
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
/* #undef HAVE_MEMORY_H 1 */
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
/* #undef HAVE_NDIR_H */
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
/* #undef HAVE_PWD_H */
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
/* #undef HAVE_SYS_DIR_H */
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
/* #undef HAVE_SYS_PARAM_H 1 */
|
||||
|
||||
/* Define if you have the <sys/timeb.h> header file. */
|
||||
#define HAVE_SYS_TIMEB_H 1
|
||||
|
||||
/* Define if you have the <sys/wait.h> header file. */
|
||||
/* #undef HAVE_SYS_WAIT_H 1 */
|
||||
|
||||
/* Define if you have the dgc library (-ldgc). */
|
||||
/* #undef HAVE_LIBDGC */
|
||||
|
||||
/* Define if you have the sun library (-lsun). */
|
||||
/* #undef HAVE_LIBSUN */
|
||||
|
||||
/* VMS specific */
|
||||
|
||||
#define HAVE_VMSDIR_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define INCLUDEDIR "sys$sysroot:[syslib]"
|
||||
#define LIBDIR "sys$sysroot:[syslib]"
|
||||
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
#undef PARAMS
|
||||
#define PARAMS(protos) protos
|
||||
#else /* Not C++ or ANSI C. */
|
||||
#undef PARAMS
|
||||
#define PARAMS(protos) ()
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
264
config.h.in
Normal file
264
config.h.in
Normal file
@@ -0,0 +1,264 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
#undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define for DGUX with <sys/dg_sys_info.h>. */
|
||||
#undef DGUX
|
||||
|
||||
/* Define if the `getloadavg' function needs to be run setuid or setgid. */
|
||||
#undef GETLOADAVG_PRIVILEGED
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef gid_t
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define if your system has its own `getloadavg' function. */
|
||||
#undef HAVE_GETLOADAVG
|
||||
|
||||
/* Define if you have the getmntent function. */
|
||||
#undef HAVE_GETMNTENT
|
||||
|
||||
/* Define if the `long double' type works. */
|
||||
#undef HAVE_LONG_DOUBLE
|
||||
|
||||
/* Define if you support file names longer than 14 characters. */
|
||||
#undef HAVE_LONG_FILE_NAMES
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if system calls automatically restart after interruption
|
||||
by a signal. */
|
||||
#undef HAVE_RESTARTABLE_SYSCALLS
|
||||
|
||||
/* Define if your struct stat has st_blksize. */
|
||||
#undef HAVE_ST_BLKSIZE
|
||||
|
||||
/* Define if your struct stat has st_blocks. */
|
||||
#undef HAVE_ST_BLOCKS
|
||||
|
||||
/* Define if you have the strcoll function and it is properly defined. */
|
||||
#undef HAVE_STRCOLL
|
||||
|
||||
/* Define if your struct stat has st_rdev. */
|
||||
#undef HAVE_ST_RDEV
|
||||
|
||||
/* Define if you have the strftime function. */
|
||||
#undef HAVE_STRFTIME
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define if your struct tm has tm_zone. */
|
||||
#undef HAVE_TM_ZONE
|
||||
|
||||
/* Define if you don't have tm_zone but do have the external array
|
||||
tzname. */
|
||||
#undef HAVE_TZNAME
|
||||
|
||||
/* Define if you have <unistd.h>. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#undef HAVE_UTIME_NULL
|
||||
|
||||
/* Define if you have <vfork.h>. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define if you have the wait3 system call. */
|
||||
#undef HAVE_WAIT3
|
||||
|
||||
/* Define if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define if your struct nlist has an n_un member. */
|
||||
#undef NLIST_NAME_UNION
|
||||
|
||||
/* Define if you have <nlist.h>. */
|
||||
#undef NLIST_STRUCT
|
||||
|
||||
/* Define if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define if the system does not provide POSIX.1 features except
|
||||
with this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define if the setvbuf function takes the buffering type as its second
|
||||
argument and the buffer pointer as the third, as on System V
|
||||
before release 3. */
|
||||
#undef SETVBUF_REVERSED
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
#undef STAT_MACROS_BROKEN
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define on System V Release 4. */
|
||||
#undef SVR4
|
||||
|
||||
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||
#undef SYS_SIGLIST_DECLARED
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
||||
|
||||
/* Define for Encore UMAX. */
|
||||
#undef UMAX
|
||||
|
||||
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
|
||||
instead of <sys/cpustats.h>. */
|
||||
#undef UMAX4_3
|
||||
|
||||
/* Define vfork as fork if vfork does not work. */
|
||||
#undef vfork
|
||||
|
||||
/* Define to the name of the SCCS `get' command. */
|
||||
#undef SCCS_GET
|
||||
|
||||
/* Define this if the SCCS `get' command understands the `-G<file>' option. */
|
||||
#undef SCCS_GET_MINUS_G
|
||||
|
||||
/* Define this if the C library defines the variable `sys_siglist'. */
|
||||
#undef HAVE_SYS_SIGLIST
|
||||
|
||||
/* Define this if the C library defines the variable `_sys_siglist'. */
|
||||
#undef HAVE__SYS_SIGLIST
|
||||
|
||||
/* Define this if you have the `union wait' type in <sys/wait.h>. */
|
||||
#undef HAVE_UNION_WAIT
|
||||
|
||||
/* Define if you have the dup2 function. */
|
||||
#undef HAVE_DUP2
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getgroups function. */
|
||||
#undef HAVE_GETGROUPS
|
||||
|
||||
/* Define if you have the mktemp function. */
|
||||
#undef HAVE_MKTEMP
|
||||
|
||||
/* Define if you have the psignal function. */
|
||||
#undef HAVE_PSIGNAL
|
||||
|
||||
/* Define if you have the setegid function. */
|
||||
#undef HAVE_SETEGID
|
||||
|
||||
/* Define if you have the seteuid function. */
|
||||
#undef HAVE_SETEUID
|
||||
|
||||
/* Define if you have the setlinebuf function. */
|
||||
#undef HAVE_SETLINEBUF
|
||||
|
||||
/* Define if you have the setregid function. */
|
||||
#undef HAVE_SETREGID
|
||||
|
||||
/* Define if you have the setreuid function. */
|
||||
#undef HAVE_SETREUID
|
||||
|
||||
/* Define if you have the sigsetmask function. */
|
||||
#undef HAVE_SIGSETMASK
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define if you have the strsignal function. */
|
||||
#undef HAVE_STRSIGNAL
|
||||
|
||||
/* Define if you have the wait3 function. */
|
||||
#undef HAVE_WAIT3
|
||||
|
||||
/* Define if you have the waitpid function. */
|
||||
#undef HAVE_WAITPID
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <mach/mach.h> header file. */
|
||||
#undef HAVE_MACH_MACH_H
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <sys/timeb.h> header file. */
|
||||
#undef HAVE_SYS_TIMEB_H
|
||||
|
||||
/* Define if you have the <sys/wait.h> header file. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the dgc library (-ldgc). */
|
||||
#undef HAVE_LIBDGC
|
||||
|
||||
/* Define if you have the sun library (-lsun). */
|
||||
#undef HAVE_LIBSUN
|
||||
68
configh.dos.template
Normal file
68
configh.dos.template
Normal file
@@ -0,0 +1,68 @@
|
||||
/* Generated automatically from configure.in by autoheader. DO NOT EDIT! */
|
||||
|
||||
#define INCLUDEDIR "c:/djgpp/include"
|
||||
#define LIBDIR "c:/djgpp/lib"
|
||||
|
||||
/* Define if you have dirent.h. */
|
||||
#define DIRENT
|
||||
|
||||
/* Define if you have the strcoll function and it is properly defined. */
|
||||
#define HAVE_STRCOLL
|
||||
|
||||
/* Define if you have unistd.h. */
|
||||
#define HAVE_UNISTD_H
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#ifndef STDC_HEADERS
|
||||
#define STDC_HEADERS
|
||||
#endif
|
||||
|
||||
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||
#define SYS_SIGLIST_DECLARED
|
||||
|
||||
/* Define if you have getdtablesize. */
|
||||
#define HAVE_GETDTABLESIZE
|
||||
|
||||
/* Define if you have dup2. */
|
||||
#define HAVE_DUP2
|
||||
|
||||
/* Define if you have sys_siglist. */
|
||||
#undef HAVE_SYS_SIGLIST
|
||||
|
||||
/* Define if you have _sys_siglist. */
|
||||
#undef HAVE__SYS_SIGLIST
|
||||
|
||||
/* Define if you have psignal. */
|
||||
#define HAVE_PSIGNAL
|
||||
|
||||
/* Define if you have getcwd. */
|
||||
#define HAVE_GETCWD
|
||||
|
||||
/* Define if you have sigsetmask. */
|
||||
#define HAVE_SIGSETMASK
|
||||
|
||||
/* Define if you have setlinebuf. */
|
||||
#define HAVE_SETLINEBUF
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H
|
||||
|
||||
/* Define if you have the `strerror' function. */
|
||||
#define HAVE_STRERROR
|
||||
|
||||
#define SCCS_GET "get"
|
||||
44
configure.bat
Normal file
44
configure.bat
Normal file
@@ -0,0 +1,44 @@
|
||||
@echo off
|
||||
echo Configuring MAKE for go32
|
||||
rem This batch file assumes a unix-type "sed" program
|
||||
|
||||
update configh.dos config.h
|
||||
|
||||
echo # Makefile generated by "configure.bat"> Makefile
|
||||
|
||||
if exist config.sed del config.sed
|
||||
|
||||
echo ": try_sl ">> config.sed
|
||||
echo "/\\$/ { ">> config.sed
|
||||
echo " N ">> config.sed
|
||||
echo " s/[ ]*\\\n[ ]*/ / ">> config.sed
|
||||
echo " b try_sl ">> config.sed
|
||||
echo "} ">> config.sed
|
||||
|
||||
echo "s/@srcdir@/./ ">> config.sed
|
||||
echo "s/@CC@/gcc/ ">> config.sed
|
||||
echo "s/@CFLAGS@/-O2 -g/ ">> config.sed
|
||||
echo "s/@CPPFLAGS@/-DHAVE_CONFIG_H/ ">> config.sed
|
||||
echo "s/@LDFLAGS@// ">> config.sed
|
||||
echo "s/@RANLIB@/ranlib/ ">> config.sed
|
||||
echo "s/@DEFS@// ">> config.sed
|
||||
echo "s/@REMOTE@/stub/ ">> config.sed
|
||||
echo "s/@ALLOCA@// ">> config.sed
|
||||
echo "s/@LIBS@// ">> config.sed
|
||||
echo "s/@LIBOBJS@// ">> config.sed
|
||||
echo "s/@SET_MAKE@// ">> config.sed
|
||||
echo "s/^Makefile *:/_Makefile:/ ">> config.sed
|
||||
echo "s/^config.h *:/_config.h:/ ">> config.sed
|
||||
echo "s/^defines *=.*$/defines =/ ">> config.sed
|
||||
echo "/mv -f make.new make/d ">> config.sed
|
||||
|
||||
echo "s/cd glob; $(MAKE)/$(MAKE) -C glob/ ">> config.sed
|
||||
|
||||
sed -e "s/^\"//" -e "s/\"$//" -e "s/[ ]*$//" config.sed > config2.sed
|
||||
sed -f config2.sed Makefile.in >> Makefile
|
||||
del config.sed
|
||||
del config2.sed
|
||||
|
||||
cd glob
|
||||
call configure
|
||||
cd ..
|
||||
120
configure.in
Normal file
120
configure.in
Normal file
@@ -0,0 +1,120 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION([$Id$])
|
||||
AC_PREREQ(2.1)dnl dnl Minimum Autoconf version required.
|
||||
AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir.
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_SUBDIRS(glob) dnl Run configure in glob subdirectory.
|
||||
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_CPP dnl Later checks need this.
|
||||
AC_AIX
|
||||
AC_ISC_POSIX
|
||||
AC_MINIX
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_DIRENT
|
||||
AC_TYPE_UID_T dnl Also does gid_t.
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_HEADERS(unistd.h limits.h sys/param.h fcntl.h string.h memory.h \
|
||||
sys/timeb.h)
|
||||
AC_PROG_CC_C_O
|
||||
AC_C_CONST dnl getopt needs this.
|
||||
AC_HEADER_STAT
|
||||
|
||||
AC_SUBST(LIBOBJS)
|
||||
|
||||
AC_DEFUN(AC_CHECK_SYMBOL, [dnl
|
||||
AC_MSG_CHECKING(for $1)
|
||||
AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
|
||||
AC_TRY_LINK(, [extern char *sys_siglist[]; puts(*sys_siglist);],
|
||||
ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
|
||||
if test "$ac_cv_check_symbol_$1" = yes; then
|
||||
changequote(,)dnl
|
||||
ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
|
||||
changequote([,])dnl
|
||||
AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
|
||||
|
||||
AC_CHECK_FUNCS(psignal mktemp \
|
||||
dup2 getcwd sigsetmask getgroups setlinebuf \
|
||||
seteuid setegid setreuid setregid strerror strsignal)
|
||||
AC_CHECK_SYMBOL(sys_siglist)
|
||||
AC_CHECK_SYMBOL(_sys_siglist)
|
||||
AC_FUNC_ALLOCA
|
||||
AC_FUNC_VFORK
|
||||
AC_FUNC_SETVBUF_REVERSED
|
||||
AC_FUNC_GETLOADAVG
|
||||
AC_FUNC_STRCOLL
|
||||
|
||||
# Check out the wait reality.
|
||||
AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_FUNCS(waitpid wait3)
|
||||
AC_MSG_CHECKING(for union wait)
|
||||
AC_CACHE_VAL(make_cv_union_wait, [dnl
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <sys/wait.h>],
|
||||
[union wait status; int pid; pid = wait (&status);
|
||||
#ifdef WEXITSTATUS
|
||||
/* Some POSIXoid systems have both the new-style macros and the old
|
||||
union wait type, and they do not work together. If union wait
|
||||
conflicts with WEXITSTATUS et al, we don't want to use it at all. */
|
||||
if (WEXITSTATUS (status) != 0) pid = -1;
|
||||
#ifdef WTERMSIG
|
||||
/* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
|
||||
-- blow chunks here --
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_WAITPID
|
||||
/* Make sure union wait works with waitpid. */
|
||||
pid = waitpid (-1, &status, 0);
|
||||
#endif
|
||||
],
|
||||
[make_cv_union_wait=yes], [make_cv_union_wait=no])])
|
||||
if test "$make_cv_union_wait" = yes; then
|
||||
AC_DEFINE(HAVE_UNION_WAIT)
|
||||
fi
|
||||
AC_MSG_RESULT($make_cv_union_wait)
|
||||
|
||||
AC_DECL_SYS_SIGLIST
|
||||
|
||||
# The presence of the following is not meant to imply
|
||||
# that make necessarily works on those systems.
|
||||
AC_CHECK_LIB(sun, getpwnam)
|
||||
|
||||
AC_SUBST(REMOTE) REMOTE=stub
|
||||
AC_ARG_WITH(customs, [export jobs with the Customs daemon (NOT SUPPORTED)],
|
||||
[REMOTE=cstms LIBS="$LIBS libcustoms.a"])
|
||||
|
||||
echo checking for location of SCCS get command
|
||||
if test -f /usr/sccs/get; then
|
||||
SCCS_GET=/usr/sccs/get
|
||||
AC_DEFINE(SCCS_GET, "/usr/sccs/get")
|
||||
else
|
||||
SCCS_GET=get
|
||||
AC_DEFINE(SCCS_GET, "get")
|
||||
fi
|
||||
ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
|
||||
if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
|
||||
test -f s.conftest; then
|
||||
# We successfully created an SCCS file.
|
||||
echo checking if SCCS get command understands -G
|
||||
if $SCCS_GET -Gconftoast s.conftest >/dev/null 2>&1 &&
|
||||
test -f conftoast; then
|
||||
AC_DEFINE(SCCS_GET_MINUS_G)
|
||||
fi
|
||||
fi
|
||||
rm -f s.conftest conftoast
|
||||
|
||||
AC_OUTPUT(Makefile build.sh, [
|
||||
# Makefile uses this timestamp file to know when to remake Makefile,
|
||||
# build.sh, and glob/Makefile.
|
||||
touch stamp-config])
|
||||
|
||||
dnl Local Variables:
|
||||
dnl comment-start: "dnl "
|
||||
dnl comment-end: ""
|
||||
dnl comment-start-skip: "\\bdnl\\b\\s *"
|
||||
dnl compile-command: "make configure config.h.in"
|
||||
dnl End:
|
||||
495
default.c
Normal file
495
default.c
Normal file
@@ -0,0 +1,495 @@
|
||||
/* Data base of default implicit rules for GNU Make.
|
||||
Copyright (C) 1988,89,90,91,92,93,94,95,96 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "rule.h"
|
||||
#include "dep.h"
|
||||
#include "filedef.h"
|
||||
#include "job.h"
|
||||
#include "commands.h"
|
||||
#include "variable.h"
|
||||
|
||||
/* Define GCC_IS_NATIVE if gcc is the native development environment on
|
||||
your system (gcc/bison/flex vs cc/yacc/lex). */
|
||||
#ifdef __MSDOS__
|
||||
#define GCC_IS_NATIVE
|
||||
#endif
|
||||
|
||||
|
||||
/* This is the default list of suffixes for suffix rules.
|
||||
`.s' must come last, so that a `.o' file will be made from
|
||||
a `.c' or `.p' or ... file rather than from a .s file. */
|
||||
|
||||
static char default_suffixes[]
|
||||
#ifdef VMS
|
||||
= ".exe .olb .ln .obj .c .cc .pas .p .for .f .r .y .l .mar \
|
||||
.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
|
||||
.w .ch .cweb .web .com .sh .elc .el";
|
||||
#else
|
||||
= ".out .a .ln .o .c .cc .C .p .f .F .r .y .l .s .S \
|
||||
.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
|
||||
.w .ch .web .sh .elc .el";
|
||||
#endif
|
||||
|
||||
static struct pspec default_pattern_rules[] =
|
||||
{
|
||||
{ "(%)", "%",
|
||||
"$(AR) $(ARFLAGS) $@ $<" },
|
||||
|
||||
/* The X.out rules are only in BSD's default set because
|
||||
BSD Make has no null-suffix rules, so `foo.out' and
|
||||
`foo' are the same thing. */
|
||||
#ifdef VMS
|
||||
{ "%.exe", "%",
|
||||
"copy $< $@" },
|
||||
#else
|
||||
{ "%.out", "%",
|
||||
"@rm -f $@ \n cp $< $@" },
|
||||
#endif
|
||||
/* Syntax is "ctangle foo.w foo.ch foo.c". */
|
||||
{ "%.c", "%.w %.ch",
|
||||
"$(CTANGLE) $^ $@" },
|
||||
{ "%.tex", "%.w %.ch",
|
||||
"$(CWEAVE) $^ $@" },
|
||||
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
static struct pspec default_terminal_rules[] =
|
||||
{
|
||||
#ifdef VMS
|
||||
/* RCS. */
|
||||
{ "%", "%$$5lv", /* Multinet style */
|
||||
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
|
||||
{ "%", "[.$$rcs]%$$5lv", /* Multinet style */
|
||||
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
|
||||
{ "%", "%_v", /* Normal style */
|
||||
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
|
||||
{ "%", "[.rcs]%_v", /* Normal style */
|
||||
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
|
||||
|
||||
/* SCCS. */
|
||||
/* ain't no SCCS on vms */
|
||||
#else
|
||||
/* RCS. */
|
||||
{ "%", "%,v",
|
||||
"$(CHECKOUT,v)" },
|
||||
{ "%", "RCS/%,v",
|
||||
"$(CHECKOUT,v)" },
|
||||
|
||||
/* SCCS. */
|
||||
{ "%", "s.%",
|
||||
"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
|
||||
{ "%", "SCCS/s.%",
|
||||
"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
|
||||
#endif /* !VMS */
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
static char *default_suffix_rules[] =
|
||||
{
|
||||
#ifdef VMS
|
||||
".obj.exe",
|
||||
"$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) /exe=$@",
|
||||
".mar.exe",
|
||||
"$(LINK.mar) $^ $(LOADLIBES) $(LDLIBS) /exe=$@",
|
||||
".c.exe",
|
||||
"$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
|
||||
".cc.exe",
|
||||
"$(COMPILE.cc) $^ \n $(LINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
|
||||
".for.exe",
|
||||
"$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
|
||||
".pas.exe",
|
||||
"$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
|
||||
|
||||
".com",
|
||||
"copy $< >$@",
|
||||
|
||||
".mar.obj",
|
||||
"$(COMPILE.mar) /obj=$@ $<",
|
||||
".c.obj",
|
||||
"$(COMPILE.c) /obj=$@ $<",
|
||||
".cc.obj",
|
||||
"$(COMPILE.cc) /obj=$@ $<",
|
||||
".for.obj",
|
||||
"$(COMPILE.for) /obj=$@ $<",
|
||||
".pas.obj",
|
||||
"$(COMPILE.pas) /obj=$@ $<",
|
||||
|
||||
".y.c",
|
||||
"$(YACC.y) $< \n rename y_tab.c $@",
|
||||
".l.c",
|
||||
"$(LEX.l) $< \n rename lexyy.c $@",
|
||||
|
||||
".texinfo.info",
|
||||
"$(MAKEINFO) $<",
|
||||
|
||||
".tex.dvi",
|
||||
"$(TEX) $<",
|
||||
|
||||
#else /* ! VMS */
|
||||
|
||||
".o",
|
||||
"$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".s",
|
||||
"$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".S",
|
||||
"$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".c",
|
||||
"$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".cc",
|
||||
"$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".C",
|
||||
"$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".f",
|
||||
"$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".p",
|
||||
"$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".F",
|
||||
"$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".r",
|
||||
"$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
||||
".mod",
|
||||
"$(COMPILE.mod) -o $@ -e $@ $^",
|
||||
|
||||
".def.sym",
|
||||
"$(COMPILE.def) -o $@ $<",
|
||||
|
||||
".sh",
|
||||
"cat $< >$@ \n chmod a+x $@",
|
||||
|
||||
".s.o",
|
||||
"$(COMPILE.s) -o $@ $<",
|
||||
".S.o",
|
||||
"$(COMPILE.S) -o $@ $<",
|
||||
".c.o",
|
||||
"$(COMPILE.c) $< $(OUTPUT_OPTION)",
|
||||
".cc.o",
|
||||
"$(COMPILE.cc) $< $(OUTPUT_OPTION)",
|
||||
".C.o",
|
||||
"$(COMPILE.C) $< $(OUTPUT_OPTION)",
|
||||
".f.o",
|
||||
"$(COMPILE.f) $< $(OUTPUT_OPTION)",
|
||||
".p.o",
|
||||
"$(COMPILE.p) $< $(OUTPUT_OPTION)",
|
||||
".F.o",
|
||||
"$(COMPILE.F) $< $(OUTPUT_OPTION)",
|
||||
".r.o",
|
||||
"$(COMPILE.r) $< $(OUTPUT_OPTION)",
|
||||
".mod.o",
|
||||
"$(COMPILE.mod) -o $@ $<",
|
||||
|
||||
".c.ln",
|
||||
"$(LINT.c) -C$* $<",
|
||||
".y.ln",
|
||||
#ifndef __MSDOS__
|
||||
"$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
|
||||
#else
|
||||
"$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
|
||||
#endif
|
||||
".l.ln",
|
||||
"@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
|
||||
|
||||
".y.c",
|
||||
#ifndef __MSDOS__
|
||||
"$(YACC.y) $< \n mv -f y.tab.c $@",
|
||||
#else
|
||||
"$(YACC.y) $< \n mv -f y_tab.c $@",
|
||||
#endif
|
||||
".l.c",
|
||||
"@$(RM) $@ \n $(LEX.l) $< > $@",
|
||||
|
||||
".F.f",
|
||||
"$(PREPROCESS.F) $< $(OUTPUT_OPTION)",
|
||||
".r.f",
|
||||
"$(PREPROCESS.r) $< $(OUTPUT_OPTION)",
|
||||
|
||||
/* This might actually make lex.yy.c if there's no %R%
|
||||
directive in $*.l, but in that case why were you
|
||||
trying to make $*.r anyway? */
|
||||
".l.r",
|
||||
"$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
|
||||
|
||||
".S.s",
|
||||
"$(PREPROCESS.S) $< > $@",
|
||||
|
||||
".texinfo.info",
|
||||
"$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
|
||||
|
||||
".texi.info",
|
||||
"$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
|
||||
|
||||
".txinfo.info",
|
||||
"$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
|
||||
|
||||
".tex.dvi",
|
||||
"$(TEX) $<",
|
||||
|
||||
".texinfo.dvi",
|
||||
"$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
|
||||
|
||||
".texi.dvi",
|
||||
"$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
|
||||
|
||||
".txinfo.dvi",
|
||||
"$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
|
||||
|
||||
".w.c",
|
||||
"$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */
|
||||
|
||||
".web.p",
|
||||
"$(TANGLE) $<",
|
||||
|
||||
".w.tex",
|
||||
"$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */
|
||||
|
||||
".web.tex",
|
||||
"$(WEAVE) $<",
|
||||
|
||||
#endif /* !VMS */
|
||||
|
||||
0, 0,
|
||||
};
|
||||
|
||||
static char *default_variables[] =
|
||||
{
|
||||
#ifdef VMS
|
||||
"AR", "library/obj",
|
||||
"ARFLAGS", "/replace",
|
||||
"AS", "macro",
|
||||
"CC", "cc",
|
||||
"C++", "gcc/plus",
|
||||
"CXX", "gcc/plus",
|
||||
"CO", "co",
|
||||
"CPP", "$(CC) /preprocess_only",
|
||||
"FC", "fortran",
|
||||
/* System V uses these, so explicit rules using them should work.
|
||||
However, there is no way to make implicit rules use them and FC. */
|
||||
"F77", "$(FC)",
|
||||
"F77FLAGS", "$(FFLAGS)",
|
||||
"LD", "link",
|
||||
"LEX", "lex",
|
||||
"PC", "pascal",
|
||||
"YACC", "yacc", /* Or "bison -y" */
|
||||
"MAKEINFO", "makeinfo",
|
||||
"TEX", "tex",
|
||||
"TEXINDEX", "texindex",
|
||||
|
||||
"RM", "delete/nolog",
|
||||
|
||||
"LINK.obj", "$(LD) $(LDFLAGS)",
|
||||
"COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.cc", "$(C++) $(C++FLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
||||
"YACC.y", "$(YACC) $(YFLAGS)",
|
||||
"LEX.l", "$(LEX) $(LFLAGS)",
|
||||
"COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.mar", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
|
||||
"LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
||||
|
||||
"MV", "rename/new_version",
|
||||
"CP", "copy",
|
||||
|
||||
#else /* !VMS */
|
||||
|
||||
"AR", "ar",
|
||||
"ARFLAGS", "rv",
|
||||
"AS", "as",
|
||||
#ifdef GCC_IS_NATIVE
|
||||
"CC", "gcc",
|
||||
"CXX", "gcc",
|
||||
#else
|
||||
"CC", "cc",
|
||||
"CXX", "g++",
|
||||
#endif
|
||||
|
||||
/* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
|
||||
and to the empty string if $@ does exist. */
|
||||
"CHECKOUT,v",
|
||||
"+$(patsubst $@-noexist,$(CO) $(COFLAGS) $< $@,\
|
||||
$(filter-out $@,$(firstword $(wildcard $@) $@-noexist)))",
|
||||
|
||||
"CO", "co",
|
||||
"CPP", "$(CC) -E",
|
||||
#ifdef CRAY
|
||||
"CF77PPFLAGS", "-P",
|
||||
"CF77PP", "/lib/cpp",
|
||||
"CFT", "cft77",
|
||||
"CF", "cf77",
|
||||
"FC", "$(CF)",
|
||||
#else /* Not CRAY. */
|
||||
#ifdef _IBMR2
|
||||
"FC", "xlf",
|
||||
#else
|
||||
#ifdef __convex__
|
||||
"FC", "fc",
|
||||
#else
|
||||
"FC", "f77",
|
||||
#endif /* __convex__ */
|
||||
#endif /* _IBMR2 */
|
||||
/* System V uses these, so explicit rules using them should work.
|
||||
However, there is no way to make implicit rules use them and FC. */
|
||||
"F77", "$(FC)",
|
||||
"F77FLAGS", "$(FFLAGS)",
|
||||
#endif /* Cray. */
|
||||
"GET", SCCS_GET,
|
||||
"LD", "ld",
|
||||
#ifdef GCC_IS_NATIVE
|
||||
"LEX", "flex",
|
||||
#else
|
||||
"LEX", "lex",
|
||||
#endif
|
||||
"LINT", "lint",
|
||||
"M2C", "m2c",
|
||||
#ifdef pyr
|
||||
"PC", "pascal",
|
||||
#else
|
||||
#ifdef CRAY
|
||||
"PC", "PASCAL",
|
||||
"SEGLDR", "segldr",
|
||||
#else
|
||||
"PC", "pc",
|
||||
#endif /* CRAY. */
|
||||
#endif /* pyr. */
|
||||
#ifdef GCC_IS_NATIVE
|
||||
"YACC", "bison -y",
|
||||
#else
|
||||
"YACC", "yacc", /* Or "bison -y" */
|
||||
#endif
|
||||
"MAKEINFO", "makeinfo",
|
||||
"TEX", "tex",
|
||||
"TEXI2DVI", "texi2dvi",
|
||||
"WEAVE", "weave",
|
||||
"CWEAVE", "cweave",
|
||||
"TANGLE", "tangle",
|
||||
"CTANGLE", "ctangle",
|
||||
|
||||
"RM", "rm -f",
|
||||
|
||||
"LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
||||
"LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
||||
"COMPILE.C", "$(COMPILE.cc)",
|
||||
"LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
||||
"LINK.C", "$(LINK.cc)",
|
||||
"YACC.y", "$(YACC) $(YFLAGS)",
|
||||
"LEX.l", "$(LEX) $(LFLAGS) -t",
|
||||
"COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
|
||||
"LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
||||
"LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
|
||||
"LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
|
||||
"COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
||||
"LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
||||
"LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
|
||||
"COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
|
||||
"LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
|
||||
"COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
|
||||
"PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
|
||||
"PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
|
||||
"PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
|
||||
"LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
||||
|
||||
#ifndef NO_MINUS_C_MINUS_O
|
||||
"OUTPUT_OPTION", "-o $@",
|
||||
#endif
|
||||
|
||||
#ifdef SCCS_GET_MINUS_G
|
||||
"SCCS_OUTPUT_OPTION", "-G$@",
|
||||
#endif
|
||||
|
||||
#endif /* !VMS */
|
||||
0, 0
|
||||
};
|
||||
|
||||
/* Set up the default .SUFFIXES list. */
|
||||
|
||||
void
|
||||
set_default_suffixes ()
|
||||
{
|
||||
suffix_file = enter_file (".SUFFIXES");
|
||||
|
||||
if (no_builtin_rules_flag)
|
||||
(void) define_variable ("SUFFIXES", 8, "", o_default, 0);
|
||||
else
|
||||
{
|
||||
char *p = default_suffixes;
|
||||
suffix_file->deps = (struct dep *)
|
||||
multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1),
|
||||
sizeof (struct dep));
|
||||
(void) define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Enter the default suffix rules as file rules. This used to be done in
|
||||
install_default_implicit_rules, but that loses because we want the
|
||||
suffix rules installed before reading makefiles, and thee pattern rules
|
||||
installed after. */
|
||||
|
||||
void
|
||||
install_default_suffix_rules ()
|
||||
{
|
||||
register char **s;
|
||||
|
||||
if (no_builtin_rules_flag)
|
||||
return;
|
||||
|
||||
for (s = default_suffix_rules; *s != 0; s += 2)
|
||||
{
|
||||
register struct file *f = enter_file (s[0]);
|
||||
/* Don't clobber cmds given in a makefile if there were any. */
|
||||
if (f->cmds == 0)
|
||||
{
|
||||
f->cmds = (struct commands *) xmalloc (sizeof (struct commands));
|
||||
f->cmds->filename = 0;
|
||||
f->cmds->commands = s[1];
|
||||
f->cmds->command_lines = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Install the default pattern rules. */
|
||||
|
||||
void
|
||||
install_default_implicit_rules ()
|
||||
{
|
||||
register struct pspec *p;
|
||||
|
||||
if (no_builtin_rules_flag)
|
||||
return;
|
||||
|
||||
for (p = default_pattern_rules; p->target != 0; ++p)
|
||||
install_pattern_rule (p, 0);
|
||||
|
||||
for (p = default_terminal_rules; p->target != 0; ++p)
|
||||
install_pattern_rule (p, 1);
|
||||
}
|
||||
|
||||
void
|
||||
define_default_variables ()
|
||||
{
|
||||
register char **s;
|
||||
|
||||
for (s = default_variables; *s != 0; s += 2)
|
||||
(void) define_variable (s[0], strlen (s[0]), s[1], o_default, 1);
|
||||
}
|
||||
71
dep.h
Normal file
71
dep.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* Definitions of dependency data structures for GNU Make.
|
||||
Copyright (C) 1988, 1989, 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Structure representing one dependency of a file.
|
||||
Each struct file's `deps' points to a chain of these,
|
||||
chained through the `next'.
|
||||
|
||||
Note that the first two words of this match a struct nameseq. */
|
||||
|
||||
struct dep
|
||||
{
|
||||
struct dep *next;
|
||||
char *name;
|
||||
struct file *file;
|
||||
int changed;
|
||||
};
|
||||
|
||||
|
||||
/* Structure used in chains of names, for parsing and globbing. */
|
||||
|
||||
struct nameseq
|
||||
{
|
||||
struct nameseq *next;
|
||||
char *name;
|
||||
};
|
||||
|
||||
|
||||
extern struct nameseq *multi_glob PARAMS ((struct nameseq *chain, unsigned int size));
|
||||
#ifdef VMS
|
||||
extern struct nameseq *parse_file_seq ();
|
||||
#else
|
||||
extern struct nameseq *parse_file_seq PARAMS ((char **stringp, int stopchar, unsigned int size, int strip));
|
||||
#endif
|
||||
extern char *tilde_expand PARAMS ((char *name));
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
extern struct nameseq *ar_glob PARAMS ((char *arname, char *member_pattern, unsigned int size));
|
||||
#endif
|
||||
|
||||
#ifndef iAPX286
|
||||
#define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
|
||||
#else
|
||||
/* Buggy compiler can't hack this. */
|
||||
extern char *dep_name ();
|
||||
#endif
|
||||
|
||||
extern struct dep *read_all_makefiles PARAMS ((char **makefiles));
|
||||
|
||||
/* Flag bits for the second argument to `read_makefile'.
|
||||
These flags are saved in the `changed' field of each
|
||||
`struct dep' in the chain returned by `read_all_makefiles'. */
|
||||
#define RM_NO_DEFAULT_GOAL (1 << 0) /* Do not set default goal. */
|
||||
#define RM_INCLUDED (1 << 1) /* Search makefile search path. */
|
||||
#define RM_DONTCARE (1 << 2) /* No error if it doesn't exist. */
|
||||
#define RM_NO_TILDE (1 << 3) /* Don't expand ~ in file name. */
|
||||
#define RM_NOFLAG 0
|
||||
851
dir.c
Normal file
851
dir.c
Normal file
@@ -0,0 +1,851 @@
|
||||
/* Directory hashing for GNU Make.
|
||||
Copyright (C) 1988, 89, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
# define dirent direct
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# ifdef HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# ifdef HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
# ifdef HAVE_VMSDIR_H
|
||||
# include "vmsdir.h"
|
||||
# endif /* HAVE_VMSDIR_H */
|
||||
#endif
|
||||
|
||||
/* In GNU systems, <dirent.h> defines this macro for us. */
|
||||
#ifdef _D_NAMLEN
|
||||
#undef NAMLEN
|
||||
#define NAMLEN(d) _D_NAMLEN(d)
|
||||
#endif
|
||||
|
||||
#if defined (POSIX) && !defined (__GNU_LIBRARY__)
|
||||
/* Posix does not require that the d_ino field be present, and some
|
||||
systems do not provide it. */
|
||||
#define REAL_DIR_ENTRY(dp) 1
|
||||
#define FAKE_DIR_ENTRY(dp)
|
||||
#else
|
||||
#define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
|
||||
#define FAKE_DIR_ENTRY(dp) (dp->d_ino = 1)
|
||||
#endif /* POSIX */
|
||||
|
||||
#ifdef __MSDOS__
|
||||
#include <ctype.h>
|
||||
|
||||
static char *
|
||||
dosify (filename)
|
||||
char *filename;
|
||||
{
|
||||
static char dos_filename[14];
|
||||
char *df;
|
||||
int i;
|
||||
|
||||
if (filename == 0)
|
||||
return 0;
|
||||
|
||||
if (strpbrk (filename, "\"*+,;<=>?[\\]|") != 0)
|
||||
return filename;
|
||||
|
||||
df = dos_filename;
|
||||
|
||||
/* First, transform the name part. */
|
||||
for (i = 0; *filename != '\0' && i < 8 && *filename != '.'; ++i)
|
||||
*df++ = tolower (*filename++);
|
||||
|
||||
/* Now skip to the next dot. */
|
||||
while (*filename != '\0' && *filename != '.')
|
||||
++filename;
|
||||
if (*filename != '\0')
|
||||
{
|
||||
*df++ = *filename++;
|
||||
for (i = 0; *filename != '\0' && i < 3 && *filename != '.'; ++i)
|
||||
*df++ = tolower (*filename++);
|
||||
}
|
||||
|
||||
/* Look for more dots. */
|
||||
while (*filename != '\0' && *filename != '.')
|
||||
++filename;
|
||||
if (*filename == '.')
|
||||
return filename;
|
||||
*df = 0;
|
||||
return dos_filename;
|
||||
}
|
||||
#endif /* __MSDOS__ */
|
||||
|
||||
#ifdef _AMIGA
|
||||
#include <ctype.h>
|
||||
|
||||
static char *
|
||||
amigafy (filename)
|
||||
char *filename;
|
||||
{
|
||||
static char amiga_filename[136];
|
||||
char *df;
|
||||
int i;
|
||||
|
||||
if (filename == 0)
|
||||
return 0;
|
||||
|
||||
df = amiga_filename;
|
||||
|
||||
/* First, transform the name part. */
|
||||
for (i = 0; *filename != '\0'; ++i)
|
||||
{
|
||||
*df++ = tolower (*filename);
|
||||
++filename;
|
||||
}
|
||||
|
||||
*df = 0;
|
||||
|
||||
return amiga_filename;
|
||||
}
|
||||
#endif /* _AMIGA */
|
||||
|
||||
#ifdef VMS
|
||||
|
||||
static int
|
||||
vms_hash (name)
|
||||
char *name;
|
||||
{
|
||||
int h = 0;
|
||||
int g;
|
||||
|
||||
while (*name)
|
||||
{
|
||||
h = (h << 4) + *name++;
|
||||
g = h & 0xf0000000;
|
||||
if (g)
|
||||
{
|
||||
h = h ^ (g >> 24);
|
||||
h = h ^ g;
|
||||
}
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
/* fake stat entry for a directory */
|
||||
static int
|
||||
vmsstat_dir (name, st)
|
||||
char *name;
|
||||
struct stat *st;
|
||||
{
|
||||
char *s;
|
||||
int h;
|
||||
DIR *dir;
|
||||
|
||||
dir = opendir (name);
|
||||
if (dir == 0)
|
||||
return -1;
|
||||
closedir (dir);
|
||||
s = strchr (name, ':'); /* find device */
|
||||
if (s)
|
||||
{
|
||||
*s++ = 0;
|
||||
st->st_dev = (char *)vms_hash (name);
|
||||
}
|
||||
else
|
||||
{
|
||||
st->st_dev = 0;
|
||||
s = name;
|
||||
}
|
||||
h = vms_hash (s);
|
||||
st->st_ino[0] = h & 0xff;
|
||||
st->st_ino[1] = h & 0xff00;
|
||||
st->st_ino[2] = h >> 16;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* VMS */
|
||||
|
||||
/* Hash table of directories. */
|
||||
|
||||
#ifndef DIRECTORY_BUCKETS
|
||||
#define DIRECTORY_BUCKETS 199
|
||||
#endif
|
||||
|
||||
struct directory_contents
|
||||
{
|
||||
struct directory_contents *next;
|
||||
|
||||
dev_t dev; /* Device and inode numbers of this dir. */
|
||||
#ifdef VMS
|
||||
ino_t ino[3];
|
||||
#else
|
||||
ino_t ino;
|
||||
#endif
|
||||
struct dirfile **files; /* Files in this directory. */
|
||||
DIR *dirstream; /* Stream reading this directory. */
|
||||
};
|
||||
|
||||
/* Table of directory contents hashed by device and inode number. */
|
||||
static struct directory_contents *directories_contents[DIRECTORY_BUCKETS];
|
||||
|
||||
struct directory
|
||||
{
|
||||
struct directory *next;
|
||||
|
||||
char *name; /* Name of the directory. */
|
||||
|
||||
/* The directory's contents. This data may be shared by several
|
||||
entries in the hash table, which refer to the same directory
|
||||
(identified uniquely by `dev' and `ino') under different names. */
|
||||
struct directory_contents *contents;
|
||||
};
|
||||
|
||||
/* Table of directories hashed by name. */
|
||||
static struct directory *directories[DIRECTORY_BUCKETS];
|
||||
|
||||
|
||||
/* Never have more than this many directories open at once. */
|
||||
|
||||
#define MAX_OPEN_DIRECTORIES 10
|
||||
|
||||
static unsigned int open_directories = 0;
|
||||
|
||||
|
||||
/* Hash table of files in each directory. */
|
||||
|
||||
struct dirfile
|
||||
{
|
||||
struct dirfile *next;
|
||||
char *name; /* Name of the file. */
|
||||
char impossible; /* This file is impossible. */
|
||||
};
|
||||
|
||||
#ifndef DIRFILE_BUCKETS
|
||||
#define DIRFILE_BUCKETS 107
|
||||
#endif
|
||||
|
||||
static int dir_contents_file_exists_p PARAMS ((struct directory_contents *dir, char *filename));
|
||||
static struct directory *find_directory PARAMS ((char *name));
|
||||
|
||||
/* Find the directory named NAME and return its `struct directory'. */
|
||||
|
||||
static struct directory *
|
||||
find_directory (name)
|
||||
register char *name;
|
||||
{
|
||||
register unsigned int hash = 0;
|
||||
register char *p;
|
||||
register struct directory *dir;
|
||||
#ifdef VMS
|
||||
if ((*name == '.') && (*(name+1) == 0))
|
||||
name = "[]";
|
||||
else
|
||||
name = vmsify (name,1);
|
||||
#endif
|
||||
|
||||
for (p = name; *p != '\0'; ++p)
|
||||
HASHI (hash, *p);
|
||||
hash %= DIRECTORY_BUCKETS;
|
||||
|
||||
for (dir = directories[hash]; dir != 0; dir = dir->next)
|
||||
if (strieq (dir->name, name))
|
||||
break;
|
||||
|
||||
if (dir == 0)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
/* The directory was not found. Create a new entry for it. */
|
||||
|
||||
dir = (struct directory *) xmalloc (sizeof (struct directory));
|
||||
dir->next = directories[hash];
|
||||
directories[hash] = dir;
|
||||
dir->name = savestring (name, p - name);
|
||||
|
||||
/* The directory is not in the name hash table.
|
||||
Find its device and inode numbers, and look it up by them. */
|
||||
|
||||
#ifdef VMS
|
||||
if (vmsstat_dir (name, &st) < 0)
|
||||
#else
|
||||
if (stat (name, &st) < 0)
|
||||
#endif
|
||||
{
|
||||
/* Couldn't stat the directory. Mark this by
|
||||
setting the `contents' member to a nil pointer. */
|
||||
dir->contents = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Search the contents hash table; device and inode are the key. */
|
||||
|
||||
struct directory_contents *dc;
|
||||
|
||||
#ifdef VMS
|
||||
hash = ((unsigned int) st.st_dev << 16)
|
||||
| ((unsigned int) st.st_ino[0]
|
||||
+ (unsigned int) st.st_ino[1]
|
||||
+ (unsigned int) st.st_ino[2]);
|
||||
#else
|
||||
hash = ((unsigned int) st.st_dev << 16) | (unsigned int) st.st_ino;
|
||||
#endif
|
||||
hash %= DIRECTORY_BUCKETS;
|
||||
|
||||
for (dc = directories_contents[hash]; dc != 0; dc = dc->next)
|
||||
if (dc->dev == st.st_dev
|
||||
#ifdef VMS
|
||||
&& dc->ino[0] == st.st_ino[0]
|
||||
&& dc->ino[1] == st.st_ino[1]
|
||||
&& dc->ino[2] == st.st_ino[2])
|
||||
#else
|
||||
&& dc->ino == st.st_ino)
|
||||
#endif
|
||||
break;
|
||||
|
||||
if (dc == 0)
|
||||
{
|
||||
/* Nope; this really is a directory we haven't seen before. */
|
||||
|
||||
dc = (struct directory_contents *)
|
||||
xmalloc (sizeof (struct directory_contents));
|
||||
|
||||
/* Enter it in the contents hash table. */
|
||||
dc->dev = st.st_dev;
|
||||
#ifdef VMS
|
||||
dc->ino[0] = st.st_ino[0];
|
||||
dc->ino[1] = st.st_ino[1];
|
||||
dc->ino[2] = st.st_ino[2];
|
||||
#else
|
||||
dc->ino = st.st_ino;
|
||||
#endif
|
||||
dc->next = directories_contents[hash];
|
||||
directories_contents[hash] = dc;
|
||||
|
||||
dc->dirstream = opendir (name);
|
||||
if (dc->dirstream == 0)
|
||||
{
|
||||
/* Couldn't open the directory. Mark this by
|
||||
setting the `files' member to a nil pointer. */
|
||||
dc->files = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Allocate an array of buckets for files and zero it. */
|
||||
dc->files = (struct dirfile **)
|
||||
xmalloc (sizeof (struct dirfile *) * DIRFILE_BUCKETS);
|
||||
bzero ((char *) dc->files,
|
||||
sizeof (struct dirfile *) * DIRFILE_BUCKETS);
|
||||
|
||||
/* Keep track of how many directories are open. */
|
||||
++open_directories;
|
||||
if (open_directories == MAX_OPEN_DIRECTORIES)
|
||||
/* We have too many directories open already.
|
||||
Read the entire directory and then close it. */
|
||||
(void) dir_contents_file_exists_p (dc, (char *) 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Point the name-hashed entry for DIR at its contents data. */
|
||||
dir->contents = dc;
|
||||
}
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
/* Return 1 if the name FILENAME is entered in DIR's hash table.
|
||||
FILENAME must contain no slashes. */
|
||||
|
||||
static int
|
||||
dir_contents_file_exists_p (dir, filename)
|
||||
register struct directory_contents *dir;
|
||||
register char *filename;
|
||||
{
|
||||
register unsigned int hash;
|
||||
register char *p;
|
||||
register struct dirfile *df;
|
||||
register struct dirent *d;
|
||||
|
||||
if (dir == 0 || dir->files == 0)
|
||||
{
|
||||
/* The directory could not be stat'd or opened. */
|
||||
return 0;
|
||||
}
|
||||
#ifdef __MSDOS__
|
||||
filename = dosify (filename);
|
||||
#endif
|
||||
|
||||
#ifdef _AMIGA
|
||||
filename = amigafy (filename);
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
filename = vmsify (filename,0);
|
||||
#endif
|
||||
|
||||
hash = 0;
|
||||
if (filename != 0)
|
||||
{
|
||||
if (*filename == '\0')
|
||||
{
|
||||
/* Checking if the directory exists. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (p = filename; *p != '\0'; ++p)
|
||||
HASH (hash, *p);
|
||||
hash %= DIRFILE_BUCKETS;
|
||||
|
||||
/* Search the list of hashed files. */
|
||||
|
||||
for (df = dir->files[hash]; df != 0; df = df->next)
|
||||
{
|
||||
if (strieq (df->name, filename))
|
||||
{
|
||||
return !df->impossible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The file was not found in the hashed list.
|
||||
Try to read the directory further. */
|
||||
|
||||
if (dir->dirstream == 0)
|
||||
{
|
||||
/* The directory has been all read in. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((d = readdir (dir->dirstream)) != 0)
|
||||
{
|
||||
/* Enter the file in the hash table. */
|
||||
register unsigned int newhash = 0;
|
||||
unsigned int len;
|
||||
register unsigned int i;
|
||||
|
||||
if (!REAL_DIR_ENTRY (d))
|
||||
continue;
|
||||
|
||||
len = NAMLEN (d);
|
||||
for (i = 0; i < len; ++i)
|
||||
HASHI (newhash, d->d_name[i]);
|
||||
newhash %= DIRFILE_BUCKETS;
|
||||
|
||||
df = (struct dirfile *) xmalloc (sizeof (struct dirfile));
|
||||
df->next = dir->files[newhash];
|
||||
dir->files[newhash] = df;
|
||||
df->name = savestring (d->d_name, len);
|
||||
df->impossible = 0;
|
||||
/* Check if the name matches the one we're searching for. */
|
||||
if (filename != 0
|
||||
&& newhash == hash && strieq (d->d_name, filename))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the directory has been completely read in,
|
||||
close the stream and reset the pointer to nil. */
|
||||
if (d == 0)
|
||||
{
|
||||
--open_directories;
|
||||
closedir (dir->dirstream);
|
||||
dir->dirstream = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return 1 if the name FILENAME in directory DIRNAME
|
||||
is entered in the dir hash table.
|
||||
FILENAME must contain no slashes. */
|
||||
|
||||
int
|
||||
dir_file_exists_p (dirname, filename)
|
||||
register char *dirname;
|
||||
register char *filename;
|
||||
{
|
||||
return dir_contents_file_exists_p (find_directory (dirname)->contents,
|
||||
filename);
|
||||
}
|
||||
|
||||
/* Return 1 if the file named NAME exists. */
|
||||
|
||||
int
|
||||
file_exists_p (name)
|
||||
register char *name;
|
||||
{
|
||||
char *dirend;
|
||||
char *dirname;
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
if (ar_name (name))
|
||||
return ar_member_date (name) != (time_t) -1;
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
dirend = rindex (name, ']');
|
||||
dirend++;
|
||||
if (dirend == (char *)1)
|
||||
return dir_file_exists_p ("[]", name);
|
||||
#else /* !VMS */
|
||||
dirend = rindex (name, '/');
|
||||
if (dirend == 0)
|
||||
return dir_file_exists_p (".", name);
|
||||
if (dirend == 0)
|
||||
#ifndef _AMIGA
|
||||
return dir_file_exists_p (".", name);
|
||||
#else /* !VMS && !AMIGA */
|
||||
return dir_file_exists_p ("", name);
|
||||
#endif /* AMIGA */
|
||||
#endif /* VMS */
|
||||
|
||||
dirname = (char *) alloca (dirend - name + 1);
|
||||
bcopy (name, dirname, dirend - name);
|
||||
dirname[dirend - name] = '\0';
|
||||
return dir_file_exists_p (dirname, dirend + 1);
|
||||
}
|
||||
|
||||
/* Mark FILENAME as `impossible' for `file_impossible_p'.
|
||||
This means an attempt has been made to search for FILENAME
|
||||
as an intermediate file, and it has failed. */
|
||||
|
||||
void
|
||||
file_impossible (filename)
|
||||
register char *filename;
|
||||
{
|
||||
char *dirend;
|
||||
register char *p = filename;
|
||||
register unsigned int hash;
|
||||
register struct directory *dir;
|
||||
register struct dirfile *new;
|
||||
|
||||
#ifdef VMS
|
||||
dirend = rindex (p, ']');
|
||||
dirend++;
|
||||
if (dirend == (char *)1)
|
||||
dir = find_directory ("[]");
|
||||
#else
|
||||
dirend = rindex (p, '/');
|
||||
if (dirend == 0)
|
||||
#ifdef _AMIGA
|
||||
dir = find_directory ("");
|
||||
#else /* !VMS && !AMIGA */
|
||||
dir = find_directory (".");
|
||||
#endif /* AMIGA */
|
||||
#endif /* VMS */
|
||||
else
|
||||
{
|
||||
char *dirname = (char *) alloca (dirend - p + 1);
|
||||
bcopy (p, dirname, dirend - p);
|
||||
dirname[dirend - p] = '\0';
|
||||
dir = find_directory (dirname);
|
||||
filename = p = dirend + 1;
|
||||
}
|
||||
|
||||
for (hash = 0; *p != '\0'; ++p)
|
||||
HASHI (hash, *p);
|
||||
hash %= DIRFILE_BUCKETS;
|
||||
|
||||
if (dir->contents == 0)
|
||||
{
|
||||
/* The directory could not be stat'd. We allocate a contents
|
||||
structure for it, but leave it out of the contents hash table. */
|
||||
dir->contents = (struct directory_contents *)
|
||||
xmalloc (sizeof (struct directory_contents));
|
||||
#ifdef VMS
|
||||
dir->contents->dev = 0;
|
||||
dir->contents->ino[0] = dir->contents->ino[1] =
|
||||
dir->contents->ino[2] = 0;
|
||||
#else
|
||||
dir->contents->dev = dir->contents->ino = 0;
|
||||
#endif
|
||||
dir->contents->files = 0;
|
||||
dir->contents->dirstream = 0;
|
||||
}
|
||||
|
||||
if (dir->contents->files == 0)
|
||||
{
|
||||
/* The directory was not opened; we must allocate the hash buckets. */
|
||||
dir->contents->files = (struct dirfile **)
|
||||
xmalloc (sizeof (struct dirfile) * DIRFILE_BUCKETS);
|
||||
bzero ((char *) dir->contents->files,
|
||||
sizeof (struct dirfile) * DIRFILE_BUCKETS);
|
||||
}
|
||||
|
||||
/* Make a new entry and put it in the table. */
|
||||
|
||||
new = (struct dirfile *) xmalloc (sizeof (struct dirfile));
|
||||
new->next = dir->contents->files[hash];
|
||||
dir->contents->files[hash] = new;
|
||||
new->name = savestring (filename, strlen (filename));
|
||||
new->impossible = 1;
|
||||
}
|
||||
|
||||
/* Return nonzero if FILENAME has been marked impossible. */
|
||||
|
||||
int
|
||||
file_impossible_p (filename)
|
||||
char *filename;
|
||||
{
|
||||
char *dirend;
|
||||
register char *p = filename;
|
||||
register unsigned int hash;
|
||||
register struct directory_contents *dir;
|
||||
register struct dirfile *next;
|
||||
|
||||
#ifdef VMS
|
||||
dirend = rindex (filename, ']');
|
||||
if (dirend == 0)
|
||||
dir = find_directory ("[]")->contents;
|
||||
#else
|
||||
dirend = rindex (filename, '/');
|
||||
if (dirend == 0)
|
||||
#ifdef _AMIGA
|
||||
dir = find_directory ("")->contents;
|
||||
#else /* !VMS && !AMIGA */
|
||||
dir = find_directory (".")->contents;
|
||||
#endif /* AMIGA */
|
||||
#endif /* VMS */
|
||||
else
|
||||
{
|
||||
char *dirname = (char *) alloca (dirend - filename + 1);
|
||||
bcopy (p, dirname, dirend - p);
|
||||
dirname[dirend - p] = '\0';
|
||||
dir = find_directory (dirname)->contents;
|
||||
p = filename = dirend + 1;
|
||||
}
|
||||
|
||||
if (dir == 0 || dir->files == 0)
|
||||
/* There are no files entered for this directory. */
|
||||
return 0;
|
||||
|
||||
#ifdef __MSDOS__
|
||||
p = filename = dosify (p);
|
||||
#endif
|
||||
#ifdef _AMIGA
|
||||
p = filename = amigafy (p);
|
||||
#endif
|
||||
#ifdef VMS
|
||||
p = filename = vmsify (p, 1);
|
||||
#endif
|
||||
|
||||
for (hash = 0; *p != '\0'; ++p)
|
||||
HASH (hash, *p);
|
||||
hash %= DIRFILE_BUCKETS;
|
||||
|
||||
for (next = dir->files[hash]; next != 0; next = next->next)
|
||||
if (strieq (filename, next->name))
|
||||
return next->impossible;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return the already allocated name in the
|
||||
directory hash table that matches DIR. */
|
||||
|
||||
char *
|
||||
dir_name (dir)
|
||||
char *dir;
|
||||
{
|
||||
return find_directory (dir)->name;
|
||||
}
|
||||
|
||||
/* Print the data base of directories. */
|
||||
|
||||
void
|
||||
print_dir_data_base ()
|
||||
{
|
||||
register unsigned int i, dirs, files, impossible;
|
||||
register struct directory *dir;
|
||||
|
||||
puts ("\n# Directories\n");
|
||||
|
||||
dirs = files = impossible = 0;
|
||||
for (i = 0; i < DIRECTORY_BUCKETS; ++i)
|
||||
for (dir = directories[i]; dir != 0; dir = dir->next)
|
||||
{
|
||||
++dirs;
|
||||
if (dir->contents == 0)
|
||||
printf ("# %s: could not be stat'd.\n", dir->name);
|
||||
else if (dir->contents->files == 0)
|
||||
#ifdef VMS
|
||||
printf ("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n",
|
||||
dir->name, dir->contents->dev,
|
||||
dir->contents->ino[0], dir->contents->ino[1],
|
||||
dir->contents->ino[2]);
|
||||
#else
|
||||
printf ("# %s (device %d, inode %d): could not be opened.\n",
|
||||
dir->name, dir->contents->dev, dir->contents->ino);
|
||||
#endif
|
||||
else
|
||||
{
|
||||
register unsigned int f = 0, im = 0;
|
||||
register unsigned int j;
|
||||
register struct dirfile *df;
|
||||
for (j = 0; j < DIRFILE_BUCKETS; ++j)
|
||||
for (df = dir->contents->files[j]; df != 0; df = df->next)
|
||||
if (df->impossible)
|
||||
++im;
|
||||
else
|
||||
++f;
|
||||
#ifdef VMS
|
||||
printf ("# %s (device %d, inode [%d,%d,%d]): ",
|
||||
dir->name, dir->contents->dev,
|
||||
dir->contents->ino[0], dir->contents->ino[1],
|
||||
dir->contents->ino[2]);
|
||||
#else
|
||||
printf ("# %s (device %d, inode %d): ",
|
||||
dir->name, dir->contents->dev, dir->contents->ino);
|
||||
#endif
|
||||
if (f == 0)
|
||||
fputs ("No", stdout);
|
||||
else
|
||||
printf ("%u", f);
|
||||
fputs (" files, ", stdout);
|
||||
if (im == 0)
|
||||
fputs ("no", stdout);
|
||||
else
|
||||
printf ("%u", im);
|
||||
fputs (" impossibilities", stdout);
|
||||
if (dir->contents->dirstream == 0)
|
||||
puts (".");
|
||||
else
|
||||
puts (" so far.");
|
||||
files += f;
|
||||
impossible += im;
|
||||
}
|
||||
}
|
||||
|
||||
fputs ("\n# ", stdout);
|
||||
if (files == 0)
|
||||
fputs ("No", stdout);
|
||||
else
|
||||
printf ("%u", files);
|
||||
fputs (" files, ", stdout);
|
||||
if (impossible == 0)
|
||||
fputs ("no", stdout);
|
||||
else
|
||||
printf ("%u", impossible);
|
||||
printf (" impossibilities in %u directories.\n", dirs);
|
||||
}
|
||||
|
||||
/* Hooks for globbing. */
|
||||
|
||||
#include <glob.h>
|
||||
|
||||
/* Structure describing state of iterating through a directory hash table. */
|
||||
|
||||
struct dirstream
|
||||
{
|
||||
struct directory_contents *contents; /* The directory being read. */
|
||||
|
||||
unsigned int bucket; /* Current hash bucket. */
|
||||
struct dirfile *elt; /* Current elt in bucket. */
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
static __ptr_t open_dirstream PARAMS ((const char *));
|
||||
static struct dirent *read_dirstream PARAMS ((__ptr_t));
|
||||
|
||||
static __ptr_t
|
||||
open_dirstream (directory)
|
||||
const char *directory;
|
||||
{
|
||||
struct dirstream *new;
|
||||
struct directory *dir = find_directory ((char *)directory);
|
||||
|
||||
if (dir->contents == 0 || dir->contents->files == 0)
|
||||
/* DIR->contents is nil if the directory could not be stat'd.
|
||||
DIR->contents->files is nil if it could not be opened. */
|
||||
return 0;
|
||||
|
||||
/* Read all the contents of the directory now. There is no benefit
|
||||
in being lazy, since glob will want to see every file anyway. */
|
||||
|
||||
(void) dir_contents_file_exists_p (dir->contents, (char *) 0);
|
||||
|
||||
new = (struct dirstream *) xmalloc (sizeof (struct dirstream));
|
||||
new->contents = dir->contents;
|
||||
new->bucket = 0;
|
||||
new->elt = new->contents->files[0];
|
||||
|
||||
return (__ptr_t) new;
|
||||
}
|
||||
|
||||
static struct dirent *
|
||||
read_dirstream (stream)
|
||||
__ptr_t stream;
|
||||
{
|
||||
struct dirstream *const ds = (struct dirstream *) stream;
|
||||
register struct dirfile *df;
|
||||
static char *buf;
|
||||
static unsigned int bufsz;
|
||||
|
||||
while (ds->bucket < DIRFILE_BUCKETS)
|
||||
{
|
||||
while ((df = ds->elt) != 0)
|
||||
{
|
||||
ds->elt = df->next;
|
||||
if (!df->impossible)
|
||||
{
|
||||
/* The glob interface wants a `struct dirent',
|
||||
so mock one up. */
|
||||
struct dirent *d;
|
||||
unsigned int len = strlen (df->name) + 1;
|
||||
if (sizeof *d - sizeof d->d_name + len > bufsz)
|
||||
{
|
||||
if (buf != 0)
|
||||
free (buf);
|
||||
bufsz *= 2;
|
||||
if (sizeof *d - sizeof d->d_name + len > bufsz)
|
||||
bufsz = sizeof *d - sizeof d->d_name + len;
|
||||
buf = xmalloc (bufsz);
|
||||
}
|
||||
d = (struct dirent *) buf;
|
||||
FAKE_DIR_ENTRY (d);
|
||||
#ifdef _DIRENT_HAVE_D_NAMLEN
|
||||
d->d_namlen = len - 1;
|
||||
#endif
|
||||
memcpy (d->d_name, df->name, len);
|
||||
return d;
|
||||
}
|
||||
}
|
||||
if (++ds->bucket == DIRFILE_BUCKETS)
|
||||
break;
|
||||
ds->elt = ds->contents->files[ds->bucket];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
dir_setup_glob (gl)
|
||||
glob_t *gl;
|
||||
{
|
||||
extern int stat ();
|
||||
|
||||
/* Bogus sunos4 compiler complains (!) about & before functions. */
|
||||
gl->gl_opendir = open_dirstream;
|
||||
gl->gl_readdir = read_dirstream;
|
||||
gl->gl_closedir = free;
|
||||
gl->gl_stat = stat;
|
||||
/* We don't bother setting gl_lstat, since glob never calls it.
|
||||
The slot is only there for compatibility with 4.4 BSD. */
|
||||
}
|
||||
457
expand.c
Normal file
457
expand.c
Normal file
@@ -0,0 +1,457 @@
|
||||
/* Variable expansion functions for GNU Make.
|
||||
Copyright (C) 1988, 89, 91, 92, 93, 95 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "filedef.h"
|
||||
#include "job.h"
|
||||
#include "commands.h"
|
||||
#include "variable.h"
|
||||
|
||||
/* The next two describe the variable output buffer.
|
||||
This buffer is used to hold the variable-expansion of a line of the
|
||||
makefile. It is made bigger with realloc whenever it is too small.
|
||||
variable_buffer_length is the size currently allocated.
|
||||
variable_buffer is the address of the buffer. */
|
||||
|
||||
static unsigned int variable_buffer_length;
|
||||
static char *variable_buffer;
|
||||
|
||||
/* Subroutine of variable_expand and friends:
|
||||
The text to add is LENGTH chars starting at STRING to the variable_buffer.
|
||||
The text is added to the buffer at PTR, and the updated pointer into
|
||||
the buffer is returned as the value. Thus, the value returned by
|
||||
each call to variable_buffer_output should be the first argument to
|
||||
the following call. */
|
||||
|
||||
char *
|
||||
variable_buffer_output (ptr, string, length)
|
||||
char *ptr, *string;
|
||||
unsigned int length;
|
||||
{
|
||||
register unsigned int newlen = length + (ptr - variable_buffer);
|
||||
|
||||
if (newlen > variable_buffer_length)
|
||||
{
|
||||
unsigned int offset = ptr - variable_buffer;
|
||||
variable_buffer_length = (newlen + 100 > 2 * variable_buffer_length
|
||||
? newlen + 100
|
||||
: 2 * variable_buffer_length);
|
||||
variable_buffer = (char *) xrealloc (variable_buffer,
|
||||
variable_buffer_length);
|
||||
ptr = variable_buffer + offset;
|
||||
}
|
||||
|
||||
bcopy (string, ptr, length);
|
||||
return ptr + length;
|
||||
}
|
||||
|
||||
/* Return a pointer to the beginning of the variable buffer. */
|
||||
|
||||
static char *
|
||||
initialize_variable_output ()
|
||||
{
|
||||
/* If we don't have a variable output buffer yet, get one. */
|
||||
|
||||
if (variable_buffer == 0)
|
||||
{
|
||||
variable_buffer_length = 200;
|
||||
variable_buffer = (char *) xmalloc (variable_buffer_length);
|
||||
variable_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
return variable_buffer;
|
||||
}
|
||||
|
||||
/* Recursively expand V. The returned string is malloc'd. */
|
||||
|
||||
char *
|
||||
recursively_expand (v)
|
||||
register struct variable *v;
|
||||
{
|
||||
char *value;
|
||||
|
||||
if (v->expanding)
|
||||
{
|
||||
/* Expanding V causes infinite recursion. Lose. */
|
||||
if (reading_filename == 0)
|
||||
fatal ("Recursive variable `%s' references itself (eventually)",
|
||||
v->name);
|
||||
else
|
||||
makefile_fatal
|
||||
(reading_filename, *reading_lineno_ptr,
|
||||
"Recursive variable `%s' references itself (eventually)",
|
||||
v->name);
|
||||
}
|
||||
|
||||
v->expanding = 1;
|
||||
value = allocated_variable_expand (v->value);
|
||||
v->expanding = 0;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/* Warn that NAME is an undefined variable. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static void
|
||||
warn_undefined (name, length)
|
||||
char *name;
|
||||
unsigned int length;
|
||||
{
|
||||
if (warn_undefined_variables_flag)
|
||||
{
|
||||
static const char warnmsg[] = "warning: undefined variable `%.*s'";
|
||||
if (reading_filename != 0)
|
||||
makefile_error (reading_filename, *reading_lineno_ptr,
|
||||
warnmsg, length, name);
|
||||
else
|
||||
error (warnmsg, length, name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Expand a simple reference to variable NAME, which is LENGTH chars long. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static char *
|
||||
reference_variable (o, name, length)
|
||||
char *o;
|
||||
char *name;
|
||||
unsigned int length;
|
||||
{
|
||||
register struct variable *v = lookup_variable (name, length);
|
||||
|
||||
if (v == 0)
|
||||
warn_undefined (name, length);
|
||||
|
||||
if (v != 0 && *v->value != '\0')
|
||||
{
|
||||
char *value = (v->recursive ? recursively_expand (v) : v->value);
|
||||
o = variable_buffer_output (o, value, strlen (value));
|
||||
if (v->recursive)
|
||||
free (value);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
/* Scan LINE for variable references and expansion-function calls.
|
||||
Build in `variable_buffer' the result of expanding the references and calls.
|
||||
Return the address of the resulting string, which is null-terminated
|
||||
and is valid only until the next time this function is called. */
|
||||
|
||||
char *
|
||||
variable_expand (line)
|
||||
register char *line;
|
||||
{
|
||||
register struct variable *v;
|
||||
register char *p, *o, *p1;
|
||||
|
||||
p = line;
|
||||
o = initialize_variable_output ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
/* Copy all following uninteresting chars all at once to the
|
||||
variable output buffer, and skip them. Uninteresting chars end
|
||||
at the next $ or the end of the input. */
|
||||
|
||||
p1 = index (p, '$');
|
||||
|
||||
o = variable_buffer_output (o, p, p1 != 0 ? p1 - p : strlen (p) + 1);
|
||||
|
||||
if (p1 == 0)
|
||||
break;
|
||||
p = p1 + 1;
|
||||
|
||||
/* Dispatch on the char that follows the $. */
|
||||
|
||||
switch (*p)
|
||||
{
|
||||
case '$':
|
||||
/* $$ seen means output one $ to the variable output buffer. */
|
||||
o = variable_buffer_output (o, p, 1);
|
||||
break;
|
||||
|
||||
case '(':
|
||||
case '{':
|
||||
/* $(...) or ${...} is the general case of substitution. */
|
||||
{
|
||||
char openparen = *p;
|
||||
char closeparen = (openparen == '(') ? ')' : '}';
|
||||
register char *beg = p + 1;
|
||||
int free_beg = 0;
|
||||
char *op, *begp;
|
||||
char *end, *colon;
|
||||
|
||||
op = o;
|
||||
begp = p;
|
||||
if (handle_function (&op, &begp))
|
||||
{
|
||||
o = op;
|
||||
p = begp;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Is there a variable reference inside the parens or braces?
|
||||
If so, expand it before expanding the entire reference. */
|
||||
|
||||
end = index (beg, closeparen);
|
||||
if (end == 0)
|
||||
{
|
||||
/* Unterminated variable reference. */
|
||||
if (reading_filename != 0)
|
||||
makefile_fatal (reading_filename, *reading_lineno_ptr,
|
||||
"unterminated variable reference");
|
||||
else
|
||||
fatal ("unterminated variable reference");
|
||||
}
|
||||
p1 = lindex (beg, end, '$');
|
||||
if (p1 != 0)
|
||||
{
|
||||
/* BEG now points past the opening paren or brace.
|
||||
Count parens or braces until it is matched. */
|
||||
int count = 0;
|
||||
for (p = beg; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == openparen)
|
||||
++count;
|
||||
else if (*p == closeparen && --count < 0)
|
||||
break;
|
||||
}
|
||||
/* If COUNT is >= 0, there were unmatched opening parens
|
||||
or braces, so we go to the simple case of a variable name
|
||||
such as `$($(a)'. */
|
||||
if (count < 0)
|
||||
{
|
||||
beg = expand_argument (beg, p); /* Expand the name. */
|
||||
free_beg = 1; /* Remember to free BEG when finished. */
|
||||
end = index (beg, '\0');
|
||||
}
|
||||
}
|
||||
else
|
||||
/* Advance P to the end of this reference. After we are
|
||||
finished expanding this one, P will be incremented to
|
||||
continue the scan. */
|
||||
p = end;
|
||||
|
||||
/* This is not a reference to a built-in function and
|
||||
any variable references inside are now expanded.
|
||||
Is the resultant text a substitution reference? */
|
||||
|
||||
colon = lindex (beg, end, ':');
|
||||
if (colon != 0)
|
||||
{
|
||||
/* This looks like a substitution reference: $(FOO:A=B). */
|
||||
char *subst_beg, *subst_end, *replace_beg, *replace_end;
|
||||
|
||||
subst_beg = colon + 1;
|
||||
subst_end = index (subst_beg, '=');
|
||||
if (subst_end == 0)
|
||||
/* There is no = in sight. Punt on the substitution
|
||||
reference and treat this as a variable name containing
|
||||
a colon, in the code below. */
|
||||
colon = 0;
|
||||
else
|
||||
{
|
||||
replace_beg = subst_end + 1;
|
||||
replace_end = end;
|
||||
|
||||
/* Extract the variable name before the colon
|
||||
and look up that variable. */
|
||||
v = lookup_variable (beg, colon - beg);
|
||||
if (v == 0)
|
||||
warn_undefined (beg, colon - beg);
|
||||
|
||||
if (v != 0 && *v->value != '\0')
|
||||
{
|
||||
char *value = (v->recursive ? recursively_expand (v)
|
||||
: v->value);
|
||||
char *pattern, *percent;
|
||||
if (free_beg)
|
||||
{
|
||||
*subst_end = '\0';
|
||||
pattern = subst_beg;
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern = (char *) alloca (subst_end - subst_beg
|
||||
+ 1);
|
||||
bcopy (subst_beg, pattern, subst_end - subst_beg);
|
||||
pattern[subst_end - subst_beg] = '\0';
|
||||
}
|
||||
percent = find_percent (pattern);
|
||||
if (percent != 0)
|
||||
{
|
||||
char *replace;
|
||||
if (free_beg)
|
||||
{
|
||||
*replace_end = '\0';
|
||||
replace = replace_beg;
|
||||
}
|
||||
else
|
||||
{
|
||||
replace = (char *) alloca (replace_end
|
||||
- replace_beg
|
||||
+ 1);
|
||||
bcopy (replace_beg, replace,
|
||||
replace_end - replace_beg);
|
||||
replace[replace_end - replace_beg] = '\0';
|
||||
}
|
||||
|
||||
o = patsubst_expand (o, value, pattern, replace,
|
||||
percent, (char *) 0);
|
||||
}
|
||||
else
|
||||
o = subst_expand (o, value,
|
||||
pattern, replace_beg,
|
||||
strlen (pattern),
|
||||
end - replace_beg,
|
||||
0, 1);
|
||||
if (v->recursive)
|
||||
free (value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (colon == 0)
|
||||
/* This is an ordinary variable reference.
|
||||
Look up the value of the variable. */
|
||||
o = reference_variable (o, beg, end - beg);
|
||||
|
||||
if (free_beg)
|
||||
free (beg);
|
||||
}
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isblank (p[-1]))
|
||||
break;
|
||||
|
||||
/* A $ followed by a random char is a variable reference:
|
||||
$a is equivalent to $(a). */
|
||||
{
|
||||
/* We could do the expanding here, but this way
|
||||
avoids code repetition at a small performance cost. */
|
||||
char name[5];
|
||||
name[0] = '$';
|
||||
name[1] = '(';
|
||||
name[2] = *p;
|
||||
name[3] = ')';
|
||||
name[4] = '\0';
|
||||
p1 = allocated_variable_expand (name);
|
||||
o = variable_buffer_output (o, p1, strlen (p1));
|
||||
free (p1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (*p == '\0')
|
||||
break;
|
||||
else
|
||||
++p;
|
||||
}
|
||||
|
||||
(void) variable_buffer_output (o, "", 1);
|
||||
return initialize_variable_output ();
|
||||
}
|
||||
|
||||
/* Expand an argument for an expansion function.
|
||||
The text starting at STR and ending at END is variable-expanded
|
||||
into a null-terminated string that is returned as the value.
|
||||
This is done without clobbering `variable_buffer' or the current
|
||||
variable-expansion that is in progress. */
|
||||
|
||||
char *
|
||||
expand_argument (str, end)
|
||||
char *str, *end;
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
if (*end == '\0')
|
||||
tmp = str;
|
||||
else
|
||||
{
|
||||
tmp = (char *) alloca (end - str + 1);
|
||||
bcopy (str, tmp, end - str);
|
||||
tmp[end - str] = '\0';
|
||||
}
|
||||
|
||||
return allocated_variable_expand (tmp);
|
||||
}
|
||||
|
||||
/* Expand LINE for FILE. Error messages refer to the file and line where
|
||||
FILE's commands were found. Expansion uses FILE's variable set list. */
|
||||
|
||||
char *
|
||||
variable_expand_for_file (line, file)
|
||||
char *line;
|
||||
register struct file *file;
|
||||
{
|
||||
char *result;
|
||||
struct variable_set_list *save;
|
||||
|
||||
if (file == 0)
|
||||
return variable_expand (line);
|
||||
|
||||
save = current_variable_set_list;
|
||||
current_variable_set_list = file->variables;
|
||||
reading_filename = file->cmds->filename;
|
||||
reading_lineno_ptr = &file->cmds->lineno;
|
||||
result = variable_expand (line);
|
||||
current_variable_set_list = save;
|
||||
reading_filename = 0;
|
||||
reading_lineno_ptr = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Like variable_expand_for_file, but the returned string is malloc'd.
|
||||
This function is called a lot. It wants to be efficient. */
|
||||
|
||||
char *
|
||||
allocated_variable_expand_for_file (line, file)
|
||||
char *line;
|
||||
struct file *file;
|
||||
{
|
||||
char *value;
|
||||
|
||||
char *obuf = variable_buffer;
|
||||
unsigned int olen = variable_buffer_length;
|
||||
|
||||
variable_buffer = 0;
|
||||
|
||||
value = variable_expand_for_file (line, file);
|
||||
|
||||
#if 0
|
||||
/* Waste a little memory and save time. */
|
||||
value = xrealloc (value, strlen (value))
|
||||
#endif
|
||||
|
||||
variable_buffer = obuf;
|
||||
variable_buffer_length = olen;
|
||||
|
||||
return value;
|
||||
}
|
||||
650
file.c
Normal file
650
file.c
Normal file
@@ -0,0 +1,650 @@
|
||||
/* Target file hash table management for GNU Make.
|
||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "dep.h"
|
||||
#include "filedef.h"
|
||||
#include "job.h"
|
||||
#include "commands.h"
|
||||
#include "variable.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/* Hash table of files the makefile knows how to make. */
|
||||
|
||||
#ifndef FILE_BUCKETS
|
||||
#define FILE_BUCKETS 1007
|
||||
#endif
|
||||
static struct file *files[FILE_BUCKETS];
|
||||
|
||||
/* Number of files with the `intermediate' flag set. */
|
||||
|
||||
unsigned int num_intermediates = 0;
|
||||
|
||||
|
||||
/* Access the hash table of all file records.
|
||||
lookup_file given a name, return the struct file * for that name,
|
||||
or nil if there is none.
|
||||
enter_file similar, but create one if there is none. */
|
||||
|
||||
struct file *
|
||||
lookup_file (name)
|
||||
char *name;
|
||||
{
|
||||
register struct file *f;
|
||||
register char *n;
|
||||
register unsigned int hashval;
|
||||
|
||||
if (*name == '\0')
|
||||
abort ();
|
||||
|
||||
/* This is also done in parse_file_seq, so this is redundant
|
||||
for names read from makefiles. It is here for names passed
|
||||
on the command line. */
|
||||
#ifdef VMS
|
||||
while (name[0] == '[' && name[1] == ']' && name[2] != '\0')
|
||||
name += 2;
|
||||
#endif
|
||||
while (name[0] == '.' && name[1] == '/' && name[2] != '\0')
|
||||
{
|
||||
name += 2;
|
||||
while (*name == '/')
|
||||
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
|
||||
++name;
|
||||
}
|
||||
|
||||
if (*name == '\0')
|
||||
/* It was all slashes after a dot. */
|
||||
#ifdef VMS
|
||||
name = "[]";
|
||||
#else
|
||||
#ifdef _AMIGA
|
||||
name = "";
|
||||
#else
|
||||
name = "./";
|
||||
#endif /* AMIGA */
|
||||
#endif /* VMS */
|
||||
|
||||
hashval = 0;
|
||||
for (n = name; *n != '\0'; ++n)
|
||||
HASHI (hashval, *n);
|
||||
hashval %= FILE_BUCKETS;
|
||||
|
||||
for (f = files[hashval]; f != 0; f = f->next)
|
||||
{
|
||||
if (strieq (f->name, name))
|
||||
{
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct file *
|
||||
enter_file (name)
|
||||
char *name;
|
||||
{
|
||||
register struct file *f, *new;
|
||||
register char *n;
|
||||
register unsigned int hashval;
|
||||
#ifdef VMS
|
||||
char *lname, *ln;
|
||||
#endif
|
||||
|
||||
if (*name == '\0')
|
||||
abort ();
|
||||
|
||||
#ifdef VMS
|
||||
lname = (char *)malloc (strlen (name) + 1);
|
||||
for (n = name, ln = lname; *n != '\0'; ++n, ++ln)
|
||||
{
|
||||
if (isupper(*n))
|
||||
*ln = tolower(*n);
|
||||
else
|
||||
*ln = *n;
|
||||
}
|
||||
*ln = 0;
|
||||
name = lname;
|
||||
#endif
|
||||
|
||||
hashval = 0;
|
||||
for (n = name; *n != '\0'; ++n)
|
||||
HASHI (hashval, *n);
|
||||
hashval %= FILE_BUCKETS;
|
||||
|
||||
for (f = files[hashval]; f != 0; f = f->next)
|
||||
if (strieq (f->name, name))
|
||||
break;
|
||||
|
||||
if (f != 0 && !f->double_colon)
|
||||
{
|
||||
#ifdef VMS
|
||||
free(lname);
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
|
||||
new = (struct file *) xmalloc (sizeof (struct file));
|
||||
bzero ((char *) new, sizeof (struct file));
|
||||
new->name = name;
|
||||
new->update_status = -1;
|
||||
|
||||
if (f == 0)
|
||||
{
|
||||
/* This is a completely new file. */
|
||||
new->next = files[hashval];
|
||||
files[hashval] = new;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* There is already a double-colon entry for this file. */
|
||||
new->double_colon = f;
|
||||
while (f->prev != 0)
|
||||
f = f->prev;
|
||||
f->prev = new;
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
/* Rename FILE to NAME. This is not as simple as resetting
|
||||
the `name' member, since it must be put in a new hash bucket,
|
||||
and possibly merged with an existing file called NAME. */
|
||||
|
||||
void
|
||||
rename_file (file, name)
|
||||
register struct file *file;
|
||||
char *name;
|
||||
{
|
||||
char *oldname = file->name;
|
||||
register unsigned int oldhash;
|
||||
register char *n;
|
||||
|
||||
while (file->renamed != 0)
|
||||
file = file->renamed;
|
||||
|
||||
/* Find the hash values of the old and new names. */
|
||||
|
||||
oldhash = 0;
|
||||
for (n = oldname; *n != '\0'; ++n)
|
||||
HASHI (oldhash, *n);
|
||||
|
||||
file_hash_enter (file, name, oldhash, file->name);
|
||||
}
|
||||
|
||||
void
|
||||
file_hash_enter (file, name, oldhash, oldname)
|
||||
register struct file *file;
|
||||
char *name;
|
||||
unsigned int oldhash;
|
||||
char *oldname;
|
||||
{
|
||||
unsigned int oldbucket = oldhash % FILE_BUCKETS;
|
||||
register unsigned int newhash, newbucket;
|
||||
struct file *oldfile;
|
||||
register char *n;
|
||||
register struct file *f;
|
||||
|
||||
newhash = 0;
|
||||
for (n = name; *n != '\0'; ++n)
|
||||
HASHI (newhash, *n);
|
||||
newbucket = newhash % FILE_BUCKETS;
|
||||
|
||||
/* Look for an existing file under the new name. */
|
||||
|
||||
for (oldfile = files[newbucket]; oldfile != 0; oldfile = oldfile->next)
|
||||
if (strieq (oldfile->name, name))
|
||||
break;
|
||||
|
||||
if (oldhash != 0 && (newbucket != oldbucket || oldfile != 0))
|
||||
{
|
||||
/* Remove FILE from its hash bucket. */
|
||||
|
||||
struct file *lastf = 0;
|
||||
|
||||
for (f = files[oldbucket]; f != file; f = f->next)
|
||||
lastf = f;
|
||||
|
||||
if (lastf == 0)
|
||||
files[oldbucket] = f->next;
|
||||
else
|
||||
lastf->next = f->next;
|
||||
}
|
||||
|
||||
/* Give FILE its new name. */
|
||||
|
||||
file->name = name;
|
||||
for (f = file->double_colon; f != 0; f = f->prev)
|
||||
f->name = name;
|
||||
|
||||
if (oldfile == 0)
|
||||
{
|
||||
/* There is no existing file with the new name. */
|
||||
|
||||
if (newbucket != oldbucket)
|
||||
{
|
||||
/* Put FILE in its new hash bucket. */
|
||||
file->next = files[newbucket];
|
||||
files[newbucket] = file;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* There is an existing file with the new name.
|
||||
We must merge FILE into the existing file. */
|
||||
|
||||
register struct dep *d;
|
||||
|
||||
if (file->cmds != 0)
|
||||
{
|
||||
if (oldfile->cmds == 0)
|
||||
oldfile->cmds = file->cmds;
|
||||
else if (file->cmds != oldfile->cmds)
|
||||
{
|
||||
/* We have two sets of commands. We will go with the
|
||||
one given in the rule explicitly mentioning this name,
|
||||
but give a message to let the user know what's going on. */
|
||||
if (oldfile->cmds->filename != 0)
|
||||
makefile_error (file->cmds->filename, file->cmds->lineno,
|
||||
"Commands were specified for \
|
||||
file `%s' at %s:%u,",
|
||||
oldname, oldfile->cmds->filename,
|
||||
oldfile->cmds->lineno);
|
||||
else
|
||||
makefile_error (file->cmds->filename, file->cmds->lineno,
|
||||
"Commands for file `%s' were found by \
|
||||
implicit rule search,",
|
||||
oldname);
|
||||
makefile_error (file->cmds->filename, file->cmds->lineno,
|
||||
"but `%s' is now considered the same file \
|
||||
as `%s'.",
|
||||
oldname, name);
|
||||
makefile_error (file->cmds->filename, file->cmds->lineno,
|
||||
"Commands for `%s' will be ignored \
|
||||
in favor of those for `%s'.",
|
||||
name, oldname);
|
||||
}
|
||||
}
|
||||
|
||||
/* Merge the dependencies of the two files. */
|
||||
|
||||
d = oldfile->deps;
|
||||
if (d == 0)
|
||||
oldfile->deps = file->deps;
|
||||
else
|
||||
{
|
||||
while (d->next != 0)
|
||||
d = d->next;
|
||||
d->next = file->deps;
|
||||
}
|
||||
|
||||
merge_variable_set_lists (&oldfile->variables, file->variables);
|
||||
|
||||
if (oldfile->double_colon && !file->double_colon)
|
||||
fatal ("can't rename single-colon `%s' to double-colon `%s'",
|
||||
oldname, name);
|
||||
if (!oldfile->double_colon && file->double_colon)
|
||||
fatal ("can't rename double-colon `%s' to single-colon `%s'",
|
||||
oldname, name);
|
||||
|
||||
if (file->last_mtime > oldfile->last_mtime)
|
||||
/* %%% Kludge so -W wins on a file that gets vpathized. */
|
||||
oldfile->last_mtime = file->last_mtime;
|
||||
|
||||
#define MERGE(field) oldfile->field |= file->field
|
||||
MERGE (precious);
|
||||
MERGE (tried_implicit);
|
||||
MERGE (updating);
|
||||
MERGE (updated);
|
||||
MERGE (is_target);
|
||||
MERGE (cmd_target);
|
||||
MERGE (phony);
|
||||
#undef MERGE
|
||||
|
||||
file->renamed = oldfile;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove all nonprecious intermediate files.
|
||||
If SIG is nonzero, this was caused by a fatal signal,
|
||||
meaning that a different message will be printed, and
|
||||
the message will go to stderr rather than stdout. */
|
||||
|
||||
void
|
||||
remove_intermediates (sig)
|
||||
int sig;
|
||||
{
|
||||
register int i;
|
||||
register struct file *f;
|
||||
char doneany;
|
||||
|
||||
if (question_flag || touch_flag)
|
||||
return;
|
||||
if (sig && just_print_flag)
|
||||
return;
|
||||
|
||||
doneany = 0;
|
||||
for (i = 0; i < FILE_BUCKETS; ++i)
|
||||
for (f = files[i]; f != 0; f = f->next)
|
||||
if (f->intermediate && (f->dontcare || !f->precious)
|
||||
&& !f->secondary)
|
||||
{
|
||||
int status;
|
||||
if (f->update_status == -1)
|
||||
/* If nothing would have created this file yet,
|
||||
don't print an "rm" command for it. */
|
||||
continue;
|
||||
else if (just_print_flag)
|
||||
status = 0;
|
||||
else
|
||||
{
|
||||
status = unlink (f->name);
|
||||
if (status < 0 && errno == ENOENT)
|
||||
continue;
|
||||
}
|
||||
if (!f->dontcare)
|
||||
{
|
||||
if (sig)
|
||||
error ("*** Deleting intermediate file `%s'", f->name);
|
||||
else if (!silent_flag)
|
||||
{
|
||||
if (! doneany)
|
||||
{
|
||||
fputs ("rm ", stdout);
|
||||
doneany = 1;
|
||||
}
|
||||
else
|
||||
putchar (' ');
|
||||
fputs (f->name, stdout);
|
||||
fflush (stdout);
|
||||
}
|
||||
if (status < 0)
|
||||
perror_with_name ("unlink: ", f->name);
|
||||
}
|
||||
}
|
||||
|
||||
if (doneany && !sig)
|
||||
{
|
||||
putchar ('\n');
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/* For each dependency of each file, make the `struct dep' point
|
||||
at the appropriate `struct file' (which may have to be created).
|
||||
|
||||
Also mark the files depended on by .PRECIOUS, .PHONY, .SILENT,
|
||||
and various other special targets. */
|
||||
|
||||
void
|
||||
snap_deps ()
|
||||
{
|
||||
register struct file *f, *f2;
|
||||
register struct dep *d;
|
||||
register int i;
|
||||
|
||||
/* Enter each dependency name as a file. */
|
||||
for (i = 0; i < FILE_BUCKETS; ++i)
|
||||
for (f = files[i]; f != 0; f = f->next)
|
||||
for (f2 = f; f2 != 0; f2 = f2->prev)
|
||||
for (d = f2->deps; d != 0; d = d->next)
|
||||
if (d->name != 0)
|
||||
{
|
||||
d->file = lookup_file (d->name);
|
||||
if (d->file == 0)
|
||||
d->file = enter_file (d->name);
|
||||
else
|
||||
free (d->name);
|
||||
d->name = 0;
|
||||
}
|
||||
|
||||
for (f = lookup_file (".PRECIOUS"); f != 0; f = f->prev)
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
for (f2 = d->file; f2 != 0; f2 = f2->prev)
|
||||
f2->precious = 1;
|
||||
|
||||
for (f = lookup_file (".PHONY"); f != 0; f = f->prev)
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
for (f2 = d->file; f2 != 0; f2 = f2->prev)
|
||||
{
|
||||
/* Mark this file as phony and nonexistent. */
|
||||
f2->phony = 1;
|
||||
f2->last_mtime = (time_t) -1;
|
||||
}
|
||||
|
||||
for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev)
|
||||
{
|
||||
/* .INTERMEDIATE with deps listed
|
||||
marks those deps as intermediate files. */
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
for (f2 = d->file; f2 != 0; f2 = f2->prev)
|
||||
f2->intermediate = 1;
|
||||
/* .INTERMEDIATE with no deps does nothing.
|
||||
Marking all files as intermediates is useless
|
||||
since the goal targets would be deleted after they are built. */
|
||||
}
|
||||
|
||||
for (f = lookup_file (".SECONDARY"); f != 0; f = f->prev)
|
||||
{
|
||||
/* .SECONDARY with deps listed
|
||||
marks those deps as intermediate files
|
||||
in that they don't get rebuilt if not actually needed;
|
||||
but unlike real intermediate files,
|
||||
these are not deleted after make finishes. */
|
||||
if (f->deps)
|
||||
{
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
for (f2 = d->file; f2 != 0; f2 = f2->prev)
|
||||
f2->intermediate = f2->secondary = 1;
|
||||
}
|
||||
/* .SECONDARY with no deps listed marks *all* files that way. */
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < FILE_BUCKETS; i++)
|
||||
for (f2 = files[i]; f2; f2= f2->next)
|
||||
f2->intermediate = f2->secondary = 1;
|
||||
}
|
||||
}
|
||||
|
||||
f = lookup_file (".EXPORT_ALL_VARIABLES");
|
||||
if (f != 0 && f->is_target)
|
||||
export_all_variables = 1;
|
||||
|
||||
f = lookup_file (".IGNORE");
|
||||
if (f != 0 && f->is_target)
|
||||
{
|
||||
if (f->deps == 0)
|
||||
ignore_errors_flag = 1;
|
||||
else
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
for (f2 = d->file; f2 != 0; f2 = f2->prev)
|
||||
f2->command_flags |= COMMANDS_NOERROR;
|
||||
}
|
||||
|
||||
f = lookup_file (".SILENT");
|
||||
if (f != 0 && f->is_target)
|
||||
{
|
||||
if (f->deps == 0)
|
||||
silent_flag = 1;
|
||||
else
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
for (f2 = d->file; f2 != 0; f2 = f2->prev)
|
||||
f2->command_flags |= COMMANDS_SILENT;
|
||||
}
|
||||
|
||||
f = lookup_file (".POSIX");
|
||||
if (f != 0 && f->is_target)
|
||||
posix_pedantic = 1;
|
||||
}
|
||||
|
||||
/* Set the `command_state' member of FILE and all its `also_make's. */
|
||||
|
||||
void
|
||||
set_command_state (file, state)
|
||||
struct file *file;
|
||||
int state;
|
||||
{
|
||||
struct dep *d;
|
||||
|
||||
file->command_state = state;
|
||||
|
||||
for (d = file->also_make; d != 0; d = d->next)
|
||||
d->file->command_state = state;
|
||||
}
|
||||
|
||||
/* Print the data base of files. */
|
||||
|
||||
static void
|
||||
print_file (f)
|
||||
struct file *f;
|
||||
{
|
||||
register struct dep *d;
|
||||
#ifdef VMS
|
||||
extern char *cvt_time PARAMS ((unsigned long));
|
||||
#endif
|
||||
putchar ('\n');
|
||||
if (!f->is_target)
|
||||
puts ("# Not a target:");
|
||||
printf ("%s:%s", f->name, f->double_colon ? ":" : "");
|
||||
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
printf (" %s", dep_name (d));
|
||||
putchar ('\n');
|
||||
|
||||
if (f->precious)
|
||||
puts ("# Precious file (dependency of .PRECIOUS).");
|
||||
if (f->phony)
|
||||
puts ("# Phony target (dependency of .PHONY).");
|
||||
if (f->cmd_target)
|
||||
puts ("# Command-line target.");
|
||||
if (f->dontcare)
|
||||
puts ("# A default or MAKEFILES makefile.");
|
||||
printf ("# Implicit rule search has%s been done.\n",
|
||||
f->tried_implicit ? "" : " not");
|
||||
if (f->stem != 0)
|
||||
printf ("# Implicit/static pattern stem: `%s'\n", f->stem);
|
||||
if (f->intermediate)
|
||||
puts ("# File is an intermediate dependency.");
|
||||
if (f->also_make != 0)
|
||||
{
|
||||
fputs ("# Also makes:", stdout);
|
||||
for (d = f->also_make; d != 0; d = d->next)
|
||||
printf (" %s", dep_name (d));
|
||||
putchar ('\n');
|
||||
}
|
||||
if (f->last_mtime == (time_t) 0)
|
||||
puts ("# Modification time never checked.");
|
||||
else if (f->last_mtime == (time_t) -1)
|
||||
puts ("# File does not exist.");
|
||||
else
|
||||
#ifdef VMS
|
||||
printf ("# Last modified %.24s (%0lx)\n",
|
||||
cvt_time(f->last_mtime), (unsigned long) f->last_mtime);
|
||||
#else
|
||||
printf ("# Last modified %.24s (%ld)\n",
|
||||
ctime (&f->last_mtime), (long int) f->last_mtime);
|
||||
#endif
|
||||
printf ("# File has%s been updated.\n",
|
||||
f->updated ? "" : " not");
|
||||
switch (f->command_state)
|
||||
{
|
||||
case cs_running:
|
||||
puts ("# Commands currently running (THIS IS A BUG).");
|
||||
break;
|
||||
case cs_deps_running:
|
||||
puts ("# Dependencies commands running (THIS IS A BUG).");
|
||||
break;
|
||||
case cs_not_started:
|
||||
case cs_finished:
|
||||
switch (f->update_status)
|
||||
{
|
||||
case -1:
|
||||
break;
|
||||
case 0:
|
||||
puts ("# Successfully updated.");
|
||||
break;
|
||||
case 1:
|
||||
assert (question_flag);
|
||||
puts ("# Needs to be updated (-q is set).");
|
||||
break;
|
||||
case 2:
|
||||
puts ("# Failed to be updated.");
|
||||
break;
|
||||
default:
|
||||
puts ("# Invalid value in `update_status' member!");
|
||||
fflush (stdout);
|
||||
fflush (stderr);
|
||||
abort ();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
puts ("# Invalid value in `command_state' member!");
|
||||
fflush (stdout);
|
||||
fflush (stderr);
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (f->variables != 0)
|
||||
print_file_variables (f);
|
||||
|
||||
if (f->cmds != 0)
|
||||
print_commands (f->cmds);
|
||||
}
|
||||
|
||||
void
|
||||
print_file_data_base ()
|
||||
{
|
||||
register unsigned int i, nfiles, per_bucket;
|
||||
register struct file *file;
|
||||
|
||||
puts ("\n# Files");
|
||||
|
||||
per_bucket = nfiles = 0;
|
||||
for (i = 0; i < FILE_BUCKETS; ++i)
|
||||
{
|
||||
register unsigned int this_bucket = 0;
|
||||
|
||||
for (file = files[i]; file != 0; file = file->next)
|
||||
{
|
||||
register struct file *f;
|
||||
|
||||
++this_bucket;
|
||||
|
||||
for (f = file; f != 0; f = f->prev)
|
||||
print_file (f);
|
||||
}
|
||||
|
||||
nfiles += this_bucket;
|
||||
if (this_bucket > per_bucket)
|
||||
per_bucket = this_bucket;
|
||||
}
|
||||
|
||||
if (nfiles == 0)
|
||||
puts ("\n# No files.");
|
||||
else
|
||||
{
|
||||
printf ("\n# %u files in %u hash buckets.\n", nfiles, FILE_BUCKETS);
|
||||
#ifndef NO_FLOAT
|
||||
printf ("# average %.1f files per bucket, max %u files in one bucket.\n",
|
||||
((double) nfiles) / ((double) FILE_BUCKETS) * 100.0, per_bucket);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
120
filedef.h
Normal file
120
filedef.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/* Definition of target file data structures for GNU Make.
|
||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Structure that represents the info on one file
|
||||
that the makefile says how to make.
|
||||
All of these are chained together through `next'. */
|
||||
|
||||
struct file
|
||||
{
|
||||
struct file *next;
|
||||
char *name;
|
||||
struct dep *deps;
|
||||
struct commands *cmds; /* Commands to execute for this target. */
|
||||
int command_flags; /* Flags OR'd in for cmds; see commands.h. */
|
||||
char *stem; /* Implicit stem, if an implicit
|
||||
rule has been used */
|
||||
struct dep *also_make; /* Targets that are made by making this. */
|
||||
time_t last_mtime; /* File's modtime, if already known. */
|
||||
struct file *prev; /* Previous entry for same file name;
|
||||
used when there are multiple double-colon
|
||||
entries for the same file. */
|
||||
|
||||
/* File that this file was renamed to. After any time that a
|
||||
file could be renamed, call `check_renamed' (below). */
|
||||
struct file *renamed;
|
||||
|
||||
/* List of variable sets used for this file. */
|
||||
struct variable_set_list *variables;
|
||||
|
||||
/* Immediate dependent that caused this target to be remade,
|
||||
or nil if there isn't one. */
|
||||
struct file *parent;
|
||||
|
||||
/* For a double-colon entry, this is the first double-colon entry for
|
||||
the same file. Otherwise this is null. */
|
||||
struct file *double_colon;
|
||||
|
||||
short int update_status; /* Status of the last attempt to update,
|
||||
or -1 if none has been made. */
|
||||
|
||||
enum /* State of the commands. */
|
||||
{ /* Note: It is important that cs_not_started be zero. */
|
||||
cs_not_started, /* Not yet started. */
|
||||
cs_deps_running, /* Dep commands running. */
|
||||
cs_running, /* Commands running. */
|
||||
cs_finished /* Commands finished. */
|
||||
} command_state ENUM_BITFIELD (2);
|
||||
|
||||
unsigned int precious:1; /* Non-0 means don't delete file on quit */
|
||||
unsigned int tried_implicit:1; /* Nonzero if have searched
|
||||
for implicit rule for making
|
||||
this file; don't search again. */
|
||||
unsigned int updating:1; /* Nonzero while updating deps of this file */
|
||||
unsigned int updated:1; /* Nonzero if this file has been remade. */
|
||||
unsigned int is_target:1; /* Nonzero if file is described as target. */
|
||||
unsigned int cmd_target:1; /* Nonzero if file was given on cmd line. */
|
||||
unsigned int phony:1; /* Nonzero if this is a phony file
|
||||
i.e., a dependency of .PHONY. */
|
||||
unsigned int intermediate:1;/* Nonzero if this is an intermediate file. */
|
||||
/* Nonzero, for an intermediate file,
|
||||
means remove_intermediates should not delete it. */
|
||||
unsigned int secondary:1;
|
||||
unsigned int dontcare:1; /* Nonzero if no complaint is to be made if
|
||||
this target cannot be remade. */
|
||||
};
|
||||
|
||||
/* Number of intermediate files entered. */
|
||||
|
||||
extern unsigned int num_intermediates;
|
||||
|
||||
extern struct file *default_goal_file, *suffix_file, *default_file;
|
||||
|
||||
|
||||
extern struct file *lookup_file (), *enter_file ();
|
||||
extern void remove_intermediates (), snap_deps ();
|
||||
extern void rename_file (), file_hash_enter ();
|
||||
extern void set_command_state ();
|
||||
|
||||
|
||||
/* Return the mtime of file F (a struct file *), caching it.
|
||||
The value is -1 if the file does not exist. */
|
||||
#define file_mtime(f) file_mtime_1 ((f), 1)
|
||||
/* Return the mtime of file F (a struct file *), caching it.
|
||||
Don't search using vpath for the file--if it doesn't actually exist,
|
||||
we don't find it.
|
||||
The value is -1 if the file does not exist. */
|
||||
#define file_mtime_no_search(f) file_mtime_1 ((f), 0)
|
||||
extern time_t f_mtime ();
|
||||
#define file_mtime_1(f, v) \
|
||||
((f)->last_mtime != (time_t) 0 ? (f)->last_mtime : f_mtime ((f), v))
|
||||
|
||||
/* Modtime value to use for `infinitely new'. We used to get the current time
|
||||
from the system and use that whenever we wanted `new'. But that causes
|
||||
trouble when the machine running make and the machine holding a file have
|
||||
different ideas about what time it is; and can also lose for `force'
|
||||
targets, which need to be considered newer than anything that depends on
|
||||
them, even if said dependents' modtimes are in the future.
|
||||
|
||||
NOTE: This assumes 32-bit `time_t's, but I cannot think of a portable way
|
||||
to produce the largest representable integer of a given signed type. */
|
||||
#define NEW_MTIME ((time_t) 0x7fffffff)
|
||||
|
||||
|
||||
#define check_renamed(file) \
|
||||
while ((file)->renamed != 0) (file) = (file)->renamed /* No ; here. */
|
||||
1419
function.c
Normal file
1419
function.c
Normal file
File diff suppressed because it is too large
Load Diff
967
getloadavg.c
Normal file
967
getloadavg.c
Normal file
@@ -0,0 +1,967 @@
|
||||
/* Get the system load averages.
|
||||
Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93, 1994, 1995
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* Compile-time symbols that this file uses:
|
||||
|
||||
FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist.
|
||||
KERNEL_FILE Pathname of the kernel to nlist.
|
||||
LDAV_CVT() Scale the load average from the kernel.
|
||||
Returns a double.
|
||||
LDAV_SYMBOL Name of kernel symbol giving load average.
|
||||
LOAD_AVE_TYPE Type of the load average array in the kernel.
|
||||
Must be defined unless one of
|
||||
apollo, DGUX, NeXT, or UMAX is defined;
|
||||
otherwise, no load average is available.
|
||||
NLIST_STRUCT Include nlist.h, not a.out.h, and
|
||||
the nlist n_name element is a pointer,
|
||||
not an array.
|
||||
NLIST_NAME_UNION struct nlist has an n_un member, not n_name.
|
||||
LINUX_LDAV_FILE [__linux__]: File containing load averages.
|
||||
|
||||
Specific system predefines this file uses, aside from setting
|
||||
default values if not emacs:
|
||||
|
||||
apollo
|
||||
BSD Real BSD, not just BSD-like.
|
||||
convex
|
||||
DGUX
|
||||
eunice UNIX emulator under VMS.
|
||||
hpux
|
||||
NeXT
|
||||
sgi
|
||||
sequent Sequent Dynix 3.x.x (BSD)
|
||||
_SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV)
|
||||
sony_news NEWS-OS (works at least for 4.1C)
|
||||
UMAX
|
||||
UMAX4_3
|
||||
VMS
|
||||
__linux__ Linux: assumes /proc filesystem mounted.
|
||||
Support from Michael K. Johnson.
|
||||
__NetBSD__ NetBSD: assumes /kern filesystem mounted.
|
||||
|
||||
In addition, to avoid nesting many #ifdefs, we internally set
|
||||
LDAV_DONE to indicate that the load average has been computed.
|
||||
|
||||
We also #define LDAV_PRIVILEGED if a program will require
|
||||
special installation to be able to call getloadavg. */
|
||||
|
||||
/* This should always be first. */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Both the Emacs and non-Emacs sections want this. Some
|
||||
configuration files' definitions for the LOAD_AVE_CVT macro (like
|
||||
sparc.h's) use macros like FSCALE, defined here. */
|
||||
#ifdef unix
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Exclude all the code except the test program at the end
|
||||
if the system has its own `getloadavg' function.
|
||||
|
||||
The declaration of `errno' is needed by the test program
|
||||
as well as the function itself, so it comes first. */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETLOADAVG
|
||||
|
||||
|
||||
/* The existing Emacs configuration files define a macro called
|
||||
LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
|
||||
returns the load average multiplied by 100. What we actually want
|
||||
is a macro called LDAV_CVT, which returns the load average as an
|
||||
unmultiplied double.
|
||||
|
||||
For backwards compatibility, we'll define LDAV_CVT in terms of
|
||||
LOAD_AVE_CVT, but future machine config files should just define
|
||||
LDAV_CVT directly. */
|
||||
|
||||
#if !defined(LDAV_CVT) && defined(LOAD_AVE_CVT)
|
||||
#define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
|
||||
#endif
|
||||
|
||||
#if !defined (BSD) && defined (ultrix)
|
||||
/* Ultrix behaves like BSD on Vaxen. */
|
||||
#define BSD
|
||||
#endif
|
||||
|
||||
#ifdef NeXT
|
||||
/* NeXT in the 2.{0,1,2} releases defines BSD in <sys/param.h>, which
|
||||
conflicts with the definition understood in this file, that this
|
||||
really is BSD. */
|
||||
#undef BSD
|
||||
|
||||
/* NeXT defines FSCALE in <sys/param.h>. However, we take FSCALE being
|
||||
defined to mean that the nlist method should be used, which is not true. */
|
||||
#undef FSCALE
|
||||
#endif
|
||||
|
||||
/* Set values that are different from the defaults, which are
|
||||
set a little farther down with #ifndef. */
|
||||
|
||||
|
||||
/* Some shorthands. */
|
||||
|
||||
#if defined (HPUX) && !defined (hpux)
|
||||
#define hpux
|
||||
#endif
|
||||
|
||||
#if defined(hp300) && !defined(hpux)
|
||||
#define MORE_BSD
|
||||
#endif
|
||||
|
||||
#if defined(ultrix) && defined(mips)
|
||||
#define decstation
|
||||
#endif
|
||||
|
||||
#if defined(sun) && defined(SVR4)
|
||||
#define SUNOS_5
|
||||
#endif
|
||||
|
||||
#if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
|
||||
#define OSF_ALPHA
|
||||
#include <sys/table.h>
|
||||
#endif
|
||||
|
||||
#if defined (__osf__) && (defined (mips) || defined (__mips__))
|
||||
#define OSF_MIPS
|
||||
#include <sys/table.h>
|
||||
#endif
|
||||
|
||||
/* UTek's /bin/cc on the 4300 has no architecture specific cpp define by
|
||||
default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>. Combine
|
||||
that with a couple of other things and we'll have a unique match. */
|
||||
#if !defined (tek4300) && defined (unix) && defined (m68k) && defined (mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES)
|
||||
#define tek4300 /* Define by emacs, but not by other users. */
|
||||
#endif
|
||||
|
||||
|
||||
/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */
|
||||
#ifndef LOAD_AVE_TYPE
|
||||
|
||||
#ifdef MORE_BSD
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef sun
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef decstation
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef _SEQUENT_
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef sgi
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef SVR4
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef sony_news
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef sequent
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef OSF_ALPHA
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#if defined (ardent) && defined (titan)
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef tek4300
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#if defined(alliant) && defined(i860) /* Alliant FX/2800 */
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#ifdef convex
|
||||
#define LOAD_AVE_TYPE double
|
||||
#ifndef LDAV_CVT
|
||||
#define LDAV_CVT(n) (n)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* No LOAD_AVE_TYPE. */
|
||||
|
||||
#ifdef OSF_ALPHA
|
||||
/* <sys/param.h> defines an incorrect value for FSCALE on Alpha OSF/1,
|
||||
according to ghazi@noc.rutgers.edu. */
|
||||
#undef FSCALE
|
||||
#define FSCALE 1024.0
|
||||
#endif
|
||||
|
||||
#if defined(alliant) && defined(i860) /* Alliant FX/2800 */
|
||||
/* <sys/param.h> defines an incorrect value for FSCALE on an
|
||||
Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu. */
|
||||
#undef FSCALE
|
||||
#define FSCALE 100.0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FSCALE
|
||||
|
||||
/* SunOS and some others define FSCALE in sys/param.h. */
|
||||
|
||||
#ifdef MORE_BSD
|
||||
#define FSCALE 2048.0
|
||||
#endif
|
||||
|
||||
#if defined(MIPS) || defined(SVR4) || defined(decstation)
|
||||
#define FSCALE 256
|
||||
#endif
|
||||
|
||||
#if defined (sgi) || defined (sequent)
|
||||
/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
|
||||
above under #ifdef MIPS. But we want the sgi value. */
|
||||
#undef FSCALE
|
||||
#define FSCALE 1000.0
|
||||
#endif
|
||||
|
||||
#if defined (ardent) && defined (titan)
|
||||
#define FSCALE 65536.0
|
||||
#endif
|
||||
|
||||
#ifdef tek4300
|
||||
#define FSCALE 100.0
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#define FSCALE 65536.0
|
||||
#endif
|
||||
|
||||
#endif /* Not FSCALE. */
|
||||
|
||||
#if !defined (LDAV_CVT) && defined (FSCALE)
|
||||
#define LDAV_CVT(n) (((double) (n)) / FSCALE)
|
||||
#endif
|
||||
|
||||
/* VAX C can't handle multi-line #ifs, or lines longer that 256 characters. */
|
||||
#ifndef NLIST_STRUCT
|
||||
|
||||
#ifdef MORE_BSD
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef sun
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef decstation
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef hpux
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_) || defined (sequent)
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef sgi
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef SVR4
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef sony_news
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef OSF_ALPHA
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#if defined (ardent) && defined (titan)
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef tek4300
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef butterfly
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#if defined(alliant) && defined(i860) /* Alliant FX/2800 */
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#endif /* defined (NLIST_STRUCT) */
|
||||
|
||||
|
||||
#if defined(sgi) || (defined(mips) && !defined(BSD))
|
||||
#define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined (KERNEL_FILE) && defined (sequent)
|
||||
#define KERNEL_FILE "/dynix"
|
||||
#endif
|
||||
|
||||
#if !defined (KERNEL_FILE) && defined (hpux)
|
||||
#define KERNEL_FILE "/hp-ux"
|
||||
#endif
|
||||
|
||||
#if !defined(KERNEL_FILE) && (defined(_SEQUENT_) || defined(MIPS) || defined(SVR4) || defined(ISC) || defined (sgi) || defined(SVR4) || (defined (ardent) && defined (titan)))
|
||||
#define KERNEL_FILE "/unix"
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined (LDAV_SYMBOL) && defined (alliant)
|
||||
#define LDAV_SYMBOL "_Loadavg"
|
||||
#endif
|
||||
|
||||
#if !defined(LDAV_SYMBOL) && ((defined(hpux) && !defined(hp9000s300)) || defined(_SEQUENT_) || defined(SVR4) || defined(ISC) || defined(sgi) || (defined (ardent) && defined (titan)) || defined (_AIX))
|
||||
#define LDAV_SYMBOL "avenrun"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* LOAD_AVE_TYPE should only get defined if we're going to use the
|
||||
nlist method. */
|
||||
#if !defined(LOAD_AVE_TYPE) && (defined(BSD) || defined(LDAV_CVT) || defined(KERNEL_FILE) || defined(LDAV_SYMBOL))
|
||||
#define LOAD_AVE_TYPE double
|
||||
#endif
|
||||
|
||||
#ifdef LOAD_AVE_TYPE
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef NLIST_STRUCT
|
||||
#include <a.out.h>
|
||||
#else /* NLIST_STRUCT */
|
||||
#include <nlist.h>
|
||||
#endif /* NLIST_STRUCT */
|
||||
|
||||
#ifdef SUNOS_5
|
||||
#include <fcntl.h>
|
||||
#include <kvm.h>
|
||||
#endif
|
||||
|
||||
#ifndef KERNEL_FILE
|
||||
#define KERNEL_FILE "/vmunix"
|
||||
#endif /* KERNEL_FILE */
|
||||
|
||||
#ifndef LDAV_SYMBOL
|
||||
#define LDAV_SYMBOL "_avenrun"
|
||||
#endif /* LDAV_SYMBOL */
|
||||
|
||||
#else /* VMS */
|
||||
|
||||
#ifndef eunice
|
||||
#include <iodef.h>
|
||||
#include <descrip.h>
|
||||
#else /* eunice */
|
||||
#include <vms/iodef.h>
|
||||
#endif /* eunice */
|
||||
#endif /* VMS */
|
||||
|
||||
#ifndef LDAV_CVT
|
||||
#define LDAV_CVT(n) ((double) (n))
|
||||
#endif /* !LDAV_CVT */
|
||||
|
||||
#endif /* LOAD_AVE_TYPE */
|
||||
|
||||
#ifdef NeXT
|
||||
#ifdef HAVE_MACH_MACH_H
|
||||
#include <mach/mach.h>
|
||||
#else
|
||||
#include <mach.h>
|
||||
#endif
|
||||
#endif /* NeXT */
|
||||
|
||||
#ifdef sgi
|
||||
#include <sys/sysmp.h>
|
||||
#endif /* sgi */
|
||||
|
||||
#ifdef UMAX
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#ifdef UMAX_43
|
||||
#include <machine/cpu.h>
|
||||
#include <inq_stats/statistics.h>
|
||||
#include <inq_stats/sysstats.h>
|
||||
#include <inq_stats/cpustats.h>
|
||||
#include <inq_stats/procstats.h>
|
||||
#else /* Not UMAX_43. */
|
||||
#include <sys/sysdefs.h>
|
||||
#include <sys/statistics.h>
|
||||
#include <sys/sysstats.h>
|
||||
#include <sys/cpudefs.h>
|
||||
#include <sys/cpustats.h>
|
||||
#include <sys/procstats.h>
|
||||
#endif /* Not UMAX_43. */
|
||||
#endif /* UMAX */
|
||||
|
||||
#ifdef DGUX
|
||||
#include <sys/dg_sys_info.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
/* Avoid static vars inside a function since in HPUX they dump as pure. */
|
||||
|
||||
#ifdef NeXT
|
||||
static processor_set_t default_set;
|
||||
static int getloadavg_initialized;
|
||||
#endif /* NeXT */
|
||||
|
||||
#ifdef UMAX
|
||||
static unsigned int cpus = 0;
|
||||
static unsigned int samples;
|
||||
#endif /* UMAX */
|
||||
|
||||
#ifdef DGUX
|
||||
static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
|
||||
#endif /* DGUX */
|
||||
|
||||
#ifdef LOAD_AVE_TYPE
|
||||
/* File descriptor open to /dev/kmem or VMS load ave driver. */
|
||||
static int channel;
|
||||
/* Nonzero iff channel is valid. */
|
||||
static int getloadavg_initialized;
|
||||
/* Offset in kmem to seek to read load average, or 0 means invalid. */
|
||||
static long offset;
|
||||
|
||||
#if !defined(VMS) && !defined(sgi)
|
||||
static struct nlist nl[2];
|
||||
#endif /* Not VMS or sgi */
|
||||
|
||||
#ifdef SUNOS_5
|
||||
static kvm_t *kd;
|
||||
#endif /* SUNOS_5 */
|
||||
|
||||
#endif /* LOAD_AVE_TYPE */
|
||||
|
||||
/* Put the 1 minute, 5 minute and 15 minute load averages
|
||||
into the first NELEM elements of LOADAVG.
|
||||
Return the number written (never more than 3, but may be less than NELEM),
|
||||
or -1 if an error occurred. */
|
||||
|
||||
int
|
||||
getloadavg (loadavg, nelem)
|
||||
double loadavg[];
|
||||
int nelem;
|
||||
{
|
||||
int elem = 0; /* Return value. */
|
||||
|
||||
#ifdef NO_GET_LOAD_AVG
|
||||
#define LDAV_DONE
|
||||
/* Set errno to zero to indicate that there was no particular error;
|
||||
this function just can't work at all on this system. */
|
||||
errno = 0;
|
||||
elem = -1;
|
||||
#endif
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (__linux__)
|
||||
#define LDAV_DONE
|
||||
#undef LOAD_AVE_TYPE
|
||||
|
||||
#ifndef LINUX_LDAV_FILE
|
||||
#define LINUX_LDAV_FILE "/proc/loadavg"
|
||||
#endif
|
||||
|
||||
char ldavgbuf[40];
|
||||
double load_ave[3];
|
||||
int fd, count;
|
||||
|
||||
fd = open (LINUX_LDAV_FILE, O_RDONLY);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
count = read (fd, ldavgbuf, 40);
|
||||
(void) close (fd);
|
||||
if (count <= 0)
|
||||
return -1;
|
||||
|
||||
count = sscanf (ldavgbuf, "%lf %lf %lf",
|
||||
&load_ave[0], &load_ave[1], &load_ave[2]);
|
||||
if (count < 1)
|
||||
return -1;
|
||||
|
||||
for (elem = 0; elem < nelem && elem < count; elem++)
|
||||
loadavg[elem] = load_ave[elem];
|
||||
|
||||
return elem;
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (__NetBSD__)
|
||||
#define LDAV_DONE
|
||||
#undef LOAD_AVE_TYPE
|
||||
|
||||
#ifndef NETBSD_LDAV_FILE
|
||||
#define NETBSD_LDAV_FILE "/kern/loadavg"
|
||||
#endif
|
||||
|
||||
unsigned long int load_ave[3], scale;
|
||||
int count;
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen (NETBSD_LDAV_FILE, "r");
|
||||
if (fp == NULL)
|
||||
return -1;
|
||||
count = fscanf (fp, "%lu %lu %lu %lu\n",
|
||||
&load_ave[0], &load_ave[1], &load_ave[2],
|
||||
&scale);
|
||||
(void) fclose (fp);
|
||||
if (count != 4)
|
||||
return -1;
|
||||
|
||||
for (elem = 0; elem < nelem; elem++)
|
||||
loadavg[elem] = (double) load_ave[elem] / (double) scale;
|
||||
|
||||
return elem;
|
||||
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (NeXT)
|
||||
#define LDAV_DONE
|
||||
/* The NeXT code was adapted from iscreen 3.2. */
|
||||
|
||||
host_t host;
|
||||
struct processor_set_basic_info info;
|
||||
unsigned info_count;
|
||||
|
||||
/* We only know how to get the 1-minute average for this system,
|
||||
so even if the caller asks for more than 1, we only return 1. */
|
||||
|
||||
if (!getloadavg_initialized)
|
||||
{
|
||||
if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
|
||||
getloadavg_initialized = 1;
|
||||
}
|
||||
|
||||
if (getloadavg_initialized)
|
||||
{
|
||||
info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
|
||||
if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
|
||||
(processor_set_info_t) &info, &info_count)
|
||||
!= KERN_SUCCESS)
|
||||
getloadavg_initialized = 0;
|
||||
else
|
||||
{
|
||||
if (nelem > 0)
|
||||
loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!getloadavg_initialized)
|
||||
return -1;
|
||||
#endif /* NeXT */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (UMAX)
|
||||
#define LDAV_DONE
|
||||
/* UMAX 4.2, which runs on the Encore Multimax multiprocessor, does not
|
||||
have a /dev/kmem. Information about the workings of the running kernel
|
||||
can be gathered with inq_stats system calls.
|
||||
We only know how to get the 1-minute average for this system. */
|
||||
|
||||
struct proc_summary proc_sum_data;
|
||||
struct stat_descr proc_info;
|
||||
double load;
|
||||
register unsigned int i, j;
|
||||
|
||||
if (cpus == 0)
|
||||
{
|
||||
register unsigned int c, i;
|
||||
struct cpu_config conf;
|
||||
struct stat_descr desc;
|
||||
|
||||
desc.sd_next = 0;
|
||||
desc.sd_subsys = SUBSYS_CPU;
|
||||
desc.sd_type = CPUTYPE_CONFIG;
|
||||
desc.sd_addr = (char *) &conf;
|
||||
desc.sd_size = sizeof conf;
|
||||
|
||||
if (inq_stats (1, &desc))
|
||||
return -1;
|
||||
|
||||
c = 0;
|
||||
for (i = 0; i < conf.config_maxclass; ++i)
|
||||
{
|
||||
struct class_stats stats;
|
||||
bzero ((char *) &stats, sizeof stats);
|
||||
|
||||
desc.sd_type = CPUTYPE_CLASS;
|
||||
desc.sd_objid = i;
|
||||
desc.sd_addr = (char *) &stats;
|
||||
desc.sd_size = sizeof stats;
|
||||
|
||||
if (inq_stats (1, &desc))
|
||||
return -1;
|
||||
|
||||
c += stats.class_numcpus;
|
||||
}
|
||||
cpus = c;
|
||||
samples = cpus < 2 ? 3 : (2 * cpus / 3);
|
||||
}
|
||||
|
||||
proc_info.sd_next = 0;
|
||||
proc_info.sd_subsys = SUBSYS_PROC;
|
||||
proc_info.sd_type = PROCTYPE_SUMMARY;
|
||||
proc_info.sd_addr = (char *) &proc_sum_data;
|
||||
proc_info.sd_size = sizeof (struct proc_summary);
|
||||
proc_info.sd_sizeused = 0;
|
||||
|
||||
if (inq_stats (1, &proc_info) != 0)
|
||||
return -1;
|
||||
|
||||
load = proc_sum_data.ps_nrunnable;
|
||||
j = 0;
|
||||
for (i = samples - 1; i > 0; --i)
|
||||
{
|
||||
load += proc_sum_data.ps_nrun[j];
|
||||
if (j++ == PS_NRUNSIZE)
|
||||
j = 0;
|
||||
}
|
||||
|
||||
if (nelem > 0)
|
||||
loadavg[elem++] = load / samples / cpus;
|
||||
#endif /* UMAX */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (DGUX)
|
||||
#define LDAV_DONE
|
||||
/* This call can return -1 for an error, but with good args
|
||||
it's not supposed to fail. The first argument is for no
|
||||
apparent reason of type `long int *'. */
|
||||
dg_sys_info ((long int *) &load_info,
|
||||
DG_SYS_INFO_LOAD_INFO_TYPE,
|
||||
DG_SYS_INFO_LOAD_VERSION_0);
|
||||
|
||||
if (nelem > 0)
|
||||
loadavg[elem++] = load_info.one_minute;
|
||||
if (nelem > 1)
|
||||
loadavg[elem++] = load_info.five_minute;
|
||||
if (nelem > 2)
|
||||
loadavg[elem++] = load_info.fifteen_minute;
|
||||
#endif /* DGUX */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (apollo)
|
||||
#define LDAV_DONE
|
||||
/* Apollo code from lisch@mentorg.com (Ray Lischner).
|
||||
|
||||
This system call is not documented. The load average is obtained as
|
||||
three long integers, for the load average over the past minute,
|
||||
five minutes, and fifteen minutes. Each value is a scaled integer,
|
||||
with 16 bits of integer part and 16 bits of fraction part.
|
||||
|
||||
I'm not sure which operating system first supported this system call,
|
||||
but I know that SR10.2 supports it. */
|
||||
|
||||
extern void proc1_$get_loadav ();
|
||||
unsigned long load_ave[3];
|
||||
|
||||
proc1_$get_loadav (load_ave);
|
||||
|
||||
if (nelem > 0)
|
||||
loadavg[elem++] = load_ave[0] / 65536.0;
|
||||
if (nelem > 1)
|
||||
loadavg[elem++] = load_ave[1] / 65536.0;
|
||||
if (nelem > 2)
|
||||
loadavg[elem++] = load_ave[2] / 65536.0;
|
||||
#endif /* apollo */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (OSF_MIPS)
|
||||
#define LDAV_DONE
|
||||
|
||||
struct tbl_loadavg load_ave;
|
||||
table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
|
||||
loadavg[elem++]
|
||||
= (load_ave.tl_lscale == 0
|
||||
? load_ave.tl_avenrun.d[0]
|
||||
: (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
|
||||
#endif /* OSF_MIPS */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined(MSDOS)
|
||||
#define LDAV_DONE
|
||||
|
||||
/* A faithful emulation is going to have to be saved for a rainy day. */
|
||||
for ( ; elem < nelem; elem++)
|
||||
{
|
||||
loadavg[elem] = 0.0;
|
||||
}
|
||||
#endif /* MSDOS */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (OSF_ALPHA)
|
||||
#define LDAV_DONE
|
||||
|
||||
struct tbl_loadavg load_ave;
|
||||
table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
|
||||
for (elem = 0; elem < nelem; elem++)
|
||||
loadavg[elem]
|
||||
= (load_ave.tl_lscale == 0
|
||||
? load_ave.tl_avenrun.d[elem]
|
||||
: (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
|
||||
#endif /* OSF_ALPHA */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (VMS)
|
||||
/* VMS specific code -- read from the Load Ave driver. */
|
||||
|
||||
LOAD_AVE_TYPE load_ave[3];
|
||||
static int getloadavg_initialized = 0;
|
||||
#ifdef eunice
|
||||
struct
|
||||
{
|
||||
int dsc$w_length;
|
||||
char *dsc$a_pointer;
|
||||
} descriptor;
|
||||
#endif
|
||||
|
||||
/* Ensure that there is a channel open to the load ave device. */
|
||||
if (!getloadavg_initialized)
|
||||
{
|
||||
/* Attempt to open the channel. */
|
||||
#ifdef eunice
|
||||
descriptor.dsc$w_length = 18;
|
||||
descriptor.dsc$a_pointer = "$$VMS_LOAD_AVERAGE";
|
||||
#else
|
||||
$DESCRIPTOR (descriptor, "LAV0:");
|
||||
#endif
|
||||
if (sys$assign (&descriptor, &channel, 0, 0) & 1)
|
||||
getloadavg_initialized = 1;
|
||||
}
|
||||
|
||||
/* Read the load average vector. */
|
||||
if (getloadavg_initialized
|
||||
&& !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
|
||||
load_ave, 12, 0, 0, 0, 0) & 1))
|
||||
{
|
||||
sys$dassgn (channel);
|
||||
getloadavg_initialized = 0;
|
||||
}
|
||||
|
||||
if (!getloadavg_initialized)
|
||||
return -1;
|
||||
#endif /* VMS */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined(LOAD_AVE_TYPE) && !defined(VMS)
|
||||
|
||||
/* UNIX-specific code -- read the average from /dev/kmem. */
|
||||
|
||||
#define LDAV_PRIVILEGED /* This code requires special installation. */
|
||||
|
||||
LOAD_AVE_TYPE load_ave[3];
|
||||
|
||||
/* Get the address of LDAV_SYMBOL. */
|
||||
if (offset == 0)
|
||||
{
|
||||
#ifndef sgi
|
||||
#ifndef NLIST_STRUCT
|
||||
strcpy (nl[0].n_name, LDAV_SYMBOL);
|
||||
strcpy (nl[1].n_name, "");
|
||||
#else /* NLIST_STRUCT */
|
||||
#ifdef NLIST_NAME_UNION
|
||||
nl[0].n_un.n_name = LDAV_SYMBOL;
|
||||
nl[1].n_un.n_name = 0;
|
||||
#else /* not NLIST_NAME_UNION */
|
||||
nl[0].n_name = LDAV_SYMBOL;
|
||||
nl[1].n_name = 0;
|
||||
#endif /* not NLIST_NAME_UNION */
|
||||
#endif /* NLIST_STRUCT */
|
||||
|
||||
#ifndef SUNOS_5
|
||||
if (
|
||||
#if !(defined (_AIX) && !defined (ps2))
|
||||
nlist (KERNEL_FILE, nl)
|
||||
#else /* _AIX */
|
||||
knlist (nl, 1, sizeof (nl[0]))
|
||||
#endif
|
||||
>= 0)
|
||||
/* Omit "&& nl[0].n_type != 0 " -- it breaks on Sun386i. */
|
||||
{
|
||||
#ifdef FIXUP_KERNEL_SYMBOL_ADDR
|
||||
FIXUP_KERNEL_SYMBOL_ADDR (nl);
|
||||
#endif
|
||||
offset = nl[0].n_value;
|
||||
}
|
||||
#endif /* !SUNOS_5 */
|
||||
#else /* sgi */
|
||||
int ldav_off;
|
||||
|
||||
ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
|
||||
if (ldav_off != -1)
|
||||
offset = (long) ldav_off & 0x7fffffff;
|
||||
#endif /* sgi */
|
||||
}
|
||||
|
||||
/* Make sure we have /dev/kmem open. */
|
||||
if (!getloadavg_initialized)
|
||||
{
|
||||
#ifndef SUNOS_5
|
||||
channel = open ("/dev/kmem", 0);
|
||||
if (channel >= 0)
|
||||
{
|
||||
/* Set the channel to close on exec, so it does not
|
||||
litter any child's descriptor table. */
|
||||
#ifdef FD_SETFD
|
||||
#ifndef FD_CLOEXEC
|
||||
#define FD_CLOEXEC 1
|
||||
#endif
|
||||
(void) fcntl (channel, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
getloadavg_initialized = 1;
|
||||
}
|
||||
#else /* SUNOS_5 */
|
||||
/* We pass 0 for the kernel, corefile, and swapfile names
|
||||
to use the currently running kernel. */
|
||||
kd = kvm_open (0, 0, 0, O_RDONLY, 0);
|
||||
if (kd != 0)
|
||||
{
|
||||
/* nlist the currently running kernel. */
|
||||
kvm_nlist (kd, nl);
|
||||
offset = nl[0].n_value;
|
||||
getloadavg_initialized = 1;
|
||||
}
|
||||
#endif /* SUNOS_5 */
|
||||
}
|
||||
|
||||
/* If we can, get the load average values. */
|
||||
if (offset && getloadavg_initialized)
|
||||
{
|
||||
/* Try to read the load. */
|
||||
#ifndef SUNOS_5
|
||||
if (lseek (channel, offset, 0) == -1L
|
||||
|| read (channel, (char *) load_ave, sizeof (load_ave))
|
||||
!= sizeof (load_ave))
|
||||
{
|
||||
close (channel);
|
||||
getloadavg_initialized = 0;
|
||||
}
|
||||
#else /* SUNOS_5 */
|
||||
if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
|
||||
!= sizeof (load_ave))
|
||||
{
|
||||
kvm_close (kd);
|
||||
getloadavg_initialized = 0;
|
||||
}
|
||||
#endif /* SUNOS_5 */
|
||||
}
|
||||
|
||||
if (offset == 0 || !getloadavg_initialized)
|
||||
return -1;
|
||||
#endif /* LOAD_AVE_TYPE and not VMS */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */
|
||||
if (nelem > 0)
|
||||
loadavg[elem++] = LDAV_CVT (load_ave[0]);
|
||||
if (nelem > 1)
|
||||
loadavg[elem++] = LDAV_CVT (load_ave[1]);
|
||||
if (nelem > 2)
|
||||
loadavg[elem++] = LDAV_CVT (load_ave[2]);
|
||||
|
||||
#define LDAV_DONE
|
||||
#endif /* !LDAV_DONE && LOAD_AVE_TYPE */
|
||||
|
||||
#ifdef LDAV_DONE
|
||||
return elem;
|
||||
#else
|
||||
/* Set errno to zero to indicate that there was no particular error;
|
||||
this function just can't work at all on this system. */
|
||||
errno = 0;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* ! HAVE_GETLOADAVG */
|
||||
|
||||
#ifdef TEST
|
||||
void
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int naptime = 0;
|
||||
|
||||
if (argc > 1)
|
||||
naptime = atoi (argv[1]);
|
||||
|
||||
while (1)
|
||||
{
|
||||
double avg[3];
|
||||
int loads;
|
||||
|
||||
errno = 0; /* Don't be misled if it doesn't set errno. */
|
||||
loads = getloadavg (avg, 3);
|
||||
if (loads == -1)
|
||||
{
|
||||
perror ("Error getting load average");
|
||||
exit (1);
|
||||
}
|
||||
if (loads > 0)
|
||||
printf ("1-minute: %f ", avg[0]);
|
||||
if (loads > 1)
|
||||
printf ("5-minute: %f ", avg[1]);
|
||||
if (loads > 2)
|
||||
printf ("15-minute: %f ", avg[2]);
|
||||
if (loads > 0)
|
||||
putchar ('\n');
|
||||
|
||||
if (naptime == 0)
|
||||
break;
|
||||
sleep (naptime);
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
#endif /* TEST */
|
||||
481
glob/COPYING.LIB
Normal file
481
glob/COPYING.LIB
Normal file
@@ -0,0 +1,481 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
481
glob/COPYING.LIB.old
Executable file
481
glob/COPYING.LIB.old
Executable file
@@ -0,0 +1,481 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
141
glob/ChangeLog
Normal file
141
glob/ChangeLog
Normal file
@@ -0,0 +1,141 @@
|
||||
Mon May 13 12:03:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c [_AMIGA]: Don't include <pwd.h>.
|
||||
(glob): Remove bogus & in call to globfree.
|
||||
[_AMIGA]: Use AmigaDOS file name conventions.
|
||||
|
||||
Thu May 9 09:17:46 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob/SMakefile, posix/glob/SCOPTIONS, posix/glob/Makefile.ami:
|
||||
New files, AmigaDOS support from Aaron Digulla.
|
||||
* posix/Makefile (glob.tar): Add AmigaDOS support files.
|
||||
|
||||
Tue Apr 2 21:27:01 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* posix/glob.c (glob_pattern_p): Avoid scanning past eos if
|
||||
the pattern ends with a backslash and quoting is enabled.
|
||||
* posix/fnmatch.c (fnmatch): Likewise; return FNM_NOMATCH for such
|
||||
patterns.
|
||||
|
||||
Thu Mar 14 06:01:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (glob): In GLOB_BRACE brace expansion, fix buffer size
|
||||
calculation to include trailing invariant portion. Don't use alloca;
|
||||
instead use a dynamic auto array for GCC, malloc for non-GCC.
|
||||
Handle nested braces properly.
|
||||
|
||||
Fri Mar 1 10:09:46 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c: Use canonical code from autoconf manual for dirent
|
||||
include.
|
||||
[_D_NAMLEN]: Redefine NAMLEN using this.
|
||||
(glob_in_dir): Use NAMLEN macro.
|
||||
|
||||
Fri Jan 19 13:28:59 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (glob): Use prototype in getlogin decl.
|
||||
|
||||
Thu Jan 18 00:32:43 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (_GNU_SOURCE): Define if undefined, so glob.h
|
||||
defines GNU extensions.
|
||||
* posix/fnmatch.c: Likewise.
|
||||
|
||||
Fri Jan 12 13:40:01 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (glob): Add parens in glob call flags arg for
|
||||
GLOB_BRACE case.
|
||||
|
||||
Thu Dec 14 02:28:22 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (glob_in_dir): Cast result of opendir to __ptr_t,
|
||||
and cast STREAM to DIR * before passing to readdir and closedir.
|
||||
|
||||
Mon Dec 11 20:07:54 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c [! STDC_HEADERS]: Declare getenv.
|
||||
(glob): Avoid using function as value.
|
||||
|
||||
Fri Dec 8 13:04:51 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c: Implement new options GLOB_ALTDIRFUNC, GLOB_BRACE,
|
||||
GLOB_TILDE, GLOB_NOMAGIC.
|
||||
(glob): Use stat instead of lstat to determine directoriness.
|
||||
* posix/glob.h (GLOB_ALTDIRFUNC, GLOB_BRACE, GLOB_NOMAGIC, GLOB_TILDE):
|
||||
New flag bits.
|
||||
(__GLOB_FLAGS): Include them.
|
||||
(glob_t): New members gl_closedir, gl_readdir, gl_opendir, gl_lstat,
|
||||
gl_stat.
|
||||
|
||||
Mon Sep 11 14:00:14 1995 Roland McGrath <roland@whiz-bang.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (glob): Comment fix.
|
||||
|
||||
Wed Aug 30 16:44:55 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (glob): Use realloc to extend strings for GLOB_MARK
|
||||
slash.
|
||||
(glob_in_dir): Don't allocate extra byte here.
|
||||
|
||||
Mon Aug 7 14:04:36 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (glob_in_dir): Allocate GLOB_MARK byte in case when
|
||||
(NFOUND == 0 && (FLAGS & GLOB_NOCHECK)).
|
||||
|
||||
Sat Apr 29 15:46:57 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (S_ISDIR): Define if undefined.
|
||||
|
||||
Tue Apr 25 17:17:19 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob.c (glob): If GLOB_MARK set, stat names to find
|
||||
directories and append slashes to them in final pass before
|
||||
sorting.
|
||||
(glob_in_dir): If GLOB_MARK set, just allocate the extra char for the
|
||||
slash; never append it here.
|
||||
|
||||
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob/configure.bat: Fixes from DJ.
|
||||
|
||||
Wed Feb 22 00:44:41 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob/configure.in: Put AC_ISC_POSIX before AC_CONST.
|
||||
|
||||
Sun Feb 5 17:59:53 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* malloc/malloc.c (__malloc_extra_blocks): New variable.
|
||||
(malloc): When getting more core, get __malloc_extra_blocks extra;
|
||||
put the new block at the end of the free list and let the next loop
|
||||
iteration use the initial portion of it.
|
||||
* malloc/free.c (_free_internal): Account for twice
|
||||
__malloc_extra_blocks in deciding if we have so much extra memory
|
||||
we should return it to the system.
|
||||
* malloc/malloc.h (__malloc_extra_blocks): Declare it.
|
||||
* posix/glob.c (prefix_array, glob_pattern_p): Remove gratuitous
|
||||
const in parameter decl.
|
||||
|
||||
Fri Jan 27 17:53:49 1995 Jim Meyering (meyering@comco.com)
|
||||
|
||||
* posix/fnmatch.c: Declare errno if it's not defined.
|
||||
That's simpler than testing #if !defined(__GNU_LIBRARY__)
|
||||
&& !defined(STDC_HEADERS).
|
||||
|
||||
Thu Jan 26 00:02:01 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* io/ftw.c: Avoid `ret' as variable name.
|
||||
* posix/glob.c: Likewise.
|
||||
|
||||
Wed Jan 25 00:45:56 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob/configure.in: Put AC_AIX and AC_MINIX early, before
|
||||
any compile tests.
|
||||
|
||||
Mon Jan 16 15:49:07 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob/Makefile.in: Remove config.h and config.log.
|
||||
|
||||
Sun Jan 15 06:56:47 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* posix/glob/configure.in: Add AC_CONST check.
|
||||
|
||||
69
glob/Makefile.ami
Normal file
69
glob/Makefile.ami
Normal file
@@ -0,0 +1,69 @@
|
||||
# Makefile for standalone distribution of libglob.a (fnmatch, glob).
|
||||
|
||||
# Copyright (C) 1991, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library 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
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
# Ultrix 2.2 make doesn't expand the value of VPATH.
|
||||
VPATH = /glob/
|
||||
# This must repeat the value, because configure will remove `VPATH = .'.
|
||||
srcdir = /glob/
|
||||
|
||||
CC = sc
|
||||
RM = delete
|
||||
CPPFLAGS =
|
||||
CFLAGS =
|
||||
|
||||
# Information determined by configure.
|
||||
DEFS = Define HAVE_HEADER_STDC Define HAVE_UNISTD_H Define HAVE_STRING_H \
|
||||
Define HAVE_DIRENT_H
|
||||
|
||||
# How to invoke ar.
|
||||
AR = join
|
||||
ARFLAGS = as
|
||||
|
||||
# How to invoke ranlib.
|
||||
RANLIB = ;
|
||||
|
||||
.PHONY: all
|
||||
all: glob.lib
|
||||
|
||||
glob.lib : glob.o fnmatch.o
|
||||
$(AR) $(ARFLAGS) $@ glob.o fnmatch.o
|
||||
$(RANLIB) $@
|
||||
|
||||
# For some reason, Unix make wants the dependencies on the source files.
|
||||
# Otherwise it refuses to use an implicit rule!
|
||||
# And, get this: it doesn't work to use $(srcdir)foo.c!!
|
||||
glob.o: $(srcdir)glob.h $(srcdir)fnmatch.h glob.c
|
||||
fnmatch.o: $(srcdir)fnmatch.h fnmatch.c
|
||||
|
||||
OUTPUT_OPTION =
|
||||
.c.o:
|
||||
$(CC) IDir "" \
|
||||
$(DEFS) $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
|
||||
.PHONY: clean realclean glob-clean glob-realclean distclean
|
||||
clean glob-clean:
|
||||
-$(RM) glob.lib "#?.o" core
|
||||
distclean glob-realclean: clean
|
||||
-$(RM) TAGS tags Makefile config.status config.h config.log
|
||||
realcean: distclean
|
||||
|
||||
# For inside the C library.
|
||||
glob.tar glob.tar.Z:
|
||||
$(MAKE) -C .. $@
|
||||
66
glob/Makefile.in
Normal file
66
glob/Makefile.in
Normal file
@@ -0,0 +1,66 @@
|
||||
# Makefile for standalone distribution of libglob.a (fnmatch, glob).
|
||||
|
||||
# Copyright (C) 1991, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library 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
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
# Ultrix 2.2 make doesn't expand the value of VPATH.
|
||||
VPATH = @srcdir@
|
||||
# This must repeat the value, because configure will remove `VPATH = .'.
|
||||
srcdir = @srcdir@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
|
||||
# Information determined by configure.
|
||||
DEFS = @DEFS@
|
||||
|
||||
# How to invoke ar.
|
||||
AR = @AR@
|
||||
ARFLAGS = rv
|
||||
|
||||
# How to invoke ranlib.
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
.PHONY: all
|
||||
all: libglob.a
|
||||
|
||||
libglob.a: glob.o fnmatch.o
|
||||
$(AR) $(ARFLAGS) $@ glob.o fnmatch.o
|
||||
$(RANLIB) $@
|
||||
|
||||
# For some reason, Unix make wants the dependencies on the source files.
|
||||
# Otherwise it refuses to use an implicit rule!
|
||||
# And, get this: it doesn't work to use $(srcdir)/foo.c!!
|
||||
glob.o: $(srcdir)/glob.h $(srcdir)/fnmatch.h glob.c
|
||||
fnmatch.o: $(srcdir)/fnmatch.h fnmatch.c
|
||||
|
||||
.c.o:
|
||||
$(CC) -I. -I$(srcdir) -c \
|
||||
$(DEFS) $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
|
||||
.PHONY: clean realclean glob-clean glob-realclean distclean
|
||||
clean glob-clean:
|
||||
-rm -f libglob.a *.o core
|
||||
distclean glob-realclean: clean
|
||||
-rm -f TAGS tags Makefile config.status config.h config.log
|
||||
realcean: distclean
|
||||
|
||||
# For inside the C library.
|
||||
glob.tar glob.tar.Z:
|
||||
$(MAKE) -C .. $@
|
||||
13
glob/SCOPTIONS
Normal file
13
glob/SCOPTIONS
Normal file
@@ -0,0 +1,13 @@
|
||||
ERRORREXX
|
||||
OPTIMIZE
|
||||
NOVERSION
|
||||
OPTIMIZERTIME
|
||||
OPTIMIZERALIAS
|
||||
DEFINE INCLUDEDIR="include:"
|
||||
DEFINE LIBDIR="lib:"
|
||||
DEFINE NO_ALLOCA
|
||||
DEFINE NO_FLOAT
|
||||
DEFINE NO_ARCHIVES
|
||||
IGNORE=161
|
||||
IGNORE=100
|
||||
STARTUP=cres
|
||||
69
glob/SMakefile
Normal file
69
glob/SMakefile
Normal file
@@ -0,0 +1,69 @@
|
||||
# Makefile for standalone distribution of libglob.a (fnmatch, glob).
|
||||
|
||||
# Copyright (C) 1991, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library 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
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
# Ultrix 2.2 make doesn't expand the value of VPATH.
|
||||
VPATH = /glob/
|
||||
# This must repeat the value, because configure will remove `VPATH = .'.
|
||||
srcdir = /glob/
|
||||
|
||||
CC = sc
|
||||
CPPFLAGS =
|
||||
CFLAGS =
|
||||
MAKE = smake
|
||||
RM = delete
|
||||
|
||||
# Information determined by configure.
|
||||
DEFS = Define HAVE_HEADER_STDC Define HAVE_UNISTD_H Define HAVE_STRING_H \
|
||||
Define HAVE_DIRENT_H
|
||||
|
||||
# How to invoke ar.
|
||||
AR = join
|
||||
ARFLAGS = as
|
||||
|
||||
# How to invoke ranlib.
|
||||
RANLIB = ;
|
||||
|
||||
.PHONY: all
|
||||
all: glob.lib
|
||||
|
||||
glob.lib : glob.o fnmatch.o
|
||||
$(AR) $(ARFLAGS) $@ glob.o fnmatch.o
|
||||
$(RANLIB) $@
|
||||
|
||||
# For some reason, Unix make wants the dependencies on the source files.
|
||||
# Otherwise it refuses to use an implicit rule!
|
||||
# And, get this: it doesn't work to use $(srcdir)foo.c!!
|
||||
glob.o: $(srcdir)glob.h $(srcdir)fnmatch.h glob.c
|
||||
fnmatch.o: $(srcdir)fnmatch.h fnmatch.c
|
||||
|
||||
.c.o:
|
||||
$(CC) IDir "" \
|
||||
$(DEFS) $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||
|
||||
.PHONY: clean realclean glob-clean glob-realclean distclean
|
||||
clean glob-clean:
|
||||
-$(RM) -f glob.lib *.o core
|
||||
distclean glob-realclean: clean
|
||||
-$(RM) -f TAGS tags Makefile config.status config.h config.log
|
||||
realcean: distclean
|
||||
|
||||
# For inside the C library.
|
||||
glob.tar glob.tar.Z:
|
||||
$(MAKE) -C .. $@
|
||||
1664
glob/configure
vendored
Executable file
1664
glob/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
26
glob/configure.bat
Normal file
26
glob/configure.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
@echo off
|
||||
echo Configuring glob for GO32
|
||||
rem This batch file assumes a unix-type "sed" program
|
||||
|
||||
echo # Makefile generated by "configure.bat"> Makefile
|
||||
|
||||
if exist config.sed del config.sed
|
||||
|
||||
echo "s/@srcdir@/./ ">> config.sed
|
||||
echo "s/@CC@/gcc/ ">> config.sed
|
||||
echo "s/@CFLAGS@/-O2 -g/ ">> config.sed
|
||||
echo "s/@CPPFLAGS@/-DHAVE_CONFIG_H -I../ ">> config.sed
|
||||
echo "s/@AR@/ar/ ">> config.sed
|
||||
echo "s/@RANLIB@/ranlib/ ">> config.sed
|
||||
echo "s/@LDFLAGS@// ">> config.sed
|
||||
echo "s/@DEFS@// ">> config.sed
|
||||
echo "s/@ALLOCA@// ">> config.sed
|
||||
echo "s/@LIBS@// ">> config.sed
|
||||
echo "s/@LIBOBJS@// ">> config.sed
|
||||
echo "s/^Makefile *:/_Makefile:/ ">> config.sed
|
||||
echo "s/^config.h *:/_config.h:/ ">> config.sed
|
||||
|
||||
sed -e "s/^\"//" -e "s/\"$//" -e "s/[ ]*$//" config.sed > config2.sed
|
||||
sed -f config2.sed Makefile.in >> Makefile
|
||||
del config.sed
|
||||
del config2.sed
|
||||
19
glob/configure.in
Normal file
19
glob/configure.in
Normal file
@@ -0,0 +1,19 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(fnmatch.c) dnl A distinctive file to look for in srcdir.
|
||||
AC_PREREQ(2.1) dnl Minimum Autoconf version required.
|
||||
AC_PROG_CC
|
||||
AC_CHECK_PROG(AR, ar, ar, ar)
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_CPP dnl Later checks need this.
|
||||
dnl These two want to come early.
|
||||
AC_AIX
|
||||
AC_MINIX
|
||||
AC_ISC_POSIX
|
||||
AC_CONST
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(memory.h unistd.h string.h)
|
||||
AC_HEADER_DIRENT
|
||||
AC_FUNC_CLOSEDIR_VOID
|
||||
AC_FUNC_ALLOCA
|
||||
AC_FUNC_STRCOLL
|
||||
AC_OUTPUT(Makefile)
|
||||
216
glob/fnmatch.c
Normal file
216
glob/fnmatch.c
Normal file
@@ -0,0 +1,216 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/* Enable GNU extensions in fnmatch.h. */
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <fnmatch.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
/* Match STRING against the filename pattern PATTERN, returning zero if
|
||||
it matches, nonzero if not. */
|
||||
int
|
||||
fnmatch (pattern, string, flags)
|
||||
const char *pattern;
|
||||
const char *string;
|
||||
int flags;
|
||||
{
|
||||
register const char *p = pattern, *n = string;
|
||||
register char c;
|
||||
|
||||
/* Note that this evalutes C many times. */
|
||||
#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
c = FOLD (c);
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '?':
|
||||
if (*n == '\0')
|
||||
return FNM_NOMATCH;
|
||||
else if ((flags & FNM_FILE_NAME) && *n == '/')
|
||||
return FNM_NOMATCH;
|
||||
else if ((flags & FNM_PERIOD) && *n == '.' &&
|
||||
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
|
||||
return FNM_NOMATCH;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
if (!(flags & FNM_NOESCAPE))
|
||||
{
|
||||
c = *p++;
|
||||
if (c == '\0')
|
||||
/* Trailing \ loses. */
|
||||
return FNM_NOMATCH;
|
||||
c = FOLD (c);
|
||||
}
|
||||
if (FOLD (*n) != c)
|
||||
return FNM_NOMATCH;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
if ((flags & FNM_PERIOD) && *n == '.' &&
|
||||
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
|
||||
if (((flags & FNM_FILE_NAME) && *n == '/') ||
|
||||
(c == '?' && *n == '\0'))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if (c == '\0')
|
||||
return 0;
|
||||
|
||||
{
|
||||
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
|
||||
c1 = FOLD (c1);
|
||||
for (--p; *n != '\0'; ++n)
|
||||
if ((c == '[' || FOLD (*n) == c1) &&
|
||||
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
|
||||
return 0;
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
|
||||
case '[':
|
||||
{
|
||||
/* Nonzero if the sense of the character class is inverted. */
|
||||
register int not;
|
||||
|
||||
if (*n == '\0')
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if ((flags & FNM_PERIOD) && *n == '.' &&
|
||||
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
not = (*p == '!' || *p == '^');
|
||||
if (not)
|
||||
++p;
|
||||
|
||||
c = *p++;
|
||||
for (;;)
|
||||
{
|
||||
register char cstart = c, cend = c;
|
||||
|
||||
if (!(flags & FNM_NOESCAPE) && c == '\\')
|
||||
{
|
||||
if (*p == '\0')
|
||||
return FNM_NOMATCH;
|
||||
cstart = cend = *p++;
|
||||
}
|
||||
|
||||
cstart = cend = FOLD (cstart);
|
||||
|
||||
if (c == '\0')
|
||||
/* [ (unterminated) loses. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
c = *p++;
|
||||
c = FOLD (c);
|
||||
|
||||
if ((flags & FNM_FILE_NAME) && c == '/')
|
||||
/* [/] can never match. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if (c == '-' && *p != ']')
|
||||
{
|
||||
cend = *p++;
|
||||
if (!(flags & FNM_NOESCAPE) && cend == '\\')
|
||||
cend = *p++;
|
||||
if (cend == '\0')
|
||||
return FNM_NOMATCH;
|
||||
cend = FOLD (cend);
|
||||
|
||||
c = *p++;
|
||||
}
|
||||
|
||||
if (FOLD (*n) >= cstart && FOLD (*n) <= cend)
|
||||
goto matched;
|
||||
|
||||
if (c == ']')
|
||||
break;
|
||||
}
|
||||
if (!not)
|
||||
return FNM_NOMATCH;
|
||||
break;
|
||||
|
||||
matched:;
|
||||
/* Skip the rest of the [...] that already matched. */
|
||||
while (c != ']')
|
||||
{
|
||||
if (c == '\0')
|
||||
/* [... (unterminated) loses. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
c = *p++;
|
||||
if (!(flags & FNM_NOESCAPE) && c == '\\')
|
||||
{
|
||||
if (*p == '\0')
|
||||
return FNM_NOMATCH;
|
||||
/* XXX 1003.2d11 is unclear if this is right. */
|
||||
++p;
|
||||
}
|
||||
}
|
||||
if (not)
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (c != FOLD (*n))
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
|
||||
++n;
|
||||
}
|
||||
|
||||
if (*n == '\0')
|
||||
return 0;
|
||||
|
||||
if ((flags & FNM_LEADING_DIR) && *n == '/')
|
||||
/* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
|
||||
return 0;
|
||||
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
67
glob/fnmatch.h
Normal file
67
glob/fnmatch.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _FNMATCH_H
|
||||
|
||||
#define _FNMATCH_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
#undef __P
|
||||
#define __P(protos) protos
|
||||
#else /* Not C++ or ANSI C. */
|
||||
#undef __P
|
||||
#define __P(protos) ()
|
||||
/* We can get away without defining `const' here only because in this file
|
||||
it is used only inside the prototype for `fnmatch', which is elided in
|
||||
non-ANSI C where `const' is problematical. */
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
|
||||
/* We #undef these before defining them because some losing systems
|
||||
(HP-UX A.08.07 for example) define these in <unistd.h>. */
|
||||
#undef FNM_PATHNAME
|
||||
#undef FNM_NOESCAPE
|
||||
#undef FNM_PERIOD
|
||||
|
||||
/* Bits set in the FLAGS argument to `fnmatch'. */
|
||||
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
|
||||
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
|
||||
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
|
||||
|
||||
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
|
||||
#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
|
||||
#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
|
||||
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
|
||||
#endif
|
||||
|
||||
/* Value returned by `fnmatch' if STRING does not match PATTERN. */
|
||||
#define FNM_NOMATCH 1
|
||||
|
||||
/* Match STRING against the filename pattern PATTERN,
|
||||
returning zero if it matches, FNM_NOMATCH if not. */
|
||||
extern int fnmatch __P ((const char *__pattern, const char *__string,
|
||||
int __flags));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* fnmatch.h */
|
||||
883
glob/glob.c
Normal file
883
glob/glob.c
Normal file
@@ -0,0 +1,883 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#if defined (_AIX) && !defined (__GNUC__)
|
||||
#pragma alloca
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/* Enable GNU extensions in glob.h. */
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#define GLOB_INTERFACE_VERSION 1
|
||||
#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#ifndef POSIX
|
||||
#ifdef _POSIX_VERSION
|
||||
#define POSIX
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _AMIGA
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (HAVE_DIRENT_H) || defined (__GNU_LIBRARY__)
|
||||
# include <dirent.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
# define dirent direct
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# ifdef HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# ifdef HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* In GNU systems, <dirent.h> defines this macro for us. */
|
||||
#ifdef _D_NAMLEN
|
||||
#undef NAMLEN
|
||||
#define NAMLEN(d) _D_NAMLEN(d)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (POSIX) && !defined (__GNU_LIBRARY__)
|
||||
/* Posix does not require that the d_ino field be present, and some
|
||||
systems do not provide it. */
|
||||
#define REAL_DIR_ENTRY(dp) 1
|
||||
#else
|
||||
#define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
|
||||
#endif /* POSIX */
|
||||
|
||||
#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define ANSI_STRING
|
||||
#else /* No standard headers. */
|
||||
|
||||
extern char *getenv ();
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#define ANSI_STRING
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
|
||||
extern char *malloc (), *realloc ();
|
||||
extern void free ();
|
||||
|
||||
extern void qsort ();
|
||||
extern void abort (), exit ();
|
||||
|
||||
#endif /* Standard headers. */
|
||||
|
||||
#ifndef ANSI_STRING
|
||||
|
||||
#ifndef bzero
|
||||
extern void bzero ();
|
||||
#endif
|
||||
#ifndef bcopy
|
||||
extern void bcopy ();
|
||||
#endif
|
||||
|
||||
#define memcpy(d, s, n) bcopy ((s), (d), (n))
|
||||
#define strrchr rindex
|
||||
/* memset is only used for zero here, but let's be paranoid. */
|
||||
#define memset(s, better_be_zero, n) \
|
||||
((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0)))
|
||||
#endif /* Not ANSI_STRING. */
|
||||
|
||||
#ifndef HAVE_STRCOLL
|
||||
#define strcoll strcmp
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __GNU_LIBRARY__
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
#ifndef __SASC
|
||||
static char *
|
||||
my_realloc (p, n)
|
||||
char *p;
|
||||
unsigned int n;
|
||||
{
|
||||
/* These casts are the for sake of the broken Ultrix compiler,
|
||||
which warns of illegal pointer combinations otherwise. */
|
||||
if (p == NULL)
|
||||
return (char *) malloc (n);
|
||||
return (char *) realloc (p, n);
|
||||
}
|
||||
#define realloc my_realloc
|
||||
#endif /* __SASC */
|
||||
#endif /* __GNU_LIBRARY__ */
|
||||
|
||||
|
||||
#if !defined(__alloca) && !defined(__GNU_LIBRARY__)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#undef alloca
|
||||
#define alloca(n) __builtin_alloca (n)
|
||||
#else /* Not GCC. */
|
||||
#if defined (sparc) || defined (HAVE_ALLOCA_H)
|
||||
#include <alloca.h>
|
||||
#else /* Not sparc or HAVE_ALLOCA_H. */
|
||||
#ifndef _AIX
|
||||
extern char *alloca ();
|
||||
#endif /* Not _AIX. */
|
||||
#endif /* sparc or HAVE_ALLOCA_H. */
|
||||
#endif /* GCC. */
|
||||
|
||||
#define __alloca alloca
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __GNU_LIBRARY__
|
||||
#define __stat stat
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
#undef S_ISDIR
|
||||
#endif
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
#undef size_t
|
||||
#define size_t unsigned int
|
||||
#endif
|
||||
|
||||
/* Some system header files erroneously define these.
|
||||
We want our own definitions from <fnmatch.h> to take precedence. */
|
||||
#undef FNM_PATHNAME
|
||||
#undef FNM_NOESCAPE
|
||||
#undef FNM_PERIOD
|
||||
#include <fnmatch.h>
|
||||
|
||||
/* Some system header files erroneously define these.
|
||||
We want our own definitions from <glob.h> to take precedence. */
|
||||
#undef GLOB_ERR
|
||||
#undef GLOB_MARK
|
||||
#undef GLOB_NOSORT
|
||||
#undef GLOB_DOOFFS
|
||||
#undef GLOB_NOCHECK
|
||||
#undef GLOB_APPEND
|
||||
#undef GLOB_NOESCAPE
|
||||
#undef GLOB_PERIOD
|
||||
#include <glob.h>
|
||||
|
||||
static int glob_pattern_p __P ((const char *pattern, int quote));
|
||||
static int glob_in_dir __P ((const char *pattern, const char *directory,
|
||||
int flags,
|
||||
int (*errfunc) __P ((const char *, int)),
|
||||
glob_t *pglob));
|
||||
static int prefix_array __P ((const char *prefix, char **array, size_t n));
|
||||
static int collated_compare __P ((const __ptr_t, const __ptr_t));
|
||||
|
||||
/* Do glob searching for PATTERN, placing results in PGLOB.
|
||||
The bits defined above may be set in FLAGS.
|
||||
If a directory cannot be opened or read and ERRFUNC is not nil,
|
||||
it is called with the pathname that caused the error, and the
|
||||
`errno' value from the failing call; if it returns non-zero
|
||||
`glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
|
||||
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
|
||||
Otherwise, `glob' returns zero. */
|
||||
int
|
||||
glob (pattern, flags, errfunc, pglob)
|
||||
const char *pattern;
|
||||
int flags;
|
||||
int (*errfunc) __P ((const char *, int));
|
||||
glob_t *pglob;
|
||||
{
|
||||
const char *filename;
|
||||
char *dirname;
|
||||
size_t dirlen;
|
||||
int status;
|
||||
int oldcount;
|
||||
|
||||
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & GLOB_BRACE)
|
||||
{
|
||||
const char *begin = strchr (pattern, '{');
|
||||
if (begin != NULL)
|
||||
{
|
||||
int firstc;
|
||||
size_t restlen;
|
||||
const char *p, *end, *next;
|
||||
unsigned int depth = 0;
|
||||
|
||||
/* Find the end of the brace expression, by counting braces.
|
||||
While we're at it, notice the first comma at top brace level. */
|
||||
end = begin + 1;
|
||||
next = NULL;
|
||||
while (1)
|
||||
{
|
||||
switch (*end++)
|
||||
{
|
||||
case ',':
|
||||
if (depth == 0 && next == NULL)
|
||||
next = end;
|
||||
continue;
|
||||
case '{':
|
||||
++depth;
|
||||
continue;
|
||||
case '}':
|
||||
if (depth-- == 0)
|
||||
break;
|
||||
continue;
|
||||
case '\0':
|
||||
return glob (pattern, flags &~ GLOB_BRACE, errfunc, pglob);
|
||||
}
|
||||
break;
|
||||
}
|
||||
restlen = strlen (end) + 1;
|
||||
if (next == NULL)
|
||||
next = end;
|
||||
|
||||
/* We have a brace expression. BEGIN points to the opening {,
|
||||
NEXT points past the terminator of the first element, and END
|
||||
points past the final }. We will accumulate result names from
|
||||
recursive runs for each brace alternative in the buffer using
|
||||
GLOB_APPEND. */
|
||||
|
||||
if (!(flags & GLOB_APPEND))
|
||||
{
|
||||
/* This call is to set a new vector, so clear out the
|
||||
vector so we can append to it. */
|
||||
pglob->gl_pathc = 0;
|
||||
pglob->gl_pathv = NULL;
|
||||
}
|
||||
firstc = pglob->gl_pathc;
|
||||
|
||||
/* In this loop P points to the beginning of the current element
|
||||
and NEXT points past its terminator. */
|
||||
p = begin + 1;
|
||||
while (1)
|
||||
{
|
||||
/* Construct a whole name that is one of the brace
|
||||
alternatives in a temporary buffer. */
|
||||
int result;
|
||||
size_t bufsz = (begin - pattern) + (next - 1 - p) + restlen;
|
||||
#ifdef __GNUC__
|
||||
char onealt[bufsz];
|
||||
#else
|
||||
char *onealt = malloc (bufsz);
|
||||
if (onealt == NULL)
|
||||
{
|
||||
if (!(flags & GLOB_APPEND))
|
||||
globfree (pglob);
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
#endif
|
||||
memcpy (onealt, pattern, begin - pattern);
|
||||
memcpy (&onealt[begin - pattern], p, next - 1 - p);
|
||||
memcpy (&onealt[(begin - pattern) + (next - 1 - p)],
|
||||
end, restlen);
|
||||
result = glob (onealt,
|
||||
((flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC)) |
|
||||
GLOB_APPEND), errfunc, pglob);
|
||||
#ifndef __GNUC__
|
||||
free (onealt);
|
||||
#endif
|
||||
|
||||
/* If we got an error, return it. */
|
||||
if (result && result != GLOB_NOMATCH)
|
||||
{
|
||||
if (!(flags & GLOB_APPEND))
|
||||
globfree (pglob);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Advance past this alternative and process the next. */
|
||||
p = next;
|
||||
depth = 0;
|
||||
scan:
|
||||
switch (*p++)
|
||||
{
|
||||
case ',':
|
||||
if (depth == 0)
|
||||
{
|
||||
/* Found the next alternative. Loop to glob it. */
|
||||
next = p;
|
||||
continue;
|
||||
}
|
||||
goto scan;
|
||||
case '{':
|
||||
++depth;
|
||||
goto scan;
|
||||
case '}':
|
||||
if (depth-- == 0)
|
||||
/* End of the brace expression. Break out of the loop. */
|
||||
break;
|
||||
goto scan;
|
||||
}
|
||||
}
|
||||
|
||||
if (pglob->gl_pathc == firstc &&
|
||||
!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
|
||||
return GLOB_NOMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the filename. */
|
||||
filename = strrchr (pattern, '/');
|
||||
if (filename == NULL)
|
||||
{
|
||||
filename = pattern;
|
||||
#ifdef _AMIGA
|
||||
dirname = (char *) "";
|
||||
#else
|
||||
dirname = (char *) ".";
|
||||
#endif
|
||||
dirlen = 0;
|
||||
}
|
||||
else if (filename == pattern)
|
||||
{
|
||||
/* "/pattern". */
|
||||
dirname = (char *) "/";
|
||||
dirlen = 1;
|
||||
++filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
dirlen = filename - pattern;
|
||||
dirname = (char *) __alloca (dirlen + 1);
|
||||
memcpy (dirname, pattern, dirlen);
|
||||
dirname[dirlen] = '\0';
|
||||
++filename;
|
||||
}
|
||||
|
||||
if (filename[0] == '\0' && dirlen > 1)
|
||||
/* "pattern/". Expand "pattern", appending slashes. */
|
||||
{
|
||||
int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
|
||||
if (val == 0)
|
||||
pglob->gl_flags = (pglob->gl_flags & ~GLOB_MARK) | (flags & GLOB_MARK);
|
||||
return val;
|
||||
}
|
||||
|
||||
if (!(flags & GLOB_APPEND))
|
||||
{
|
||||
pglob->gl_pathc = 0;
|
||||
pglob->gl_pathv = NULL;
|
||||
}
|
||||
|
||||
oldcount = pglob->gl_pathc;
|
||||
|
||||
if ((flags & GLOB_TILDE) && dirname[0] == '~')
|
||||
{
|
||||
if (dirname[1] == '\0')
|
||||
{
|
||||
/* Look up home directory. */
|
||||
dirname = getenv ("HOME");
|
||||
#ifdef _AMIGA
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
dirname = "SYS:";
|
||||
#else
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
{
|
||||
extern char *getlogin __P ((void));
|
||||
char *name = getlogin ();
|
||||
if (name != NULL)
|
||||
{
|
||||
struct passwd *p = getpwnam (name);
|
||||
if (p != NULL)
|
||||
dirname = p->pw_dir;
|
||||
}
|
||||
}
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
dirname = (char *) "~"; /* No luck. */
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _AMIGA
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
dirname = "SYS:";
|
||||
#else
|
||||
/* Look up specific user's home directory. */
|
||||
struct passwd *p = getpwnam (dirname + 1);
|
||||
if (p != NULL)
|
||||
dirname = p->pw_dir;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE)))
|
||||
{
|
||||
/* The directory name contains metacharacters, so we
|
||||
have to glob for the directory, and then glob for
|
||||
the pattern in each directory found. */
|
||||
glob_t dirs;
|
||||
register int i;
|
||||
|
||||
status = glob (dirname,
|
||||
((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE)) |
|
||||
GLOB_NOSORT),
|
||||
errfunc, &dirs);
|
||||
if (status != 0)
|
||||
return status;
|
||||
|
||||
/* We have successfully globbed the preceding directory name.
|
||||
For each name we found, call glob_in_dir on it and FILENAME,
|
||||
appending the results to PGLOB. */
|
||||
for (i = 0; i < dirs.gl_pathc; ++i)
|
||||
{
|
||||
int oldcount;
|
||||
|
||||
#ifdef SHELL
|
||||
{
|
||||
/* Make globbing interruptible in the bash shell. */
|
||||
extern int interrupt_state;
|
||||
|
||||
if (interrupt_state)
|
||||
{
|
||||
globfree (&dirs);
|
||||
globfree (&files);
|
||||
return GLOB_ABEND;
|
||||
}
|
||||
}
|
||||
#endif /* SHELL. */
|
||||
|
||||
oldcount = pglob->gl_pathc;
|
||||
status = glob_in_dir (filename, dirs.gl_pathv[i],
|
||||
(flags | GLOB_APPEND) & ~GLOB_NOCHECK,
|
||||
errfunc, pglob);
|
||||
if (status == GLOB_NOMATCH)
|
||||
/* No matches in this directory. Try the next. */
|
||||
continue;
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
globfree (&dirs);
|
||||
globfree (pglob);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Stick the directory on the front of each name. */
|
||||
if (prefix_array (dirs.gl_pathv[i],
|
||||
&pglob->gl_pathv[oldcount],
|
||||
pglob->gl_pathc - oldcount))
|
||||
{
|
||||
globfree (&dirs);
|
||||
globfree (pglob);
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
}
|
||||
|
||||
flags |= GLOB_MAGCHAR;
|
||||
|
||||
if (pglob->gl_pathc == oldcount)
|
||||
/* No matches. */
|
||||
if (flags & GLOB_NOCHECK)
|
||||
{
|
||||
size_t len = strlen (pattern) + 1;
|
||||
char *patcopy = (char *) malloc (len);
|
||||
if (patcopy == NULL)
|
||||
return GLOB_NOSPACE;
|
||||
memcpy (patcopy, pattern, len);
|
||||
|
||||
pglob->gl_pathv
|
||||
= (char **) realloc (pglob->gl_pathv,
|
||||
(pglob->gl_pathc +
|
||||
((flags & GLOB_DOOFFS) ?
|
||||
pglob->gl_offs : 0) +
|
||||
1 + 1) *
|
||||
sizeof (char *));
|
||||
if (pglob->gl_pathv == NULL)
|
||||
{
|
||||
free (patcopy);
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
|
||||
if (flags & GLOB_DOOFFS)
|
||||
while (pglob->gl_pathc < pglob->gl_offs)
|
||||
pglob->gl_pathv[pglob->gl_pathc++] = NULL;
|
||||
|
||||
pglob->gl_pathv[pglob->gl_pathc++] = patcopy;
|
||||
pglob->gl_pathv[pglob->gl_pathc] = NULL;
|
||||
pglob->gl_flags = flags;
|
||||
}
|
||||
else
|
||||
return GLOB_NOMATCH;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = glob_in_dir (filename, dirname, flags, errfunc, pglob);
|
||||
if (status != 0)
|
||||
return status;
|
||||
|
||||
if (dirlen > 0)
|
||||
{
|
||||
/* Stick the directory on the front of each name. */
|
||||
if (prefix_array (dirname,
|
||||
&pglob->gl_pathv[oldcount],
|
||||
pglob->gl_pathc - oldcount))
|
||||
{
|
||||
globfree (pglob);
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & GLOB_MARK)
|
||||
{
|
||||
/* Append slashes to directory names. */
|
||||
int i;
|
||||
struct stat st;
|
||||
for (i = oldcount; i < pglob->gl_pathc; ++i)
|
||||
if (((flags & GLOB_ALTDIRFUNC) ?
|
||||
(*pglob->gl_stat) (pglob->gl_pathv[i], &st) :
|
||||
__stat (pglob->gl_pathv[i], &st)) == 0 &&
|
||||
S_ISDIR (st.st_mode))
|
||||
{
|
||||
size_t len = strlen (pglob->gl_pathv[i]) + 2;
|
||||
char *new = realloc (pglob->gl_pathv[i], len);
|
||||
if (new == NULL)
|
||||
{
|
||||
globfree (pglob);
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
strcpy (&new[len - 2], "/");
|
||||
pglob->gl_pathv[i] = new;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & GLOB_NOSORT))
|
||||
/* Sort the vector. */
|
||||
qsort ((__ptr_t) &pglob->gl_pathv[oldcount],
|
||||
pglob->gl_pathc - oldcount,
|
||||
sizeof (char *), collated_compare);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Free storage allocated in PGLOB by a previous `glob' call. */
|
||||
void
|
||||
globfree (pglob)
|
||||
register glob_t *pglob;
|
||||
{
|
||||
if (pglob->gl_pathv != NULL)
|
||||
{
|
||||
register int i;
|
||||
for (i = 0; i < pglob->gl_pathc; ++i)
|
||||
if (pglob->gl_pathv[i] != NULL)
|
||||
free ((__ptr_t) pglob->gl_pathv[i]);
|
||||
free ((__ptr_t) pglob->gl_pathv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Do a collated comparison of A and B. */
|
||||
static int
|
||||
collated_compare (a, b)
|
||||
const __ptr_t a;
|
||||
const __ptr_t b;
|
||||
{
|
||||
const char *const s1 = *(const char *const * const) a;
|
||||
const char *const s2 = *(const char *const * const) b;
|
||||
|
||||
if (s1 == s2)
|
||||
return 0;
|
||||
if (s1 == NULL)
|
||||
return 1;
|
||||
if (s2 == NULL)
|
||||
return -1;
|
||||
return strcoll (s1, s2);
|
||||
}
|
||||
|
||||
|
||||
/* Prepend DIRNAME to each of N members of ARRAY, replacing ARRAY's
|
||||
elements in place. Return nonzero if out of memory, zero if successful.
|
||||
A slash is inserted between DIRNAME and each elt of ARRAY,
|
||||
unless DIRNAME is just "/". Each old element of ARRAY is freed. */
|
||||
static int
|
||||
prefix_array (dirname, array, n)
|
||||
const char *dirname;
|
||||
char **array;
|
||||
size_t n;
|
||||
{
|
||||
register size_t i;
|
||||
size_t dirlen = strlen (dirname);
|
||||
|
||||
if (dirlen == 1 && dirname[0] == '/')
|
||||
/* DIRNAME is just "/", so normal prepending would get us "//foo".
|
||||
We want "/foo" instead, so don't prepend any chars from DIRNAME. */
|
||||
dirlen = 0;
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
size_t eltlen = strlen (array[i]) + 1;
|
||||
char *new = (char *) malloc (dirlen + 1 + eltlen);
|
||||
if (new == NULL)
|
||||
{
|
||||
while (i > 0)
|
||||
free ((__ptr_t) array[--i]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
memcpy (new, dirname, dirlen);
|
||||
new[dirlen] = '/';
|
||||
memcpy (&new[dirlen + 1], array[i], eltlen);
|
||||
free ((__ptr_t) array[i]);
|
||||
array[i] = new;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Return nonzero if PATTERN contains any metacharacters.
|
||||
Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
|
||||
static int
|
||||
glob_pattern_p (pattern, quote)
|
||||
const char *pattern;
|
||||
int quote;
|
||||
{
|
||||
register const char *p;
|
||||
int open = 0;
|
||||
|
||||
for (p = pattern; *p != '\0'; ++p)
|
||||
switch (*p)
|
||||
{
|
||||
case '?':
|
||||
case '*':
|
||||
return 1;
|
||||
|
||||
case '\\':
|
||||
if (quote && p[1] != '\0')
|
||||
++p;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
open = 1;
|
||||
break;
|
||||
|
||||
case ']':
|
||||
if (open)
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Like `glob', but PATTERN is a final pathname component,
|
||||
and matches are searched for in DIRECTORY.
|
||||
The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
|
||||
The GLOB_APPEND flag is assumed to be set (always appends). */
|
||||
static int
|
||||
glob_in_dir (pattern, directory, flags, errfunc, pglob)
|
||||
const char *pattern;
|
||||
const char *directory;
|
||||
int flags;
|
||||
int (*errfunc) __P ((const char *, int));
|
||||
glob_t *pglob;
|
||||
{
|
||||
__ptr_t stream;
|
||||
|
||||
struct globlink
|
||||
{
|
||||
struct globlink *next;
|
||||
char *name;
|
||||
};
|
||||
struct globlink *names = NULL;
|
||||
size_t nfound = 0;
|
||||
|
||||
if (!glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)))
|
||||
{
|
||||
stream = NULL;
|
||||
flags |= GLOB_NOCHECK;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= GLOB_MAGCHAR;
|
||||
|
||||
stream = ((flags & GLOB_ALTDIRFUNC) ?
|
||||
(*pglob->gl_opendir) (directory) :
|
||||
(__ptr_t) opendir (directory));
|
||||
if (stream == NULL)
|
||||
{
|
||||
if ((errfunc != NULL && (*errfunc) (directory, errno)) ||
|
||||
(flags & GLOB_ERR))
|
||||
return GLOB_ABEND;
|
||||
}
|
||||
else
|
||||
while (1)
|
||||
{
|
||||
const char *name;
|
||||
size_t len;
|
||||
struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ?
|
||||
(*pglob->gl_readdir) (stream) :
|
||||
readdir ((DIR *) stream));
|
||||
if (d == NULL)
|
||||
break;
|
||||
if (! REAL_DIR_ENTRY (d))
|
||||
continue;
|
||||
|
||||
name = d->d_name;
|
||||
|
||||
if (fnmatch (pattern, name,
|
||||
(!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
|
||||
((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
|
||||
#ifdef _AMIGA
|
||||
| FNM_CASEFOLD
|
||||
#endif
|
||||
) == 0)
|
||||
{
|
||||
struct globlink *new
|
||||
= (struct globlink *) __alloca (sizeof (struct globlink));
|
||||
len = NAMLEN (d);
|
||||
new->name
|
||||
= (char *) malloc (len + 1);
|
||||
if (new->name == NULL)
|
||||
goto memory_error;
|
||||
memcpy ((__ptr_t) new->name, name, len);
|
||||
new->name[len] = '\0';
|
||||
new->next = names;
|
||||
names = new;
|
||||
++nfound;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nfound == 0 && (flags & GLOB_NOMAGIC) &&
|
||||
! glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)))
|
||||
flags |= GLOB_NOCHECK;
|
||||
|
||||
if (nfound == 0 && (flags & GLOB_NOCHECK))
|
||||
{
|
||||
size_t len = strlen (pattern);
|
||||
nfound = 1;
|
||||
names = (struct globlink *) __alloca (sizeof (struct globlink));
|
||||
names->next = NULL;
|
||||
names->name = (char *) malloc (len + 1);
|
||||
if (names->name == NULL)
|
||||
goto memory_error;
|
||||
memcpy (names->name, pattern, len);
|
||||
names->name[len] = '\0';
|
||||
}
|
||||
|
||||
pglob->gl_pathv
|
||||
= (char **) realloc (pglob->gl_pathv,
|
||||
(pglob->gl_pathc +
|
||||
((flags & GLOB_DOOFFS) ? pglob->gl_offs : 0) +
|
||||
nfound + 1) *
|
||||
sizeof (char *));
|
||||
if (pglob->gl_pathv == NULL)
|
||||
goto memory_error;
|
||||
|
||||
if (flags & GLOB_DOOFFS)
|
||||
while (pglob->gl_pathc < pglob->gl_offs)
|
||||
pglob->gl_pathv[pglob->gl_pathc++] = NULL;
|
||||
|
||||
for (; names != NULL; names = names->next)
|
||||
pglob->gl_pathv[pglob->gl_pathc++] = names->name;
|
||||
pglob->gl_pathv[pglob->gl_pathc] = NULL;
|
||||
|
||||
pglob->gl_flags = flags;
|
||||
|
||||
if (stream != NULL)
|
||||
{
|
||||
int save = errno;
|
||||
if (flags & GLOB_ALTDIRFUNC)
|
||||
(*pglob->gl_closedir) (stream);
|
||||
else
|
||||
closedir ((DIR *) stream);
|
||||
errno = save;
|
||||
}
|
||||
return nfound == 0 ? GLOB_NOMATCH : 0;
|
||||
|
||||
memory_error:
|
||||
{
|
||||
int save = errno;
|
||||
if (flags & GLOB_ALTDIRFUNC)
|
||||
(*pglob->gl_closedir) (stream);
|
||||
else
|
||||
closedir ((DIR *) stream);
|
||||
errno = save;
|
||||
}
|
||||
while (names != NULL)
|
||||
{
|
||||
if (names->name != NULL)
|
||||
free ((__ptr_t) names->name);
|
||||
names = names->next;
|
||||
}
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
112
glob/glob.h
Normal file
112
glob/glob.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _GLOB_H
|
||||
|
||||
#define _GLOB_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#undef __ptr_t
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
#undef __P
|
||||
#define __P(protos) protos
|
||||
#define __ptr_t void *
|
||||
#else /* Not C++ or ANSI C. */
|
||||
#undef __P
|
||||
#define __P(protos) ()
|
||||
#undef const
|
||||
#define const
|
||||
#define __ptr_t char *
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
/* Bits set in the FLAGS argument to `glob'. */
|
||||
#define GLOB_ERR (1 << 0)/* Return on read errors. */
|
||||
#define GLOB_MARK (1 << 1)/* Append a slash to each name. */
|
||||
#define GLOB_NOSORT (1 << 2)/* Don't sort the names. */
|
||||
#define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */
|
||||
#define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */
|
||||
#define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */
|
||||
#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */
|
||||
#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
|
||||
#define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
|
||||
GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \
|
||||
GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \
|
||||
GLOB_NOMAGIC|GLOB_TILDE)
|
||||
|
||||
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE)
|
||||
#define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
|
||||
#define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
|
||||
#define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
|
||||
#define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */
|
||||
#define GLOB_TILDE (1 <<12)/* Expand ~user and ~ to home directories. */
|
||||
#endif
|
||||
|
||||
/* Error returns from `glob'. */
|
||||
#define GLOB_NOSPACE 1 /* Ran out of memory. */
|
||||
#define GLOB_ABEND 2 /* Read error. */
|
||||
#define GLOB_NOMATCH 3 /* No matches found. */
|
||||
|
||||
/* Structure describing a globbing run. */
|
||||
struct stat;
|
||||
typedef struct
|
||||
{
|
||||
int gl_pathc; /* Count of paths matched by the pattern. */
|
||||
char **gl_pathv; /* List of matched pathnames. */
|
||||
int gl_offs; /* Slots to reserve in `gl_pathv'. */
|
||||
int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */
|
||||
|
||||
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
|
||||
are used instead of the normal file access functions. */
|
||||
void (*gl_closedir) __P ((void *));
|
||||
struct dirent *(*gl_readdir) __P ((void *));
|
||||
__ptr_t (*gl_opendir) __P ((const char *));
|
||||
int (*gl_lstat) __P ((const char *, struct stat *));
|
||||
int (*gl_stat) __P ((const char *, struct stat *));
|
||||
} glob_t;
|
||||
|
||||
/* Do glob searching for PATTERN, placing results in PGLOB.
|
||||
The bits defined above may be set in FLAGS.
|
||||
If a directory cannot be opened or read and ERRFUNC is not nil,
|
||||
it is called with the pathname that caused the error, and the
|
||||
`errno' value from the failing call; if it returns non-zero
|
||||
`glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
|
||||
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
|
||||
Otherwise, `glob' returns zero. */
|
||||
extern int glob __P ((const char *__pattern, int __flags,
|
||||
int (*__errfunc) __P ((const char *, int)),
|
||||
glob_t *__pglob));
|
||||
|
||||
/* Free storage allocated in PGLOB by a previous `glob' call. */
|
||||
extern void globfree __P ((glob_t *__pglob));
|
||||
|
||||
|
||||
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
|
||||
/* If they are not NULL, `glob' uses these functions to read directories. */
|
||||
extern __ptr_t (*__glob_opendir_hook) __P ((const char *__directory));
|
||||
extern const char *(*__glob_readdir_hook) __P ((__ptr_t __stream));
|
||||
extern void (*__glob_closedir_hook) __P ((__ptr_t __stream));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* glob.h */
|
||||
396
gpl.texinfo
Executable file
396
gpl.texinfo
Executable file
@@ -0,0 +1,396 @@
|
||||
@setfilename gpl.info
|
||||
|
||||
@unnumbered GNU GENERAL PUBLIC LICENSE
|
||||
@center Version 2, June 1991
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place -- Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@end display
|
||||
|
||||
@unnumberedsec Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software---to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
@iftex
|
||||
@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end ifinfo
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The ``Program'', below,
|
||||
refers to any such program or work, and a ``work based on the Program''
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term ``modification''.) Each licensee is addressed as ``you''.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
@item
|
||||
You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
@item
|
||||
You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
@item
|
||||
You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
@item
|
||||
If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
@end enumerate
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
@item
|
||||
You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
@item
|
||||
Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
@item
|
||||
Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
@end enumerate
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
@item
|
||||
You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
@item
|
||||
You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
@item
|
||||
Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
@item
|
||||
If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
@item
|
||||
If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
@item
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and ``any
|
||||
later version'', you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
@item
|
||||
If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
@iftex
|
||||
@heading NO WARRANTY
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center NO WARRANTY
|
||||
@end ifinfo
|
||||
|
||||
@item
|
||||
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
@item
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
@end enumerate
|
||||
|
||||
@iftex
|
||||
@heading END OF TERMS AND CONDITIONS
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center END OF TERMS AND CONDITIONS
|
||||
@end ifinfo
|
||||
|
||||
@page
|
||||
@unnumberedsec How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the ``copyright'' line and a pointer to where the full notice is found.
|
||||
|
||||
@smallexample
|
||||
@var{one line to give the program's name and an idea of what it does.}
|
||||
Copyright (C) 19@var{yy} @var{name of author}
|
||||
|
||||
This program 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 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
@end smallexample
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
@smallexample
|
||||
Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
|
||||
type `show w'. This is free software, and you are welcome
|
||||
to redistribute it under certain conditions; type `show c'
|
||||
for details.
|
||||
@end smallexample
|
||||
|
||||
The hypothetical commands @samp{show w} and @samp{show c} should show
|
||||
the appropriate parts of the General Public License. Of course, the
|
||||
commands you use may be called something other than @samp{show w} and
|
||||
@samp{show c}; they could even be mouse-clicks or menu items---whatever
|
||||
suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a ``copyright disclaimer'' for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
Yoyodyne, Inc., hereby disclaims all copyright
|
||||
interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written
|
||||
by James Hacker.
|
||||
|
||||
@var{signature of Ty Coon}, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
599
implicit.c
Normal file
599
implicit.c
Normal file
@@ -0,0 +1,599 @@
|
||||
/* Implicit rule searching for GNU Make.
|
||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "rule.h"
|
||||
#include "dep.h"
|
||||
#include "filedef.h"
|
||||
|
||||
static int pattern_search PARAMS ((struct file *file, int archive, unsigned int depth,
|
||||
unsigned int recursions));
|
||||
|
||||
/* For a FILE which has no commands specified, try to figure out some
|
||||
from the implicit pattern rules.
|
||||
Returns 1 if a suitable implicit rule was found,
|
||||
after modifying FILE to contain the appropriate commands and deps,
|
||||
or returns 0 if no implicit rule was found. */
|
||||
|
||||
int
|
||||
try_implicit_rule (file, depth)
|
||||
struct file *file;
|
||||
unsigned int depth;
|
||||
{
|
||||
DEBUGPR ("Looking for an implicit rule for `%s'.\n");
|
||||
|
||||
/* The order of these searches was previously reversed. My logic now is
|
||||
that since the non-archive search uses more information in the target
|
||||
(the archive search omits the archive name), it is more specific and
|
||||
should come first. */
|
||||
|
||||
if (pattern_search (file, 0, depth, 0))
|
||||
return 1;
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
/* If this is an archive member reference, use just the
|
||||
archive member name to search for implicit rules. */
|
||||
if (ar_name (file->name))
|
||||
{
|
||||
DEBUGPR ("Looking for archive-member implicit rule for `%s'.\n");
|
||||
if (pattern_search (file, 1, depth, 0))
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define DEBUGP2(msg, a1, a2) \
|
||||
do { \
|
||||
if (debug_flag) \
|
||||
{ print_spaces (depth); printf (msg, a1, a2); fflush (stdout); } \
|
||||
} while (0)
|
||||
|
||||
/* Search the pattern rules for a rule with an existing dependency to make
|
||||
FILE. If a rule is found, the appropriate commands and deps are put in FILE
|
||||
and 1 is returned. If not, 0 is returned.
|
||||
|
||||
If ARCHIVE is nonzero, FILE->name is of the form "LIB(MEMBER)". A rule for
|
||||
"(MEMBER)" will be searched for, and "(MEMBER)" will not be chopped up into
|
||||
directory and filename parts.
|
||||
|
||||
If an intermediate file is found by pattern search, the intermediate file
|
||||
is set up as a target by the recursive call and is also made a dependency
|
||||
of FILE.
|
||||
|
||||
DEPTH is used for debugging messages. */
|
||||
|
||||
static int
|
||||
pattern_search (file, archive, depth, recursions)
|
||||
struct file *file;
|
||||
int archive;
|
||||
unsigned int depth;
|
||||
unsigned int recursions;
|
||||
{
|
||||
/* Filename we are searching for a rule for. */
|
||||
char *filename = archive ? index (file->name, '(') : file->name;
|
||||
|
||||
/* Length of FILENAME. */
|
||||
unsigned int namelen = strlen (filename);
|
||||
|
||||
/* The last slash in FILENAME (or nil if there is none). */
|
||||
char *lastslash;
|
||||
|
||||
/* This is a file-object used as an argument in
|
||||
recursive calls. It never contains any data
|
||||
except during a recursive call. */
|
||||
struct file *intermediate_file = 0;
|
||||
|
||||
/* List of dependencies found recursively. */
|
||||
struct file **intermediate_files
|
||||
= (struct file **) alloca (max_pattern_deps * sizeof (struct file *));
|
||||
|
||||
/* List of the patterns used to find intermediate files. */
|
||||
char **intermediate_patterns
|
||||
= (char **) alloca (max_pattern_deps * sizeof (char *));
|
||||
|
||||
/* This buffer records all the dependencies actually found for a rule. */
|
||||
char **found_files = (char **) alloca (max_pattern_deps * sizeof (char *));
|
||||
/* Number of dep names now in FOUND_FILES. */
|
||||
unsigned int deps_found;
|
||||
|
||||
/* Names of possible dependencies are constructed in this buffer. */
|
||||
register char *depname = (char *) alloca (namelen + max_pattern_dep_length);
|
||||
|
||||
/* The start and length of the stem of FILENAME for the current rule. */
|
||||
register char *stem;
|
||||
register unsigned int stemlen;
|
||||
|
||||
/* Buffer in which we store all the rules that are possibly applicable. */
|
||||
struct rule **tryrules
|
||||
= (struct rule **) alloca (num_pattern_rules * max_pattern_targets
|
||||
* sizeof (struct rule *));
|
||||
|
||||
/* Number of valid elements in TRYRULES. */
|
||||
unsigned int nrules;
|
||||
|
||||
/* The numbers of the rule targets of each rule
|
||||
in TRYRULES that matched the target file. */
|
||||
unsigned int *matches
|
||||
= (unsigned int *) alloca (num_pattern_rules * sizeof (unsigned int));
|
||||
|
||||
/* Each element is nonzero if LASTSLASH was used in
|
||||
matching the corresponding element of TRYRULES. */
|
||||
char *checked_lastslash
|
||||
= (char *) alloca (num_pattern_rules * sizeof (char));
|
||||
|
||||
/* The index in TRYRULES of the rule we found. */
|
||||
unsigned int foundrule;
|
||||
|
||||
/* Nonzero if should consider intermediate files as dependencies. */
|
||||
int intermed_ok;
|
||||
|
||||
/* Nonzero if we have matched a pattern-rule target
|
||||
that is not just `%'. */
|
||||
int specific_rule_matched = 0;
|
||||
|
||||
register unsigned int i;
|
||||
register struct rule *rule;
|
||||
register struct dep *dep;
|
||||
|
||||
char *p;
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
if (archive || ar_name (filename))
|
||||
lastslash = 0;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Set LASTSLASH to point at the last slash in FILENAME
|
||||
but not counting any slash at the end. (foo/bar/ counts as
|
||||
bar/ in directory foo/, not empty in directory foo/bar/.) */
|
||||
#ifdef VMS
|
||||
lastslash = rindex (filename, ']');
|
||||
#else
|
||||
lastslash = rindex (filename, '/');
|
||||
#endif
|
||||
if (lastslash != 0 && lastslash[1] == '\0')
|
||||
lastslash = 0;
|
||||
}
|
||||
|
||||
/* First see which pattern rules match this target
|
||||
and may be considered. Put them in TRYRULES. */
|
||||
|
||||
nrules = 0;
|
||||
for (rule = pattern_rules; rule != 0; rule = rule->next)
|
||||
{
|
||||
/* If the pattern rule has deps but no commands, ignore it.
|
||||
Users cancel built-in rules by redefining them without commands. */
|
||||
if (rule->deps != 0 && rule->cmds == 0)
|
||||
continue;
|
||||
|
||||
/* If this rule is in use by a parent pattern_search,
|
||||
don't use it here. */
|
||||
if (rule->in_use)
|
||||
{
|
||||
DEBUGP2 ("Avoiding implicit rule recursion.%s%s\n", "", "");
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0; rule->targets[i] != 0; ++i)
|
||||
{
|
||||
char *target = rule->targets[i];
|
||||
char *suffix = rule->suffixes[i];
|
||||
int check_lastslash;
|
||||
|
||||
/* Rules that can match any filename and are not terminal
|
||||
are ignored if we're recursing, so that they cannot be
|
||||
intermediate files. */
|
||||
if (recursions > 0 && target[1] == '\0' && !rule->terminal)
|
||||
continue;
|
||||
|
||||
if (rule->lens[i] > namelen)
|
||||
/* It can't possibly match. */
|
||||
continue;
|
||||
|
||||
/* From the lengths of the filename and the pattern parts,
|
||||
find the stem: the part of the filename that matches the %. */
|
||||
stem = filename + (suffix - target - 1);
|
||||
stemlen = namelen - rule->lens[i] + 1;
|
||||
|
||||
/* Set CHECK_LASTSLASH if FILENAME contains a directory
|
||||
prefix and the target pattern does not contain a slash. */
|
||||
|
||||
#ifdef VMS
|
||||
check_lastslash = lastslash != 0 && index (target, ']') == 0;
|
||||
#else
|
||||
check_lastslash = lastslash != 0 && index (target, '/') == 0;
|
||||
#endif
|
||||
if (check_lastslash)
|
||||
{
|
||||
/* In that case, don't include the
|
||||
directory prefix in STEM here. */
|
||||
unsigned int difference = lastslash - filename + 1;
|
||||
if (difference > stemlen)
|
||||
continue;
|
||||
stemlen -= difference;
|
||||
stem += difference;
|
||||
}
|
||||
|
||||
/* Check that the rule pattern matches the text before the stem. */
|
||||
if (check_lastslash)
|
||||
{
|
||||
if (stem > (lastslash + 1)
|
||||
&& strncmp (target, lastslash + 1, stem - lastslash - 1))
|
||||
continue;
|
||||
}
|
||||
else if (stem > filename
|
||||
&& strncmp (target, filename, stem - filename))
|
||||
continue;
|
||||
|
||||
/* Check that the rule pattern matches the text after the stem.
|
||||
We could test simply use streq, but this way we compare the
|
||||
first two characters immediately. This saves time in the very
|
||||
common case where the first character matches because it is a
|
||||
period. */
|
||||
if (*suffix != stem[stemlen]
|
||||
|| (*suffix != '\0' && !streq (&suffix[1], &stem[stemlen + 1])))
|
||||
continue;
|
||||
|
||||
/* Record if we match a rule that not all filenames will match. */
|
||||
if (target[1] != '\0')
|
||||
specific_rule_matched = 1;
|
||||
|
||||
/* A rule with no dependencies and no commands exists solely to set
|
||||
specific_rule_matched when it matches. Don't try to use it. */
|
||||
if (rule->deps == 0 && rule->cmds == 0)
|
||||
continue;
|
||||
|
||||
/* Record this rule in TRYRULES and the index of the matching
|
||||
target in MATCHES. If several targets of the same rule match,
|
||||
that rule will be in TRYRULES more than once. */
|
||||
tryrules[nrules] = rule;
|
||||
matches[nrules] = i;
|
||||
checked_lastslash[nrules] = check_lastslash;
|
||||
++nrules;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we have found a matching rule that won't match all filenames,
|
||||
retroactively reject any non-"terminal" rules that do always match. */
|
||||
if (specific_rule_matched)
|
||||
for (i = 0; i < nrules; ++i)
|
||||
if (!tryrules[i]->terminal)
|
||||
{
|
||||
register unsigned int j;
|
||||
for (j = 0; tryrules[i]->targets[j] != 0; ++j)
|
||||
if (tryrules[i]->targets[j][1] == '\0')
|
||||
break;
|
||||
if (tryrules[i]->targets[j] != 0)
|
||||
tryrules[i] = 0;
|
||||
}
|
||||
|
||||
/* Try each rule once without intermediate files, then once with them. */
|
||||
for (intermed_ok = 0; intermed_ok == !!intermed_ok; ++intermed_ok)
|
||||
{
|
||||
/* Try each pattern rule till we find one that applies.
|
||||
If it does, copy the names of its dependencies (as substituted)
|
||||
and store them in FOUND_FILES. DEPS_FOUND is the number of them. */
|
||||
|
||||
for (i = 0; i < nrules; i++)
|
||||
{
|
||||
int check_lastslash;
|
||||
|
||||
rule = tryrules[i];
|
||||
|
||||
/* RULE is nil when we discover that a rule,
|
||||
already placed in TRYRULES, should not be applied. */
|
||||
if (rule == 0)
|
||||
continue;
|
||||
|
||||
/* Reject any terminal rules if we're
|
||||
looking to make intermediate files. */
|
||||
if (intermed_ok && rule->terminal)
|
||||
continue;
|
||||
|
||||
/* Mark this rule as in use so a recursive
|
||||
pattern_search won't try to use it. */
|
||||
rule->in_use = 1;
|
||||
|
||||
/* From the lengths of the filename and the matching pattern parts,
|
||||
find the stem: the part of the filename that matches the %. */
|
||||
stem = filename
|
||||
+ (rule->suffixes[matches[i]] - rule->targets[matches[i]]) - 1;
|
||||
stemlen = namelen - rule->lens[matches[i]] + 1;
|
||||
check_lastslash = checked_lastslash[i];
|
||||
if (check_lastslash)
|
||||
{
|
||||
stem += lastslash - filename + 1;
|
||||
stemlen -= (lastslash - filename) + 1;
|
||||
}
|
||||
|
||||
DEBUGP2 ("Trying pattern rule with stem `%.*s'.\n",
|
||||
(int) stemlen, stem);
|
||||
|
||||
/* Try each dependency; see if it "exists". */
|
||||
|
||||
deps_found = 0;
|
||||
for (dep = rule->deps; dep != 0; dep = dep->next)
|
||||
{
|
||||
/* If the dependency name has a %, substitute the stem. */
|
||||
p = index (dep_name (dep), '%');
|
||||
if (p != 0)
|
||||
{
|
||||
register unsigned int i;
|
||||
if (check_lastslash)
|
||||
{
|
||||
/* Copy directory name from the original FILENAME. */
|
||||
i = lastslash - filename + 1;
|
||||
bcopy (filename, depname, i);
|
||||
}
|
||||
else
|
||||
i = 0;
|
||||
bcopy (dep_name (dep), depname + i, p - dep_name (dep));
|
||||
i += p - dep_name (dep);
|
||||
bcopy (stem, depname + i, stemlen);
|
||||
i += stemlen;
|
||||
strcpy (depname + i, p + 1);
|
||||
p = depname;
|
||||
}
|
||||
else
|
||||
p = dep_name (dep);
|
||||
|
||||
/* P is now the actual dependency name as substituted. */
|
||||
|
||||
if (file_impossible_p (p))
|
||||
{
|
||||
/* If this dependency has already been ruled
|
||||
"impossible", then the rule fails and don't
|
||||
bother trying it on the second pass either
|
||||
since we know that will fail too. */
|
||||
DEBUGP2 ("Rejecting impossible %s dependency `%s'.\n",
|
||||
p == depname ? "implicit" : "rule", p);
|
||||
tryrules[i] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
intermediate_files[deps_found] = 0;
|
||||
|
||||
DEBUGP2 ("Trying %s dependency `%s'.\n",
|
||||
p == depname ? "implicit" : "rule", p);
|
||||
|
||||
/* The DEP->changed flag says that this dependency resides in a
|
||||
nonexistent directory. So we normally can skip looking for
|
||||
the file. However, if CHECK_LASTSLASH is set, then the
|
||||
dependency file we are actually looking for is in a different
|
||||
directory (the one gotten by prepending FILENAME's directory),
|
||||
so it might actually exist. */
|
||||
|
||||
if ((!dep->changed || check_lastslash)
|
||||
&& (lookup_file (p) != 0 || file_exists_p (p)))
|
||||
{
|
||||
found_files[deps_found++] = savestring (p, strlen (p));
|
||||
continue;
|
||||
}
|
||||
/* This code, given FILENAME = "lib/foo.o", dependency name
|
||||
"lib/foo.c", and VPATH=src, searches for "src/lib/foo.c". */
|
||||
if (vpath_search (&p, (time_t *) 0))
|
||||
{
|
||||
DEBUGP2 ("Found dependency as `%s'.%s\n", p, "");
|
||||
found_files[deps_found++] = p;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We could not find the file in any place we should look.
|
||||
Try to make this dependency as an intermediate file,
|
||||
but only on the second pass. */
|
||||
|
||||
if (intermed_ok)
|
||||
{
|
||||
if (intermediate_file == 0)
|
||||
intermediate_file
|
||||
= (struct file *) alloca (sizeof (struct file));
|
||||
|
||||
DEBUGP2 ("Looking for a rule with %s file `%s'.\n",
|
||||
"intermediate", p);
|
||||
|
||||
bzero ((char *) intermediate_file, sizeof (struct file));
|
||||
intermediate_file->name = p;
|
||||
if (pattern_search (intermediate_file, 0, depth + 1,
|
||||
recursions + 1))
|
||||
{
|
||||
p = savestring (p, strlen (p));
|
||||
intermediate_patterns[deps_found]
|
||||
= intermediate_file->name;
|
||||
intermediate_file->name = p;
|
||||
intermediate_files[deps_found] = intermediate_file;
|
||||
intermediate_file = 0;
|
||||
/* Allocate an extra copy to go in FOUND_FILES,
|
||||
because every elt of FOUND_FILES is consumed
|
||||
or freed later. */
|
||||
found_files[deps_found] = savestring (p, strlen (p));
|
||||
++deps_found;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we have tried to find P as an intermediate
|
||||
file and failed, mark that name as impossible
|
||||
so we won't go through the search again later. */
|
||||
file_impossible (p);
|
||||
}
|
||||
|
||||
/* A dependency of this rule does not exist.
|
||||
Therefore, this rule fails. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* This rule is no longer `in use' for recursive searches. */
|
||||
rule->in_use = 0;
|
||||
|
||||
if (dep != 0)
|
||||
{
|
||||
/* This pattern rule does not apply.
|
||||
If some of its dependencies succeeded,
|
||||
free the data structure describing them. */
|
||||
while (deps_found-- > 0)
|
||||
{
|
||||
register struct file *f = intermediate_files[deps_found];
|
||||
free (found_files[deps_found]);
|
||||
if (f != 0
|
||||
&& (f->stem < f->name
|
||||
|| f->stem > f->name + strlen (f->name)))
|
||||
free (f->stem);
|
||||
}
|
||||
}
|
||||
else
|
||||
/* This pattern rule does apply. Stop looking for one. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we found an applicable rule without
|
||||
intermediate files, don't try with them. */
|
||||
if (i < nrules)
|
||||
break;
|
||||
|
||||
rule = 0;
|
||||
}
|
||||
|
||||
/* RULE is nil if the loop went all the way
|
||||
through the list and everything failed. */
|
||||
if (rule == 0)
|
||||
return 0;
|
||||
|
||||
foundrule = i;
|
||||
|
||||
/* If we are recursing, store the pattern that matched
|
||||
FILENAME in FILE->name for use in upper levels. */
|
||||
|
||||
if (recursions > 0)
|
||||
/* Kludge-o-matic */
|
||||
file->name = rule->targets[matches[foundrule]];
|
||||
|
||||
/* FOUND_FILES lists the dependencies for the rule we found.
|
||||
This includes the intermediate files, if any.
|
||||
Convert them into entries on the deps-chain of FILE. */
|
||||
|
||||
while (deps_found-- > 0)
|
||||
{
|
||||
register char *s;
|
||||
|
||||
if (intermediate_files[deps_found] != 0)
|
||||
{
|
||||
/* If we need to use an intermediate file,
|
||||
make sure it is entered as a target, with the info that was
|
||||
found for it in the recursive pattern_search call.
|
||||
We know that the intermediate file did not already exist as
|
||||
a target; therefore we can assume that the deps and cmds
|
||||
of F below are null before we change them. */
|
||||
|
||||
struct file *imf = intermediate_files[deps_found];
|
||||
register struct file *f = enter_file (imf->name);
|
||||
f->deps = imf->deps;
|
||||
f->cmds = imf->cmds;
|
||||
f->stem = imf->stem;
|
||||
imf = lookup_file (intermediate_patterns[deps_found]);
|
||||
if (imf != 0 && imf->precious)
|
||||
f->precious = 1;
|
||||
f->intermediate = 1;
|
||||
f->tried_implicit = 1;
|
||||
for (dep = f->deps; dep != 0; dep = dep->next)
|
||||
{
|
||||
dep->file = enter_file (dep->name);
|
||||
dep->name = 0;
|
||||
dep->file->tried_implicit |= dep->changed;
|
||||
}
|
||||
num_intermediates++;
|
||||
}
|
||||
|
||||
dep = (struct dep *) xmalloc (sizeof (struct dep));
|
||||
s = found_files[deps_found];
|
||||
if (recursions == 0)
|
||||
{
|
||||
dep->name = 0;
|
||||
dep->file = lookup_file (s);
|
||||
if (dep->file == 0)
|
||||
/* enter_file consumes S's storage. */
|
||||
dep->file = enter_file (s);
|
||||
else
|
||||
/* A copy of S is already allocated in DEP->file->name.
|
||||
So we can free S. */
|
||||
free (s);
|
||||
}
|
||||
else
|
||||
{
|
||||
dep->name = s;
|
||||
dep->file = 0;
|
||||
dep->changed = 0;
|
||||
}
|
||||
if (intermediate_files[deps_found] == 0 && tryrules[foundrule]->terminal)
|
||||
{
|
||||
/* If the file actually existed (was not an intermediate file),
|
||||
and the rule that found it was a terminal one, then we want
|
||||
to mark the found file so that it will not have implicit rule
|
||||
search done for it. If we are not entering a `struct file' for
|
||||
it now, we indicate this with the `changed' flag. */
|
||||
if (dep->file == 0)
|
||||
dep->changed = 1;
|
||||
else
|
||||
dep->file->tried_implicit = 1;
|
||||
}
|
||||
dep->next = file->deps;
|
||||
file->deps = dep;
|
||||
}
|
||||
|
||||
if (!checked_lastslash[foundrule])
|
||||
/* Always allocate new storage, since STEM might be
|
||||
on the stack for an intermediate file. */
|
||||
file->stem = savestring (stem, stemlen);
|
||||
else
|
||||
{
|
||||
/* We want to prepend the directory from
|
||||
the original FILENAME onto the stem. */
|
||||
file->stem = (char *) xmalloc (((lastslash + 1) - filename)
|
||||
+ stemlen + 1);
|
||||
bcopy (filename, file->stem, (lastslash + 1) - filename);
|
||||
bcopy (stem, file->stem + ((lastslash + 1) - filename), stemlen);
|
||||
file->stem[((lastslash + 1) - filename) + stemlen] = '\0';
|
||||
}
|
||||
|
||||
file->cmds = rule->cmds;
|
||||
|
||||
/* Put the targets other than the one that
|
||||
matched into FILE's `also_make' member. */
|
||||
|
||||
/* If there was only one target, there is nothing to do. */
|
||||
if (rule->targets[1] != 0)
|
||||
for (i = 0; rule->targets[i] != 0; ++i)
|
||||
if (i != matches[foundrule])
|
||||
{
|
||||
struct dep *new = (struct dep *) xmalloc (sizeof (struct dep));
|
||||
new->name = p = (char *) xmalloc (rule->lens[i] + stemlen + 1);
|
||||
bcopy (rule->targets[i], p,
|
||||
rule->suffixes[i] - rule->targets[i] - 1);
|
||||
p += rule->suffixes[i] - rule->targets[i] - 1;
|
||||
bcopy (stem, p, stemlen);
|
||||
p += stemlen;
|
||||
bcopy (rule->suffixes[i], p,
|
||||
rule->lens[i] - (rule->suffixes[i] - rule->targets[i]) + 1);
|
||||
new->file = enter_file (new->name);
|
||||
new->next = file->also_make;
|
||||
file->also_make = new;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
80
job.h
Normal file
80
job.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* Definitions for managing subprocesses in GNU Make.
|
||||
Copyright (C) 1992, 1993 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef SEEN_JOB_H
|
||||
#define SEEN_JOB_H
|
||||
|
||||
/* Structure describing a running or dead child process. */
|
||||
|
||||
struct child
|
||||
{
|
||||
struct child *next; /* Link in the chain. */
|
||||
|
||||
struct file *file; /* File being remade. */
|
||||
|
||||
char **environment; /* Environment for commands. */
|
||||
|
||||
char **command_lines; /* Array of variable-expanded cmd lines. */
|
||||
unsigned int command_line; /* Index into above. */
|
||||
char *command_ptr; /* Ptr into command_lines[command_line]. */
|
||||
|
||||
pid_t pid; /* Child process's ID number. */
|
||||
#ifdef VMS
|
||||
int efn; /* Completion event flag number */
|
||||
int cstatus; /* Completion status */
|
||||
#endif
|
||||
unsigned int remote:1; /* Nonzero if executing remotely. */
|
||||
|
||||
unsigned int noerror:1; /* Nonzero if commands contained a `-'. */
|
||||
|
||||
unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */
|
||||
unsigned int deleted:1; /* Nonzero if targets have been deleted. */
|
||||
};
|
||||
|
||||
extern struct child *children;
|
||||
|
||||
extern void new_job PARAMS ((struct file *file));
|
||||
extern void reap_children PARAMS ((int block, int err));
|
||||
extern void start_waiting_jobs PARAMS ((void));
|
||||
|
||||
extern char **construct_command_argv PARAMS ((char *line, char **restp, struct file *file));
|
||||
#ifdef VMS
|
||||
extern int child_execute_job PARAMS ((char *argv, struct child *child));
|
||||
#else
|
||||
extern void child_execute_job PARAMS ((int stdin_fd, int stdout_fd, char **argv, char **envp));
|
||||
#endif
|
||||
#ifdef _AMIGA
|
||||
extern void exec_command PARAMS ((char **argv));
|
||||
#else
|
||||
extern void exec_command PARAMS ((char **argv, char **envp));
|
||||
#endif
|
||||
|
||||
extern unsigned int job_slots_used;
|
||||
|
||||
#ifdef POSIX
|
||||
extern void unblock_sigs PARAMS ((void));
|
||||
#else
|
||||
#ifdef HAVE_SIGSETMASK
|
||||
extern int fatal_signal_mask;
|
||||
#define unblock_sigs() sigsetmask (0)
|
||||
#else
|
||||
#define unblock_sigs()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* SEEN_JOB_H */
|
||||
31
loadtest.c
Normal file
31
loadtest.c
Normal file
@@ -0,0 +1,31 @@
|
||||
extern volatile void exit (int);
|
||||
extern double load_average (void);
|
||||
|
||||
double max_load_average = -1;
|
||||
unsigned int job_slots_used = 0;
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
printf ("load_average () = %.2f\n", load_average ());
|
||||
exit (0);
|
||||
}
|
||||
|
||||
void
|
||||
error (char *fmt, ...)
|
||||
{
|
||||
exit (1);
|
||||
}
|
||||
|
||||
void
|
||||
perror_with_name (char *a, char *b)
|
||||
{
|
||||
exit (1);
|
||||
}
|
||||
|
||||
void
|
||||
wait_for_children (int i)
|
||||
{
|
||||
return;
|
||||
}
|
||||
722
make-stds.texi
Normal file
722
make-stds.texi
Normal file
@@ -0,0 +1,722 @@
|
||||
@comment This file is included by both standards.texi and make.texinfo.
|
||||
@comment It was broken out of standards.texi on 1/6/93 by roland.
|
||||
|
||||
@node Makefile Conventions
|
||||
@chapter Makefile Conventions
|
||||
@comment standards.texi does not print an index, but make.texinfo does.
|
||||
@cindex makefile, conventions for
|
||||
@cindex conventions for makefiles
|
||||
@cindex standards for makefiles
|
||||
|
||||
This
|
||||
@ifinfo
|
||||
node
|
||||
@end ifinfo
|
||||
@iftex
|
||||
@ifset CODESTD
|
||||
section
|
||||
@end ifset
|
||||
@ifclear CODESTD
|
||||
chapter
|
||||
@end ifclear
|
||||
@end iftex
|
||||
describes conventions for writing the Makefiles for GNU programs.
|
||||
|
||||
@menu
|
||||
* Makefile Basics:: General Conventions for Makefiles
|
||||
* Utilities in Makefiles:: Utilities in Makefiles
|
||||
* Command Variables:: Variables for Specifying Commands
|
||||
* Directory Variables:: Variables for Installation Directories
|
||||
* Standard Targets:: Standard Targets for Users
|
||||
@end menu
|
||||
|
||||
@node Makefile Basics
|
||||
@section General Conventions for Makefiles
|
||||
|
||||
Every Makefile should contain this line:
|
||||
|
||||
@example
|
||||
SHELL = /bin/sh
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
to avoid trouble on systems where the @code{SHELL} variable might be
|
||||
inherited from the environment. (This is never a problem with GNU
|
||||
@code{make}.)
|
||||
|
||||
Different @code{make} programs have incompatible suffix lists and
|
||||
implicit rules, and this sometimes creates confusion or misbehavior. So
|
||||
it is a good idea to set the suffix list explicitly using only the
|
||||
suffixes you need in the particular Makefile, like this:
|
||||
|
||||
@example
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The first line clears out the suffix list, the second introduces all
|
||||
suffixes which may be subject to implicit rules in this Makefile.
|
||||
|
||||
Don't assume that @file{.} is in the path for command execution. When
|
||||
you need to run programs that are a part of your package during the
|
||||
make, please make sure that it uses @file{./} if the program is built as
|
||||
part of the make or @file{$(srcdir)/} if the file is an unchanging part
|
||||
of the source code. Without one of these prefixes, the current search
|
||||
path is used.
|
||||
|
||||
The distinction between @file{./} and @file{$(srcdir)/} is important
|
||||
when using the @samp{--srcdir} option to @file{configure}. A rule of
|
||||
the form:
|
||||
|
||||
@smallexample
|
||||
foo.1 : foo.man sedscript
|
||||
sed -e sedscript foo.man > foo.1
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
will fail when the current directory is not the source directory,
|
||||
because @file{foo.man} and @file{sedscript} are not in the current
|
||||
directory.
|
||||
|
||||
When using GNU @code{make}, relying on @samp{VPATH} to find the source
|
||||
file will work in the case where there is a single dependency file,
|
||||
since the @code{make} automatic variable @samp{$<} will represent the
|
||||
source file wherever it is. (Many versions of @code{make} set @samp{$<}
|
||||
only in implicit rules.) A Makefile target like
|
||||
|
||||
@smallexample
|
||||
foo.o : bar.c
|
||||
$(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
should instead be written as
|
||||
|
||||
@smallexample
|
||||
foo.o : bar.c
|
||||
$(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@@
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
in order to allow @samp{VPATH} to work correctly. When the target has
|
||||
multiple dependencies, using an explicit @samp{$(srcdir)} is the easiest
|
||||
way to make the rule work well. For example, the target above for
|
||||
@file{foo.1} is best written as:
|
||||
|
||||
@smallexample
|
||||
foo.1 : foo.man sedscript
|
||||
sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@@
|
||||
@end smallexample
|
||||
|
||||
Try to make the build and installation targets, at least (and all their
|
||||
subtargets) work correctly with a parallel @code{make}.
|
||||
|
||||
@node Utilities in Makefiles
|
||||
@section Utilities in Makefiles
|
||||
|
||||
Write the Makefile commands (and any shell scripts, such as
|
||||
@code{configure}) to run in @code{sh}, not in @code{csh}. Don't use any
|
||||
special features of @code{ksh} or @code{bash}.
|
||||
|
||||
The @code{configure} script and the Makefile rules for building and
|
||||
installation should not use any utilities directly except these:
|
||||
|
||||
@example
|
||||
cat cmp cp echo egrep expr false grep
|
||||
ln mkdir mv pwd rm rmdir sed test touch true
|
||||
@end example
|
||||
|
||||
Stick to the generally supported options for these programs. For
|
||||
example, don't use @samp{mkdir -p}, convenient as it may be, because
|
||||
most systems don't support it.
|
||||
|
||||
It is a good idea to avoid creating symbolic links in makefiles, since a
|
||||
few systems don't support them.
|
||||
|
||||
The Makefile rules for building and installation can also use compilers
|
||||
and related programs, but should do so via @code{make} variables so that the
|
||||
user can substitute alternatives. Here are some of the programs we
|
||||
mean:
|
||||
|
||||
@example
|
||||
ar bison cc flex install ld lex
|
||||
make makeinfo ranlib texi2dvi yacc
|
||||
@end example
|
||||
|
||||
Use the following @code{make} variables:
|
||||
|
||||
@example
|
||||
$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LEX)
|
||||
$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
|
||||
@end example
|
||||
|
||||
When you use @code{ranlib}, you should make sure nothing bad happens if
|
||||
the system does not have @code{ranlib}. Arrange to ignore an error
|
||||
from that command, and print a message before the command to tell the
|
||||
user that failure of the @code{ranlib} command does not mean a problem.
|
||||
(The Autoconf @samp{AC_PROG_RANLIB} macro can help with this.)
|
||||
|
||||
If you use symbolic links, you should implement a fallback for systems
|
||||
that don't have symbolic links.
|
||||
|
||||
It is ok to use other utilities in Makefile portions (or scripts)
|
||||
intended only for particular systems where you know those utilities
|
||||
exist.
|
||||
|
||||
@node Command Variables
|
||||
@section Variables for Specifying Commands
|
||||
|
||||
Makefiles should provide variables for overriding certain commands, options,
|
||||
and so on.
|
||||
|
||||
In particular, you should run most utility programs via variables.
|
||||
Thus, if you use Bison, have a variable named @code{BISON} whose default
|
||||
value is set with @samp{BISON = bison}, and refer to it with
|
||||
@code{$(BISON)} whenever you need to use Bison.
|
||||
|
||||
File management utilities such as @code{ln}, @code{rm}, @code{mv}, and
|
||||
so on, need not be referred to through variables in this way, since users
|
||||
don't need to replace them with other programs.
|
||||
|
||||
Each program-name variable should come with an options variable that is
|
||||
used to supply options to the program. Append @samp{FLAGS} to the
|
||||
program-name variable name to get the options variable name---for
|
||||
example, @code{BISONFLAGS}. (The name @code{CFLAGS} is an exception to
|
||||
this rule, but we keep it because it is standard.) Use @code{CPPFLAGS}
|
||||
in any compilation command that runs the preprocessor, and use
|
||||
@code{LDFLAGS} in any compilation command that does linking as well as
|
||||
in any direct use of @code{ld}.
|
||||
|
||||
If there are C compiler options that @emph{must} be used for proper
|
||||
compilation of certain files, do not include them in @code{CFLAGS}.
|
||||
Users expect to be able to specify @code{CFLAGS} freely themselves.
|
||||
Instead, arrange to pass the necessary options to the C compiler
|
||||
independently of @code{CFLAGS}, by writing them explicitly in the
|
||||
compilation commands or by defining an implicit rule, like this:
|
||||
|
||||
@smallexample
|
||||
CFLAGS = -g
|
||||
ALL_CFLAGS = -I. $(CFLAGS)
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
|
||||
@end smallexample
|
||||
|
||||
Do include the @samp{-g} option in @code{CFLAGS}, because that is not
|
||||
@emph{required} for proper compilation. You can consider it a default
|
||||
that is only recommended. If the package is set up so that it is
|
||||
compiled with GCC by default, then you might as well include @samp{-O}
|
||||
in the default value of @code{CFLAGS} as well.
|
||||
|
||||
Put @code{CFLAGS} last in the compilation command, after other variables
|
||||
containing compiler options, so the user can use @code{CFLAGS} to
|
||||
override the others.
|
||||
|
||||
Every Makefile should define the variable @code{INSTALL}, which is the
|
||||
basic command for installing a file into the system.
|
||||
|
||||
Every Makefile should also define the variables @code{INSTALL_PROGRAM}
|
||||
and @code{INSTALL_DATA}. (The default for each of these should be
|
||||
@code{$(INSTALL)}.) Then it should use those variables as the commands
|
||||
for actual installation, for executables and nonexecutables
|
||||
respectively. Use these variables as follows:
|
||||
|
||||
@example
|
||||
$(INSTALL_PROGRAM) foo $(bindir)/foo
|
||||
$(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Always use a file name, not a directory name, as the second argument of
|
||||
the installation commands. Use a separate command for each file to be
|
||||
installed.
|
||||
|
||||
@node Directory Variables
|
||||
@section Variables for Installation Directories
|
||||
|
||||
Installation directories should always be named by variables, so it is
|
||||
easy to install in a nonstandard place. The standard names for these
|
||||
variables are described below. They are based on a standard filesystem
|
||||
layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and
|
||||
other modern operating systems.
|
||||
|
||||
These two variables set the root for the installation. All the other
|
||||
installation directories should be subdirectories of one of these two,
|
||||
and nothing should be directly installed into these two directories.
|
||||
|
||||
@table @samp
|
||||
@item prefix
|
||||
A prefix used in constructing the default values of the variables listed
|
||||
below. The default value of @code{prefix} should be @file{/usr/local}.
|
||||
When building the complete GNU system, the prefix will be empty and
|
||||
@file{/usr} will be a symbolic link to @file{/}.
|
||||
(If you are using Autoconf, write it as @samp{@@prefix@@}.)
|
||||
|
||||
@item exec_prefix
|
||||
A prefix used in constructing the default values of some of the
|
||||
variables listed below. The default value of @code{exec_prefix} should
|
||||
be @code{$(prefix)}.
|
||||
(If you are using Autoconf, write it as @samp{@@exec_prefix@@}.)
|
||||
|
||||
Generally, @code{$(exec_prefix)} is used for directories that contain
|
||||
machine-specific files (such as executables and subroutine libraries),
|
||||
while @code{$(prefix)} is used directly for other directories.
|
||||
@end table
|
||||
|
||||
Executable programs are installed in one of the following directories.
|
||||
|
||||
@table @samp
|
||||
@item bindir
|
||||
The directory for installing executable programs that users can run.
|
||||
This should normally be @file{/usr/local/bin}, but write it as
|
||||
@file{$(exec_prefix)/bin}.
|
||||
(If you are using Autoconf, write it as @samp{@@bindir@@}.)
|
||||
|
||||
@item sbindir
|
||||
The directory for installing executable programs that can be run from
|
||||
the shell, but are only generally useful to system administrators. This
|
||||
should normally be @file{/usr/local/sbin}, but write it as
|
||||
@file{$(exec_prefix)/sbin}.
|
||||
(If you are using Autoconf, write it as @samp{@@sbindir@@}.)
|
||||
|
||||
@item libexecdir
|
||||
@comment This paragraph adjusted to avoid overfull hbox --roland 5jul94
|
||||
The directory for installing executable programs to be run by other
|
||||
programs rather than by users. This directory should normally be
|
||||
@file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}.
|
||||
(If you are using Autoconf, write it as @samp{@@libexecdir@@}.)
|
||||
@end table
|
||||
|
||||
Data files used by the program during its execution are divided into
|
||||
categories in two ways.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Some files are normally modified by programs; others are never normally
|
||||
modified (though users may edit some of these).
|
||||
|
||||
@item
|
||||
Some files are architecture-independent and can be shared by all
|
||||
machines at a site; some are architecture-dependent and can be shared
|
||||
only by machines of the same kind and operating system; others may never
|
||||
be shared between two machines.
|
||||
@end itemize
|
||||
|
||||
This makes for six different possibilities. However, we want to
|
||||
discourage the use of architecture-dependent files, aside from object
|
||||
files and libraries. It is much cleaner to make other data files
|
||||
architecture-independent, and it is generally not hard.
|
||||
|
||||
Therefore, here are the variables Makefiles should use to specify
|
||||
directories:
|
||||
|
||||
@table @samp
|
||||
@item datadir
|
||||
The directory for installing read-only architecture independent data
|
||||
files. This should normally be @file{/usr/local/share}, but write it as
|
||||
@file{$(prefix)/share}.
|
||||
(If you are using Autoconf, write it as @samp{@@datadir@@}.)
|
||||
As a special exception, see @file{$(infodir)}
|
||||
and @file{$(includedir)} below.
|
||||
|
||||
@item sysconfdir
|
||||
The directory for installing read-only data files that pertain to a
|
||||
single machine--that is to say, files for configuring a host. Mailer
|
||||
and network configuration files, @file{/etc/passwd}, and so forth belong
|
||||
here. All the files in this directory should be ordinary ASCII text
|
||||
files. This directory should normally be @file{/usr/local/etc}, but
|
||||
write it as @file{$(prefix)/etc}.
|
||||
(If you are using Autoconf, write it as @samp{@@sysconfdir@@}.)
|
||||
|
||||
@c rewritten to avoid overfull hbox --tower
|
||||
Do not install executables
|
||||
@c here
|
||||
in this directory (they probably
|
||||
belong in @file{$(libexecdir)} or @file{$(sbindir)}). Also do not
|
||||
install files that are modified in the normal course of their use
|
||||
(programs whose purpose is to change the configuration of the system
|
||||
excluded). Those probably belong in @file{$(localstatedir)}.
|
||||
|
||||
@item sharedstatedir
|
||||
The directory for installing architecture-independent data files which
|
||||
the programs modify while they run. This should normally be
|
||||
@file{/usr/local/com}, but write it as @file{$(prefix)/com}.
|
||||
(If you are using Autoconf, write it as @samp{@@sharedstatedir@@}.)
|
||||
|
||||
@item localstatedir
|
||||
The directory for installing data files which the programs modify while
|
||||
they run, and that pertain to one specific machine. Users should never
|
||||
need to modify files in this directory to configure the package's
|
||||
operation; put such configuration information in separate files that go
|
||||
in @file{$(datadir)} or @file{$(sysconfdir)}. @file{$(localstatedir)}
|
||||
should normally be @file{/usr/local/var}, but write it as
|
||||
@file{$(prefix)/var}.
|
||||
(If you are using Autoconf, write it as @samp{@@localstatedir@@}.)
|
||||
|
||||
@item libdir
|
||||
The directory for object files and libraries of object code. Do not
|
||||
install executables here, they probably ought to go in @file{$(libexecdir)}
|
||||
instead. The value of @code{libdir} should normally be
|
||||
@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}.
|
||||
(If you are using Autoconf, write it as @samp{@@libdir@@}.)
|
||||
|
||||
@item infodir
|
||||
The directory for installing the Info files for this package. By
|
||||
default, it should be @file{/usr/local/info}, but it should be written
|
||||
as @file{$(prefix)/info}.
|
||||
(If you are using Autoconf, write it as @samp{@@infodir@@}.)
|
||||
|
||||
@item includedir
|
||||
@c rewritten to avoid overfull hbox --roland
|
||||
The directory for installing header files to be included by user
|
||||
programs with the C @samp{#include} preprocessor directive. This
|
||||
should normally be @file{/usr/local/include}, but write it as
|
||||
@file{$(prefix)/include}.
|
||||
(If you are using Autoconf, write it as @samp{@@includedir@@}.)
|
||||
|
||||
Most compilers other than GCC do not look for header files in
|
||||
@file{/usr/local/include}. So installing the header files this way is
|
||||
only useful with GCC. Sometimes this is not a problem because some
|
||||
libraries are only really intended to work with GCC. But some libraries
|
||||
are intended to work with other compilers. They should install their
|
||||
header files in two places, one specified by @code{includedir} and one
|
||||
specified by @code{oldincludedir}.
|
||||
|
||||
@item oldincludedir
|
||||
The directory for installing @samp{#include} header files for use with
|
||||
compilers other than GCC. This should normally be @file{/usr/include}.
|
||||
(If you are using Autoconf, you can write it as @samp{@@oldincludedir@@}.)
|
||||
|
||||
The Makefile commands should check whether the value of
|
||||
@code{oldincludedir} is empty. If it is, they should not try to use
|
||||
it; they should cancel the second installation of the header files.
|
||||
|
||||
A package should not replace an existing header in this directory unless
|
||||
the header came from the same package. Thus, if your Foo package
|
||||
provides a header file @file{foo.h}, then it should install the header
|
||||
file in the @code{oldincludedir} directory if either (1) there is no
|
||||
@file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo
|
||||
package.
|
||||
|
||||
To tell whether @file{foo.h} came from the Foo package, put a magic
|
||||
string in the file---part of a comment---and @code{grep} for that string.
|
||||
@end table
|
||||
|
||||
Unix-style man pages are installed in one of the following:
|
||||
|
||||
@table @samp
|
||||
@item mandir
|
||||
The top-level directory for installing the man pages (if any) for this
|
||||
package. It will normally be @file{/usr/local/man}, but you should
|
||||
write it as @file{$(prefix)/man}.
|
||||
(If you are using Autoconf, write it as @samp{@@mandir@@}.)
|
||||
|
||||
@item man1dir
|
||||
The directory for installing section 1 man pages. Write it as
|
||||
@file{$(mandir)/man1}.
|
||||
@item man2dir
|
||||
The directory for installing section 2 man pages. Write it as
|
||||
@file{$(mandir)/man2}
|
||||
@item @dots{}
|
||||
|
||||
@strong{Don't make the primary documentation for any GNU software be a
|
||||
man page. Write a manual in Texinfo instead. Man pages are just for
|
||||
the sake of people running GNU software on Unix, which is a secondary
|
||||
application only.}
|
||||
|
||||
@item manext
|
||||
The file name extension for the installed man page. This should contain
|
||||
a period followed by the appropriate digit; it should normally be @samp{.1}.
|
||||
|
||||
@item man1ext
|
||||
The file name extension for installed section 1 man pages.
|
||||
@item man2ext
|
||||
The file name extension for installed section 2 man pages.
|
||||
@item @dots{}
|
||||
Use these names instead of @samp{manext} if the package needs to install man
|
||||
pages in more than one section of the manual.
|
||||
@end table
|
||||
|
||||
And finally, you should set the following variable:
|
||||
|
||||
@table @samp
|
||||
@item srcdir
|
||||
The directory for the sources being compiled. The value of this
|
||||
variable is normally inserted by the @code{configure} shell script.
|
||||
(If you are using Autconf, use @samp{srcdir = @@srcdir@@}.)
|
||||
@end table
|
||||
|
||||
For example:
|
||||
|
||||
@smallexample
|
||||
@c I have changed some of the comments here slightly to fix an overfull
|
||||
@c hbox, so the make manual can format correctly. --roland
|
||||
# Common prefix for installation directories.
|
||||
# NOTE: This directory must exist when you start the install.
|
||||
prefix = /usr/local
|
||||
exec_prefix = $(prefix)
|
||||
# Where to put the executable for the command `gcc'.
|
||||
bindir = $(exec_prefix)/bin
|
||||
# Where to put the directories used by the compiler.
|
||||
libexecdir = $(exec_prefix)/libexec
|
||||
# Where to put the Info files.
|
||||
infodir = $(prefix)/info
|
||||
@end smallexample
|
||||
|
||||
If your program installs a large number of files into one of the
|
||||
standard user-specified directories, it might be useful to group them
|
||||
into a subdirectory particular to that program. If you do this, you
|
||||
should write the @code{install} rule to create these subdirectories.
|
||||
|
||||
Do not expect the user to include the subdirectory name in the value of
|
||||
any of the variables listed above. The idea of having a uniform set of
|
||||
variable names for installation directories is to enable the user to
|
||||
specify the exact same values for several different GNU packages. In
|
||||
order for this to be useful, all the packages must be designed so that
|
||||
they will work sensibly when the user does so.
|
||||
|
||||
@node Standard Targets
|
||||
@section Standard Targets for Users
|
||||
|
||||
All GNU programs should have the following targets in their Makefiles:
|
||||
|
||||
@table @samp
|
||||
@item all
|
||||
Compile the entire program. This should be the default target. This
|
||||
target need not rebuild any documentation files; Info files should
|
||||
normally be included in the distribution, and DVI files should be made
|
||||
only when explicitly asked for.
|
||||
|
||||
By default, the Make rules should compile and link with @samp{-g}, so
|
||||
that executable programs have debugging symbols. Users who don't mind
|
||||
being helpless can strip the executables later if they wish.
|
||||
|
||||
@item install
|
||||
Compile the program and copy the executables, libraries, and so on to
|
||||
the file names where they should reside for actual use. If there is a
|
||||
simple test to verify that a program is properly installed, this target
|
||||
should run that test.
|
||||
|
||||
Do not strip executables when installing them. Devil-may-care users can
|
||||
use the @code{install-strip} target to do that.
|
||||
|
||||
If possible, write the @code{install} target rule so that it does not
|
||||
modify anything in the directory where the program was built, provided
|
||||
@samp{make all} has just been done. This is convenient for building the
|
||||
program under one user name and installing it under another.
|
||||
|
||||
The commands should create all the directories in which files are to be
|
||||
installed, if they don't already exist. This includes the directories
|
||||
specified as the values of the variables @code{prefix} and
|
||||
@code{exec_prefix}, as well as all subdirectories that are needed.
|
||||
One way to do this is by means of an @code{installdirs} target
|
||||
as described below.
|
||||
|
||||
Use @samp{-} before any command for installing a man page, so that
|
||||
@code{make} will ignore any errors. This is in case there are systems
|
||||
that don't have the Unix man page documentation system installed.
|
||||
|
||||
The way to install Info files is to copy them into @file{$(infodir)}
|
||||
with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run
|
||||
the @code{install-info} program if it is present. @code{install-info}
|
||||
is a program that edits the Info @file{dir} file to add or update the
|
||||
menu entry for the given Info file; it is part of the Texinfo package.
|
||||
Here is a sample rule to install an Info file:
|
||||
|
||||
@comment This example has been carefully formatted for the Make manual.
|
||||
@comment Please do not reformat it without talking to roland@gnu.ai.mit.edu.
|
||||
@smallexample
|
||||
$(infodir)/foo.info: foo.info
|
||||
# There may be a newer info file in . than in srcdir.
|
||||
-if test -f foo.info; then d=.; \
|
||||
else d=$(srcdir); fi; \
|
||||
$(INSTALL_DATA) $$d/foo.info $@@; \
|
||||
# Run install-info only if it exists.
|
||||
# Use `if' instead of just prepending `-' to the
|
||||
# line so we notice real errors from install-info.
|
||||
# We use `$(SHELL) -c' because some shells do not
|
||||
# fail gracefully when there is an unknown command.
|
||||
if $(SHELL) -c 'install-info --version' \
|
||||
>/dev/null 2>&1; then \
|
||||
install-info --dir-file=$(infodir)/dir \
|
||||
$(infodir)/foo.info; \
|
||||
else true; fi
|
||||
@end smallexample
|
||||
|
||||
@item uninstall
|
||||
Delete all the installed files that the @samp{install} target would
|
||||
create (but not the noninstalled files such as @samp{make all} would
|
||||
create).
|
||||
|
||||
This rule should not modify the directories where compilation is done,
|
||||
only the directories where files are installed.
|
||||
|
||||
@item install-strip
|
||||
Like @code{install}, but strip the executable files while installing
|
||||
them. The definition of this target can be very simple:
|
||||
|
||||
@smallexample
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
|
||||
install
|
||||
@end smallexample
|
||||
|
||||
Normally we do not recommend stripping an executable unless you are sure
|
||||
the program has no bugs. However, it can be reasonable to install a
|
||||
stripped executable for actual execution while saving the unstripped
|
||||
executable elsewhere in case there is a bug.
|
||||
|
||||
@comment The gratuitous blank line here is to make the table look better
|
||||
@comment in the printed Make manual. Please leave it in.
|
||||
@item clean
|
||||
|
||||
Delete all files from the current directory that are normally created by
|
||||
building the program. Don't delete the files that record the
|
||||
configuration. Also preserve files that could be made by building, but
|
||||
normally aren't because the distribution comes with them.
|
||||
|
||||
Delete @file{.dvi} files here if they are not part of the distribution.
|
||||
|
||||
@item distclean
|
||||
Delete all files from the current directory that are created by
|
||||
configuring or building the program. If you have unpacked the source
|
||||
and built the program without creating any other files, @samp{make
|
||||
distclean} should leave only the files that were in the distribution.
|
||||
|
||||
@item mostlyclean
|
||||
Like @samp{clean}, but may refrain from deleting a few files that people
|
||||
normally don't want to recompile. For example, the @samp{mostlyclean}
|
||||
target for GCC does not delete @file{libgcc.a}, because recompiling it
|
||||
is rarely necessary and takes a lot of time.
|
||||
|
||||
@item maintainer-clean
|
||||
Delete almost everything from the current directory that can be
|
||||
reconstructed with this Makefile. This typically includes everything
|
||||
deleted by @code{distclean}, plus more: C source files produced by
|
||||
Bison, tags tables, Info files, and so on.
|
||||
|
||||
The reason we say ``almost everything'' is that running the command
|
||||
@samp{make maintainer-clean} should not delete @file{configure} even if
|
||||
@file{configure} can be remade using a rule in the Makefile. More generally,
|
||||
@samp{make maintainer-clean} should not delete anything that needs to
|
||||
exist in order to run @file{configure} and then begin to build the
|
||||
program. This is the only exception; @code{maintainer-clean} should
|
||||
delete everything else that can be rebuilt.
|
||||
|
||||
The @samp{maintainer-clean} target is intended to be used by a maintainer of
|
||||
the package, not by ordinary users. You may need special tools to
|
||||
reconstruct some of the files that @samp{make maintainer-clean} deletes.
|
||||
Since these files are normally included in the distribution, we don't
|
||||
take care to make them easy to reconstruct. If you find you need to
|
||||
unpack the full distribution again, don't blame us.
|
||||
|
||||
To help make users aware of this, the commands for the special
|
||||
@code{maintainer-clean} target should start with these two:
|
||||
|
||||
@smallexample
|
||||
@@echo 'This command is intended for maintainers to use; it'
|
||||
@@echo 'deletes files that may need special tools to rebuild.'
|
||||
@end smallexample
|
||||
|
||||
@item TAGS
|
||||
Update a tags table for this program.
|
||||
@c ADR: how?
|
||||
|
||||
@item info
|
||||
Generate any Info files needed. The best way to write the rules is as
|
||||
follows:
|
||||
|
||||
@smallexample
|
||||
info: foo.info
|
||||
|
||||
foo.info: foo.texi chap1.texi chap2.texi
|
||||
$(MAKEINFO) $(srcdir)/foo.texi
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
You must define the variable @code{MAKEINFO} in the Makefile. It should
|
||||
run the @code{makeinfo} program, which is part of the Texinfo
|
||||
distribution.
|
||||
|
||||
@item dvi
|
||||
Generate DVI files for all Texinfo documentation.
|
||||
For example:
|
||||
|
||||
@smallexample
|
||||
dvi: foo.dvi
|
||||
|
||||
foo.dvi: foo.texi chap1.texi chap2.texi
|
||||
$(TEXI2DVI) $(srcdir)/foo.texi
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
You must define the variable @code{TEXI2DVI} in the Makefile. It should
|
||||
run the program @code{texi2dvi}, which is part of the Texinfo
|
||||
distribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real work
|
||||
of formatting. @TeX{} is not distributed with Texinfo.} Alternatively,
|
||||
write just the dependencies, and allow GNU @code{make} to provide the command.
|
||||
|
||||
@item dist
|
||||
Create a distribution tar file for this program. The tar file should be
|
||||
set up so that the file names in the tar file start with a subdirectory
|
||||
name which is the name of the package it is a distribution for. This
|
||||
name can include the version number.
|
||||
|
||||
For example, the distribution tar file of GCC version 1.40 unpacks into
|
||||
a subdirectory named @file{gcc-1.40}.
|
||||
|
||||
The easiest way to do this is to create a subdirectory appropriately
|
||||
named, use @code{ln} or @code{cp} to install the proper files in it, and
|
||||
then @code{tar} that subdirectory.
|
||||
|
||||
Compress the tar file file with @code{gzip}. For example, the actual
|
||||
distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}.
|
||||
|
||||
The @code{dist} target should explicitly depend on all non-source files
|
||||
that are in the distribution, to make sure they are up to date in the
|
||||
distribution.
|
||||
@ifset CODESTD
|
||||
@xref{Releases, , Making Releases}.
|
||||
@end ifset
|
||||
@ifclear CODESTD
|
||||
@xref{Releases, , Making Releases, standards, GNU Coding Standards}.
|
||||
@end ifclear
|
||||
|
||||
@item check
|
||||
Perform self-tests (if any). The user must build the program before
|
||||
running the tests, but need not install the program; you should write
|
||||
the self-tests so that they work when the program is built but not
|
||||
installed.
|
||||
@end table
|
||||
|
||||
The following targets are suggested as conventional names, for programs
|
||||
in which they are useful.
|
||||
|
||||
@table @code
|
||||
@item installcheck
|
||||
Perform installation tests (if any). The user must build and install
|
||||
the program before running the tests. You should not assume that
|
||||
@file{$(bindir)} is in the search path.
|
||||
|
||||
@item installdirs
|
||||
It's useful to add a target named @samp{installdirs} to create the
|
||||
directories where files are installed, and their parent directories.
|
||||
There is a script called @file{mkinstalldirs} which is convenient for
|
||||
this; you can find it in the Texinfo package.
|
||||
@c It's in /gd/gnu/lib/mkinstalldirs.
|
||||
You can use a rule like this:
|
||||
|
||||
@comment This has been carefully formatted to look decent in the Make manual.
|
||||
@comment Please be sure not to make it extend any further to the right.--roland
|
||||
@smallexample
|
||||
# Make sure all installation directories (e.g. $(bindir))
|
||||
# actually exist by making them if necessary.
|
||||
installdirs: mkinstalldirs
|
||||
$(srcdir)/mkinstalldirs $(bindir) $(datadir) \
|
||||
$(libdir) $(infodir) \
|
||||
$(mandir)
|
||||
@end smallexample
|
||||
|
||||
This rule should not modify the directories where compilation is done.
|
||||
It should do nothing but create installation directories.
|
||||
@end table
|
||||
302
make.1
Normal file
302
make.1
Normal file
@@ -0,0 +1,302 @@
|
||||
.TH MAKE 1L "22 August 1989" "GNU" "LOCAL USER COMMANDS"
|
||||
.SH NAME
|
||||
make \- GNU make utility to maintain groups of programs
|
||||
.SH SYNOPSIS
|
||||
.B "make "
|
||||
[
|
||||
.B \-f
|
||||
makefile ] [ option ] ...
|
||||
target ...
|
||||
.SH WARNING
|
||||
This man paage is an extract of the documentation of
|
||||
.I GNU make .
|
||||
It is updated only occasionally, because the GNU project does not use nroff.
|
||||
For complete, current documentation, refer to the Info file
|
||||
.B make
|
||||
or the DVI file
|
||||
.B make.dvi
|
||||
which are made from the Texinfo source file
|
||||
.BR make.texinfo .
|
||||
.SH DESCRIPTION
|
||||
.LP
|
||||
The purpose of the
|
||||
.I make
|
||||
utility is to determine automatically which
|
||||
pieces of a large program need to be recompiled, and issue the commands to
|
||||
recompile them.
|
||||
This manual describes the GNU implementation of
|
||||
.IR make ,
|
||||
which was written by Richard Stallman and Roland McGrath.
|
||||
Our examples show C programs, since they are most common, but you can use
|
||||
.I make
|
||||
with any programming language whose compiler can be run with a
|
||||
shell command.
|
||||
In fact,
|
||||
.I make
|
||||
is not limited to programs.
|
||||
You can use it to describe any task where some files must be
|
||||
updated automatically from others whenever the others change.
|
||||
.LP
|
||||
To prepare to use
|
||||
.IR make ,
|
||||
you must write a file called the
|
||||
.I makefile
|
||||
that describes the relationships among files in your program, and the
|
||||
states the commands for updating each file.
|
||||
In a program, typically the executable file is updated from object
|
||||
files, which are in turn made by compiling source files.
|
||||
.LP
|
||||
Once a suitable makefile exists, each time you change some source files,
|
||||
this simple shell command:
|
||||
.sp 1
|
||||
.RS
|
||||
.B make
|
||||
.RE
|
||||
.sp 1
|
||||
suffices to perform all necessary recompilations.
|
||||
The
|
||||
.I make
|
||||
program uses the makefile data base and the last-modification times
|
||||
of the files to decide which of the files need to be updated.
|
||||
For each of those files, it issues the commands recorded in the data base.
|
||||
.LP
|
||||
.I make
|
||||
executes commands in the
|
||||
.I makefile
|
||||
to update
|
||||
one or more target
|
||||
.IR names ,
|
||||
where
|
||||
.I name
|
||||
is typically a program.
|
||||
If no
|
||||
.B \-f
|
||||
option is present,
|
||||
.I make
|
||||
will look for the makefiles
|
||||
.IR GNUmakefile ,
|
||||
.IR makefile ,
|
||||
and
|
||||
.IR Makefile ,
|
||||
in that order.
|
||||
.LP
|
||||
Normally you should call your makefile either
|
||||
.I makefile
|
||||
or
|
||||
.IR Makefile .
|
||||
(We recommend
|
||||
.I Makefile
|
||||
because it appears prominently near the beginning of a directory
|
||||
listing, right near other important files such as
|
||||
.IR README .)
|
||||
The first name checked,
|
||||
.IR GNUmakefile ,
|
||||
is not recommended for most makefiles.
|
||||
You should use this name if you have a makefile that is specific to GNU
|
||||
.IR make ,
|
||||
and will not be understood by other versions of
|
||||
.IR make .
|
||||
If
|
||||
.I makefile
|
||||
is `\-', the standard input is read.
|
||||
.LP
|
||||
.I make
|
||||
updates a target if it depends on prerequisite files
|
||||
that have been modified since the target was last modified,
|
||||
or if the target does not exist.
|
||||
.SH OPTIONS
|
||||
.sp 1
|
||||
.TP 0.5i
|
||||
.B \-b
|
||||
.TP 0.5i
|
||||
.B \-m
|
||||
These options are ignored for compatibility with other versions of
|
||||
.IR make .
|
||||
.TP 0.5i
|
||||
.BI "\-C " dir
|
||||
Change to directory
|
||||
.I dir
|
||||
before reading the makefiles or doing anything else.
|
||||
If multiple
|
||||
.B \-C
|
||||
options are specified, each is interpreted relative to the
|
||||
previous one:
|
||||
.BR "\-C " /
|
||||
.BR "\-C " etc
|
||||
is equivalent to
|
||||
.BR "\-C " /etc.
|
||||
This is typically used with recursive invocations of
|
||||
.IR make .
|
||||
.TP 0.5i
|
||||
.B \-d
|
||||
Print debugging information in addition to normal processing.
|
||||
The debugging information says which files are being considered for
|
||||
remaking, which file-times are being compared and with what results,
|
||||
which files actually need to be remade, which implicit rules are
|
||||
considered and which are applied---everything interesting about how
|
||||
.I make
|
||||
decides what to do.
|
||||
.TP 0.5i
|
||||
.B \-e
|
||||
Give variables taken from the environment precedence
|
||||
over variables from makefiles.
|
||||
.TP 0.5i
|
||||
.BI "\-f " file
|
||||
Use
|
||||
.I file
|
||||
as a makefile.
|
||||
.TP 0.5i
|
||||
.B \-i
|
||||
Ignore all errors in commands executed to remake files.
|
||||
.TP 0.5i
|
||||
.BI "\-I " dir
|
||||
Specifies a directory
|
||||
.I dir
|
||||
to search for included makefiles.
|
||||
If several
|
||||
.B \-I
|
||||
options are used to specify several directories, the directories are
|
||||
searched in the order specified.
|
||||
Unlike the arguments to other flags of
|
||||
.IR make ,
|
||||
directories given with
|
||||
.B \-I
|
||||
flags may come directly after the flag:
|
||||
.BI \-I dir
|
||||
is allowed, as well as
|
||||
.BI "\-I " dir.
|
||||
This syntax is allowed for compatibility with the C
|
||||
preprocessor's
|
||||
.B \-I
|
||||
flag.
|
||||
.TP 0.5i
|
||||
.BI "\-j " jobs
|
||||
Specifies the number of jobs (commands) to run simultaneously.
|
||||
If there is more than one
|
||||
.B \-j
|
||||
option, the last one is effective.
|
||||
If the
|
||||
.B \-j
|
||||
option is given without an argument,
|
||||
.IR make
|
||||
will not limit the number of jobs that can run simultaneously.
|
||||
.TP 0.5i
|
||||
.B \-k
|
||||
Continue as much as possible after an error.
|
||||
While the target that failed, and those that depend on it, cannot
|
||||
be remade, the other dependencies of these targets can be processed
|
||||
all the same.
|
||||
.TP 0.5i
|
||||
.B \-l
|
||||
.TP 0.5i
|
||||
.BI "\-l " load
|
||||
Specifies that no new jobs (commands) should be started if there are
|
||||
others jobs running and the load average is at least
|
||||
.I load
|
||||
(a floating-point number).
|
||||
With no argument, removes a previous load limit.
|
||||
.TP 0.5i
|
||||
.B \-n
|
||||
Print the commands that would be executed, but do not execute them.
|
||||
.TP 0.5i
|
||||
.BI "\-o " file
|
||||
Do not remake the file
|
||||
.I file
|
||||
even if it is older than its dependencies, and do not remake anything
|
||||
on account of changes in
|
||||
.IR file .
|
||||
Essentially the file is treated as very old and its rules are ignored.
|
||||
.TP 0.5i
|
||||
.B \-p
|
||||
Print the data base (rules and variable values) that results from
|
||||
reading the makefiles; then execute as usual or as otherwise
|
||||
specified.
|
||||
This also prints the version information given by the
|
||||
.B \-v
|
||||
switch (see below).
|
||||
To print the data base without trying to remake any files, use
|
||||
.B make
|
||||
.B \-p
|
||||
.BI \-f /dev/null.
|
||||
.TP 0.5i
|
||||
.B \-q
|
||||
``Question mode''.
|
||||
Do not run any commands, or print anything; just return an exit status
|
||||
that is zero if the specified targets are already up to date, nonzero
|
||||
otherwise.
|
||||
.TP 0.5i
|
||||
.B \-r
|
||||
Eliminate use of the built-in implicit rules.
|
||||
Also clear out the default list of suffixes for suffix rules.
|
||||
.TP 0.5i
|
||||
.B \-s
|
||||
Silent operation; do not print the commands as they are executed.
|
||||
.TP 0.5i
|
||||
.B \-S
|
||||
Cancel the effect of the
|
||||
.B \-k
|
||||
option.
|
||||
This is never necessary except in a recursive
|
||||
.I make
|
||||
where
|
||||
.B \-k
|
||||
might be inherited from the top-level
|
||||
.I make
|
||||
via MAKEFLAGS or if you set
|
||||
.B \-k
|
||||
in MAKEFLAGS in your environment.
|
||||
.TP 0.5i
|
||||
.B \-t
|
||||
Touch files (mark them up to date without really changing them)
|
||||
instead of running their commands.
|
||||
This is used to pretend that the commands were done, in order to fool
|
||||
future invocations of
|
||||
.IR make .
|
||||
.TP 0.5i
|
||||
.B \-v
|
||||
Print the version of the
|
||||
.I make
|
||||
program plus a copyright, a list of authors and a notice that there
|
||||
is no warranty.
|
||||
After this information is printed, processing continues normally.
|
||||
To get this information without doing anything else, use
|
||||
.B make
|
||||
.B \-v
|
||||
.BI \-f /dev/null.
|
||||
.TP 0.5i
|
||||
.B \-w
|
||||
Print a message containing the working directory
|
||||
before and after other processing.
|
||||
This may be useful for tracking down errors from complicated nests of
|
||||
recursive
|
||||
.I make
|
||||
commands.
|
||||
.TP 0.5i
|
||||
.BI "\-W " file
|
||||
Pretend that the target
|
||||
.I file
|
||||
has just been modified.
|
||||
When used with the
|
||||
.B \-n
|
||||
flag, this shows you what would happen if you were to modify that file.
|
||||
Without
|
||||
.BR \-n ,
|
||||
it is almost the same as running a
|
||||
.I touch
|
||||
command on the given file before running
|
||||
.IR make ,
|
||||
except that the modification time is changed only in the imagination of
|
||||
.IR make .
|
||||
.SH "SEE ALSO"
|
||||
.PD 0
|
||||
.TP 2.0i
|
||||
/usr/local/doc/gnumake.dvi
|
||||
.I
|
||||
The GNU Make Manual
|
||||
.PD
|
||||
.SH BUGS
|
||||
See the chapter `Problems and Bugs' in
|
||||
.I "The GNU Make Manual" .
|
||||
.SH AUTHOR
|
||||
This manual page contributed by Dennis Morse of Stanford University.
|
||||
It has been reworked by Roland McGrath.
|
||||
436
make.h
Normal file
436
make.h
Normal file
@@ -0,0 +1,436 @@
|
||||
/* Miscellaneous global declarations and portability cruft for GNU Make.
|
||||
Copyright (C) 1988,89,90,91,92,93,94,95,96 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#if defined (_AIX) && !defined (__GNUC__)
|
||||
#pragma alloca
|
||||
#endif
|
||||
|
||||
/* We use <config.h> instead of "config.h" so that a compilation
|
||||
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
|
||||
(which it would do because make.h was found in $srcdir). */
|
||||
#include <config.h>
|
||||
#undef HAVE_CONFIG_H
|
||||
#define HAVE_CONFIG_H
|
||||
|
||||
|
||||
/* Use prototypes if available. */
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
#undef PARAMS
|
||||
#define PARAMS(protos) protos
|
||||
#else /* Not C++ or ANSI C. */
|
||||
#undef PARAMS
|
||||
#define PARAMS(protos) ()
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
|
||||
#ifdef CRAY
|
||||
/* This must happen before #include <signal.h> so
|
||||
that the declaration therein is changed. */
|
||||
#define signal bsdsignal
|
||||
#endif
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_SYS_TIMEB_H
|
||||
/* SCO 3.2 "devsys 4.2" has a prototype for `ftime' in <time.h> that bombs
|
||||
unless <sys/timeb.h> has been included first. Does every system have a
|
||||
<sys/timeb.h>? If any does not, configure should check for it. */
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifndef isblank
|
||||
#define isblank(c) ((c) == ' ' || (c) == '\t')
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
/* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
|
||||
POSIX.1 behavior with `cc -YPOSIX', which predefines POSIX itself! */
|
||||
#if defined (_POSIX_VERSION) && !defined (ultrix)
|
||||
#define POSIX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Some systems define _POSIX_VERSION but are not really POSIX.1. */
|
||||
#if (defined (butterfly) || defined (__arm) || (defined (__mips) && defined (_SYSTYPE_SVR3)) || (defined (sequent) && defined (i386)))
|
||||
#undef POSIX
|
||||
#endif
|
||||
|
||||
#if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE)
|
||||
#define POSIX
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_SYS_SIGLIST) && defined (HAVE__SYS_SIGLIST)
|
||||
#define sys_siglist _sys_siglist
|
||||
#define HAVE_SYS_SIGLIST /* Now we have it. */
|
||||
|
||||
/* It was declared in <signal.h>, with who knows what type.
|
||||
Don't declare it again and risk conflicting. */
|
||||
#define SYS_SIGLIST_DECLARED
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SIGLIST
|
||||
#ifndef SYS_SIGLIST_DECLARED
|
||||
extern char *sys_siglist[];
|
||||
#endif
|
||||
#else
|
||||
#include "signame.h"
|
||||
#endif
|
||||
|
||||
/* Some systems do not define NSIG in <signal.h>. */
|
||||
#ifndef NSIG
|
||||
#ifdef _NSIG
|
||||
#define NSIG _NSIG
|
||||
#else
|
||||
#define NSIG 32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RETSIGTYPE
|
||||
#define RETSIGTYPE void
|
||||
#endif
|
||||
|
||||
#ifndef sigmask
|
||||
#define sigmask(sig) (1 << ((sig) - 1))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#ifndef POSIX
|
||||
#define PATH_MAX MAXPATHLEN
|
||||
#endif /* Not POSIX. */
|
||||
#endif /* No PATH_MAX. */
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 1024
|
||||
#endif /* No MAXPATHLEN. */
|
||||
|
||||
#ifdef PATH_MAX
|
||||
#define GET_PATH_MAX PATH_MAX
|
||||
#define PATH_VAR(var) char var[PATH_MAX]
|
||||
#else
|
||||
#define NEED_GET_PATH_MAX
|
||||
extern unsigned int get_path_max PARAMS ((void));
|
||||
#define GET_PATH_MAX (get_path_max ())
|
||||
#define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX)
|
||||
#endif
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
#ifdef S_ISREG
|
||||
#undef S_ISREG
|
||||
#endif
|
||||
#ifdef S_ISDIR
|
||||
#undef S_ISDIR
|
||||
#endif
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
#include <stdio.h>
|
||||
#include <types.h>
|
||||
#include <unixlib.h>
|
||||
#include <unixio.h>
|
||||
#include <errno.h>
|
||||
#include <perror.h>
|
||||
#endif
|
||||
|
||||
#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) || defined(VMS))
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define ANSI_STRING
|
||||
#else /* No standard headers. */
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#define ANSI_STRING
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
|
||||
extern char *malloc PARAMS ((int));
|
||||
extern char *realloc PARAMS ((char *, int));
|
||||
extern void free PARAMS ((char *));
|
||||
|
||||
extern void abort PARAMS ((void));
|
||||
extern void exit PARAMS ((int));
|
||||
|
||||
#endif /* Standard headers. */
|
||||
|
||||
#ifdef ANSI_STRING
|
||||
|
||||
#ifndef index
|
||||
#define index(s, c) strchr((s), (c))
|
||||
#endif
|
||||
#ifndef rindex
|
||||
#define rindex(s, c) strrchr((s), (c))
|
||||
#endif
|
||||
|
||||
#ifndef bcmp
|
||||
#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
|
||||
#endif
|
||||
#ifndef bzero
|
||||
#define bzero(s, n) memset ((s), 0, (n))
|
||||
#endif
|
||||
#ifndef bcopy
|
||||
#define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
|
||||
#else /* Not ANSI_STRING. */
|
||||
|
||||
#ifndef bcmp
|
||||
extern int bcmp ();
|
||||
#endif
|
||||
#ifndef bzero
|
||||
extern void bzero ();
|
||||
#endif
|
||||
#ifndef bcopy
|
||||
extern void bcopy ();
|
||||
#endif
|
||||
|
||||
#endif /* ANSI_STRING. */
|
||||
#undef ANSI_STRING
|
||||
|
||||
/* SCO Xenix has a buggy macro definition in <string.h>. */
|
||||
#undef strerror
|
||||
|
||||
#if !defined(ANSI_STRING) && !defined(__DECC)
|
||||
extern char *strerror PARAMS ((int errnum));
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#undef alloca
|
||||
#define alloca(n) __builtin_alloca (n)
|
||||
#else /* Not GCC. */
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#else /* Not HAVE_ALLOCA_H. */
|
||||
#ifndef _AIX
|
||||
extern char *alloca ();
|
||||
#endif /* Not AIX. */
|
||||
#endif /* HAVE_ALLOCA_H. */
|
||||
#endif /* GCC. */
|
||||
|
||||
#ifndef iAPX286
|
||||
#define streq(a, b) \
|
||||
((a) == (b) || \
|
||||
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
|
||||
#ifdef _AMIGA
|
||||
#define strieq(a, b) \
|
||||
((a) == (b) || \
|
||||
(tolower(*(a)) == tolower(*(b)) && (*(a) == '\0' || !strcmpi ((a) + 1, (b) + 1))))
|
||||
#else
|
||||
#define strieq(a, b) \
|
||||
((a) == (b) || \
|
||||
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
|
||||
#endif
|
||||
#else
|
||||
/* Buggy compiler can't handle this. */
|
||||
#define streq(a, b) (strcmp ((a), (b)) == 0)
|
||||
#define strieq(a, b) (strcmp ((a), (b)) == 0)
|
||||
#endif
|
||||
|
||||
/* Add to VAR the hashing value of C, one character in a name. */
|
||||
#define HASH(var, c) \
|
||||
((var += (c)), (var = ((var) << 7) + ((var) >> 20)))
|
||||
#ifdef _AMIGA /* Fold filenames on #amiga */
|
||||
#define HASHI(var, c) \
|
||||
((var += tolower((c))), (var = ((var) << 7) + ((var) >> 20)))
|
||||
#else
|
||||
#define HASHI(var, c) HASH(var,c)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(ENUM_BITFIELDS)
|
||||
#define ENUM_BITFIELD(bits) :bits
|
||||
#else
|
||||
#define ENUM_BITFIELD(bits)
|
||||
#endif
|
||||
|
||||
#ifdef __MSDOS__
|
||||
#define PATH_SEPARATOR_CHAR ';'
|
||||
#else
|
||||
#define PATH_SEPARATOR_CHAR ':'
|
||||
#endif
|
||||
|
||||
extern void die ();
|
||||
extern void message ();
|
||||
extern void fatal ();
|
||||
extern void error ();
|
||||
extern void log_working_directory ();
|
||||
extern void makefile_error ();
|
||||
extern void makefile_fatal ();
|
||||
extern void pfatal_with_name ();
|
||||
extern void perror_with_name ();
|
||||
extern char *savestring ();
|
||||
extern char *concat ();
|
||||
extern char *xmalloc ();
|
||||
extern char *xrealloc ();
|
||||
extern char *find_next_token ();
|
||||
extern char *next_token ();
|
||||
extern char *end_of_token ();
|
||||
extern void collapse_continuations ();
|
||||
extern void remove_comments ();
|
||||
extern char *sindex ();
|
||||
extern char *lindex ();
|
||||
extern int alpha_compare ();
|
||||
extern void print_spaces ();
|
||||
extern struct dep *copy_dep_chain ();
|
||||
extern char *find_char_unquote ();
|
||||
extern char *find_percent ();
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
extern int ar_name ();
|
||||
extern void ar_parse_name ();
|
||||
extern int ar_touch ();
|
||||
extern time_t ar_member_date ();
|
||||
#endif
|
||||
|
||||
extern void dir_load ();
|
||||
extern int dir_file_exists_p ();
|
||||
extern int file_exists_p ();
|
||||
extern int file_impossible_p ();
|
||||
extern void file_impossible ();
|
||||
extern char *dir_name ();
|
||||
|
||||
extern void define_default_variables ();
|
||||
extern void set_default_suffixes ();
|
||||
extern void install_default_suffix_rules ();
|
||||
extern void install_default_implicit_rules ();
|
||||
extern void count_implicit_rule_limits ();
|
||||
extern void convert_to_pattern ();
|
||||
extern void create_pattern_rule ();
|
||||
|
||||
extern void build_vpath_lists ();
|
||||
extern void construct_vpath_list ();
|
||||
extern int vpath_search ();
|
||||
|
||||
extern void construct_include_path ();
|
||||
extern void uniquize_deps ();
|
||||
|
||||
extern int update_goal_chain ();
|
||||
extern void notice_finished_file ();
|
||||
|
||||
extern void user_access ();
|
||||
extern void make_access ();
|
||||
extern void child_access ();
|
||||
|
||||
#ifdef HAVE_VFORK_H
|
||||
#include <vfork.h>
|
||||
#endif
|
||||
|
||||
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
|
||||
because such systems often declare the in header files anyway. */
|
||||
|
||||
#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION)
|
||||
|
||||
extern long int atol ();
|
||||
#ifndef VMS
|
||||
extern long int lseek ();
|
||||
#endif
|
||||
|
||||
#endif /* Not GNU C library or POSIX. */
|
||||
|
||||
#ifdef HAVE_GETCWD
|
||||
extern char *getcwd ();
|
||||
#ifdef VMS
|
||||
extern char *getwd PARAMS ((char *));
|
||||
#endif
|
||||
#else
|
||||
extern char *getwd ();
|
||||
#define getcwd(buf, len) getwd (buf)
|
||||
#endif
|
||||
|
||||
extern char **environ;
|
||||
|
||||
extern char *reading_filename;
|
||||
extern unsigned int *reading_lineno_ptr;
|
||||
|
||||
extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
|
||||
extern int debug_flag, print_data_base_flag, question_flag, touch_flag;
|
||||
extern int env_overrides, no_builtin_rules_flag, print_version_flag;
|
||||
extern int print_directory_flag, warn_undefined_variables_flag;
|
||||
extern int posix_pedantic;
|
||||
|
||||
extern unsigned int job_slots;
|
||||
#ifndef NO_FLOAT
|
||||
extern double max_load_average;
|
||||
#else
|
||||
extern int max_load_average;
|
||||
#endif
|
||||
|
||||
extern char *program;
|
||||
extern char *starting_directory;
|
||||
extern unsigned int makelevel;
|
||||
extern char *version_string, *remote_description;
|
||||
|
||||
extern unsigned int commands_started;
|
||||
|
||||
extern int handling_fatal_signal;
|
||||
|
||||
|
||||
#define DEBUGPR(msg) \
|
||||
do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \
|
||||
fflush (stdout); } while (0)
|
||||
|
||||
#ifdef VMS
|
||||
# ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 3
|
||||
# endif
|
||||
# ifndef EXIT_SUCCESS
|
||||
# define EXIT_SUCCESS 1
|
||||
# endif
|
||||
# ifndef EXIT_TROUBLE
|
||||
# define EXIT_TROUBLE 2
|
||||
# endif
|
||||
#else
|
||||
# ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 2
|
||||
# endif
|
||||
# ifndef EXIT_SUCCESS
|
||||
# define EXIT_SUCCESS 0
|
||||
# endif
|
||||
# ifndef EXIT_TROUBLE
|
||||
# define EXIT_TROUBLE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
5
make.lnk
Normal file
5
make.lnk
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM LIB:cres.o "commands.o"+"job.o"+"dir.o"+"file.o"+"misc.o"+"main.o"+"read.o"+"remake.o"+"rule.o"+"implicit.o"+"default.o"+"variable.o"+"expand.o"+"function.o"+"vpath.o"+"version.o"+"ar.o"+"arscan.o"+"signame.o"+"remote-stub.o"+"getopt.o"+"getopt1.o"+"alloca.o"+"amiga.o"
|
||||
TO "make.new"
|
||||
LIB glob/glob.lib LIB:sc.lib LIB:amiga.lib
|
||||
QUIET
|
||||
|
||||
8187
make.texinfo
8187
make.texinfo
File diff suppressed because it is too large
Load Diff
34
makefile.com
Normal file
34
makefile.com
Normal file
@@ -0,0 +1,34 @@
|
||||
$!
|
||||
$! Makefile.com - builds GNU Make for VMS
|
||||
$!
|
||||
$! P1 is non-empty if you want to link with the VAXCRTL library instead
|
||||
$! of the shareable executable
|
||||
$!
|
||||
$ def/nolog sys sys$library:
|
||||
$ filelist = "alloca commands default dir expand file function implicit job main misc read remake remote-stub rule signame variable version vmsfunctions vmsify vpath [.glob]glob [.glob]fnmatch getopt getopt1"
|
||||
$ copy config.h-vms config.h
|
||||
$ n=0
|
||||
$ loop:
|
||||
$ cfile = f$elem(n," ",filelist)
|
||||
$ if cfile .eqs. " " then goto linkit
|
||||
$ write sys$output "Compiling ''cfile'..."
|
||||
$ call compileit 'cfile' 'p1'
|
||||
$ n = n + 1
|
||||
$ goto loop
|
||||
$ linkit:
|
||||
$ if p1 .nes. "" then goto link_using_library
|
||||
$ link/exe=make alloca,commands,default,dir,expand,file,function,-
|
||||
implicit,job,main,misc,read,remake,remote-stub,rule,-
|
||||
signame,variable,version,vmsfunctions,vmsify,vpath,-
|
||||
glob,fnmatch,getopt,getopt1
|
||||
$ exit
|
||||
$ link_using_library:
|
||||
$ link/exe=make alloca,commands,default,dir,expand,file,function,-
|
||||
implicit,job,main,misc,read,remake,remote-stub,rule,-
|
||||
signame,variable,version,vmsfunctions,vmsfiy,vpath,-
|
||||
glob,fnmatch,getopt,getopt1,sys$library:vaxcrtl/lib
|
||||
$!
|
||||
$ compileit : subroutine
|
||||
$ cc/include=([],[.glob])/define=("allocated_variable_expand_for_file=alloc_var_expand_for_file","unlink=remove","HAVE_CONFIG_H","VMS","NO_ARCHIVES") 'p1'
|
||||
$ exit
|
||||
$ endsubroutine : compileit
|
||||
121
makefile.vms
Normal file
121
makefile.vms
Normal file
@@ -0,0 +1,121 @@
|
||||
# Copyright (C) 1988, 1989 Free Software Foundation, Inc.
|
||||
# This file is part of GNU Make.
|
||||
#
|
||||
# VMS extensions from GNU Make 3.60 imported by
|
||||
# Klaus Kämpf (kkaempf@didymus.rmi.de)
|
||||
#
|
||||
# GNU Make 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 1, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
CC = cc/warn
|
||||
CP = copy
|
||||
|
||||
%.obj: %.c
|
||||
$(CC) $(CFLAGS)/obj=$@ $<
|
||||
#
|
||||
# Makefile for GNU Make
|
||||
#
|
||||
|
||||
CFLAGS = $(defines) /debug/noopt/include=([],[.glob])
|
||||
#LDFLAGS = /deb
|
||||
LDFLAGS =
|
||||
|
||||
defines = /define=("unlink=remove","HAVE_CONFIG_H","VMS","NO_ARCHIVES","allocated_variable_expand_for_file=alloc_var_expand_for_file")
|
||||
|
||||
LOAD_AVG = /define="NO_LDAV"
|
||||
|
||||
# If you don't want archive support, comment these out.
|
||||
#ARCHIVES = ,ar.obj,arscan.obj
|
||||
#ARCHIVES_SRC = ar.c arscan.c
|
||||
|
||||
# If your system needs extra libraries loaded in, define them here.
|
||||
# System V probably need -lPW for alloca.
|
||||
# if on vax, uncomment the following line
|
||||
#LOADLIBES = ,c.opt/opt
|
||||
LOADLIBES =
|
||||
|
||||
# If your system doesn't have alloca, or the one provided is bad,
|
||||
# get it from the Emacs distribution and define these.
|
||||
ALLOCA = ,alloca.obj
|
||||
ALLOCASRC = alloca.c
|
||||
|
||||
# If there are remote execution facilities defined,
|
||||
# enable them with switches here (see remote-*.c).
|
||||
REMOTE =
|
||||
|
||||
# Any extra object files your system needs.
|
||||
extras = ,signame.obj,remote-stub.obj,vmsfunctions.obj,vmsify.obj
|
||||
#,directory.obj
|
||||
# as an alternative:
|
||||
glob = ,[.glob]glob.obj,[.glob]fnmatch.obj
|
||||
getopt = ,getopt.obj,getopt1.obj
|
||||
# Directory to install `make' in.
|
||||
bindir = []
|
||||
# Directory to install the man page in.
|
||||
mandir = []
|
||||
# Number to put on the man page filename.
|
||||
manext = 1
|
||||
|
||||
objs = commands.obj,job.obj,dir.obj,file.obj,misc.obj,\
|
||||
main.obj,read.obj,remake.obj,rule.obj,implicit.obj,\
|
||||
default.obj,variable.obj,expand.obj,function.obj,\
|
||||
vpath.obj,version.obj$(ARCHIVES)$(ALLOCA)$(extras)$(getopt)$(glob)
|
||||
srcs = commands.c job.c dir.c file.c misc.c \
|
||||
main.c read.c remake.c rule.c implicit.c \
|
||||
default.c variable.c expand.c function.c \
|
||||
vpath.c version.c vmsfunctions.c vmsify.c $(ARCHIVES_SRC) $(ALLOCASRC) \
|
||||
commands.h dep.h filedef.h job.h make.h rule.h variable.h
|
||||
|
||||
|
||||
.PHONY: all doc
|
||||
all: config.h make.exe
|
||||
|
||||
doc: make.info make.dvi
|
||||
|
||||
|
||||
make.exe: $(objs)
|
||||
$(LD)$(LDFLAGS)/exe=$@ $^$(LOADLIBES)
|
||||
|
||||
.PHONY: clean realclean
|
||||
clean:
|
||||
-$(RM) make.exe;,*.obj;*
|
||||
|
||||
# Automatically generated dependencies.
|
||||
commands.obj: commands.c make.h dep.h commands.h filedef.h variable.h job.h
|
||||
job.obj: job.c make.h commands.h job.h filedef.h variable.h
|
||||
dir.obj: dir.c make.h
|
||||
file.obj: file.c make.h commands.h dep.h filedef.h variable.h
|
||||
misc.obj: misc.c make.h dep.h
|
||||
main.obj: main.c make.h commands.h dep.h filedef.h variable.h job.h
|
||||
read.obj: read.c make.h commands.h dep.h filedef.h variable.h
|
||||
remake.obj: remake.c make.h commands.h job.h dep.h filedef.h
|
||||
rule.obj: rule.c make.h commands.h dep.h filedef.h variable.h rule.h
|
||||
implicit.obj: implicit.c make.h rule.h dep.h filedef.h
|
||||
default.obj: default.c make.h rule.h dep.h filedef.h commands.h variable.h
|
||||
variable.obj: variable.c make.h commands.h variable.h dep.h filedef.h
|
||||
expand.obj: expand.c make.h commands.h filedef.h variable.h
|
||||
function.obj: function.c make.h variable.h dep.h commands.h job.h
|
||||
vpath.obj: vpath.c make.h filedef.h variable.h
|
||||
version.obj: version.c
|
||||
arscan.obj: arscan.c
|
||||
ar.obj: ar.c make.h filedef.h
|
||||
signame.obj: signame.c
|
||||
remote-stub.obj: remote-stub.c
|
||||
[.glob]glob.obj: [.glob]glob.c
|
||||
[.glob]fnmatch.obj: [.glob]fnmatch.c
|
||||
getopt.obj: getopt.c
|
||||
getopt1.obj: getopt1.c
|
||||
|
||||
config.h: config.h-vms
|
||||
$(CP) $< $@
|
||||
739
misc.c
Normal file
739
misc.c
Normal file
@@ -0,0 +1,739 @@
|
||||
/* Miscellaneous generic support functions for GNU Make.
|
||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "dep.h"
|
||||
|
||||
|
||||
/* Compare strings *S1 and *S2.
|
||||
Return negative if the first is less, positive if it is greater,
|
||||
zero if they are equal. */
|
||||
|
||||
int
|
||||
alpha_compare (s1, s2)
|
||||
char **s1, **s2;
|
||||
{
|
||||
if (**s1 != **s2)
|
||||
return **s1 - **s2;
|
||||
return strcmp (*s1, *s2);
|
||||
}
|
||||
|
||||
/* Discard each backslash-newline combination from LINE.
|
||||
Backslash-backslash-newline combinations become backslash-newlines.
|
||||
This is done by copying the text at LINE into itself. */
|
||||
|
||||
void
|
||||
collapse_continuations (line)
|
||||
char *line;
|
||||
{
|
||||
register char *in, *out, *p;
|
||||
register int backslash;
|
||||
register unsigned int bs_write;
|
||||
|
||||
in = index (line, '\n');
|
||||
if (in == 0)
|
||||
return;
|
||||
|
||||
out = in;
|
||||
while (out > line && out[-1] == '\\')
|
||||
--out;
|
||||
|
||||
while (*in != '\0')
|
||||
{
|
||||
/* BS_WRITE gets the number of quoted backslashes at
|
||||
the end just before IN, and BACKSLASH gets nonzero
|
||||
if the next character is quoted. */
|
||||
backslash = 0;
|
||||
bs_write = 0;
|
||||
for (p = in - 1; p >= line && *p == '\\'; --p)
|
||||
{
|
||||
if (backslash)
|
||||
++bs_write;
|
||||
backslash = !backslash;
|
||||
|
||||
/* It should be impossible to go back this far without exiting,
|
||||
but if we do, we can't get the right answer. */
|
||||
if (in == out - 1)
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Output the appropriate number of backslashes. */
|
||||
while (bs_write-- > 0)
|
||||
*out++ = '\\';
|
||||
|
||||
/* Skip the newline. */
|
||||
++in;
|
||||
|
||||
/* If the newline is quoted, discard following whitespace
|
||||
and any preceding whitespace; leave just one space. */
|
||||
if (backslash)
|
||||
{
|
||||
in = next_token (in);
|
||||
while (out > line && isblank (out[-1]))
|
||||
--out;
|
||||
*out++ = ' ';
|
||||
}
|
||||
else
|
||||
/* If the newline isn't quoted, put it in the output. */
|
||||
*out++ = '\n';
|
||||
|
||||
/* Now copy the following line to the output.
|
||||
Stop when we find backslashes followed by a newline. */
|
||||
while (*in != '\0')
|
||||
if (*in == '\\')
|
||||
{
|
||||
p = in + 1;
|
||||
while (*p == '\\')
|
||||
++p;
|
||||
if (*p == '\n')
|
||||
{
|
||||
in = p;
|
||||
break;
|
||||
}
|
||||
while (in < p)
|
||||
*out++ = *in++;
|
||||
}
|
||||
else
|
||||
*out++ = *in++;
|
||||
}
|
||||
|
||||
*out = '\0';
|
||||
}
|
||||
|
||||
|
||||
/* Remove comments from LINE.
|
||||
This is done by copying the text at LINE onto itself. */
|
||||
|
||||
void
|
||||
remove_comments (line)
|
||||
char *line;
|
||||
{
|
||||
char *comment;
|
||||
|
||||
comment = find_char_unquote (line, "#", 0);
|
||||
|
||||
if (comment != 0)
|
||||
/* Cut off the line at the #. */
|
||||
*comment = '\0';
|
||||
}
|
||||
|
||||
/* Print N spaces (used by DEBUGPR for target-depth). */
|
||||
|
||||
void
|
||||
print_spaces (n)
|
||||
register unsigned int n;
|
||||
{
|
||||
while (n-- > 0)
|
||||
putchar (' ');
|
||||
}
|
||||
|
||||
|
||||
/* Return a newly-allocated string whose contents
|
||||
concatenate those of s1, s2, s3. */
|
||||
|
||||
char *
|
||||
concat (s1, s2, s3)
|
||||
register char *s1, *s2, *s3;
|
||||
{
|
||||
register unsigned int len1, len2, len3;
|
||||
register char *result;
|
||||
|
||||
len1 = *s1 != '\0' ? strlen (s1) : 0;
|
||||
len2 = *s2 != '\0' ? strlen (s2) : 0;
|
||||
len3 = *s3 != '\0' ? strlen (s3) : 0;
|
||||
|
||||
result = (char *) xmalloc (len1 + len2 + len3 + 1);
|
||||
|
||||
if (*s1 != '\0')
|
||||
bcopy (s1, result, len1);
|
||||
if (*s2 != '\0')
|
||||
bcopy (s2, result + len1, len2);
|
||||
if (*s3 != '\0')
|
||||
bcopy (s3, result + len1 + len2, len3);
|
||||
*(result + len1 + len2 + len3) = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Print a message on stdout. */
|
||||
|
||||
void
|
||||
message (prefix, s1, s2, s3, s4, s5, s6)
|
||||
int prefix;
|
||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||
{
|
||||
log_working_directory (1);
|
||||
|
||||
if (s1 != 0)
|
||||
{
|
||||
if (prefix)
|
||||
{
|
||||
if (makelevel == 0)
|
||||
printf ("%s: ", program);
|
||||
else
|
||||
printf ("%s[%u]: ", program, makelevel);
|
||||
}
|
||||
printf (s1, s2, s3, s4, s5, s6);
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/* Print an error message and exit. */
|
||||
|
||||
/* VARARGS1 */
|
||||
void
|
||||
fatal (s1, s2, s3, s4, s5, s6)
|
||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||
{
|
||||
log_working_directory (1);
|
||||
|
||||
if (makelevel == 0)
|
||||
fprintf (stderr, "%s: *** ", program);
|
||||
else
|
||||
fprintf (stderr, "%s[%u]: *** ", program, makelevel);
|
||||
fprintf (stderr, s1, s2, s3, s4, s5, s6);
|
||||
fputs (". Stop.\n", stderr);
|
||||
|
||||
die (2);
|
||||
}
|
||||
|
||||
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
|
||||
|
||||
/* VARARGS1 */
|
||||
|
||||
void
|
||||
error (s1, s2, s3, s4, s5, s6)
|
||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||
{
|
||||
log_working_directory (1);
|
||||
|
||||
if (makelevel == 0)
|
||||
fprintf (stderr, "%s: ", program);
|
||||
else
|
||||
fprintf (stderr, "%s[%u]: ", program, makelevel);
|
||||
fprintf (stderr, s1, s2, s3, s4, s5, s6);
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
void
|
||||
makefile_error (file, lineno, s1, s2, s3, s4, s5, s6)
|
||||
char *file;
|
||||
unsigned int lineno;
|
||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||
{
|
||||
log_working_directory (1);
|
||||
|
||||
fprintf (stderr, "%s:%u: ", file, lineno);
|
||||
fprintf (stderr, s1, s2, s3, s4, s5, s6);
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
void
|
||||
makefile_fatal (file, lineno, s1, s2, s3, s4, s5, s6)
|
||||
char *file;
|
||||
unsigned int lineno;
|
||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||
{
|
||||
log_working_directory (1);
|
||||
|
||||
fprintf (stderr, "%s:%u: *** ", file, lineno);
|
||||
fprintf (stderr, s1, s2, s3, s4, s5, s6);
|
||||
fputs (". Stop.\n", stderr);
|
||||
|
||||
die (2);
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
|
||||
#undef strerror
|
||||
|
||||
char *
|
||||
strerror (errnum)
|
||||
int errnum;
|
||||
{
|
||||
extern int errno, sys_nerr;
|
||||
#ifndef __DECC
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
static char buf[] = "Unknown error 12345678901234567890";
|
||||
|
||||
if (errno < sys_nerr)
|
||||
return sys_errlist[errnum];
|
||||
|
||||
sprintf (buf, "Unknown error %d", errnum);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Print an error message from errno. */
|
||||
|
||||
void
|
||||
perror_with_name (str, name)
|
||||
char *str, *name;
|
||||
{
|
||||
error ("%s%s: %s", str, name, strerror (errno));
|
||||
}
|
||||
|
||||
/* Print an error message from errno and exit. */
|
||||
|
||||
void
|
||||
pfatal_with_name (name)
|
||||
char *name;
|
||||
{
|
||||
fatal ("%s: %s", name, strerror (errno));
|
||||
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* Like malloc but get fatal error if memory is exhausted. */
|
||||
|
||||
#undef xmalloc
|
||||
#undef xrealloc
|
||||
|
||||
char *
|
||||
xmalloc (size)
|
||||
unsigned int size;
|
||||
{
|
||||
char *result = (char *) malloc (size);
|
||||
if (result == 0)
|
||||
fatal ("virtual memory exhausted");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
xrealloc (ptr, size)
|
||||
char *ptr;
|
||||
unsigned int size;
|
||||
{
|
||||
char *result = (char *) realloc (ptr, size);
|
||||
if (result == 0)
|
||||
fatal ("virtual memory exhausted");
|
||||
return result;
|
||||
}
|
||||
|
||||
char *
|
||||
savestring (str, length)
|
||||
char *str;
|
||||
unsigned int length;
|
||||
{
|
||||
register char *out = (char *) xmalloc (length + 1);
|
||||
if (length > 0)
|
||||
bcopy (str, out, length);
|
||||
out[length] = '\0';
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Search string BIG (length BLEN) for an occurrence of
|
||||
string SMALL (length SLEN). Return a pointer to the
|
||||
beginning of the first occurrence, or return nil if none found. */
|
||||
|
||||
char *
|
||||
sindex (big, blen, small, slen)
|
||||
char *big;
|
||||
unsigned int blen;
|
||||
char *small;
|
||||
unsigned int slen;
|
||||
{
|
||||
register unsigned int b;
|
||||
|
||||
if (blen < 1)
|
||||
blen = strlen (big);
|
||||
if (slen < 1)
|
||||
slen = strlen (small);
|
||||
|
||||
for (b = 0; b < blen; ++b)
|
||||
if (big[b] == *small && !strncmp (&big[b + 1], small + 1, slen - 1))
|
||||
return (&big[b]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Limited INDEX:
|
||||
Search through the string STRING, which ends at LIMIT, for the character C.
|
||||
Returns a pointer to the first occurrence, or nil if none is found.
|
||||
Like INDEX except that the string searched ends where specified
|
||||
instead of at the first null. */
|
||||
|
||||
char *
|
||||
lindex (s, limit, c)
|
||||
register char *s, *limit;
|
||||
int c;
|
||||
{
|
||||
while (s < limit)
|
||||
if (*s++ == c)
|
||||
return s - 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return the address of the first whitespace or null in the string S. */
|
||||
|
||||
char *
|
||||
end_of_token (s)
|
||||
char *s;
|
||||
{
|
||||
while (*s != '\0' && !isblank (*s))
|
||||
++s;
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Return the address of the first nonwhitespace or null in the string S. */
|
||||
|
||||
char *
|
||||
next_token (s)
|
||||
char *s;
|
||||
{
|
||||
register char *p = s;
|
||||
|
||||
while (isblank (*p))
|
||||
++p;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Find the next token in PTR; return the address of it, and store the
|
||||
length of the token into *LENGTHPTR if LENGTHPTR is not nil. */
|
||||
|
||||
char *
|
||||
find_next_token (ptr, lengthptr)
|
||||
char **ptr;
|
||||
unsigned int *lengthptr;
|
||||
{
|
||||
char *p = next_token (*ptr);
|
||||
char *end;
|
||||
|
||||
if (*p == '\0')
|
||||
return 0;
|
||||
|
||||
*ptr = end = end_of_token (p);
|
||||
if (lengthptr != 0)
|
||||
*lengthptr = end - p;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Copy a chain of `struct dep', making a new chain
|
||||
with the same contents as the old one. */
|
||||
|
||||
struct dep *
|
||||
copy_dep_chain (d)
|
||||
register struct dep *d;
|
||||
{
|
||||
register struct dep *c;
|
||||
struct dep *firstnew = 0;
|
||||
struct dep *lastnew;
|
||||
|
||||
while (d != 0)
|
||||
{
|
||||
c = (struct dep *) xmalloc (sizeof (struct dep));
|
||||
bcopy ((char *) d, (char *) c, sizeof (struct dep));
|
||||
if (c->name != 0)
|
||||
c->name = savestring (c->name, strlen (c->name));
|
||||
c->next = 0;
|
||||
if (firstnew == 0)
|
||||
firstnew = lastnew = c;
|
||||
else
|
||||
lastnew = lastnew->next = c;
|
||||
|
||||
d = d->next;
|
||||
}
|
||||
|
||||
return firstnew;
|
||||
}
|
||||
|
||||
#ifdef iAPX286
|
||||
/* The losing compiler on this machine can't handle this macro. */
|
||||
|
||||
char *
|
||||
dep_name (dep)
|
||||
struct dep *dep;
|
||||
{
|
||||
return dep->name == 0 ? dep->file->name : dep->name;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GETLOADAVG_PRIVILEGED
|
||||
|
||||
#ifdef POSIX
|
||||
|
||||
/* Hopefully if a system says it's POSIX.1 and has the setuid and setgid
|
||||
functions, they work as POSIX.1 says. Some systems (Alpha OSF/1 1.2,
|
||||
for example) which claim to be POSIX.1 also have the BSD setreuid and
|
||||
setregid functions, but they don't work as in BSD and only the POSIX.1
|
||||
way works. */
|
||||
|
||||
#undef HAVE_SETREUID
|
||||
#undef HAVE_SETREGID
|
||||
|
||||
#else /* Not POSIX. */
|
||||
|
||||
/* Some POSIX.1 systems have the seteuid and setegid functions. In a
|
||||
POSIX-like system, they are the best thing to use. However, some
|
||||
non-POSIX systems have them too but they do not work in the POSIX style
|
||||
and we must use setreuid and setregid instead. */
|
||||
|
||||
#undef HAVE_SETEUID
|
||||
#undef HAVE_SETEGID
|
||||
|
||||
#endif /* POSIX. */
|
||||
|
||||
#ifndef HAVE_UNISTD_H
|
||||
extern int getuid (), getgid (), geteuid (), getegid ();
|
||||
extern int setuid (), setgid ();
|
||||
#ifdef HAVE_SETEUID
|
||||
extern int seteuid ();
|
||||
#else
|
||||
#ifdef HAVE_SETREUID
|
||||
extern int setreuid ();
|
||||
#endif /* Have setreuid. */
|
||||
#endif /* Have seteuid. */
|
||||
#ifdef HAVE_SETEGID
|
||||
extern int setegid ();
|
||||
#else
|
||||
#ifdef HAVE_SETREGID
|
||||
extern int setregid ();
|
||||
#endif /* Have setregid. */
|
||||
#endif /* Have setegid. */
|
||||
#endif /* No <unistd.h>. */
|
||||
|
||||
/* Keep track of the user and group IDs for user- and make- access. */
|
||||
static int user_uid = -1, user_gid = -1, make_uid = -1, make_gid = -1;
|
||||
#define access_inited (user_uid != -1)
|
||||
static enum { make, user } current_access;
|
||||
|
||||
|
||||
/* Under -d, write a message describing the current IDs. */
|
||||
|
||||
static void
|
||||
log_access (flavor)
|
||||
char *flavor;
|
||||
{
|
||||
if (! debug_flag)
|
||||
return;
|
||||
|
||||
/* All the other debugging messages go to stdout,
|
||||
but we write this one to stderr because it might be
|
||||
run in a child fork whose stdout is piped. */
|
||||
|
||||
fprintf (stderr, "%s access: user %d (real %d), group %d (real %d)\n",
|
||||
flavor, geteuid (), getuid (), getegid (), getgid ());
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init_access ()
|
||||
{
|
||||
#ifndef VMS
|
||||
user_uid = getuid ();
|
||||
user_gid = getgid ();
|
||||
|
||||
make_uid = geteuid ();
|
||||
make_gid = getegid ();
|
||||
|
||||
/* Do these ever fail? */
|
||||
if (user_uid == -1 || user_gid == -1 || make_uid == -1 || make_gid == -1)
|
||||
pfatal_with_name ("get{e}[gu]id");
|
||||
|
||||
log_access ("Initialized");
|
||||
|
||||
current_access = make;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* GETLOADAVG_PRIVILEGED */
|
||||
|
||||
/* Give the process appropriate permissions for access to
|
||||
user data (i.e., to stat files, or to spawn a child process). */
|
||||
void
|
||||
user_access ()
|
||||
{
|
||||
#ifdef GETLOADAVG_PRIVILEGED
|
||||
|
||||
if (!access_inited)
|
||||
init_access ();
|
||||
|
||||
if (current_access == user)
|
||||
return;
|
||||
|
||||
/* We are in "make access" mode. This means that the effective user and
|
||||
group IDs are those of make (if it was installed setuid or setgid).
|
||||
We now want to set the effective user and group IDs to the real IDs,
|
||||
which are the IDs of the process that exec'd make. */
|
||||
|
||||
#ifdef HAVE_SETEUID
|
||||
|
||||
/* Modern systems have the seteuid/setegid calls which set only the
|
||||
effective IDs, which is ideal. */
|
||||
|
||||
if (seteuid (user_uid) < 0)
|
||||
pfatal_with_name ("user_access: seteuid");
|
||||
|
||||
#else /* Not HAVE_SETEUID. */
|
||||
|
||||
#ifndef HAVE_SETREUID
|
||||
|
||||
/* System V has only the setuid/setgid calls to set user/group IDs.
|
||||
There is an effective ID, which can be set by setuid/setgid.
|
||||
It can be set (unless you are root) only to either what it already is
|
||||
(returned by geteuid/getegid, now in make_uid/make_gid),
|
||||
the real ID (return by getuid/getgid, now in user_uid/user_gid),
|
||||
or the saved set ID (what the effective ID was before this set-ID
|
||||
executable (make) was exec'd). */
|
||||
|
||||
if (setuid (user_uid) < 0)
|
||||
pfatal_with_name ("user_access: setuid");
|
||||
|
||||
#else /* HAVE_SETREUID. */
|
||||
|
||||
/* In 4BSD, the setreuid/setregid calls set both the real and effective IDs.
|
||||
They may be set to themselves or each other. So you have two alternatives
|
||||
at any one time. If you use setuid/setgid, the effective will be set to
|
||||
the real, leaving only one alternative. Using setreuid/setregid, however,
|
||||
you can toggle between your two alternatives by swapping the values in a
|
||||
single setreuid or setregid call. */
|
||||
|
||||
if (setreuid (make_uid, user_uid) < 0)
|
||||
pfatal_with_name ("user_access: setreuid");
|
||||
|
||||
#endif /* Not HAVE_SETREUID. */
|
||||
#endif /* HAVE_SETEUID. */
|
||||
|
||||
#ifdef HAVE_SETEGID
|
||||
if (setegid (user_gid) < 0)
|
||||
pfatal_with_name ("user_access: setegid");
|
||||
#else
|
||||
#ifndef HAVE_SETREGID
|
||||
if (setgid (user_gid) < 0)
|
||||
pfatal_with_name ("user_access: setgid");
|
||||
#else
|
||||
if (setregid (make_gid, user_gid) < 0)
|
||||
pfatal_with_name ("user_access: setregid");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
current_access = user;
|
||||
|
||||
log_access ("User");
|
||||
|
||||
#endif /* GETLOADAVG_PRIVILEGED */
|
||||
}
|
||||
|
||||
/* Give the process appropriate permissions for access to
|
||||
make data (i.e., the load average). */
|
||||
void
|
||||
make_access ()
|
||||
{
|
||||
#ifdef GETLOADAVG_PRIVILEGED
|
||||
|
||||
if (!access_inited)
|
||||
init_access ();
|
||||
|
||||
if (current_access == make)
|
||||
return;
|
||||
|
||||
/* See comments in user_access, above. */
|
||||
|
||||
#ifdef HAVE_SETEUID
|
||||
if (seteuid (make_uid) < 0)
|
||||
pfatal_with_name ("make_access: seteuid");
|
||||
#else
|
||||
#ifndef HAVE_SETREUID
|
||||
if (setuid (make_uid) < 0)
|
||||
pfatal_with_name ("make_access: setuid");
|
||||
#else
|
||||
if (setreuid (user_uid, make_uid) < 0)
|
||||
pfatal_with_name ("make_access: setreuid");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SETEGID
|
||||
if (setegid (make_gid) < 0)
|
||||
pfatal_with_name ("make_access: setegid");
|
||||
#else
|
||||
#ifndef HAVE_SETREGID
|
||||
if (setgid (make_gid) < 0)
|
||||
pfatal_with_name ("make_access: setgid");
|
||||
#else
|
||||
if (setregid (user_gid, make_gid) < 0)
|
||||
pfatal_with_name ("make_access: setregid");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
current_access = make;
|
||||
|
||||
log_access ("Make");
|
||||
|
||||
#endif /* GETLOADAVG_PRIVILEGED */
|
||||
}
|
||||
|
||||
/* Give the process appropriate permissions for a child process.
|
||||
This is like user_access, but you can't get back to make_access. */
|
||||
void
|
||||
child_access ()
|
||||
{
|
||||
#ifdef GETLOADAVG_PRIVILEGED
|
||||
|
||||
if (!access_inited)
|
||||
abort ();
|
||||
|
||||
/* Set both the real and effective UID and GID to the user's.
|
||||
They cannot be changed back to make's. */
|
||||
|
||||
#ifndef HAVE_SETREUID
|
||||
if (setuid (user_uid) < 0)
|
||||
pfatal_with_name ("child_access: setuid");
|
||||
#else
|
||||
if (setreuid (user_uid, user_uid) < 0)
|
||||
pfatal_with_name ("child_access: setreuid");
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SETREGID
|
||||
if (setgid (user_gid) < 0)
|
||||
pfatal_with_name ("child_access: setgid");
|
||||
#else
|
||||
if (setregid (user_gid, user_gid) < 0)
|
||||
pfatal_with_name ("child_access: setregid");
|
||||
#endif
|
||||
|
||||
log_access ("Child");
|
||||
|
||||
#endif /* GETLOADAVG_PRIVILEGED */
|
||||
}
|
||||
|
||||
#ifdef NEED_GET_PATH_MAX
|
||||
unsigned int
|
||||
get_path_max ()
|
||||
{
|
||||
static unsigned int value;
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
long int x = pathconf ("/", _PC_PATH_MAX);
|
||||
if (x > 0)
|
||||
value = x;
|
||||
else
|
||||
return MAXPATHLEN;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
62
readme.vms
Normal file
62
readme.vms
Normal file
@@ -0,0 +1,62 @@
|
||||
This is the VMS port of GNU Make version 3.74.
|
||||
|
||||
It is based on the VMS port of GNU Make 3.60 by Mike Moretti.
|
||||
|
||||
This port was done by Klaus Kämpf (kkaempf@didymus.rmi.de)
|
||||
|
||||
To build Make, simply type @makefile. This should compile all the
|
||||
necessary files and link Make.
|
||||
There is also a file called makefile.vms. If you already have GNU
|
||||
Make 3.74 built you can just use Make with this makefile to rebuild.
|
||||
|
||||
Here are some notes about GNU Make for VMS:
|
||||
|
||||
Libraries are not supported. They were in GNU Make 3.60 but somehow I didn't
|
||||
care porting the code. If there is enough interest, I'll do it at some
|
||||
later time.
|
||||
|
||||
The variable $^ separates files with commas instead of spaces (It's the
|
||||
natural thing to do for VMS).
|
||||
|
||||
See defaults.c for VMS default suffixes and my definitions for default
|
||||
rules and variables.
|
||||
|
||||
The shell function is not implemented yet.
|
||||
|
||||
Load average routines haven't been implemented for VMS yet.
|
||||
|
||||
The default include directory for including other makefiles is
|
||||
SYS$SYSROOT:[SYSLIB] (I don't remember why I didn't just use
|
||||
SYS$LIBRARY: instead; maybe it wouldn't work that way).
|
||||
|
||||
The default makefiles make looks for are: makefile.vms, gnumakefile, makefile.,
|
||||
and gnumakefile. .
|
||||
|
||||
The stat() function and handling of time stamps in VMS is broken, so I
|
||||
replaced it with a hack in vmsfunctions.c. I will provide a full rewrite
|
||||
somewhere in the future. Be warned, the time resolution inside make is
|
||||
less than what vms provides. This might be a problem on the faster Alphas.
|
||||
|
||||
You can use a : in a filename only if you preceed it with a backslash ('\').
|
||||
E.g.- hobbes\:[bogas.files]
|
||||
|
||||
None of the stuff in vpath.c has been implemented yet.
|
||||
|
||||
Make ignores success, informational, or warning errors (-S-, -I-, or -W-).
|
||||
But it will stop on -E- and -F- errors. (unless you do something to override
|
||||
this in your makefile, or whatever).
|
||||
|
||||
Remote stuff isn't implemented yet.
|
||||
|
||||
Multiple line DCL commands, such as "if" statements, must be put inside
|
||||
command files. You can run a command file by using \@.
|
||||
|
||||
|
||||
VMS changes made for 3.74.3
|
||||
|
||||
Lots of default settings are adapted for VMS. See default.c.
|
||||
|
||||
Long command lines are now converted to command files.
|
||||
|
||||
Comma (',') as a separator is now allowed. See makefile.vms for an example.
|
||||
|
||||
270
remote-cstms.c
Normal file
270
remote-cstms.c
Normal file
@@ -0,0 +1,270 @@
|
||||
/* GNU Make remote job exportation interface to the Customs daemon.
|
||||
THIS CODE IS NOT SUPPORTED BY THE GNU PROJECT.
|
||||
Please do not send bug reports or questions about it to
|
||||
the Make maintainers.
|
||||
|
||||
Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "commands.h"
|
||||
#include "job.h"
|
||||
#include <sys/time.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#define __STRICT_BSD__ /* Don't make conflicting declarations. */
|
||||
#include "customs.h"
|
||||
|
||||
|
||||
char *remote_description = "Customs";
|
||||
|
||||
/* File name of the Customs `export' client command.
|
||||
A full path name can be used to avoid some path-searching overhead. */
|
||||
#define EXPORT_COMMAND "/usr/local/bin/export"
|
||||
|
||||
/* ExportPermit gotten by start_remote_job_p, and used by start_remote_job. */
|
||||
static ExportPermit permit;
|
||||
|
||||
/* Normalized path name of the current directory. */
|
||||
static char *normalized_cwd;
|
||||
|
||||
/* Return nonzero if the next job should be done remotely. */
|
||||
|
||||
int
|
||||
start_remote_job_p ()
|
||||
{
|
||||
static int inited = 0;
|
||||
int status;
|
||||
|
||||
/* Allow the user to turn off job exportation
|
||||
(useful while he is debugging Customs, for example). */
|
||||
if (getenv ("GNU_MAKE_NO_CUSTOMS") != 0)
|
||||
return 0;
|
||||
|
||||
if (!inited)
|
||||
{
|
||||
/* For secure Customs, make is installed setuid root and
|
||||
Customs requires a privileged source port be used. */
|
||||
make_access ();
|
||||
|
||||
/* Ping the daemon once to see if it is there. */
|
||||
inited = Customs_Ping () == RPC_SUCCESS ? 1 : -1;
|
||||
|
||||
/* Return to normal user access. */
|
||||
user_access ();
|
||||
|
||||
if (starting_directory == 0)
|
||||
/* main couldn't figure it out. */
|
||||
inited = -1;
|
||||
else
|
||||
{
|
||||
/* Normalize the current directory path name to something
|
||||
that should work on all machines exported to. */
|
||||
|
||||
normalized_cwd = (char *) xmalloc (GET_PATH_MAX);
|
||||
strcpy (normalized_cwd, starting_directory);
|
||||
if (Customs_NormPath (normalized_cwd, GET_PATH_MAX) < 0)
|
||||
/* Path normalization failure means using Customs
|
||||
won't work, but it's not really an error. */
|
||||
inited = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (inited < 0)
|
||||
return 0;
|
||||
|
||||
status = Customs_Host (EXPORT_SAME, &permit);
|
||||
if (status != RPC_SUCCESS)
|
||||
{
|
||||
if (debug_flag)
|
||||
printf ("Customs won't export: %s\n", Rpc_ErrorMessage (status));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return !CUSTOMS_FAIL (&permit.addr);
|
||||
}
|
||||
|
||||
/* Start a remote job running the command in ARGV, with environment from
|
||||
ENVP. It gets standard input from STDIN_FD. On failure, return
|
||||
nonzero. On success, return zero, and set *USED_STDIN to nonzero if it
|
||||
will actually use STDIN_FD, zero if not, set *ID_PTR to a unique
|
||||
identification, and set *IS_REMOTE to nonzero if the job is remote, zero
|
||||
if it is local (meaning *ID_PTR is a process ID). */
|
||||
|
||||
int
|
||||
start_remote_job (argv, envp, stdin_fd, is_remote, id_ptr, used_stdin)
|
||||
char **argv, **envp;
|
||||
int stdin_fd;
|
||||
int *is_remote;
|
||||
int *id_ptr;
|
||||
int *used_stdin;
|
||||
{
|
||||
extern int vfork (), execve ();
|
||||
char waybill[MAX_DATA_SIZE], msg[128];
|
||||
struct timeval timeout;
|
||||
struct sockaddr_in sin;
|
||||
int len;
|
||||
int retsock, retport, sock;
|
||||
Rpc_Stat status;
|
||||
int pid;
|
||||
|
||||
/* Create the return socket. */
|
||||
retsock = Rpc_UdpCreate (True, 0);
|
||||
if (retsock < 0)
|
||||
{
|
||||
error ("exporting: Couldn't create return socket.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get the return socket's port number. */
|
||||
len = sizeof (sin);
|
||||
if (getsockname (retsock, (struct sockaddr *) &sin, &len) < 0)
|
||||
{
|
||||
(void) close (retsock);
|
||||
perror_with_name ("exporting: ", "getsockname");
|
||||
return 1;
|
||||
}
|
||||
retport = sin.sin_port;
|
||||
|
||||
/* Create the TCP socket for talking to the remote child. */
|
||||
sock = Rpc_TcpCreate (False, 0);
|
||||
|
||||
/* Create a WayBill to give to the server. */
|
||||
len = Customs_MakeWayBill (&permit, normalized_cwd, argv[0], argv,
|
||||
envp, retport, waybill);
|
||||
|
||||
/* Modify the waybill as if the remote child had done `child_access ()'. */
|
||||
{
|
||||
WayBill *wb = (WayBill *) waybill;
|
||||
wb->euid = wb->ruid;
|
||||
wb->rgid = wb->rgid;
|
||||
}
|
||||
|
||||
/* Send the request to the server, timing out in 20 seconds. */
|
||||
timeout.tv_usec = 0;
|
||||
timeout.tv_sec = 20;
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons (Customs_Port ());
|
||||
sin.sin_addr = permit.addr;
|
||||
status = Rpc_Call (sock, &sin, (Rpc_Proc) CUSTOMS_IMPORT,
|
||||
len, (Rpc_Opaque) waybill,
|
||||
sizeof(msg), (Rpc_Opaque) msg,
|
||||
1, &timeout);
|
||||
if (status != RPC_SUCCESS)
|
||||
{
|
||||
(void) close (retsock);
|
||||
(void) close (sock);
|
||||
error ("exporting: %s", Rpc_ErrorMessage (status));
|
||||
return 1;
|
||||
}
|
||||
else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0')
|
||||
{
|
||||
(void) close (retsock);
|
||||
(void) close (sock);
|
||||
error ("CUSTOMS_IMPORT: %s", msg);
|
||||
return 1;
|
||||
}
|
||||
else if (debug_flag)
|
||||
{
|
||||
struct hostent *host = gethostbyaddr (&permit.addr, sizeof (permit.addr),
|
||||
AF_INET);
|
||||
printf ("Job exported to %s ID %u\n",
|
||||
host == 0 ? inet_ntoa (permit.addr) : host->h_name,
|
||||
permit.id);
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
fflush (stderr);
|
||||
|
||||
pid = vfork ();
|
||||
if (pid < 0)
|
||||
{
|
||||
/* The fork failed! */
|
||||
perror_with_name ("vfork", "");
|
||||
return 1;
|
||||
}
|
||||
else if (pid == 0)
|
||||
{
|
||||
/* Child side. Run `export' to handle the connection. */
|
||||
static char sock_buf[20], retsock_buf[20], id_buf[20];
|
||||
static char *new_argv[6] =
|
||||
{ EXPORT_COMMAND, "-id", sock_buf, retsock_buf, id_buf, 0 };
|
||||
|
||||
/* Set up the arguments. */
|
||||
(void) sprintf (sock_buf, "%d", sock);
|
||||
(void) sprintf (retsock_buf, "%d", retsock);
|
||||
(void) sprintf (id_buf, "%x", permit.id);
|
||||
|
||||
/* Get the right stdin. */
|
||||
if (stdin_fd != 0)
|
||||
(void) dup2 (stdin_fd, 0);
|
||||
|
||||
/* Unblock signals in the child. */
|
||||
unblock_sigs ();
|
||||
|
||||
/* Run the command. */
|
||||
exec_command (new_argv, envp);
|
||||
}
|
||||
|
||||
/* Parent side. Return the `export' process's ID. */
|
||||
(void) close (retsock);
|
||||
(void) close (sock);
|
||||
*is_remote = 0;
|
||||
*id_ptr = pid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the status of a dead remote child. Block waiting for one to die
|
||||
if BLOCK is nonzero. Set *EXIT_CODE_PTR to the exit status, *SIGNAL_PTR
|
||||
to the termination signal or zero if it exited normally, and *COREDUMP_PTR
|
||||
nonzero if it dumped core. Return the ID of the child that died,
|
||||
0 if we would have to block and !BLOCK, or < 0 if there were none. */
|
||||
|
||||
int
|
||||
remote_status (exit_code_ptr, signal_ptr, coredump_ptr, block)
|
||||
int *exit_code_ptr, *signal_ptr, *coredump_ptr;
|
||||
int block;
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Block asynchronous notification of remote child death.
|
||||
If this notification is done by raising the child termination
|
||||
signal, do not block that signal. */
|
||||
void
|
||||
block_remote_children ()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Restore asynchronous notification of remote child death.
|
||||
If this is done by raising the child termination signal,
|
||||
do not unblock that signal. */
|
||||
void
|
||||
unblock_remote_children ()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send signal SIG to child ID. Return 0 if successful, -1 if not. */
|
||||
int
|
||||
remote_kill (id, sig)
|
||||
int id;
|
||||
int sig;
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
94
remote-stub.c
Normal file
94
remote-stub.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* Template for the remote job exportation interface to GNU Make.
|
||||
Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "filedef.h"
|
||||
#include "job.h"
|
||||
#include "commands.h"
|
||||
|
||||
|
||||
char *remote_description = 0;
|
||||
|
||||
|
||||
/* Return nonzero if the next job should be done remotely. */
|
||||
|
||||
int
|
||||
start_remote_job_p ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Start a remote job running the command in ARGV,
|
||||
with environment from ENVP. It gets standard input from STDIN_FD. On
|
||||
failure, return nonzero. On success, return zero, and set *USED_STDIN
|
||||
to nonzero if it will actually use STDIN_FD, zero if not, set *ID_PTR to
|
||||
a unique identification, and set *IS_REMOTE to zero if the job is local,
|
||||
nonzero if it is remote (meaning *ID_PTR is a process ID). */
|
||||
|
||||
int
|
||||
start_remote_job (argv, envp, stdin_fd, is_remote, id_ptr, used_stdin)
|
||||
char **argv, **envp;
|
||||
int stdin_fd;
|
||||
int *is_remote;
|
||||
int *id_ptr;
|
||||
int *used_stdin;
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get the status of a dead remote child. Block waiting for one to die
|
||||
if BLOCK is nonzero. Set *EXIT_CODE_PTR to the exit status, *SIGNAL_PTR
|
||||
to the termination signal or zero if it exited normally, and *COREDUMP_PTR
|
||||
nonzero if it dumped core. Return the ID of the child that died,
|
||||
0 if we would have to block and !BLOCK, or < 0 if there were none. */
|
||||
|
||||
int
|
||||
remote_status (exit_code_ptr, signal_ptr, coredump_ptr, block)
|
||||
int *exit_code_ptr, *signal_ptr, *coredump_ptr;
|
||||
int block;
|
||||
{
|
||||
errno = ECHILD;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Block asynchronous notification of remote child death.
|
||||
If this notification is done by raising the child termination
|
||||
signal, do not block that signal. */
|
||||
void
|
||||
block_remote_children ()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Restore asynchronous notification of remote child death.
|
||||
If this is done by raising the child termination signal,
|
||||
do not unblock that signal. */
|
||||
void
|
||||
unblock_remote_children ()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send signal SIG to child ID. Return 0 if successful, -1 if not. */
|
||||
int
|
||||
remote_kill (id, sig)
|
||||
int id;
|
||||
int sig;
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
589
rule.c
Normal file
589
rule.c
Normal file
@@ -0,0 +1,589 @@
|
||||
/* Pattern and suffix rule internals for GNU Make.
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "dep.h"
|
||||
#include "filedef.h"
|
||||
#include "job.h"
|
||||
#include "commands.h"
|
||||
#include "variable.h"
|
||||
#include "rule.h"
|
||||
|
||||
static void freerule PARAMS ((struct rule *rule, struct rule *lastrule));
|
||||
|
||||
/* Chain of all pattern rules. */
|
||||
|
||||
struct rule *pattern_rules;
|
||||
|
||||
/* Pointer to last rule in the chain, so we can add onto the end. */
|
||||
|
||||
struct rule *last_pattern_rule;
|
||||
|
||||
/* Number of rules in the chain. */
|
||||
|
||||
unsigned int num_pattern_rules;
|
||||
|
||||
/* Maximum number of target patterns of any pattern rule. */
|
||||
|
||||
unsigned int max_pattern_targets;
|
||||
|
||||
/* Maximum number of dependencies of any pattern rule. */
|
||||
|
||||
unsigned int max_pattern_deps;
|
||||
|
||||
/* Maximum length of the name of a dependencies of any pattern rule. */
|
||||
|
||||
unsigned int max_pattern_dep_length;
|
||||
|
||||
/* Pointer to structure for the file .SUFFIXES
|
||||
whose dependencies are the suffixes to be searched. */
|
||||
|
||||
struct file *suffix_file;
|
||||
|
||||
/* Maximum length of a suffix. */
|
||||
|
||||
unsigned int maxsuffix;
|
||||
|
||||
/* Compute the maximum dependency length and maximum number of
|
||||
dependencies of all implicit rules. Also sets the subdir
|
||||
flag for a rule when appropriate, possibly removing the rule
|
||||
completely when appropriate. */
|
||||
|
||||
void
|
||||
count_implicit_rule_limits ()
|
||||
{
|
||||
char *name;
|
||||
unsigned int namelen;
|
||||
register struct rule *rule, *lastrule;
|
||||
|
||||
num_pattern_rules = max_pattern_targets = max_pattern_deps = 0;
|
||||
max_pattern_dep_length = 0;
|
||||
|
||||
name = 0;
|
||||
namelen = 0;
|
||||
rule = pattern_rules;
|
||||
lastrule = 0;
|
||||
while (rule != 0)
|
||||
{
|
||||
unsigned int ndeps = 0;
|
||||
register struct dep *dep;
|
||||
struct rule *next = rule->next;
|
||||
unsigned int ntargets;
|
||||
|
||||
++num_pattern_rules;
|
||||
|
||||
ntargets = 0;
|
||||
while (rule->targets[ntargets] != 0)
|
||||
++ntargets;
|
||||
|
||||
if (ntargets > max_pattern_targets)
|
||||
max_pattern_targets = ntargets;
|
||||
|
||||
for (dep = rule->deps; dep != 0; dep = dep->next)
|
||||
{
|
||||
unsigned int len = strlen (dep->name);
|
||||
|
||||
#ifdef VMS
|
||||
char *p = rindex (dep->name, ']');
|
||||
#else
|
||||
char *p = rindex (dep->name, '/');
|
||||
#endif
|
||||
char *p2 = p != 0 ? index (dep->name, '%') : 0;
|
||||
ndeps++;
|
||||
|
||||
if (len > max_pattern_dep_length)
|
||||
max_pattern_dep_length = len;
|
||||
|
||||
if (p != 0 && p2 > p)
|
||||
{
|
||||
/* There is a slash before the % in the dep name.
|
||||
Extract the directory name. */
|
||||
if (p == dep->name)
|
||||
++p;
|
||||
if (p - dep->name > namelen)
|
||||
{
|
||||
if (name != 0)
|
||||
free (name);
|
||||
namelen = p - dep->name;
|
||||
name = (char *) xmalloc (namelen + 1);
|
||||
}
|
||||
bcopy (dep->name, name, p - dep->name);
|
||||
name[p - dep->name] = '\0';
|
||||
|
||||
/* In the deps of an implicit rule the `changed' flag
|
||||
actually indicates that the dependency is in a
|
||||
nonexistent subdirectory. */
|
||||
|
||||
dep->changed = !dir_file_exists_p (name, "");
|
||||
#ifdef VMS
|
||||
if (dep->changed && *name == ']')
|
||||
#else
|
||||
if (dep->changed && *name == '/')
|
||||
#endif
|
||||
{
|
||||
/* The name is absolute and the directory does not exist.
|
||||
This rule can never possibly match, since this dependency
|
||||
can never possibly exist. So just remove the rule from
|
||||
the list. */
|
||||
freerule (rule, lastrule);
|
||||
--num_pattern_rules;
|
||||
goto end_main_loop;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* This dependency does not reside in a subdirectory. */
|
||||
dep->changed = 0;
|
||||
}
|
||||
|
||||
if (ndeps > max_pattern_deps)
|
||||
max_pattern_deps = ndeps;
|
||||
|
||||
lastrule = rule;
|
||||
end_main_loop:
|
||||
rule = next;
|
||||
}
|
||||
|
||||
if (name != 0)
|
||||
free (name);
|
||||
}
|
||||
|
||||
/* Create a pattern rule from a suffix rule.
|
||||
TARGET is the target suffix; SOURCE is the source suffix.
|
||||
CMDS are the commands.
|
||||
If TARGET is nil, it means the target pattern should be `(%.o)'.
|
||||
If SOURCE is nil, it means there should be no deps. */
|
||||
|
||||
static void
|
||||
convert_suffix_rule (target, source, cmds)
|
||||
char *target, *source;
|
||||
struct commands *cmds;
|
||||
{
|
||||
char *targname, *targpercent, *depname;
|
||||
char **names, **percents;
|
||||
struct dep *deps;
|
||||
unsigned int len;
|
||||
|
||||
if (target == 0)
|
||||
/* Special case: TARGET being nil means we are defining a
|
||||
`.X.a' suffix rule; the target pattern is always `(%.o)'. */
|
||||
{
|
||||
#ifdef VMS
|
||||
targname = savestring ("(%.obj)", 7);
|
||||
#else
|
||||
targname = savestring ("(%.o)", 5);
|
||||
#endif
|
||||
targpercent = targname + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Construct the target name. */
|
||||
len = strlen (target);
|
||||
targname = xmalloc (1 + len + 1);
|
||||
targname[0] = '%';
|
||||
bcopy (target, targname + 1, len + 1);
|
||||
targpercent = targname;
|
||||
}
|
||||
|
||||
names = (char **) xmalloc (2 * sizeof (char *));
|
||||
percents = (char **) alloca (2 * sizeof (char *));
|
||||
names[0] = targname;
|
||||
percents[0] = targpercent;
|
||||
names[1] = percents[1] = 0;
|
||||
|
||||
if (source == 0)
|
||||
deps = 0;
|
||||
else
|
||||
{
|
||||
/* Construct the dependency name. */
|
||||
len = strlen (source);
|
||||
depname = xmalloc (1 + len + 1);
|
||||
depname[0] = '%';
|
||||
bcopy (source, depname + 1, len + 1);
|
||||
deps = (struct dep *) xmalloc (sizeof (struct dep));
|
||||
deps->next = 0;
|
||||
deps->name = depname;
|
||||
}
|
||||
|
||||
create_pattern_rule (names, percents, 0, deps, cmds, 0);
|
||||
}
|
||||
|
||||
/* Convert old-style suffix rules to pattern rules.
|
||||
All rules for the suffixes on the .SUFFIXES list
|
||||
are converted and added to the chain of pattern rules. */
|
||||
|
||||
void
|
||||
convert_to_pattern ()
|
||||
{
|
||||
register struct dep *d, *d2;
|
||||
register struct file *f;
|
||||
register char *rulename;
|
||||
register unsigned int slen, s2len;
|
||||
|
||||
/* Compute maximum length of all the suffixes. */
|
||||
|
||||
maxsuffix = 0;
|
||||
for (d = suffix_file->deps; d != 0; d = d->next)
|
||||
{
|
||||
register unsigned int namelen = strlen (dep_name (d));
|
||||
if (namelen > maxsuffix)
|
||||
maxsuffix = namelen;
|
||||
}
|
||||
|
||||
rulename = (char *) alloca ((maxsuffix * 2) + 1);
|
||||
|
||||
for (d = suffix_file->deps; d != 0; d = d->next)
|
||||
{
|
||||
/* Make a rule that is just the suffix, with no deps or commands.
|
||||
This rule exists solely to disqualify match-anything rules. */
|
||||
convert_suffix_rule (dep_name (d), (char *) 0, (struct commands *) 0);
|
||||
|
||||
f = d->file;
|
||||
if (f->cmds != 0)
|
||||
/* Record a pattern for this suffix's null-suffix rule. */
|
||||
convert_suffix_rule ("", dep_name (d), f->cmds);
|
||||
|
||||
/* Record a pattern for each of this suffix's two-suffix rules. */
|
||||
slen = strlen (dep_name (d));
|
||||
bcopy (dep_name (d), rulename, slen);
|
||||
for (d2 = suffix_file->deps; d2 != 0; d2 = d2->next)
|
||||
{
|
||||
s2len = strlen (dep_name (d2));
|
||||
|
||||
if (slen == s2len && streq (dep_name (d), dep_name (d2)))
|
||||
continue;
|
||||
|
||||
bcopy (dep_name (d2), rulename + slen, s2len + 1);
|
||||
f = lookup_file (rulename);
|
||||
if (f == 0 || f->cmds == 0)
|
||||
continue;
|
||||
|
||||
if (s2len == 2 && rulename[slen] == '.' && rulename[slen + 1] == 'a')
|
||||
/* A suffix rule `.X.a:' generates the pattern rule `(%.o): %.X'.
|
||||
It also generates a normal `%.a: %.X' rule below. */
|
||||
convert_suffix_rule ((char *) 0, /* Indicates `(%.o)'. */
|
||||
dep_name (d),
|
||||
f->cmds);
|
||||
|
||||
/* The suffix rule `.X.Y:' is converted
|
||||
to the pattern rule `%.Y: %.X'. */
|
||||
convert_suffix_rule (dep_name (d2), dep_name (d), f->cmds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Install the pattern rule RULE (whose fields have been filled in)
|
||||
at the end of the list (so that any rules previously defined
|
||||
will take precedence). If this rule duplicates a previous one
|
||||
(identical target and dependencies), the old one is replaced
|
||||
if OVERRIDE is nonzero, otherwise this new one is thrown out.
|
||||
When an old rule is replaced, the new one is put at the end of the
|
||||
list. Return nonzero if RULE is used; zero if not. */
|
||||
|
||||
int
|
||||
new_pattern_rule (rule, override)
|
||||
register struct rule *rule;
|
||||
int override;
|
||||
{
|
||||
register struct rule *r, *lastrule;
|
||||
register unsigned int i, j;
|
||||
|
||||
rule->in_use = 0;
|
||||
rule->terminal = 0;
|
||||
|
||||
rule->next = 0;
|
||||
|
||||
/* Search for an identical rule. */
|
||||
lastrule = 0;
|
||||
for (r = pattern_rules; r != 0; lastrule = r, r = r->next)
|
||||
for (i = 0; rule->targets[i] != 0; ++i)
|
||||
{
|
||||
for (j = 0; r->targets[j] != 0; ++j)
|
||||
if (!streq (rule->targets[i], r->targets[j]))
|
||||
break;
|
||||
if (r->targets[j] == 0)
|
||||
/* All the targets matched. */
|
||||
{
|
||||
register struct dep *d, *d2;
|
||||
for (d = rule->deps, d2 = r->deps;
|
||||
d != 0 && d2 != 0; d = d->next, d2 = d2->next)
|
||||
if (!streq (dep_name (d), dep_name (d2)))
|
||||
break;
|
||||
if (d == 0 && d2 == 0)
|
||||
/* All the dependencies matched. */
|
||||
if (override)
|
||||
{
|
||||
/* Remove the old rule. */
|
||||
freerule (r, lastrule);
|
||||
/* Install the new one. */
|
||||
if (pattern_rules == 0)
|
||||
pattern_rules = rule;
|
||||
else
|
||||
last_pattern_rule->next = rule;
|
||||
last_pattern_rule = rule;
|
||||
|
||||
/* We got one. Stop looking. */
|
||||
goto matched;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The old rule stays intact. Destroy the new one. */
|
||||
freerule (rule, (struct rule *) 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
matched:;
|
||||
|
||||
if (r == 0)
|
||||
{
|
||||
/* There was no rule to replace. */
|
||||
if (pattern_rules == 0)
|
||||
pattern_rules = rule;
|
||||
else
|
||||
last_pattern_rule->next = rule;
|
||||
last_pattern_rule = rule;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Install an implicit pattern rule based on the three text strings
|
||||
in the structure P points to. These strings come from one of
|
||||
the arrays of default implicit pattern rules.
|
||||
TERMINAL specifies what the `terminal' field of the rule should be. */
|
||||
|
||||
void
|
||||
install_pattern_rule (p, terminal)
|
||||
struct pspec *p;
|
||||
int terminal;
|
||||
{
|
||||
register struct rule *r;
|
||||
char *ptr;
|
||||
|
||||
r = (struct rule *) xmalloc (sizeof (struct rule));
|
||||
|
||||
r->targets = (char **) xmalloc (2 * sizeof (char *));
|
||||
r->suffixes = (char **) xmalloc (2 * sizeof (char *));
|
||||
r->lens = (unsigned int *) xmalloc (2 * sizeof (unsigned int));
|
||||
|
||||
r->targets[1] = 0;
|
||||
r->suffixes[1] = 0;
|
||||
r->lens[1] = 0;
|
||||
|
||||
r->lens[0] = strlen (p->target);
|
||||
/* These will all be string literals, but we malloc space for
|
||||
them anyway because somebody might want to free them later on. */
|
||||
r->targets[0] = savestring (p->target, r->lens[0]);
|
||||
r->suffixes[0] = find_percent (r->targets[0]);
|
||||
if (r->suffixes[0] == 0)
|
||||
/* Programmer-out-to-lunch error. */
|
||||
abort ();
|
||||
else
|
||||
++r->suffixes[0];
|
||||
|
||||
ptr = p->dep;
|
||||
r->deps = (struct dep *) multi_glob (parse_file_seq (&ptr, '\0',
|
||||
sizeof (struct dep), 1),
|
||||
sizeof (struct dep));
|
||||
|
||||
if (new_pattern_rule (r, 0))
|
||||
{
|
||||
r->terminal = terminal;
|
||||
r->cmds = (struct commands *) xmalloc (sizeof (struct commands));
|
||||
r->cmds->filename = 0;
|
||||
r->cmds->lineno = 0;
|
||||
/* These will all be string literals, but we malloc space for them
|
||||
anyway because somebody might want to free them later. */
|
||||
r->cmds->commands = savestring (p->commands, strlen (p->commands));
|
||||
r->cmds->command_lines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Free all the storage used in RULE and take it out of the
|
||||
pattern_rules chain. LASTRULE is the rule whose next pointer
|
||||
points to RULE. */
|
||||
|
||||
static void
|
||||
freerule (rule, lastrule)
|
||||
register struct rule *rule, *lastrule;
|
||||
{
|
||||
struct rule *next = rule->next;
|
||||
register unsigned int i;
|
||||
|
||||
for (i = 0; rule->targets[i] != 0; ++i)
|
||||
free (rule->targets[i]);
|
||||
|
||||
free ((char *) rule->targets);
|
||||
free ((char *) rule->suffixes);
|
||||
free ((char *) rule->lens);
|
||||
|
||||
/* We can't free the storage for the commands because there
|
||||
are ways that they could be in more than one place:
|
||||
* If the commands came from a suffix rule, they could also be in
|
||||
the `struct file's for other suffix rules or plain targets given
|
||||
on the same makefile line.
|
||||
* If two suffixes that together make a two-suffix rule were each
|
||||
given twice in the .SUFFIXES list, and in the proper order, two
|
||||
identical pattern rules would be created and the second one would
|
||||
be discarded here, but both would contain the same `struct commands'
|
||||
pointer from the `struct file' for the suffix rule. */
|
||||
|
||||
free ((char *) rule);
|
||||
|
||||
if (pattern_rules == rule)
|
||||
if (lastrule != 0)
|
||||
abort ();
|
||||
else
|
||||
pattern_rules = next;
|
||||
else if (lastrule != 0)
|
||||
lastrule->next = next;
|
||||
if (last_pattern_rule == rule)
|
||||
last_pattern_rule = lastrule;
|
||||
}
|
||||
|
||||
/* Create a new pattern rule with the targets in the nil-terminated
|
||||
array TARGETS. If TARGET_PERCENTS is not nil, it is an array of
|
||||
pointers into the elements of TARGETS, where the `%'s are.
|
||||
The new rule has dependencies DEPS and commands from COMMANDS.
|
||||
It is a terminal rule if TERMINAL is nonzero. This rule overrides
|
||||
identical rules with different commands if OVERRIDE is nonzero.
|
||||
|
||||
The storage for TARGETS and its elements is used and must not be freed
|
||||
until the rule is destroyed. The storage for TARGET_PERCENTS is not used;
|
||||
it may be freed. */
|
||||
|
||||
void
|
||||
create_pattern_rule (targets, target_percents,
|
||||
terminal, deps, commands, override)
|
||||
char **targets, **target_percents;
|
||||
int terminal;
|
||||
struct dep *deps;
|
||||
struct commands *commands;
|
||||
int override;
|
||||
{
|
||||
register struct rule *r = (struct rule *) xmalloc (sizeof (struct rule));
|
||||
register unsigned int max_targets, i;
|
||||
|
||||
r->cmds = commands;
|
||||
r->deps = deps;
|
||||
r->targets = targets;
|
||||
|
||||
max_targets = 2;
|
||||
r->lens = (unsigned int *) xmalloc (2 * sizeof (unsigned int));
|
||||
r->suffixes = (char **) xmalloc (2 * sizeof (char *));
|
||||
for (i = 0; targets[i] != 0; ++i)
|
||||
{
|
||||
if (i == max_targets - 1)
|
||||
{
|
||||
max_targets += 5;
|
||||
r->lens = (unsigned int *)
|
||||
xrealloc ((char *) r->lens, max_targets * sizeof (unsigned int));
|
||||
r->suffixes = (char **)
|
||||
xrealloc ((char *) r->suffixes, max_targets * sizeof (char *));
|
||||
}
|
||||
r->lens[i] = strlen (targets[i]);
|
||||
r->suffixes[i] = (target_percents == 0 ? find_percent (targets[i])
|
||||
: target_percents[i]) + 1;
|
||||
if (r->suffixes[i] == 0)
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (i < max_targets - 1)
|
||||
{
|
||||
r->lens = (unsigned int *) xrealloc ((char *) r->lens,
|
||||
(i + 1) * sizeof (unsigned int));
|
||||
r->suffixes = (char **) xrealloc ((char *) r->suffixes,
|
||||
(i + 1) * sizeof (char *));
|
||||
}
|
||||
|
||||
if (new_pattern_rule (r, override))
|
||||
r->terminal = terminal;
|
||||
}
|
||||
|
||||
/* Print the data base of rules. */
|
||||
|
||||
static void /* Useful to call from gdb. */
|
||||
print_rule (r)
|
||||
struct rule *r;
|
||||
{
|
||||
register unsigned int i;
|
||||
register struct dep *d;
|
||||
|
||||
for (i = 0; r->targets[i] != 0; ++i)
|
||||
{
|
||||
fputs (r->targets[i], stdout);
|
||||
if (r->targets[i + 1] != 0)
|
||||
putchar (' ');
|
||||
else
|
||||
putchar (':');
|
||||
}
|
||||
if (r->terminal)
|
||||
putchar (':');
|
||||
|
||||
for (d = r->deps; d != 0; d = d->next)
|
||||
printf (" %s", dep_name (d));
|
||||
putchar ('\n');
|
||||
|
||||
if (r->cmds != 0)
|
||||
print_commands (r->cmds);
|
||||
}
|
||||
|
||||
void
|
||||
print_rule_data_base ()
|
||||
{
|
||||
register unsigned int rules, terminal;
|
||||
register struct rule *r;
|
||||
|
||||
puts ("\n# Implicit Rules");
|
||||
|
||||
rules = terminal = 0;
|
||||
for (r = pattern_rules; r != 0; r = r->next)
|
||||
{
|
||||
++rules;
|
||||
|
||||
putchar ('\n');
|
||||
print_rule (r);
|
||||
|
||||
if (r->terminal)
|
||||
++terminal;
|
||||
}
|
||||
|
||||
if (rules == 0)
|
||||
puts ("\n# No implicit rules.");
|
||||
else
|
||||
{
|
||||
printf ("\n# %u implicit rules, %u", rules, terminal);
|
||||
#ifndef NO_FLOAT
|
||||
printf (" (%.1f%%)", (double) terminal / (double) rules * 100.0);
|
||||
#else
|
||||
{
|
||||
int f = (terminal * 1000 + 5) / rules;
|
||||
printf (" (%d.%d%%)", f/10, f%10);
|
||||
}
|
||||
#endif
|
||||
puts (" terminal.");
|
||||
}
|
||||
|
||||
if (num_pattern_rules != rules)
|
||||
fatal ("BUG: num_pattern_rules wrong! %u != %u",
|
||||
num_pattern_rules, rules);
|
||||
}
|
||||
53
rule.h
Normal file
53
rule.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* Definitions for using pattern rules in GNU Make.
|
||||
Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Structure used for pattern rules. */
|
||||
|
||||
struct rule
|
||||
{
|
||||
struct rule *next;
|
||||
char **targets; /* Targets of the rule. */
|
||||
unsigned int *lens; /* Lengths of each target. */
|
||||
char **suffixes; /* Suffixes (after `%') of each target. */
|
||||
struct dep *deps; /* Dependencies of the rule. */
|
||||
struct commands *cmds; /* Commands to execute. */
|
||||
char terminal; /* If terminal (double-colon). */
|
||||
char in_use; /* If in use by a parent pattern_search. */
|
||||
};
|
||||
|
||||
/* For calling install_pattern_rule. */
|
||||
struct pspec
|
||||
{
|
||||
char *target, *dep, *commands;
|
||||
};
|
||||
|
||||
|
||||
extern struct rule *pattern_rules;
|
||||
extern struct rule *last_pattern_rule;
|
||||
extern unsigned int num_pattern_rules;
|
||||
|
||||
extern unsigned int max_pattern_deps;
|
||||
extern unsigned int max_pattern_targets;
|
||||
extern unsigned int max_pattern_dep_length;
|
||||
|
||||
extern struct file *suffix_file;
|
||||
extern unsigned int maxsuffix;
|
||||
|
||||
|
||||
extern void install_pattern_rule PARAMS ((struct pspec *p, int terminal));
|
||||
extern int new_pattern_rule PARAMS ((struct rule *rule, int override));
|
||||
307
signame.c
Normal file
307
signame.c
Normal file
@@ -0,0 +1,307 @@
|
||||
/* Convert between signal names and numbers.
|
||||
Copyright (C) 1990, 1992, 1993, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h> /* Some systems need this for <signal.h>. */
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
/* Some systems declare `sys_siglist in <unistd.h>; if
|
||||
configure defined SYS_SIGLIST_DECLARED, it may expect
|
||||
to find the declaration there. */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Some systems do not define NSIG in <signal.h>. */
|
||||
#ifndef NSIG
|
||||
#ifdef _NSIG
|
||||
#define NSIG _NSIG
|
||||
#else
|
||||
#define NSIG 32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !__STDC__
|
||||
#define const
|
||||
#endif
|
||||
|
||||
#include "signame.h"
|
||||
|
||||
#ifndef HAVE_SYS_SIGLIST
|
||||
/* There is too much variation in Sys V signal numbers and names, so
|
||||
we must initialize them at runtime. */
|
||||
|
||||
static const char undoc[] = "unknown signal";
|
||||
|
||||
const char *sys_siglist[NSIG];
|
||||
|
||||
#else /* HAVE_SYS_SIGLIST. */
|
||||
|
||||
#ifndef SYS_SIGLIST_DECLARED
|
||||
extern char *sys_siglist[];
|
||||
#endif /* Not SYS_SIGLIST_DECLARED. */
|
||||
|
||||
#endif /* Not HAVE_SYS_SIGLIST. */
|
||||
|
||||
/* Table of abbreviations for signals. Note: A given number can
|
||||
appear more than once with different abbreviations. */
|
||||
typedef struct
|
||||
{
|
||||
int number;
|
||||
const char *abbrev;
|
||||
} num_abbrev;
|
||||
static num_abbrev sig_table[NSIG*2];
|
||||
/* Number of elements of sig_table used. */
|
||||
static int sig_table_nelts = 0;
|
||||
|
||||
/* Enter signal number NUMBER into the tables with ABBREV and NAME. */
|
||||
|
||||
static void
|
||||
init_sig (number, abbrev, name)
|
||||
int number;
|
||||
const char *abbrev;
|
||||
const char *name;
|
||||
{
|
||||
#ifndef HAVE_SYS_SIGLIST
|
||||
sys_siglist[number] = name;
|
||||
#endif
|
||||
sig_table[sig_table_nelts].number = number;
|
||||
sig_table[sig_table_nelts++].abbrev = abbrev;
|
||||
}
|
||||
|
||||
void
|
||||
signame_init ()
|
||||
{
|
||||
#ifndef HAVE_SYS_SIGLIST
|
||||
int i;
|
||||
/* Initialize signal names. */
|
||||
for (i = 0; i < NSIG; i++)
|
||||
sys_siglist[i] = undoc;
|
||||
#endif /* !HAVE_SYS_SIGLIST */
|
||||
|
||||
/* Initialize signal names. */
|
||||
#if defined (SIGHUP)
|
||||
init_sig (SIGHUP, "HUP", "Hangup");
|
||||
#endif
|
||||
#if defined (SIGINT)
|
||||
init_sig (SIGINT, "INT", "Interrupt");
|
||||
#endif
|
||||
#if defined (SIGQUIT)
|
||||
init_sig (SIGQUIT, "QUIT", "Quit");
|
||||
#endif
|
||||
#if defined (SIGILL)
|
||||
init_sig (SIGILL, "ILL", "Illegal Instruction");
|
||||
#endif
|
||||
#if defined (SIGTRAP)
|
||||
init_sig (SIGTRAP, "TRAP", "Trace/breakpoint trap");
|
||||
#endif
|
||||
/* If SIGIOT == SIGABRT, we want to print it as SIGABRT because
|
||||
SIGABRT is in ANSI and POSIX.1 and SIGIOT isn't. */
|
||||
#if defined (SIGABRT)
|
||||
init_sig (SIGABRT, "ABRT", "Aborted");
|
||||
#endif
|
||||
#if defined (SIGIOT)
|
||||
init_sig (SIGIOT, "IOT", "IOT trap");
|
||||
#endif
|
||||
#if defined (SIGEMT)
|
||||
init_sig (SIGEMT, "EMT", "EMT trap");
|
||||
#endif
|
||||
#if defined (SIGFPE)
|
||||
init_sig (SIGFPE, "FPE", "Floating point exception");
|
||||
#endif
|
||||
#if defined (SIGKILL)
|
||||
init_sig (SIGKILL, "KILL", "Killed");
|
||||
#endif
|
||||
#if defined (SIGBUS)
|
||||
init_sig (SIGBUS, "BUS", "Bus error");
|
||||
#endif
|
||||
#if defined (SIGSEGV)
|
||||
init_sig (SIGSEGV, "SEGV", "Segmentation fault");
|
||||
#endif
|
||||
#if defined (SIGSYS)
|
||||
init_sig (SIGSYS, "SYS", "Bad system call");
|
||||
#endif
|
||||
#if defined (SIGPIPE)
|
||||
init_sig (SIGPIPE, "PIPE", "Broken pipe");
|
||||
#endif
|
||||
#if defined (SIGALRM)
|
||||
init_sig (SIGALRM, "ALRM", "Alarm clock");
|
||||
#endif
|
||||
#if defined (SIGTERM)
|
||||
init_sig (SIGTERM, "TERM", "Terminated");
|
||||
#endif
|
||||
#if defined (SIGUSR1)
|
||||
init_sig (SIGUSR1, "USR1", "User defined signal 1");
|
||||
#endif
|
||||
#if defined (SIGUSR2)
|
||||
init_sig (SIGUSR2, "USR2", "User defined signal 2");
|
||||
#endif
|
||||
/* If SIGCLD == SIGCHLD, we want to print it as SIGCHLD because that
|
||||
is what is in POSIX.1. */
|
||||
#if defined (SIGCHLD)
|
||||
init_sig (SIGCHLD, "CHLD", "Child exited");
|
||||
#endif
|
||||
#if defined (SIGCLD)
|
||||
init_sig (SIGCLD, "CLD", "Child exited");
|
||||
#endif
|
||||
#if defined (SIGPWR)
|
||||
init_sig (SIGPWR, "PWR", "Power failure");
|
||||
#endif
|
||||
#if defined (SIGTSTP)
|
||||
init_sig (SIGTSTP, "TSTP", "Stopped");
|
||||
#endif
|
||||
#if defined (SIGTTIN)
|
||||
init_sig (SIGTTIN, "TTIN", "Stopped (tty input)");
|
||||
#endif
|
||||
#if defined (SIGTTOU)
|
||||
init_sig (SIGTTOU, "TTOU", "Stopped (tty output)");
|
||||
#endif
|
||||
#if defined (SIGSTOP)
|
||||
init_sig (SIGSTOP, "STOP", "Stopped (signal)");
|
||||
#endif
|
||||
#if defined (SIGXCPU)
|
||||
init_sig (SIGXCPU, "XCPU", "CPU time limit exceeded");
|
||||
#endif
|
||||
#if defined (SIGXFSZ)
|
||||
init_sig (SIGXFSZ, "XFSZ", "File size limit exceeded");
|
||||
#endif
|
||||
#if defined (SIGVTALRM)
|
||||
init_sig (SIGVTALRM, "VTALRM", "Virtual timer expired");
|
||||
#endif
|
||||
#if defined (SIGPROF)
|
||||
init_sig (SIGPROF, "PROF", "Profiling timer expired");
|
||||
#endif
|
||||
#if defined (SIGWINCH)
|
||||
/* "Window size changed" might be more accurate, but even if that
|
||||
is all that it means now, perhaps in the future it will be
|
||||
extended to cover other kinds of window changes. */
|
||||
init_sig (SIGWINCH, "WINCH", "Window changed");
|
||||
#endif
|
||||
#if defined (SIGCONT)
|
||||
init_sig (SIGCONT, "CONT", "Continued");
|
||||
#endif
|
||||
#if defined (SIGURG)
|
||||
init_sig (SIGURG, "URG", "Urgent I/O condition");
|
||||
#endif
|
||||
#if defined (SIGIO)
|
||||
/* "I/O pending" has also been suggested. A disadvantage is
|
||||
that signal only happens when the process has
|
||||
asked for it, not everytime I/O is pending. Another disadvantage
|
||||
is the confusion from giving it a different name than under Unix. */
|
||||
init_sig (SIGIO, "IO", "I/O possible");
|
||||
#endif
|
||||
#if defined (SIGWIND)
|
||||
init_sig (SIGWIND, "WIND", "SIGWIND");
|
||||
#endif
|
||||
#if defined (SIGPHONE)
|
||||
init_sig (SIGPHONE, "PHONE", "SIGPHONE");
|
||||
#endif
|
||||
#if defined (SIGPOLL)
|
||||
init_sig (SIGPOLL, "POLL", "I/O possible");
|
||||
#endif
|
||||
#if defined (SIGLOST)
|
||||
init_sig (SIGLOST, "LOST", "Resource lost");
|
||||
#endif
|
||||
#if defined (SIGDANGER)
|
||||
init_sig (SIGDANGER, "DANGER", "Danger signal");
|
||||
#endif
|
||||
#if defined (SIGINFO)
|
||||
init_sig (SIGINFO, "INFO", "Information request");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return the abbreviation for signal NUMBER. */
|
||||
|
||||
char *
|
||||
sig_abbrev (number)
|
||||
int number;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (sig_table_nelts == 0)
|
||||
signame_init ();
|
||||
|
||||
for (i = 0; i < sig_table_nelts; i++)
|
||||
if (sig_table[i].number == number)
|
||||
return (char *)sig_table[i].abbrev;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return the signal number for an ABBREV, or -1 if there is no
|
||||
signal by that name. */
|
||||
|
||||
int
|
||||
sig_number (abbrev)
|
||||
const char *abbrev;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (sig_table_nelts == 0)
|
||||
signame_init ();
|
||||
|
||||
/* Skip over "SIG" if present. */
|
||||
if (abbrev[0] == 'S' && abbrev[1] == 'I' && abbrev[2] == 'G')
|
||||
abbrev += 3;
|
||||
|
||||
for (i = 0; i < sig_table_nelts; i++)
|
||||
if (abbrev[0] == sig_table[i].abbrev[0]
|
||||
&& strcmp (abbrev, sig_table[i].abbrev) == 0)
|
||||
return sig_table[i].number;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef HAVE_PSIGNAL
|
||||
/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
|
||||
a colon, and followed by a newline. */
|
||||
|
||||
void
|
||||
psignal (signal, message)
|
||||
int signal;
|
||||
const char *message;
|
||||
{
|
||||
if (signal <= 0 || signal >= NSIG)
|
||||
fprintf (stderr, "%s: unknown signal", message);
|
||||
else
|
||||
fprintf (stderr, "%s: %s\n", message, sys_siglist[signal]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRSIGNAL
|
||||
/* Return the string associated with the signal number. */
|
||||
|
||||
char *
|
||||
strsignal (signal)
|
||||
int signal;
|
||||
{
|
||||
static char buf[] = "Signal 12345678901234567890";
|
||||
|
||||
if (signal > 0 || signal < NSIG)
|
||||
return (char *) sys_siglist[signal];
|
||||
|
||||
sprintf (buf, "Signal %d", signal);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
65
signame.h
Normal file
65
signame.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* Convert between signal names and numbers.
|
||||
Copyright (C) 1990, 1992, 1993, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
|
||||
/* Initialize `sys_siglist'. */
|
||||
void signame_init (void);
|
||||
|
||||
/* Return the abbreviation (e.g. ABRT, FPE, etc.) for signal NUMBER.
|
||||
Do not return this as a const char *. The caller might want to
|
||||
assign it to a char *. */
|
||||
char *sig_abbrev (int number);
|
||||
|
||||
/* Return the signal number for an ABBREV, or -1 if there is no
|
||||
signal by that name. */
|
||||
int sig_number (const char *abbrev);
|
||||
|
||||
/* Avoid conflicts with a system header file that might define these three. */
|
||||
|
||||
#ifndef HAVE_PSIGNAL
|
||||
/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
|
||||
a colon, and followed by a newline. */
|
||||
void psignal (int signal, const char *message);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRSIGNAL
|
||||
/* Return the name of SIGNAL. */
|
||||
char *strsignal (int signal);
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_SYS_SIGLIST)
|
||||
/* Names for signals from 0 to NSIG-1. */
|
||||
extern const char *sys_siglist[];
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
void signame_init ();
|
||||
char *sig_abbrev ();
|
||||
int sig_number ();
|
||||
#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_PSIGNAL)
|
||||
void psignal ();
|
||||
#endif
|
||||
#ifndef HAVE_STRSIGNAL
|
||||
char *strsignal ();
|
||||
#endif
|
||||
#if !defined (HAVE_SYS_SIGLIST)
|
||||
extern char *sys_siglist[];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
864
variable.c
Normal file
864
variable.c
Normal file
@@ -0,0 +1,864 @@
|
||||
/* Internals of variables for GNU Make.
|
||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 96 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "dep.h"
|
||||
#include "filedef.h"
|
||||
#include "job.h"
|
||||
#include "commands.h"
|
||||
#include "variable.h"
|
||||
|
||||
/* Hash table of all global variable definitions. */
|
||||
|
||||
#ifndef VARIABLE_BUCKETS
|
||||
#define VARIABLE_BUCKETS 523
|
||||
#endif
|
||||
#ifndef PERFILE_VARIABLE_BUCKETS
|
||||
#define PERFILE_VARIABLE_BUCKETS 23
|
||||
#endif
|
||||
#ifndef SMALL_SCOPE_VARIABLE_BUCKETS
|
||||
#define SMALL_SCOPE_VARIABLE_BUCKETS 13
|
||||
#endif
|
||||
static struct variable *variable_table[VARIABLE_BUCKETS];
|
||||
static struct variable_set global_variable_set
|
||||
= { variable_table, VARIABLE_BUCKETS };
|
||||
static struct variable_set_list global_setlist
|
||||
= { 0, &global_variable_set };
|
||||
struct variable_set_list *current_variable_set_list = &global_setlist;
|
||||
|
||||
static struct variable *define_variable_in_set PARAMS ((char *name, unsigned int length,
|
||||
char *value, enum variable_origin origin,
|
||||
int recursive, struct variable_set *set));
|
||||
|
||||
|
||||
/* Implement variables. */
|
||||
|
||||
/* Define variable named NAME with value VALUE in SET. VALUE is copied.
|
||||
LENGTH is the length of NAME, which does not need to be null-terminated.
|
||||
ORIGIN specifies the origin of the variable (makefile, command line
|
||||
or environment).
|
||||
If RECURSIVE is nonzero a flag is set in the variable saying
|
||||
that it should be recursively re-expanded. */
|
||||
|
||||
static struct variable *
|
||||
define_variable_in_set (name, length, value, origin, recursive, set)
|
||||
char *name;
|
||||
unsigned int length;
|
||||
char *value;
|
||||
enum variable_origin origin;
|
||||
int recursive;
|
||||
struct variable_set *set;
|
||||
{
|
||||
register unsigned int i;
|
||||
register unsigned int hashval;
|
||||
register struct variable *v;
|
||||
|
||||
hashval = 0;
|
||||
for (i = 0; i < length; ++i)
|
||||
HASH (hashval, name[i]);
|
||||
hashval %= set->buckets;
|
||||
|
||||
for (v = set->table[hashval]; v != 0; v = v->next)
|
||||
if (*v->name == *name
|
||||
&& !strncmp (v->name + 1, name + 1, length - 1)
|
||||
&& v->name[length] == '\0')
|
||||
break;
|
||||
|
||||
if (env_overrides && origin == o_env)
|
||||
origin = o_env_override;
|
||||
|
||||
if (v != 0)
|
||||
{
|
||||
if (env_overrides && v->origin == o_env)
|
||||
/* V came from in the environment. Since it was defined
|
||||
before the switches were parsed, it wasn't affected by -e. */
|
||||
v->origin = o_env_override;
|
||||
|
||||
/* A variable of this name is already defined.
|
||||
If the old definition is from a stronger source
|
||||
than this one, don't redefine it. */
|
||||
if ((int) origin >= (int) v->origin)
|
||||
{
|
||||
if (v->value != 0)
|
||||
free (v->value);
|
||||
v->value = savestring (value, strlen (value));
|
||||
v->origin = origin;
|
||||
v->recursive = recursive;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Create a new variable definition and add it to the hash table. */
|
||||
|
||||
v = (struct variable *) xmalloc (sizeof (struct variable));
|
||||
v->name = savestring (name, length);
|
||||
v->value = savestring (value, strlen (value));
|
||||
v->origin = origin;
|
||||
v->recursive = recursive;
|
||||
v->expanding = 0;
|
||||
v->export = v_default;
|
||||
v->next = set->table[hashval];
|
||||
set->table[hashval] = v;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Define a variable in the current variable set. */
|
||||
|
||||
struct variable *
|
||||
define_variable (name, length, value, origin, recursive)
|
||||
char *name;
|
||||
unsigned int length;
|
||||
char *value;
|
||||
enum variable_origin origin;
|
||||
int recursive;
|
||||
{
|
||||
return define_variable_in_set (name, length, value, origin, recursive,
|
||||
current_variable_set_list->set);
|
||||
}
|
||||
|
||||
/* Define a variable in FILE's variable set. */
|
||||
|
||||
struct variable *
|
||||
define_variable_for_file (name, length, value, origin, recursive, file)
|
||||
char *name;
|
||||
unsigned int length;
|
||||
char *value;
|
||||
enum variable_origin origin;
|
||||
int recursive;
|
||||
struct file *file;
|
||||
{
|
||||
return define_variable_in_set (name, length, value, origin, recursive,
|
||||
file->variables->set);
|
||||
}
|
||||
|
||||
/* Lookup a variable whose name is a string starting at NAME
|
||||
and with LENGTH chars. NAME need not be null-terminated.
|
||||
Returns address of the `struct variable' containing all info
|
||||
on the variable, or nil if no such variable is defined. */
|
||||
|
||||
struct variable *
|
||||
lookup_variable (name, length)
|
||||
char *name;
|
||||
unsigned int length;
|
||||
{
|
||||
register struct variable_set_list *setlist;
|
||||
|
||||
register unsigned int i;
|
||||
register unsigned int rawhash = 0;
|
||||
|
||||
for (i = 0; i < length; ++i)
|
||||
HASH (rawhash, name[i]);
|
||||
|
||||
for (setlist = current_variable_set_list;
|
||||
setlist != 0; setlist = setlist->next)
|
||||
{
|
||||
register struct variable_set *set = setlist->set;
|
||||
register unsigned int hashval = rawhash % set->buckets;
|
||||
register struct variable *v;
|
||||
|
||||
for (v = set->table[hashval]; v != 0; v = v->next)
|
||||
if (*v->name == *name
|
||||
&& !strncmp (v->name + 1, name + 1, length - 1)
|
||||
&& v->name[length] == 0)
|
||||
return v;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize FILE's variable set list. If FILE already has a variable set
|
||||
list, the topmost variable set is left intact, but the the rest of the
|
||||
chain is replaced with FILE->parent's setlist. */
|
||||
|
||||
void
|
||||
initialize_file_variables (file)
|
||||
struct file *file;
|
||||
{
|
||||
register struct variable_set_list *l = file->variables;
|
||||
if (l == 0)
|
||||
{
|
||||
l = (struct variable_set_list *)
|
||||
xmalloc (sizeof (struct variable_set_list));
|
||||
l->set = (struct variable_set *) xmalloc (sizeof (struct variable_set));
|
||||
l->set->buckets = PERFILE_VARIABLE_BUCKETS;
|
||||
l->set->table = (struct variable **)
|
||||
xmalloc (l->set->buckets * sizeof (struct variable *));
|
||||
bzero ((char *) l->set->table,
|
||||
l->set->buckets * sizeof (struct variable *));
|
||||
file->variables = l;
|
||||
}
|
||||
|
||||
if (file->parent == 0)
|
||||
l->next = &global_setlist;
|
||||
else
|
||||
{
|
||||
if (file->parent->variables == 0)
|
||||
initialize_file_variables (file->parent);
|
||||
l->next = file->parent->variables;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pop the top set off the current variable set list,
|
||||
and free all its storage. */
|
||||
|
||||
void
|
||||
pop_variable_scope ()
|
||||
{
|
||||
register struct variable_set_list *setlist = current_variable_set_list;
|
||||
register struct variable_set *set = setlist->set;
|
||||
register unsigned int i;
|
||||
|
||||
current_variable_set_list = setlist->next;
|
||||
free ((char *) setlist);
|
||||
|
||||
for (i = 0; i < set->buckets; ++i)
|
||||
{
|
||||
register struct variable *next = set->table[i];
|
||||
while (next != 0)
|
||||
{
|
||||
register struct variable *v = next;
|
||||
next = v->next;
|
||||
|
||||
free (v->name);
|
||||
free ((char *) v);
|
||||
}
|
||||
}
|
||||
free ((char *) set->table);
|
||||
free ((char *) set);
|
||||
}
|
||||
|
||||
/* Create a new variable set and push it on the current setlist. */
|
||||
|
||||
void
|
||||
push_new_variable_scope ()
|
||||
{
|
||||
register struct variable_set_list *setlist;
|
||||
register struct variable_set *set;
|
||||
|
||||
set = (struct variable_set *) xmalloc (sizeof (struct variable_set));
|
||||
set->buckets = SMALL_SCOPE_VARIABLE_BUCKETS;
|
||||
set->table = (struct variable **)
|
||||
xmalloc (set->buckets * sizeof (struct variable *));
|
||||
bzero ((char *) set->table, set->buckets * sizeof (struct variable *));
|
||||
|
||||
setlist = (struct variable_set_list *)
|
||||
xmalloc (sizeof (struct variable_set_list));
|
||||
setlist->set = set;
|
||||
setlist->next = current_variable_set_list;
|
||||
current_variable_set_list = setlist;
|
||||
}
|
||||
|
||||
/* Merge SET1 into SET0, freeing unused storage in SET1. */
|
||||
|
||||
static void
|
||||
merge_variable_sets (set0, set1)
|
||||
struct variable_set *set0, *set1;
|
||||
{
|
||||
register unsigned int bucket1;
|
||||
|
||||
for (bucket1 = 0; bucket1 < set1->buckets; ++bucket1)
|
||||
{
|
||||
register struct variable *v1 = set1->table[bucket1];
|
||||
while (v1 != 0)
|
||||
{
|
||||
struct variable *next = v1->next;
|
||||
unsigned int bucket0;
|
||||
register struct variable *v0;
|
||||
|
||||
if (set1->buckets >= set0->buckets)
|
||||
bucket0 = bucket1;
|
||||
else
|
||||
{
|
||||
register char *n;
|
||||
bucket0 = 0;
|
||||
for (n = v1->name; *n != '\0'; ++n)
|
||||
HASH (bucket0, *n);
|
||||
}
|
||||
bucket0 %= set0->buckets;
|
||||
|
||||
for (v0 = set0->table[bucket0]; v0 != 0; v0 = v0->next)
|
||||
if (streq (v0->name, v1->name))
|
||||
break;
|
||||
|
||||
if (v0 == 0)
|
||||
{
|
||||
/* There is no variable in SET0 with the same name. */
|
||||
v1->next = set0->table[bucket0];
|
||||
set0->table[bucket0] = v1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The same variable exists in both sets.
|
||||
SET0 takes precedence. */
|
||||
free (v1->value);
|
||||
free ((char *) v1);
|
||||
}
|
||||
|
||||
v1 = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Merge SETLIST1 into SETLIST0, freeing unused storage in SETLIST1. */
|
||||
|
||||
void
|
||||
merge_variable_set_lists (setlist0, setlist1)
|
||||
struct variable_set_list **setlist0, *setlist1;
|
||||
{
|
||||
register struct variable_set_list *list0 = *setlist0;
|
||||
struct variable_set_list *last0 = 0;
|
||||
|
||||
while (setlist1 != 0 && list0 != 0)
|
||||
{
|
||||
struct variable_set_list *next = setlist1;
|
||||
setlist1 = setlist1->next;
|
||||
|
||||
merge_variable_sets (list0->set, next->set);
|
||||
|
||||
free ((char *) next);
|
||||
|
||||
last0 = list0;
|
||||
list0 = list0->next;
|
||||
}
|
||||
|
||||
if (setlist1 != 0)
|
||||
{
|
||||
if (last0 == 0)
|
||||
*setlist0 = setlist1;
|
||||
else
|
||||
last0->next = setlist1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Define the automatic variables, and record the addresses
|
||||
of their structures so we can change their values quickly. */
|
||||
|
||||
void
|
||||
define_automatic_variables ()
|
||||
{
|
||||
extern char default_shell[];
|
||||
register struct variable *v;
|
||||
char buf[200];
|
||||
|
||||
sprintf (buf, "%u", makelevel);
|
||||
(void) define_variable ("MAKELEVEL", 9, buf, o_env, 0);
|
||||
|
||||
sprintf (buf, "%s%s%s",
|
||||
version_string,
|
||||
(remote_description == 0 || remote_description[0] == '\0')
|
||||
? "" : "-",
|
||||
(remote_description == 0 || remote_description[0] == '\0')
|
||||
? "" : remote_description);
|
||||
(void) define_variable ("MAKE_VERSION", 12, buf, o_default, 0);
|
||||
|
||||
|
||||
/* This won't override any definition, but it
|
||||
will provide one if there isn't one there. */
|
||||
v = define_variable ("SHELL", 5, default_shell, o_default, 0);
|
||||
v->export = v_export; /* Always export SHELL. */
|
||||
|
||||
/* Don't let SHELL come from the environment. */
|
||||
if (*v->value == '\0' || v->origin == o_env || v->origin == o_env_override)
|
||||
{
|
||||
free (v->value);
|
||||
v->origin = o_file;
|
||||
v->value = savestring (default_shell, strlen (default_shell));
|
||||
}
|
||||
|
||||
/* Make sure MAKEFILES gets exported if it is set. */
|
||||
v = define_variable ("MAKEFILES", 9, "", o_default, 0);
|
||||
v->export = v_ifset;
|
||||
|
||||
/* Define the magic D and F variables in terms of
|
||||
the automatic variables they are variations of. */
|
||||
|
||||
define_variable ("@D", 2, "$(patsubst %/,%,$(dir $@))", o_automatic, 1);
|
||||
define_variable ("%D", 2, "$(patsubst %/,%,$(dir $%))", o_automatic, 1);
|
||||
define_variable ("*D", 2, "$(patsubst %/,%,$(dir $*))", o_automatic, 1);
|
||||
define_variable ("<D", 2, "$(patsubst %/,%,$(dir $<))", o_automatic, 1);
|
||||
define_variable ("?D", 2, "$(patsubst %/,%,$(dir $?))", o_automatic, 1);
|
||||
define_variable ("^D", 2, "$(patsubst %/,%,$(dir $^))", o_automatic, 1);
|
||||
define_variable ("+D", 2, "$(patsubst %/,%,$(dir $+))", o_automatic, 1);
|
||||
define_variable ("@F", 2, "$(notdir $@)", o_automatic, 1);
|
||||
define_variable ("%F", 2, "$(notdir $%)", o_automatic, 1);
|
||||
define_variable ("*F", 2, "$(notdir $*)", o_automatic, 1);
|
||||
define_variable ("<F", 2, "$(notdir $<)", o_automatic, 1);
|
||||
define_variable ("?F", 2, "$(notdir $?)", o_automatic, 1);
|
||||
define_variable ("^F", 2, "$(notdir $^)", o_automatic, 1);
|
||||
define_variable ("+F", 2, "$(notdir $+)", o_automatic, 1);
|
||||
}
|
||||
|
||||
int export_all_variables;
|
||||
|
||||
/* Create a new environment for FILE's commands.
|
||||
If FILE is nil, this is for the `shell' function.
|
||||
The child's MAKELEVEL variable is incremented. */
|
||||
|
||||
char **
|
||||
target_environment (file)
|
||||
struct file *file;
|
||||
{
|
||||
struct variable_set_list *set_list;
|
||||
register struct variable_set_list *s;
|
||||
struct variable_bucket
|
||||
{
|
||||
struct variable_bucket *next;
|
||||
struct variable *variable;
|
||||
};
|
||||
struct variable_bucket **table;
|
||||
unsigned int buckets;
|
||||
register unsigned int i;
|
||||
register unsigned nvariables;
|
||||
char **result;
|
||||
unsigned int mklev_hash;
|
||||
|
||||
if (file == 0)
|
||||
set_list = current_variable_set_list;
|
||||
else
|
||||
set_list = file->variables;
|
||||
|
||||
/* Find the lowest number of buckets in any set in the list. */
|
||||
s = set_list;
|
||||
buckets = s->set->buckets;
|
||||
for (s = s->next; s != 0; s = s->next)
|
||||
if (s->set->buckets < buckets)
|
||||
buckets = s->set->buckets;
|
||||
|
||||
/* Find the hash value of the bucket `MAKELEVEL' will fall into. */
|
||||
{
|
||||
char *p = "MAKELEVEL";
|
||||
mklev_hash = 0;
|
||||
while (*p != '\0')
|
||||
HASH (mklev_hash, *p++);
|
||||
}
|
||||
|
||||
/* Temporarily allocate a table with that many buckets. */
|
||||
table = (struct variable_bucket **)
|
||||
alloca (buckets * sizeof (struct variable_bucket *));
|
||||
bzero ((char *) table, buckets * sizeof (struct variable_bucket *));
|
||||
|
||||
/* Run through all the variable sets in the list,
|
||||
accumulating variables in TABLE. */
|
||||
nvariables = 0;
|
||||
for (s = set_list; s != 0; s = s->next)
|
||||
{
|
||||
register struct variable_set *set = s->set;
|
||||
for (i = 0; i < set->buckets; ++i)
|
||||
{
|
||||
register struct variable *v;
|
||||
for (v = set->table[i]; v != 0; v = v->next)
|
||||
{
|
||||
unsigned int j = i % buckets;
|
||||
register struct variable_bucket *ov;
|
||||
register char *p = v->name;
|
||||
|
||||
if (i == mklev_hash % set->buckets
|
||||
&& streq (v->name, "MAKELEVEL"))
|
||||
/* Don't include MAKELEVEL because it will be
|
||||
added specially at the end. */
|
||||
continue;
|
||||
|
||||
switch (v->export)
|
||||
{
|
||||
case v_default:
|
||||
if (v->origin == o_default || v->origin == o_automatic)
|
||||
/* Only export default variables by explicit request. */
|
||||
continue;
|
||||
|
||||
if (! export_all_variables
|
||||
&& v->origin != o_command
|
||||
&& v->origin != o_env && v->origin != o_env_override)
|
||||
continue;
|
||||
|
||||
if (*p != '_' && (*p < 'A' || *p > 'Z')
|
||||
&& (*p < 'a' || *p > 'z'))
|
||||
continue;
|
||||
for (++p; *p != '\0'; ++p)
|
||||
if (*p != '_' && (*p < 'a' || *p > 'z')
|
||||
&& (*p < 'A' || *p > 'Z') && (*p < '0' || *p > '9'))
|
||||
break;
|
||||
if (*p != '\0')
|
||||
continue;
|
||||
|
||||
case v_export:
|
||||
break;
|
||||
|
||||
case v_noexport:
|
||||
continue;
|
||||
|
||||
case v_ifset:
|
||||
if (v->origin == o_default)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
for (ov = table[j]; ov != 0; ov = ov->next)
|
||||
if (streq (v->name, ov->variable->name))
|
||||
break;
|
||||
if (ov == 0)
|
||||
{
|
||||
register struct variable_bucket *entry;
|
||||
entry = (struct variable_bucket *)
|
||||
alloca (sizeof (struct variable_bucket));
|
||||
entry->next = table[j];
|
||||
entry->variable = v;
|
||||
table[j] = entry;
|
||||
++nvariables;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = (char **) xmalloc ((nvariables + 2) * sizeof (char *));
|
||||
nvariables = 0;
|
||||
for (i = 0; i < buckets; ++i)
|
||||
{
|
||||
register struct variable_bucket *b;
|
||||
for (b = table[i]; b != 0; b = b->next)
|
||||
{
|
||||
register struct variable *v = b->variable;
|
||||
/* If V is recursively expanded and didn't come from the environment,
|
||||
expand its value. If it came from the environment, it should
|
||||
go back into the environment unchanged. */
|
||||
if (v->recursive
|
||||
&& v->origin != o_env && v->origin != o_env_override)
|
||||
{
|
||||
char *value = recursively_expand (v);
|
||||
result[nvariables++] = concat (v->name, "=", value);
|
||||
free (value);
|
||||
}
|
||||
else
|
||||
result[nvariables++] = concat (v->name, "=", v->value);
|
||||
}
|
||||
}
|
||||
result[nvariables] = (char *) xmalloc (100);
|
||||
(void) sprintf (result[nvariables], "MAKELEVEL=%u", makelevel + 1);
|
||||
result[++nvariables] = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Try to interpret LINE (a null-terminated string) as a variable definition.
|
||||
|
||||
ORIGIN may be o_file, o_override, o_env, o_env_override,
|
||||
or o_command specifying that the variable definition comes
|
||||
from a makefile, an override directive, the environment with
|
||||
or without the -e switch, or the command line.
|
||||
|
||||
A variable definition has the form "name = value" or "name := value".
|
||||
Any whitespace around the "=" or ":=" is removed. The first form
|
||||
defines a variable that is recursively re-evaluated. The second form
|
||||
defines a variable whose value is variable-expanded at the time of
|
||||
definition and then is evaluated only once at the time of expansion.
|
||||
|
||||
If a variable was defined, a pointer to its `struct variable' is returned.
|
||||
If not, NULL is returned. */
|
||||
|
||||
struct variable *
|
||||
try_variable_definition (filename, lineno, line, origin)
|
||||
char *filename;
|
||||
unsigned int lineno;
|
||||
char *line;
|
||||
enum variable_origin origin;
|
||||
{
|
||||
register int c;
|
||||
register char *p = line;
|
||||
register char *beg;
|
||||
register char *end;
|
||||
enum { bogus, simple, recursive, append } flavor = bogus;
|
||||
char *name, *expanded_name, *value;
|
||||
struct variable *v;
|
||||
|
||||
while (1)
|
||||
{
|
||||
c = *p++;
|
||||
if (c == '\0' || c == '#')
|
||||
return 0;
|
||||
if (c == '=')
|
||||
{
|
||||
end = p - 1;
|
||||
flavor = recursive;
|
||||
break;
|
||||
}
|
||||
else if (c == ':')
|
||||
if (*p == '=')
|
||||
{
|
||||
end = p++ - 1;
|
||||
flavor = simple;
|
||||
break;
|
||||
}
|
||||
else
|
||||
/* A colon other than := is a rule line, not a variable defn. */
|
||||
return 0;
|
||||
else if (c == '+' && *p == '=')
|
||||
{
|
||||
end = p++ - 1;
|
||||
flavor = append;
|
||||
break;
|
||||
}
|
||||
else if (c == '$')
|
||||
{
|
||||
/* This might begin a variable expansion reference. Make sure we
|
||||
don't misrecognize chars inside the reference as =, := or +=. */
|
||||
char closeparen;
|
||||
int count;
|
||||
c = *p++;
|
||||
if (c == '(')
|
||||
closeparen = ')';
|
||||
else if (c == '{')
|
||||
closeparen = '}';
|
||||
else
|
||||
continue; /* Nope. */
|
||||
|
||||
/* P now points past the opening paren or brace.
|
||||
Count parens or braces until it is matched. */
|
||||
count = 0;
|
||||
for (; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == c)
|
||||
++count;
|
||||
else if (*p == closeparen && --count < 0)
|
||||
{
|
||||
++p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
beg = next_token (line);
|
||||
while (end > beg && isblank (end[-1]))
|
||||
--end;
|
||||
p = next_token (p);
|
||||
|
||||
/* Expand the name, so "$(foo)bar = baz" works. */
|
||||
name = (char *) alloca (end - beg + 1);
|
||||
bcopy (beg, name, end - beg);
|
||||
name[end - beg] = '\0';
|
||||
expanded_name = allocated_variable_expand (name);
|
||||
|
||||
if (expanded_name[0] == '\0')
|
||||
{
|
||||
if (filename == 0)
|
||||
fatal ("empty variable name");
|
||||
else
|
||||
makefile_fatal (filename, lineno, "empty variable name");
|
||||
}
|
||||
|
||||
/* Calculate the variable's new value in VALUE. */
|
||||
|
||||
switch (flavor)
|
||||
{
|
||||
case bogus:
|
||||
/* Should not be possible. */
|
||||
abort ();
|
||||
return 0;
|
||||
case simple:
|
||||
/* A simple variable definition "var := value". Expand the value. */
|
||||
value = variable_expand (p);
|
||||
break;
|
||||
case recursive:
|
||||
/* A recursive variable definition "var = value".
|
||||
The value is used verbatim. */
|
||||
value = p;
|
||||
break;
|
||||
case append:
|
||||
/* An appending variable definition "var += value".
|
||||
Extract the old value and append the new one. */
|
||||
v = lookup_variable (expanded_name, strlen (expanded_name));
|
||||
if (v == 0)
|
||||
{
|
||||
/* There was no old value.
|
||||
This becomes a normal recursive definition. */
|
||||
value = p;
|
||||
flavor = recursive;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Paste the old and new values together in VALUE. */
|
||||
|
||||
unsigned int oldlen, newlen;
|
||||
|
||||
if (v->recursive)
|
||||
/* The previous definition of the variable was recursive.
|
||||
The new value comes from the unexpanded old and new values. */
|
||||
flavor = recursive;
|
||||
else
|
||||
/* The previous definition of the variable was simple.
|
||||
The new value comes from the old value, which was expanded
|
||||
when it was set; and from the expanded new value. */
|
||||
p = variable_expand (p);
|
||||
|
||||
oldlen = strlen (v->value);
|
||||
newlen = strlen (p);
|
||||
value = (char *) alloca (oldlen + 1 + newlen + 1);
|
||||
bcopy (v->value, value, oldlen);
|
||||
value[oldlen] = ' ';
|
||||
bcopy (p, &value[oldlen + 1], newlen + 1);
|
||||
}
|
||||
}
|
||||
|
||||
v = define_variable (expanded_name, strlen (expanded_name),
|
||||
value, origin, flavor == recursive);
|
||||
|
||||
free (expanded_name);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Print information for variable V, prefixing it with PREFIX. */
|
||||
|
||||
static void
|
||||
print_variable (v, prefix)
|
||||
register struct variable *v;
|
||||
char *prefix;
|
||||
{
|
||||
char *origin;
|
||||
|
||||
switch (v->origin)
|
||||
{
|
||||
case o_default:
|
||||
origin = "default";
|
||||
break;
|
||||
case o_env:
|
||||
origin = "environment";
|
||||
break;
|
||||
case o_file:
|
||||
origin = "makefile";
|
||||
break;
|
||||
case o_env_override:
|
||||
origin = "environment under -e";
|
||||
break;
|
||||
case o_command:
|
||||
origin = "command line";
|
||||
break;
|
||||
case o_override:
|
||||
origin = "`override' directive";
|
||||
break;
|
||||
case o_automatic:
|
||||
origin = "automatic";
|
||||
break;
|
||||
case o_invalid:
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
printf ("# %s\n", origin);
|
||||
|
||||
fputs (prefix, stdout);
|
||||
|
||||
/* Is this a `define'? */
|
||||
if (v->recursive && index (v->value, '\n') != 0)
|
||||
printf ("define %s\n%s\nendef\n", v->name, v->value);
|
||||
else
|
||||
{
|
||||
register char *p;
|
||||
|
||||
printf ("%s %s= ", v->name, v->recursive ? "" : ":");
|
||||
|
||||
/* Check if the value is just whitespace. */
|
||||
p = next_token (v->value);
|
||||
if (p != v->value && *p == '\0')
|
||||
/* All whitespace. */
|
||||
printf ("$(subst ,,%s)", v->value);
|
||||
else if (v->recursive)
|
||||
fputs (v->value, stdout);
|
||||
else
|
||||
/* Double up dollar signs. */
|
||||
for (p = v->value; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == '$')
|
||||
putchar ('$');
|
||||
putchar (*p);
|
||||
}
|
||||
putchar ('\n');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Print all the variables in SET. PREFIX is printed before
|
||||
the actual variable definitions (everything else is comments). */
|
||||
|
||||
static void
|
||||
print_variable_set (set, prefix)
|
||||
register struct variable_set *set;
|
||||
char *prefix;
|
||||
{
|
||||
register unsigned int i, nvariables, per_bucket;
|
||||
register struct variable *v;
|
||||
|
||||
per_bucket = nvariables = 0;
|
||||
for (i = 0; i < set->buckets; ++i)
|
||||
{
|
||||
register unsigned int this_bucket = 0;
|
||||
|
||||
for (v = set->table[i]; v != 0; v = v->next)
|
||||
{
|
||||
++this_bucket;
|
||||
print_variable (v, prefix);
|
||||
}
|
||||
|
||||
nvariables += this_bucket;
|
||||
if (this_bucket > per_bucket)
|
||||
per_bucket = this_bucket;
|
||||
}
|
||||
|
||||
if (nvariables == 0)
|
||||
puts ("# No variables.");
|
||||
else
|
||||
{
|
||||
printf ("# %u variables in %u hash buckets.\n",
|
||||
nvariables, set->buckets);
|
||||
#ifndef NO_FLOAT
|
||||
printf ("# average of %.1f variables per bucket, \
|
||||
max %u in one bucket.\n",
|
||||
(double) nvariables / (double) set->buckets,
|
||||
per_bucket);
|
||||
#else
|
||||
{
|
||||
int f = (nvariables * 1000 + 5) / set->buckets;
|
||||
printf ("# average of %d.%d variables per bucket, \
|
||||
max %u in one bucket.\n",
|
||||
f/10, f%10,
|
||||
per_bucket);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Print the data base of variables. */
|
||||
|
||||
void
|
||||
print_variable_data_base ()
|
||||
{
|
||||
puts ("\n# Variables\n");
|
||||
|
||||
print_variable_set (&global_variable_set, "");
|
||||
}
|
||||
|
||||
|
||||
/* Print all the local variables of FILE. */
|
||||
|
||||
void
|
||||
print_file_variables (file)
|
||||
struct file *file;
|
||||
{
|
||||
if (file->variables != 0)
|
||||
print_variable_set (file->variables->set, "# ");
|
||||
}
|
||||
109
variable.h
Normal file
109
variable.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/* Definitions for using variables in GNU Make.
|
||||
Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Codes in a variable definition saying where the definition came from.
|
||||
Increasing numeric values signify less-overridable definitions. */
|
||||
enum variable_origin
|
||||
{
|
||||
o_default, /* Variable from the default set. */
|
||||
o_env, /* Variable from environment. */
|
||||
o_file, /* Variable given in a makefile. */
|
||||
o_env_override, /* Variable from environment, if -e. */
|
||||
o_command, /* Variable given by user. */
|
||||
o_override, /* Variable from an `override' directive. */
|
||||
o_automatic, /* Automatic variable -- cannot be set. */
|
||||
o_invalid /* Core dump time. */
|
||||
};
|
||||
|
||||
/* Structure that represents one variable definition.
|
||||
Each bucket of the hash table is a chain of these,
|
||||
chained through `next'. */
|
||||
|
||||
struct variable
|
||||
{
|
||||
struct variable *next; /* Link in the chain. */
|
||||
char *name; /* Variable name. */
|
||||
char *value; /* Variable value. */
|
||||
enum variable_origin
|
||||
origin ENUM_BITFIELD (3); /* Variable origin. */
|
||||
unsigned int recursive:1; /* Gets recursively re-evaluated. */
|
||||
unsigned int expanding:1; /* Nonzero if currently being expanded. */
|
||||
enum
|
||||
{
|
||||
v_export, /* Export this variable. */
|
||||
v_noexport, /* Don't export this variable. */
|
||||
v_ifset, /* Export it if it has a non-default value. */
|
||||
v_default /* Decide in target_environment. */
|
||||
} export ENUM_BITFIELD (2);
|
||||
};
|
||||
|
||||
/* Structure that represents a variable set. */
|
||||
|
||||
struct variable_set
|
||||
{
|
||||
struct variable **table; /* Hash table of variables. */
|
||||
unsigned int buckets; /* Number of hash buckets in `table'. */
|
||||
};
|
||||
|
||||
/* Structure that represents a list of variable sets. */
|
||||
|
||||
struct variable_set_list
|
||||
{
|
||||
struct variable_set_list *next; /* Link in the chain. */
|
||||
struct variable_set *set; /* Variable set. */
|
||||
};
|
||||
|
||||
extern struct variable_set_list *current_variable_set_list;
|
||||
|
||||
/* expand.c */
|
||||
extern char *variable_buffer_output PARAMS ((char *ptr, char *string, unsigned int length));
|
||||
extern char *variable_expand PARAMS ((char *line));
|
||||
extern char *variable_expand_for_file PARAMS ((char *line, struct file *file));
|
||||
extern char *allocated_variable_expand_for_file PARAMS ((char *line, struct file *file));
|
||||
#define allocated_variable_expand(line) \
|
||||
allocated_variable_expand_for_file (line, (struct file *) 0)
|
||||
extern char *expand_argument PARAMS ((char *str, char *end));
|
||||
|
||||
/* function.c */
|
||||
extern int handle_function PARAMS ((char **op, char **stringp));
|
||||
extern int pattern_matches PARAMS ((char *pattern, char *percent, char *word));
|
||||
extern char *subst_expand PARAMS ((char *o, char *text, char *subst, char *replace,
|
||||
unsigned int slen, unsigned int rlen, int by_word, int suffix_only));
|
||||
extern char *patsubst_expand PARAMS ((char *o, char *text, char *pattern, char *replace,
|
||||
char *pattern_percent, char *replace_percent));
|
||||
|
||||
/* expand.c */
|
||||
extern char *recursively_expand PARAMS ((struct variable *v));
|
||||
|
||||
/* variable.c */
|
||||
extern void push_new_variable_scope PARAMS ((void));
|
||||
extern void pop_variable_scope PARAMS ((void));
|
||||
extern void define_automatic_variables PARAMS ((void));
|
||||
extern void initialize_file_variables PARAMS ((struct file *file));
|
||||
extern void print_file_variables PARAMS ((struct file *file));
|
||||
extern void merge_variable_set_lists PARAMS ((struct variable_set_list **setlist0, struct variable_set_list *setlist1));
|
||||
extern struct variable *try_variable_definition PARAMS ((char *filename, unsigned int lineno, char *line, enum variable_origin origin));
|
||||
|
||||
extern struct variable *lookup_variable PARAMS ((char *name, unsigned int length));
|
||||
extern struct variable *define_variable PARAMS ((char *name, unsigned int length, char *value,
|
||||
enum variable_origin origin, int recursive));
|
||||
extern struct variable *define_variable_for_file PARAMS ((char *name, unsigned int length,
|
||||
char *value, enum variable_origin origin, int recursive, struct file *file));
|
||||
extern char **target_environment PARAMS ((struct file *file));
|
||||
|
||||
extern int export_all_variables;
|
||||
7
version.c
Normal file
7
version.c
Normal file
@@ -0,0 +1,7 @@
|
||||
char *version_string = "3.74.4";
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
version-control: never
|
||||
End:
|
||||
*/
|
||||
40
vmsdir.h
Normal file
40
vmsdir.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/* dirent.h for vms */
|
||||
|
||||
#include <rms.h>
|
||||
|
||||
#define MAXNAMLEN 255
|
||||
|
||||
typedef unsigned long u_long;
|
||||
typedef unsigned short u_short;
|
||||
|
||||
struct direct {
|
||||
off_t d_off;
|
||||
u_long d_fileno;
|
||||
u_short d_reclen;
|
||||
u_short d_namlen;
|
||||
char d_name[MAXNAMLEN + 1];
|
||||
};
|
||||
|
||||
#undef DIRSIZ
|
||||
#define DIRSIZ(dp) \
|
||||
(((sizeof (struct direct) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) + 3) & ~3)
|
||||
|
||||
#define d_ino d_fileno /* compatability */
|
||||
|
||||
|
||||
/*
|
||||
* Definitions for library routines operating on directories.
|
||||
*/
|
||||
|
||||
typedef struct FAB DIR;
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
extern DIR *opendir PARAMS (());
|
||||
extern struct direct *readdir PARAMS ((DIR *dfd));
|
||||
#define rewinddir(dirp) seekdir((dirp), (long)0)
|
||||
extern int closedir PARAMS ((DIR *dfd));
|
||||
extern char *vmsify PARAMS ((char *name, int type));
|
||||
|
||||
/* EOF */
|
||||
234
vmsfunctions.c
Normal file
234
vmsfunctions.c
Normal file
@@ -0,0 +1,234 @@
|
||||
#define KDEBUG 0
|
||||
/* vmsfunctions.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "make.h"
|
||||
#ifdef __DECC
|
||||
#include <starlet.h>
|
||||
#endif
|
||||
#include <descrip.h>
|
||||
#include <rms.h>
|
||||
#include <iodef.h>
|
||||
#include <atrdef.h>
|
||||
#include <fibdef.h>
|
||||
#include "vmsdir.h"
|
||||
|
||||
DIR *opendir(char *dspec)
|
||||
{
|
||||
static struct FAB *dfab;
|
||||
struct NAM *dnam;
|
||||
char *searchspec;
|
||||
|
||||
if ((dfab = (struct FAB *)xmalloc(sizeof (struct FAB))) == NULL) {
|
||||
printf("Error mallocing for FAB\n");
|
||||
return(NULL);
|
||||
}
|
||||
if ((dnam = (struct NAM *)xmalloc(sizeof (struct NAM))) == NULL) {
|
||||
printf("Error mallocing for NAM\n");
|
||||
free(dfab);
|
||||
return(NULL);
|
||||
}
|
||||
if ((searchspec = (char *)xmalloc(MAXNAMLEN+1)) == NULL) {
|
||||
printf("Error mallocing for searchspec\n");
|
||||
free(dfab);
|
||||
free(dnam);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
sprintf(searchspec,"%s*.*;",dspec);
|
||||
|
||||
*dfab = cc$rms_fab;
|
||||
dfab->fab$l_fna = searchspec;
|
||||
dfab->fab$b_fns = strlen(searchspec);
|
||||
dfab->fab$l_nam = dnam;
|
||||
|
||||
*dnam = cc$rms_nam;
|
||||
dnam->nam$l_esa = searchspec;
|
||||
dnam->nam$b_ess = MAXNAMLEN;
|
||||
|
||||
if (!(sys$parse(dfab) & 1)) {
|
||||
free(dfab);
|
||||
free(dnam);
|
||||
free(searchspec);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return(dfab);
|
||||
}
|
||||
|
||||
#include <ctype.h>
|
||||
#define uppercasify(str) { char *tmp; for(tmp = (str); *tmp != '\0'; tmp++) if(islower(*tmp)) *tmp = toupper(*tmp); }
|
||||
|
||||
struct direct *readdir(DIR *dfd)
|
||||
{
|
||||
static struct direct *dentry;
|
||||
static char resultspec[MAXNAMLEN+1];
|
||||
int i;
|
||||
|
||||
if ((dentry = (struct direct *)xmalloc(sizeof (struct direct))) == NULL) {
|
||||
printf("Error mallocing for direct\n");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
dfd->fab$l_nam->nam$l_rsa = resultspec;
|
||||
dfd->fab$l_nam->nam$b_rss = MAXNAMLEN;
|
||||
|
||||
if (debug_flag)
|
||||
printf(".");
|
||||
|
||||
if (!((i = sys$search(dfd)) & 1)) {
|
||||
if (debug_flag)
|
||||
printf("sys$search failed with %d\n", i);
|
||||
free(dentry);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
dentry->d_off = 0;
|
||||
if (dfd->fab$l_nam->nam$w_fid == 0)
|
||||
dentry->d_fileno = 1;
|
||||
else dentry->d_fileno = dfd->fab$l_nam->nam$w_fid[0]
|
||||
+dfd->fab$l_nam->nam$w_fid[1]<<16;
|
||||
dentry->d_reclen = sizeof (struct direct);
|
||||
/*
|
||||
if (!strcmp(dfd->fab$l_nam->nam$l_type,".DIR"))
|
||||
dentry->d_namlen = dfd->fab$l_nam->nam$b_name;
|
||||
else
|
||||
*/
|
||||
dentry->d_namlen = dfd->fab$l_nam->nam$b_name+dfd->fab$l_nam->nam$b_type;
|
||||
strncpy(dentry->d_name,dfd->fab$l_nam->nam$l_name,dentry->d_namlen);
|
||||
dentry->d_name[dentry->d_namlen] = '\0';
|
||||
uppercasify(dentry->d_name);
|
||||
/* uvUnFixRCSSeparator(dentry->d_name);*/
|
||||
|
||||
return(dentry);
|
||||
}
|
||||
|
||||
closedir(DIR *dfd)
|
||||
{
|
||||
if (dfd != NULL) {
|
||||
if (dfd->fab$l_nam != NULL)
|
||||
free(dfd->fab$l_nam->nam$l_esa);
|
||||
free(dfd->fab$l_nam);
|
||||
free(dfd);
|
||||
}
|
||||
}
|
||||
|
||||
char *getwd(char *cwd)
|
||||
{
|
||||
static char buf[512];
|
||||
|
||||
if (cwd)
|
||||
return(getcwd(cwd,512));
|
||||
else
|
||||
return(getcwd(buf,512));
|
||||
}
|
||||
|
||||
int
|
||||
vms_stat (name, buf)
|
||||
char *name;
|
||||
struct stat *buf;
|
||||
{
|
||||
int status;
|
||||
int i;
|
||||
|
||||
static struct FAB Fab;
|
||||
static struct NAM Nam;
|
||||
static struct fibdef Fib; /* short fib */
|
||||
static struct dsc$descriptor FibDesc =
|
||||
{sizeof(Fib), DSC$K_DTYPE_Z, DSC$K_CLASS_S, (char *)&Fib};
|
||||
static struct dsc$descriptor_s DevDesc =
|
||||
{0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &Nam.nam$t_dvi[1]};
|
||||
static char EName[NAM$C_MAXRSS];
|
||||
static char RName[NAM$C_MAXRSS];
|
||||
static struct dsc$descriptor_s FileName =
|
||||
{0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};
|
||||
static struct dsc$descriptor_s string =
|
||||
{0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};
|
||||
static unsigned long Rdate[2];
|
||||
static unsigned long Cdate[2];
|
||||
static struct atrdef Atr[] = {
|
||||
{sizeof(Rdate),ATR$C_REVDATE,&Rdate[0]}, /* Revision date */
|
||||
{sizeof(Cdate),ATR$C_CREDATE,&Cdate[0]}, /* Creation date */
|
||||
{0,0,0}
|
||||
};
|
||||
static short int DevChan;
|
||||
static short int iosb[4];
|
||||
|
||||
name = vmsify (name, 0);
|
||||
|
||||
/* initialize RMS structures, we need a NAM to retrieve the FID */
|
||||
Fab = cc$rms_fab;
|
||||
Fab.fab$l_fna = name ; /* name of file */
|
||||
Fab.fab$b_fns = strlen(name);
|
||||
Fab.fab$l_nam = &Nam; /* FAB has an associated NAM */
|
||||
|
||||
Nam = cc$rms_nam;
|
||||
Nam.nam$l_esa = EName; /* expanded filename */
|
||||
Nam.nam$b_ess = sizeof(EName);
|
||||
Nam.nam$l_rsa = RName; /* resultant filename */
|
||||
Nam.nam$b_rss = sizeof(RName);
|
||||
|
||||
/* do $PARSE and $SEARCH here */
|
||||
status = sys$parse(&Fab);
|
||||
if (!(status & 1))
|
||||
return -1;
|
||||
|
||||
DevDesc.dsc$w_length = Nam.nam$t_dvi[0];
|
||||
status = sys$assign(&DevDesc,&DevChan,0,0);
|
||||
if (!(status & 1))
|
||||
return -1;
|
||||
|
||||
FileName.dsc$a_pointer = Nam.nam$l_name;
|
||||
FileName.dsc$w_length = Nam.nam$b_name+Nam.nam$b_type+Nam.nam$b_ver;
|
||||
|
||||
/* Initialize the FIB */
|
||||
for (i=0;i<3;i++)
|
||||
{
|
||||
#if __DECC
|
||||
Fib.fib$w_fid[i]=Nam.nam$w_fid[i];
|
||||
Fib.fib$w_did[i]=Nam.nam$w_did[i];
|
||||
#else
|
||||
Fib.fib$r_fid_overlay.fib$w_fid[i]=Nam.nam$w_fid[i];
|
||||
Fib.fib$r_did_overlay.fib$w_did[i]=Nam.nam$w_did[i];
|
||||
#endif
|
||||
}
|
||||
|
||||
status = sys$qiow(0,DevChan,IO$_ACCESS,&iosb,0,0,
|
||||
&FibDesc,&FileName,0,0,&Atr,0);
|
||||
if (!(status & 1))
|
||||
return -1;
|
||||
status = iosb[0];
|
||||
if (!(status & 1))
|
||||
return -1;
|
||||
|
||||
status = stat (name, buf);
|
||||
if (status)
|
||||
return -1;
|
||||
|
||||
buf->st_mtime = ((Rdate[0]>>24) & 0xff) + ((Rdate[1]<<8) & 0xffffff00);
|
||||
buf->st_ctime = ((Cdate[0]>>24) & 0xff) + ((Cdate[1]<<8) & 0xffffff00);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
cvt_time(tval)
|
||||
unsigned long tval;
|
||||
{
|
||||
static long int date[2];
|
||||
static char str[27];
|
||||
static struct dsc$descriptor date_str =
|
||||
{26, DSC$K_DTYPE_T, DSC$K_CLASS_S, str};
|
||||
|
||||
date[0] = (tval & 0xff) << 24;
|
||||
date[1] = ((tval>>8) & 0xffffff);
|
||||
|
||||
if ((date[0]==0) && (date[1]==0))
|
||||
return("never");
|
||||
|
||||
sys$asctim(0,&date_str,date,0);
|
||||
str[26]='\0';
|
||||
|
||||
return(str);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
925
vmsify.c
Normal file
925
vmsify.c
Normal file
@@ -0,0 +1,925 @@
|
||||
/*
|
||||
vmsify.c
|
||||
|
||||
Module for vms <-> unix file name conversion
|
||||
|
||||
Written by Klaus Kämpf (kkaempf@didymus.rmi.de)
|
||||
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if VMS
|
||||
#include <unixlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <jpidef.h>
|
||||
#include <descrip.h>
|
||||
#include <uaidef.h>
|
||||
#include <ssdef.h>
|
||||
#include <starlet.h>
|
||||
#include <lib$routines.h>
|
||||
/* Initialize a string descriptor (struct dsc$descriptor_s) for an
|
||||
arbitrary string. ADDR is a pointer to the first character
|
||||
of the string, and LEN is the length of the string. */
|
||||
|
||||
#define INIT_DSC_S(dsc, addr, len) do { \
|
||||
(dsc).dsc$b_dtype = DSC$K_DTYPE_T; \
|
||||
(dsc).dsc$b_class = DSC$K_CLASS_S; \
|
||||
(dsc).dsc$w_length = (len); \
|
||||
(dsc).dsc$a_pointer = (addr); \
|
||||
} while (0)
|
||||
|
||||
/* Initialize a string descriptor (struct dsc$descriptor_s) for a
|
||||
NUL-terminated string. S is a pointer to the string; the length
|
||||
is determined by calling strlen(). */
|
||||
|
||||
#define INIT_DSC_CSTRING(dsc, s) INIT_DSC_S(dsc, s, strlen(s))
|
||||
#endif
|
||||
|
||||
/*
|
||||
copy 'from' to 'to' up to but not including 'upto'
|
||||
return 0 if eos on from
|
||||
return 1 if upto found
|
||||
|
||||
return 'to' at last char + 1
|
||||
return 'from' at match + 1 or eos if no match
|
||||
|
||||
if as_dir == 1, change all '.' to '_'
|
||||
else change all '.' but the last to '_'
|
||||
*/
|
||||
|
||||
static int
|
||||
copyto (char **to, char **from, char upto, int as_dir)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = strrchr (*from, '.');
|
||||
|
||||
while (**from)
|
||||
{
|
||||
if (**from == upto)
|
||||
{
|
||||
do
|
||||
{
|
||||
(*from)++;
|
||||
}
|
||||
while (**from == upto);
|
||||
return 1;
|
||||
}
|
||||
if (**from == '.')
|
||||
{
|
||||
if ((as_dir == 1)
|
||||
|| (*from != s))
|
||||
**to = '_';
|
||||
else
|
||||
**to = '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (islower (**from))
|
||||
**to = toupper (**from);
|
||||
else
|
||||
**to = **from;
|
||||
}
|
||||
(*to)++;
|
||||
(*from)++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
get translation of logical name
|
||||
|
||||
*/
|
||||
|
||||
static char *
|
||||
trnlog (char *name)
|
||||
{
|
||||
int stat;
|
||||
static char reslt[1024];
|
||||
$DESCRIPTOR (reslt_dsc, reslt);
|
||||
short resltlen;
|
||||
struct dsc$descriptor_s name_dsc;
|
||||
char *s;
|
||||
|
||||
INIT_DSC_CSTRING (name_dsc, name);
|
||||
|
||||
stat = lib$sys_trnlog (&name_dsc, &resltlen, &reslt_dsc);
|
||||
|
||||
if ((stat&1) == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (stat == SS$_NOTRAN)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
reslt[resltlen] = '\0';
|
||||
|
||||
s = (char *)malloc (resltlen+1);
|
||||
if (s == 0)
|
||||
return "";
|
||||
strcpy (s, reslt);
|
||||
return s;
|
||||
}
|
||||
|
||||
enum namestate { N_START, N_DEVICE, N_OPEN, N_DOT, N_CLOSED, N_DONE };
|
||||
|
||||
/*
|
||||
convert unix style name to vms style
|
||||
type = 0 -> name is a full name (directory and filename part)
|
||||
type = 1 -> name is a directory
|
||||
type = 2 -> name is a filename without directory
|
||||
|
||||
The following conversions are applied
|
||||
(0) (1) (2)
|
||||
input full name dir name file name
|
||||
|
||||
1 ./ <cwd> [] <current directory>.dir
|
||||
2 ../ <home of cwd> <home of cwd> <home of cwd>.dir
|
||||
|
||||
3 // <dev of cwd>: <dev of cwd>:[000000] <dev of cwd>:000000.dir
|
||||
4 //a a: a: a:
|
||||
5 //a/ a: a: a:000000.dir
|
||||
|
||||
9 / [000000] [000000] 000000.dir
|
||||
10 /a [000000]a [a] [000000]a
|
||||
11 /a/ [a] [a] [000000]a.dir
|
||||
12 /a/b [a]b [a.b] [a]b
|
||||
13 /a/b/ [a.b] [a.b] [a]b.dir
|
||||
14 /a/b/c [a.b]c [a.b.c] [a.b]c
|
||||
15 /a/b/c/ [a.b.c] [a.b.c] [a.b]c.dir
|
||||
|
||||
16 a a [.a] a
|
||||
17 a/ [.a] [.a] a.dir
|
||||
18 a/b [.a]b [.a.b] [.a]b
|
||||
19 a/b/ [.a.b] [.a.b] [.a]b.dir
|
||||
20 a/b/c [.a.b]c [.a.b.c] [.a.b]c
|
||||
21 a/b/c/ [.a.b.c] [.a.b.c] [.a.b]c.dir
|
||||
|
||||
22 a.b.c a_b.c [.a_b_c] a_b_c.dir
|
||||
|
||||
23 [x][y]z [x.y]z [x.y]z [x.y]z
|
||||
24 [x][.y]z [x.y]z [x.y]z [x.y]z
|
||||
|
||||
25 filenames with '$' are left unchanged if they contain no '/'
|
||||
25 filenames with ':' are left unchanged
|
||||
26 filenames with a single pair of '[' ']' are left unchanged
|
||||
|
||||
the input string is not written to
|
||||
*/
|
||||
|
||||
char *
|
||||
vmsify (name, type)
|
||||
char *name;
|
||||
int type;
|
||||
{
|
||||
/* max 255 device
|
||||
max 39 directory
|
||||
max 39 filename
|
||||
max 39 filetype
|
||||
max 5 version
|
||||
*/
|
||||
#define MAXPATHLEN 512
|
||||
|
||||
enum namestate nstate;
|
||||
static char vmsname[MAXPATHLEN+1];
|
||||
char *fptr;
|
||||
char *vptr;
|
||||
char *s,*s1;
|
||||
int as_dir;
|
||||
int count;
|
||||
|
||||
if (name == 0)
|
||||
return 0;
|
||||
fptr = name;
|
||||
vptr = vmsname;
|
||||
nstate = N_START;
|
||||
|
||||
/* case 25a */
|
||||
|
||||
s = strpbrk (name, "$:");
|
||||
if (s != 0)
|
||||
{
|
||||
if (*s == '$')
|
||||
{
|
||||
if (strchr (name, '/') == 0)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/* case 26 */
|
||||
|
||||
s = strchr (name, '[');
|
||||
|
||||
if (s != 0)
|
||||
{
|
||||
s1 = strchr (s+1, '[');
|
||||
if (s1 == 0)
|
||||
{
|
||||
return name; /* single [, keep unchanged */
|
||||
}
|
||||
s1--;
|
||||
if (*s1 != ']')
|
||||
{
|
||||
return name; /* not ][, keep unchanged */
|
||||
}
|
||||
|
||||
/* we have ][ */
|
||||
|
||||
s = name;
|
||||
|
||||
/* s -> starting char
|
||||
s1 -> ending ']' */
|
||||
|
||||
do
|
||||
{
|
||||
strncpy (vptr, s, s1-s); /* copy up to but not including ']' */
|
||||
vptr += s1-s;
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
s = s1 + 1; /* s -> char behind ']' */
|
||||
if (*s != '[') /* was '][' ? */
|
||||
break; /* no, last ] found, exit */
|
||||
s++;
|
||||
if (*s != '.')
|
||||
*vptr++ = '.';
|
||||
s1 = strchr (s, ']');
|
||||
if (s1 == 0) /* no closing ] */
|
||||
s1 = s + strlen (s);
|
||||
}
|
||||
while (1);
|
||||
|
||||
*vptr++ = ']';
|
||||
|
||||
fptr = s;
|
||||
|
||||
}
|
||||
|
||||
else /* no [ in name */
|
||||
|
||||
{
|
||||
|
||||
int state;
|
||||
int rooted = 1; /* flag if logical is rooted, else insert [000000] */
|
||||
|
||||
state = 0;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0: /* start of loop */
|
||||
if (*fptr == '/')
|
||||
{
|
||||
fptr++;
|
||||
state = 1;
|
||||
}
|
||||
else if (*fptr == '.')
|
||||
{
|
||||
fptr++;
|
||||
state = 10;
|
||||
}
|
||||
else
|
||||
state = 2;
|
||||
break;
|
||||
|
||||
case 1: /* '/' at start */
|
||||
if (*fptr == '/')
|
||||
{
|
||||
fptr++;
|
||||
state = 3;
|
||||
}
|
||||
else
|
||||
state = 4;
|
||||
break;
|
||||
|
||||
case 2: /* no '/' at start */
|
||||
s = strchr (fptr, '/');
|
||||
if (s == 0) /* no '/' (16) */
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
strcpy (vptr, "[.");
|
||||
vptr += 2;
|
||||
}
|
||||
copyto (&vptr, &fptr, 0, (type==1));
|
||||
if (type == 1)
|
||||
*vptr++ = ']';
|
||||
state = -1;
|
||||
}
|
||||
else /* found '/' (17..21) */
|
||||
{
|
||||
if ((type == 2)
|
||||
&& (*(s+1) == 0)) /* 17(2) */
|
||||
{
|
||||
copyto (&vptr, &fptr, '/', 1);
|
||||
state = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (vptr, "[.");
|
||||
nstate = N_DOT;
|
||||
vptr += 2;
|
||||
copyto (&vptr, &fptr, '/', 1);
|
||||
state = 9;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: /* '//' at start */
|
||||
while (*fptr == '/') /* collapse all '/' */
|
||||
fptr++;
|
||||
if (*fptr == 0) /* just // */
|
||||
{
|
||||
char cwdbuf[MAXPATHLEN+1];
|
||||
|
||||
s1 = getcwd(cwdbuf, MAXPATHLEN);
|
||||
if (s1 == 0)
|
||||
{
|
||||
return ""; /* FIXME, err getcwd */
|
||||
}
|
||||
s = strchr (s1, ':');
|
||||
if (s == 0)
|
||||
{
|
||||
return ""; /* FIXME, err no device */
|
||||
}
|
||||
strncpy (vptr, s1, s-s1+1);
|
||||
vptr += s-s1+1;
|
||||
state = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
s = vptr;
|
||||
|
||||
if (copyto (&vptr, &fptr, '/', 1) == 0) /* copy device part */
|
||||
{
|
||||
*vptr++ = ':';
|
||||
state = -1;
|
||||
break;
|
||||
}
|
||||
*vptr = ':';
|
||||
nstate = N_DEVICE;
|
||||
if (*fptr == 0) /* just '//a/' */
|
||||
{
|
||||
strcpy (vptr+1, "[000000]");
|
||||
vptr += 9;
|
||||
state = -1;
|
||||
break;
|
||||
}
|
||||
*vptr = 0;
|
||||
/* check logical for [000000] insertion */
|
||||
s1 = trnlog (s);
|
||||
if (*s1 != 0)
|
||||
{ /* found translation */
|
||||
char *s2;
|
||||
for (;;) /* loop over all nested logicals */
|
||||
{
|
||||
s2 = s1 + strlen (s1) - 1;
|
||||
if (*s2 == ':') /* translation ends in ':' */
|
||||
{
|
||||
s2 = trnlog (s1);
|
||||
free (s1);
|
||||
if (*s2 == 0)
|
||||
{
|
||||
rooted = 0;
|
||||
break;
|
||||
}
|
||||
s1 = s2;
|
||||
continue; /* next iteration */
|
||||
}
|
||||
if (*s2 == ']') /* translation ends in ']' */
|
||||
{
|
||||
if (*(s2-1) == '.') /* ends in '.]' */
|
||||
{
|
||||
if (strncmp (fptr, "000000", 6) != 0)
|
||||
rooted = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (vmsname, s1);
|
||||
s = strchr (vmsname, ']');
|
||||
*s = '.';
|
||||
nstate = N_DOT;
|
||||
vptr = s;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
free (s1);
|
||||
}
|
||||
else
|
||||
rooted = 0;
|
||||
|
||||
if (*vptr == 0)
|
||||
{
|
||||
nstate = N_DEVICE;
|
||||
*vptr++ = ':';
|
||||
}
|
||||
else
|
||||
vptr++;
|
||||
|
||||
if (rooted == 0)
|
||||
{
|
||||
strcpy (vptr, "[000000.");
|
||||
vptr += 8;
|
||||
s1 = vptr-1;
|
||||
nstate = N_DOT;
|
||||
}
|
||||
else
|
||||
s1 = 0;
|
||||
|
||||
/* s1-> '.' after 000000 or NULL */
|
||||
|
||||
s = strchr (fptr, '/');
|
||||
if (s == 0)
|
||||
{ /* no next '/' */
|
||||
if (*(vptr-1) == '.')
|
||||
*(vptr-1) = ']';
|
||||
else if (rooted == 0)
|
||||
*vptr++ = ']';
|
||||
copyto (&vptr, &fptr, 0, (type == 1));
|
||||
state = -1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*(s+1) == '/') /* skip multiple '/' */
|
||||
s++;
|
||||
}
|
||||
|
||||
if ((rooted != 0)
|
||||
&& (*(vptr-1) != '.'))
|
||||
{
|
||||
*vptr++ = '[';
|
||||
nstate = N_DOT;
|
||||
}
|
||||
else
|
||||
if ((nstate == N_DOT)
|
||||
&& (s1 != 0)
|
||||
&& (*(s+1) == 0))
|
||||
{
|
||||
if (type == 2)
|
||||
{
|
||||
*s1 = ']';
|
||||
nstate = N_CLOSED;
|
||||
}
|
||||
}
|
||||
state = 9;
|
||||
break;
|
||||
|
||||
case 4: /* single '/' at start (9..15) */
|
||||
if (*fptr == 0)
|
||||
state = 5;
|
||||
else
|
||||
state = 6;
|
||||
break;
|
||||
|
||||
case 5: /* just '/' at start (9) */
|
||||
if (type != 2)
|
||||
{
|
||||
*vptr++ = '[';
|
||||
nstate = N_OPEN;
|
||||
}
|
||||
strcpy (vptr, "000000");
|
||||
vptr += 6;
|
||||
if (type == 2)
|
||||
state = 7;
|
||||
else
|
||||
state = 8;
|
||||
break;
|
||||
|
||||
case 6: /* chars following '/' at start 10..15 */
|
||||
*vptr++ = '[';
|
||||
nstate = N_OPEN;
|
||||
s = strchr (fptr, '/');
|
||||
if (s == 0) /* 10 */
|
||||
{
|
||||
if (type != 1)
|
||||
{
|
||||
strcpy (vptr, "000000]");
|
||||
vptr += 7;
|
||||
}
|
||||
copyto (&vptr, &fptr, 0, (type == 1));
|
||||
if (type == 1)
|
||||
{
|
||||
*vptr++ = ']';
|
||||
}
|
||||
state = -1;
|
||||
}
|
||||
else /* 11..15 */
|
||||
{
|
||||
if ( (type == 2)
|
||||
&& (*(s+1) == 0)) /* 11(2) */
|
||||
{
|
||||
strcpy (vptr, "000000]");
|
||||
nstate = N_CLOSED;
|
||||
vptr += 7;
|
||||
}
|
||||
copyto (&vptr, &fptr, '/', (*(vptr-1) != ']'));
|
||||
state = 9;
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: /* add '.dir' and exit */
|
||||
if ((nstate == N_OPEN)
|
||||
|| (nstate == N_DOT))
|
||||
{
|
||||
s = vptr-1;
|
||||
while (s > vmsname)
|
||||
{
|
||||
if (*s == ']')
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (*s == '.')
|
||||
{
|
||||
*s = ']';
|
||||
break;
|
||||
}
|
||||
s--;
|
||||
}
|
||||
}
|
||||
strcpy (vptr, ".dir");
|
||||
vptr += 4;
|
||||
state = -1;
|
||||
break;
|
||||
|
||||
case 8: /* add ']' and exit */
|
||||
*vptr++ = ']';
|
||||
state = -1;
|
||||
break;
|
||||
|
||||
case 9: /* 17..21, fptr -> 1st '/' + 1 */
|
||||
if (*fptr == 0)
|
||||
{
|
||||
if (type == 2)
|
||||
{
|
||||
state = 7;
|
||||
}
|
||||
else
|
||||
state = 8;
|
||||
break;
|
||||
}
|
||||
s = strchr (fptr, '/');
|
||||
if (s == 0)
|
||||
{
|
||||
if (type != 1)
|
||||
{
|
||||
if (nstate == N_OPEN)
|
||||
{
|
||||
*vptr++ = ']';
|
||||
nstate = N_CLOSED;
|
||||
}
|
||||
as_dir = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nstate == N_OPEN)
|
||||
{
|
||||
*vptr++ = '.';
|
||||
nstate = N_DOT;
|
||||
}
|
||||
as_dir = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*(s+1) == '/')
|
||||
s++;
|
||||
if ( (type == 2)
|
||||
&& (*(s+1) == 0)) /* 19(2), 21(2)*/
|
||||
{
|
||||
if (nstate != N_CLOSED)
|
||||
{
|
||||
*vptr++ = ']';
|
||||
nstate = N_CLOSED;
|
||||
}
|
||||
as_dir = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nstate == N_OPEN)
|
||||
{
|
||||
*vptr++ = '.';
|
||||
nstate = N_DOT;
|
||||
}
|
||||
as_dir = 1;
|
||||
}
|
||||
}
|
||||
if ( (*fptr == '.') /* check for '..' or '../' */
|
||||
&& (*(fptr+1) == '.')
|
||||
&& ((*(fptr+2) == '/')
|
||||
|| (*(fptr+2) == 0)) )
|
||||
{
|
||||
fptr += 2;
|
||||
if (*fptr == '/')
|
||||
{
|
||||
do
|
||||
{
|
||||
fptr++;
|
||||
}
|
||||
while (*fptr == '/');
|
||||
}
|
||||
else if (*fptr == 0)
|
||||
type = 1;
|
||||
vptr--; /* vptr -> '.' or ']' */
|
||||
s1 = vptr;
|
||||
for (;;)
|
||||
{
|
||||
s1--;
|
||||
if (*s1 == '.') /* one back */
|
||||
{
|
||||
vptr = s1;
|
||||
nstate = N_OPEN;
|
||||
break;
|
||||
}
|
||||
if (*s1 == '[') /* top level reached */
|
||||
{
|
||||
if (*fptr == 0)
|
||||
{
|
||||
strcpy (s1, "[000000]");
|
||||
vptr = s1 + 8;
|
||||
nstate = N_CLOSED;
|
||||
s = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
vptr = s1+1;
|
||||
nstate = N_OPEN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
copyto (&vptr, &fptr, '/', as_dir);
|
||||
if (nstate == N_DOT)
|
||||
nstate = N_OPEN;
|
||||
}
|
||||
if (s == 0)
|
||||
{ /* 18,20 */
|
||||
if (type == 1)
|
||||
*vptr++ = ']';
|
||||
state = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*(s+1) == 0)
|
||||
{
|
||||
if (type == 2) /* 19,21 */
|
||||
{
|
||||
state = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
*vptr++ = ']';
|
||||
state = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: /* 1,2 first is '.' */
|
||||
if (*fptr == '.')
|
||||
{
|
||||
fptr++;
|
||||
state = 11;
|
||||
}
|
||||
else
|
||||
state = 12;
|
||||
break;
|
||||
|
||||
case 11: /* 2, '..' at start */
|
||||
count = 1;
|
||||
if (*fptr != 0)
|
||||
{
|
||||
if (*fptr != '/') /* got ..xxx */
|
||||
{
|
||||
return name;
|
||||
}
|
||||
do /* got ../ */
|
||||
{
|
||||
fptr++;
|
||||
while (*fptr == '/') fptr++;
|
||||
if (*fptr != '.')
|
||||
break;
|
||||
if (*(fptr+1) != '.')
|
||||
break;
|
||||
fptr += 2;
|
||||
if ((*fptr == 0)
|
||||
|| (*fptr == '/'))
|
||||
count++;
|
||||
}
|
||||
while (*fptr == '/');
|
||||
}
|
||||
{ /* got '..' or '../' */
|
||||
char cwdbuf[MAXPATHLEN+1];
|
||||
|
||||
s1 = getcwd(cwdbuf, MAXPATHLEN);
|
||||
if (s1 == 0)
|
||||
{
|
||||
return ""; /* FIXME, err getcwd */
|
||||
}
|
||||
strcpy (vptr, s1);
|
||||
s = strchr (vptr, ']');
|
||||
if (s != 0)
|
||||
{
|
||||
while (s > vptr)
|
||||
{
|
||||
s--;
|
||||
if (*s == '[')
|
||||
{
|
||||
s++;
|
||||
strcpy (s, "000000]");
|
||||
state = -1;
|
||||
break;
|
||||
}
|
||||
else if (*s == '.')
|
||||
{
|
||||
if (--count == 0)
|
||||
{
|
||||
if (*fptr == 0) /* had '..' or '../' */
|
||||
{
|
||||
*s++ = ']';
|
||||
state = -1;
|
||||
}
|
||||
else /* had '../xxx' */
|
||||
{
|
||||
state = 9;
|
||||
}
|
||||
*s = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vptr += strlen (vptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: /* 1, '.' at start */
|
||||
if (*fptr != 0)
|
||||
{
|
||||
if (*fptr != '/')
|
||||
{
|
||||
return name;
|
||||
}
|
||||
fptr++;
|
||||
}
|
||||
|
||||
{
|
||||
char cwdbuf[MAXPATHLEN+1];
|
||||
|
||||
s1 = getcwd(cwdbuf, MAXPATHLEN);
|
||||
if (s1 == 0)
|
||||
{
|
||||
return ""; /*FIXME, err getcwd */
|
||||
}
|
||||
strcpy (vptr, s1);
|
||||
if (*fptr == 0)
|
||||
{
|
||||
state = -1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = strchr (vptr, ']');
|
||||
if (s == 0)
|
||||
{
|
||||
state = -1;
|
||||
break;
|
||||
}
|
||||
*s = 0;
|
||||
nstate = N_OPEN;
|
||||
vptr += strlen (vptr);
|
||||
state = 9;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
while (state > 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* directory conversion done
|
||||
fptr -> filename part of input string
|
||||
vptr -> free space in vmsname
|
||||
*/
|
||||
|
||||
*vptr++ = 0;
|
||||
|
||||
return vmsname;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
convert from vms-style to unix-style
|
||||
|
||||
dev:[dir1.dir2] //dev/dir1/dir2/
|
||||
*/
|
||||
|
||||
char *
|
||||
unixify (char *name)
|
||||
{
|
||||
static char piece[512];
|
||||
char *s, *p;
|
||||
|
||||
if (strchr (name, '/') != 0) /* already in unix style */
|
||||
return name;
|
||||
|
||||
p = piece;
|
||||
*p = 0;
|
||||
|
||||
/* device part */
|
||||
|
||||
s = strchr (name, ':');
|
||||
|
||||
if (s != 0)
|
||||
{
|
||||
*s = 0;
|
||||
*p++ = '/';
|
||||
*p++ = '/';
|
||||
strcpy (p, name);
|
||||
p += strlen (p);
|
||||
*s = ':';
|
||||
}
|
||||
|
||||
/* directory part */
|
||||
|
||||
*p++ = '/';
|
||||
s = strchr (name, '[');
|
||||
|
||||
if (s != 0)
|
||||
{
|
||||
s++;
|
||||
switch (*s)
|
||||
{
|
||||
case ']': /* [] */
|
||||
strcat (p, "./");
|
||||
break;
|
||||
case '-': /* [- */
|
||||
strcat (p, "../");
|
||||
break;
|
||||
case '.':
|
||||
strcat (p, "./"); /* [. */
|
||||
break;
|
||||
default:
|
||||
s--;
|
||||
break;
|
||||
}
|
||||
s++;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == '.')
|
||||
*p++ = '/';
|
||||
else
|
||||
*p++ = *s;
|
||||
s++;
|
||||
if (*s == ']')
|
||||
{
|
||||
s++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*s != 0) /* more after ']' ?? */
|
||||
{
|
||||
if (*(p-1) != '/')
|
||||
*p++ = '/';
|
||||
strcpy (p, s); /* copy it anyway */
|
||||
}
|
||||
}
|
||||
|
||||
else /* no '[' anywhere */
|
||||
|
||||
{
|
||||
*p++ = 0;
|
||||
}
|
||||
|
||||
/* force end with '/' */
|
||||
|
||||
if (*(p-1) != '/')
|
||||
*p++ = '/';
|
||||
*p = 0;
|
||||
|
||||
return piece;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
489
vpath.c
Normal file
489
vpath.c
Normal file
@@ -0,0 +1,489 @@
|
||||
/* Implementation of pattern-matching file search paths for GNU Make.
|
||||
Copyright (C) 1988, 89, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of GNU Make.
|
||||
|
||||
GNU Make 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 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Make 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 GNU Make; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "make.h"
|
||||
#include "filedef.h"
|
||||
#include "variable.h"
|
||||
|
||||
|
||||
/* Structure used to represent a selective VPATH searchpath. */
|
||||
|
||||
struct vpath
|
||||
{
|
||||
struct vpath *next; /* Pointer to next struct in the linked list. */
|
||||
char *pattern; /* The pattern to match. */
|
||||
char *percent; /* Pointer into `pattern' where the `%' is. */
|
||||
unsigned int patlen;/* Length of the pattern. */
|
||||
char **searchpath; /* Null-terminated list of directories. */
|
||||
unsigned int maxlen;/* Maximum length of any entry in the list. */
|
||||
};
|
||||
|
||||
/* Linked-list of all selective VPATHs. */
|
||||
|
||||
static struct vpath *vpaths;
|
||||
|
||||
/* Structure for the general VPATH given in the variable. */
|
||||
|
||||
static struct vpath *general_vpath;
|
||||
|
||||
static int selective_vpath_search PARAMS ((struct vpath *path, char **file, time_t *mtime_ptr));
|
||||
|
||||
/* Reverse the chain of selective VPATH lists so they
|
||||
will be searched in the order given in the makefiles
|
||||
and construct the list from the VPATH variable. */
|
||||
|
||||
void
|
||||
build_vpath_lists ()
|
||||
{
|
||||
register struct vpath *new = 0;
|
||||
register struct vpath *old, *nexto;
|
||||
register char *p;
|
||||
|
||||
/* Reverse the chain. */
|
||||
for (old = vpaths; old != 0; old = nexto)
|
||||
{
|
||||
nexto = old->next;
|
||||
old->next = new;
|
||||
new = old;
|
||||
}
|
||||
|
||||
vpaths = new;
|
||||
|
||||
/* If there is a VPATH variable with a nonnull value, construct the
|
||||
general VPATH list from it. We use variable_expand rather than just
|
||||
calling lookup_variable so that it will be recursively expanded. */
|
||||
|
||||
{
|
||||
/* Turn off --warn-undefined-variables while we expand SHELL and IFS. */
|
||||
int save = warn_undefined_variables_flag;
|
||||
warn_undefined_variables_flag = 0;
|
||||
|
||||
p = variable_expand ("$(strip $(VPATH))");
|
||||
|
||||
warn_undefined_variables_flag = save;
|
||||
}
|
||||
|
||||
if (*p != '\0')
|
||||
{
|
||||
/* Save the list of vpaths. */
|
||||
struct vpath *save_vpaths = vpaths;
|
||||
|
||||
/* Empty `vpaths' so the new one will have no next, and `vpaths'
|
||||
will still be nil if P contains no existing directories. */
|
||||
vpaths = 0;
|
||||
|
||||
/* Parse P. */
|
||||
construct_vpath_list ("%", p);
|
||||
|
||||
/* Store the created path as the general path,
|
||||
and restore the old list of vpaths. */
|
||||
general_vpath = vpaths;
|
||||
vpaths = save_vpaths;
|
||||
}
|
||||
}
|
||||
|
||||
/* Construct the VPATH listing for the pattern and searchpath given.
|
||||
|
||||
This function is called to generate selective VPATH lists and also for
|
||||
the general VPATH list (which is in fact just a selective VPATH that
|
||||
is applied to everything). The returned pointer is either put in the
|
||||
linked list of all selective VPATH lists or in the GENERAL_VPATH
|
||||
variable.
|
||||
|
||||
If SEARCHPATH is nil, remove all previous listings with the same
|
||||
pattern. If PATTERN is nil, remove all VPATH listings.
|
||||
Existing and readable directories that are not "." given in the
|
||||
searchpath separated by colons are loaded into the directory hash
|
||||
table if they are not there already and put in the VPATH searchpath
|
||||
for the given pattern with trailing slashes stripped off if present
|
||||
(and if the directory is not the root, "/").
|
||||
The length of the longest entry in the list is put in the structure as well.
|
||||
The new entry will be at the head of the VPATHS chain. */
|
||||
|
||||
void
|
||||
construct_vpath_list (pattern, dirpath)
|
||||
char *pattern, *dirpath;
|
||||
{
|
||||
register unsigned int elem;
|
||||
register char *p;
|
||||
register char **vpath;
|
||||
register unsigned int maxvpath;
|
||||
unsigned int maxelem;
|
||||
char *percent;
|
||||
|
||||
if (pattern != 0)
|
||||
{
|
||||
pattern = savestring (pattern, strlen (pattern));
|
||||
percent = find_percent (pattern);
|
||||
}
|
||||
|
||||
if (dirpath == 0)
|
||||
{
|
||||
/* Remove matching listings. */
|
||||
register struct vpath *path, *lastpath;
|
||||
|
||||
lastpath = 0;
|
||||
path = vpaths;
|
||||
while (path != 0)
|
||||
{
|
||||
struct vpath *next = path->next;
|
||||
|
||||
if (pattern == 0
|
||||
|| (((percent == 0 && path->percent == 0)
|
||||
|| (percent - pattern == path->percent - path->pattern))
|
||||
&& streq (pattern, path->pattern)))
|
||||
{
|
||||
/* Remove it from the linked list. */
|
||||
if (lastpath == 0)
|
||||
vpaths = path->next;
|
||||
else
|
||||
lastpath->next = next;
|
||||
|
||||
/* Free its unused storage. */
|
||||
free (path->pattern);
|
||||
free ((char *) path->searchpath);
|
||||
free ((char *) path);
|
||||
}
|
||||
else
|
||||
lastpath = path;
|
||||
|
||||
path = next;
|
||||
}
|
||||
|
||||
if (pattern != 0)
|
||||
free (pattern);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Figure out the maximum number of VPATH entries and
|
||||
put it in MAXELEM. We start with 2, one before the
|
||||
first colon and one nil, the list terminator and
|
||||
increment our estimated number for each colon or blank we find. */
|
||||
maxelem = 2;
|
||||
p = dirpath;
|
||||
while (*p != '\0')
|
||||
if (*p++ == PATH_SEPARATOR_CHAR || isblank (*p))
|
||||
++maxelem;
|
||||
|
||||
vpath = (char **) xmalloc (maxelem * sizeof (char *));
|
||||
maxvpath = 0;
|
||||
|
||||
/* Skip over any initial colons and blanks. */
|
||||
p = dirpath;
|
||||
while (*p == PATH_SEPARATOR_CHAR || isblank (*p))
|
||||
++p;
|
||||
|
||||
elem = 0;
|
||||
while (*p != '\0')
|
||||
{
|
||||
char *v;
|
||||
unsigned int len;
|
||||
|
||||
/* Find the end of this entry. */
|
||||
v = p;
|
||||
while (*p != '\0' && *p != PATH_SEPARATOR_CHAR && !isblank (*p))
|
||||
++p;
|
||||
|
||||
len = p - v;
|
||||
/* Make sure there's no trailing slash,
|
||||
but still allow "/" as a directory. */
|
||||
if (len > 1 && p[-1] == '/')
|
||||
--len;
|
||||
|
||||
if (len > 1 || *v != '.')
|
||||
{
|
||||
v = savestring (v, len);
|
||||
|
||||
/* Verify that the directory actually exists. */
|
||||
|
||||
if (dir_file_exists_p (v, ""))
|
||||
{
|
||||
/* It does. Put it in the list. */
|
||||
vpath[elem++] = dir_name (v);
|
||||
free (v);
|
||||
if (len > maxvpath)
|
||||
maxvpath = len;
|
||||
}
|
||||
else
|
||||
/* The directory does not exist. Omit from the list. */
|
||||
free (v);
|
||||
}
|
||||
|
||||
/* Skip over colons and blanks between entries. */
|
||||
while (*p == PATH_SEPARATOR_CHAR || isblank (*p))
|
||||
++p;
|
||||
}
|
||||
|
||||
if (elem > 0)
|
||||
{
|
||||
struct vpath *path;
|
||||
/* ELEM is now incremented one element past the last
|
||||
entry, to where the nil-pointer terminator goes.
|
||||
Usually this is maxelem - 1. If not, shrink down. */
|
||||
if (elem < (maxelem - 1))
|
||||
vpath = (char **) xrealloc ((char *) vpath,
|
||||
(elem + 1) * sizeof (char *));
|
||||
|
||||
/* Put the nil-pointer terminator on the end of the VPATH list. */
|
||||
vpath[elem] = 0;
|
||||
|
||||
/* Construct the vpath structure and put it into the linked list. */
|
||||
path = (struct vpath *) xmalloc (sizeof (struct vpath));
|
||||
path->searchpath = vpath;
|
||||
path->maxlen = maxvpath;
|
||||
path->next = vpaths;
|
||||
vpaths = path;
|
||||
|
||||
/* Set up the members. */
|
||||
path->pattern = pattern;
|
||||
path->percent = percent;
|
||||
path->patlen = strlen (pattern);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* There were no entries, so free whatever space we allocated. */
|
||||
free ((char *) vpath);
|
||||
if (pattern != 0)
|
||||
free (pattern);
|
||||
}
|
||||
}
|
||||
|
||||
/* Search the VPATH list whose pattern matches *FILE for a directory
|
||||
where the name pointed to by FILE exists. If it is found, we set *FILE to
|
||||
the newly malloc'd name of the existing file, *MTIME_PTR (if MTIME_PTR is
|
||||
not NULL) to its modtime (or zero if no stat call was done), and return 1.
|
||||
Otherwise we return 0. */
|
||||
|
||||
int
|
||||
vpath_search (file, mtime_ptr)
|
||||
char **file;
|
||||
time_t *mtime_ptr;
|
||||
{
|
||||
register struct vpath *v;
|
||||
|
||||
/* If there are no VPATH entries or FILENAME starts at the root,
|
||||
there is nothing we can do. */
|
||||
|
||||
if (**file == '/' || (vpaths == 0 && general_vpath == 0))
|
||||
return 0;
|
||||
|
||||
for (v = vpaths; v != 0; v = v->next)
|
||||
if (pattern_matches (v->pattern, v->percent, *file))
|
||||
if (selective_vpath_search (v, file, mtime_ptr))
|
||||
return 1;
|
||||
|
||||
if (general_vpath != 0
|
||||
&& selective_vpath_search (general_vpath, file, mtime_ptr))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Search the given VPATH list for a directory where the name pointed
|
||||
to by FILE exists. If it is found, we set *FILE to the newly malloc'd
|
||||
name of the existing file, *MTIME_PTR (if MTIME_PTR is not NULL) to
|
||||
its modtime (or zero if no stat call was done), and we return 1.
|
||||
Otherwise we return 0. */
|
||||
|
||||
static int
|
||||
selective_vpath_search (path, file, mtime_ptr)
|
||||
struct vpath *path;
|
||||
char **file;
|
||||
time_t *mtime_ptr;
|
||||
{
|
||||
int not_target;
|
||||
char *name, *n;
|
||||
char *filename;
|
||||
register char **vpath = path->searchpath;
|
||||
unsigned int maxvpath = path->maxlen;
|
||||
register unsigned int i;
|
||||
unsigned int flen, vlen, name_dplen;
|
||||
int exists = 0;
|
||||
|
||||
/* Find out if *FILE is a target.
|
||||
If and only if it is NOT a target, we will accept prospective
|
||||
files that don't exist but are mentioned in a makefile. */
|
||||
{
|
||||
struct file *f = lookup_file (*file);
|
||||
not_target = f == 0 || !f->is_target;
|
||||
}
|
||||
|
||||
flen = strlen (*file);
|
||||
|
||||
/* Split *FILE into a directory prefix and a name-within-directory.
|
||||
NAME_DPLEN gets the length of the prefix; FILENAME gets the
|
||||
pointer to the name-within-directory and FLEN is its length. */
|
||||
|
||||
n = rindex (*file, '/');
|
||||
name_dplen = n != 0 ? n - *file : 0;
|
||||
filename = name_dplen > 0 ? n + 1 : *file;
|
||||
if (name_dplen > 0)
|
||||
flen -= name_dplen + 1;
|
||||
|
||||
/* Allocate enough space for the biggest VPATH entry,
|
||||
a slash, the directory prefix that came with *FILE,
|
||||
another slash (although this one may not always be
|
||||
necessary), the filename, and a null terminator. */
|
||||
name = (char *) xmalloc (maxvpath + 1 + name_dplen + 1 + flen + 1);
|
||||
|
||||
/* Try each VPATH entry. */
|
||||
for (i = 0; vpath[i] != 0; ++i)
|
||||
{
|
||||
int exists_in_cache = 0;
|
||||
|
||||
n = name;
|
||||
|
||||
/* Put the next VPATH entry into NAME at N and increment N past it. */
|
||||
vlen = strlen (vpath[i]);
|
||||
bcopy (vpath[i], n, vlen);
|
||||
n += vlen;
|
||||
|
||||
/* Add the directory prefix already in *FILE. */
|
||||
if (name_dplen > 0)
|
||||
{
|
||||
*n++ = '/';
|
||||
bcopy (*file, n, name_dplen);
|
||||
n += name_dplen;
|
||||
}
|
||||
|
||||
/* Now add the name-within-directory at the end of NAME. */
|
||||
if (n != name && n[-1] != '/')
|
||||
{
|
||||
*n = '/';
|
||||
bcopy (filename, n + 1, flen + 1);
|
||||
}
|
||||
else
|
||||
bcopy (filename, n, flen + 1);
|
||||
|
||||
/* Check if the file is mentioned in a makefile. If *FILE is not
|
||||
a target, that is enough for us to decide this file exists.
|
||||
If *FILE is a target, then the file must be mentioned in the
|
||||
makefile also as a target to be chosen.
|
||||
|
||||
The restriction that *FILE must not be a target for a
|
||||
makefile-mentioned file to be chosen was added by an
|
||||
inadequately commented change in July 1990; I am not sure off
|
||||
hand what problem it fixes.
|
||||
|
||||
In December 1993 I loosened of this restriction to allow a file
|
||||
to be chosen if it is mentioned as a target in a makefile. This
|
||||
seem logical. */
|
||||
{
|
||||
struct file *f = lookup_file (name);
|
||||
if (f != 0)
|
||||
exists = not_target || f->is_target;
|
||||
}
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
/* That file wasn't mentioned in the makefile.
|
||||
See if it actually exists. */
|
||||
|
||||
/* Clobber a null into the name at the last slash.
|
||||
Now NAME is the name of the directory to look in. */
|
||||
*n = '\0';
|
||||
|
||||
/* We know the directory is in the hash table now because either
|
||||
construct_vpath_list or the code just above put it there.
|
||||
Does the file we seek exist in it? */
|
||||
exists_in_cache = exists = dir_file_exists_p (name, filename);
|
||||
}
|
||||
|
||||
if (exists)
|
||||
{
|
||||
/* The file is in the directory cache.
|
||||
Now check that it actually exists in the filesystem.
|
||||
The cache may be out of date. When vpath thinks a file
|
||||
exists, but stat fails for it, confusion results in the
|
||||
higher levels. */
|
||||
|
||||
struct stat st;
|
||||
|
||||
/* Put the slash back in NAME. */
|
||||
*n = '/';
|
||||
|
||||
if (!exists_in_cache /* Makefile-mentioned file need not exist. */
|
||||
|| stat (name, &st) == 0) /* Does it really exist? */
|
||||
{
|
||||
/* We have found a file.
|
||||
Store the name we found into *FILE for the caller. */
|
||||
|
||||
*file = savestring (name, (n + 1 - name) + flen);
|
||||
|
||||
if (mtime_ptr != 0)
|
||||
/* Store the modtime into *MTIME_PTR for the caller.
|
||||
If we have had no need to stat the file here,
|
||||
we record a zero modtime to indicate this. */
|
||||
*mtime_ptr = exists_in_cache ? st.st_mtime : (time_t) 0;
|
||||
|
||||
free (name);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
exists = 0;
|
||||
}
|
||||
}
|
||||
|
||||
free (name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Print the data base of VPATH search paths. */
|
||||
|
||||
void
|
||||
print_vpath_data_base ()
|
||||
{
|
||||
register unsigned int nvpaths;
|
||||
register struct vpath *v;
|
||||
|
||||
puts ("\n# VPATH Search Paths\n");
|
||||
|
||||
nvpaths = 0;
|
||||
for (v = vpaths; v != 0; v = v->next)
|
||||
{
|
||||
register unsigned int i;
|
||||
|
||||
++nvpaths;
|
||||
|
||||
printf ("vpath %s ", v->pattern);
|
||||
|
||||
for (i = 0; v->searchpath[i] != 0; ++i)
|
||||
printf ("%s%c", v->searchpath[i],
|
||||
v->searchpath[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
|
||||
}
|
||||
|
||||
if (vpaths == 0)
|
||||
puts ("# No `vpath' search paths.");
|
||||
else
|
||||
printf ("\n# %u `vpath' search paths.\n", nvpaths);
|
||||
|
||||
if (general_vpath == 0)
|
||||
puts ("\n# No general (`VPATH' variable) search path.");
|
||||
else
|
||||
{
|
||||
register char **path = general_vpath->searchpath;
|
||||
register unsigned int i;
|
||||
|
||||
fputs ("\n# General (`VPATH' variable) search path:\n# ", stdout);
|
||||
|
||||
for (i = 0; path[i] != 0; ++i)
|
||||
printf ("%s%c", path[i],
|
||||
path[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user