mirror of
https://github.com/mirror/make.git
synced 2026-08-29 18:58:01 +08:00
Compare commits
329 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
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
81
GNUmakefile
81
GNUmakefile
@@ -1,8 +1,8 @@
|
|||||||
# GNU Make-specific makefile for GNU Make.
|
# GNU Make-specific makefile for GNU Make.
|
||||||
|
|
||||||
# Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
# Copyright (C) 1990, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||||
# This file is part of GNU Make.
|
# This file is part of GNU Make.
|
||||||
#
|
#
|
||||||
# GNU Make is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with GNU Make; see the file COPYING. If not, write to
|
# along with GNU Make; see the file COPYING. If not, write to
|
||||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
@@ -31,7 +31,7 @@ override srcdir := .
|
|||||||
override CC := $(CC)
|
override CC := $(CC)
|
||||||
|
|
||||||
ifeq ($(ARCH),hp300)
|
ifeq ($(ARCH),hp300)
|
||||||
customs=yes
|
#customs=yes
|
||||||
endif
|
endif
|
||||||
ifdef customs
|
ifdef customs
|
||||||
override REMOTE := cstms
|
override REMOTE := cstms
|
||||||
@@ -45,17 +45,23 @@ include compatMakefile
|
|||||||
MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES)
|
MAKE = $(MAKE_COMMAND) $(MAKEOVERRIDES)
|
||||||
|
|
||||||
# Remove autoconf magic.
|
# Remove autoconf magic.
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = $(prefix)
|
||||||
extras := $(filter-out getloadavg.o @%@,$(extras)) getloadavg.o
|
extras := $(filter-out getloadavg.o @%@,$(extras)) getloadavg.o
|
||||||
LOADLIBES := $(filter-out @%@,$(LOADLIBES))
|
LOADLIBES := $(filter-out @%@,$(LOADLIBES))
|
||||||
ALLOCA := $(filter-out @%@,$(ALLOCA))
|
ALLOCA := $(filter-out @%@,$(ALLOCA))
|
||||||
|
CPPFLAGS := $(filter-out @%@,$(defines) $(CPPFLAGS)) -DHAVE_CONFIG_H
|
||||||
|
|
||||||
# Tell autoconf/autoheader to use m4 files from the master source.
|
ifdef AC_MACRODIR
|
||||||
ACFLAGS := -m /home/gd/gnu/autoconf
|
configure config.h.in: $(patsubst %,$(AC_MACRODIR)/%.m4,acspecific acgeneral)
|
||||||
configure config.h.in: $(patsubst %,/home/gd/gnu/autoconf/%.m4,\
|
config.h.in: $(AC_MACRODIR)/acconfig.h
|
||||||
acspecific acgeneral)
|
endif
|
||||||
config.h.in: /home/gd/gnu/autoconf/acconfig.h
|
configure: configure.in aclocal.m4
|
||||||
configure: configure.in; autoconf $(ACFLAGS)
|
autoconf $(ACFLAGS)
|
||||||
config.h.in: configure.in; autoheader $(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
|
ifdef customs
|
||||||
defines := $(defines) -Ipmake/customs -Ipmake/lib/include
|
defines := $(defines) -Ipmake/customs -Ipmake/lib/include
|
||||||
@@ -83,12 +89,10 @@ GETOPT =
|
|||||||
#GETOPT_SRC = Don't clear this or dist will break.
|
#GETOPT_SRC = Don't clear this or dist will break.
|
||||||
|
|
||||||
# glob is in libc too.
|
# glob is in libc too.
|
||||||
GLOB =
|
GLOB =
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
CPPFLAGS := $(CPPFLAGS) -Iglob
|
|
||||||
|
|
||||||
endif # works-for-make
|
endif # works-for-make
|
||||||
endif # $(libc_dir)
|
endif # $(libc_dir)
|
||||||
endif # !no_libc
|
endif # !no_libc
|
||||||
@@ -97,9 +101,7 @@ endif # !no_libc
|
|||||||
$(ARCH)/%.o: %.c
|
$(ARCH)/%.o: %.c
|
||||||
$(COMPILE.c) -Iglob $< $(OUTPUT_OPTION)
|
$(COMPILE.c) -Iglob $< $(OUTPUT_OPTION)
|
||||||
$(ARCH)/glob/libglob.a: FORCE
|
$(ARCH)/glob/libglob.a: FORCE
|
||||||
$(MAKE) -C $(@D) $(@F) \
|
$(MAKE) -C $(@D) $(@F)
|
||||||
CC='$(CC)' CFLAGS='$(CFLAGS) -I..' \
|
|
||||||
CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H'
|
|
||||||
FORCE:
|
FORCE:
|
||||||
objs := $(addprefix $(ARCH)/,$(objs))
|
objs := $(addprefix $(ARCH)/,$(objs))
|
||||||
prog := $(ARCH)/make
|
prog := $(ARCH)/make
|
||||||
@@ -111,7 +113,7 @@ $(archpfx)load.o: load.c
|
|||||||
$(archpfx)load.dep: load.c
|
$(archpfx)load.dep: load.c
|
||||||
$(mkdep) $(LOAD_AVG) $< | sed 's,$*\.o,& $@,' > $@
|
$(mkdep) $(LOAD_AVG) $< | sed 's,$*\.o,& $@,' > $@
|
||||||
|
|
||||||
CPPFLAGS := -I$(ARCH) $(CPPFLAGS) -DHAVE_CONFIG_H $(filter-out @%@,$(defines))
|
CPPFLAGS := -I$(ARCH) -Iglob -DHAVE_CONFIG_H $(filter-out @%@,$(CPPFLAGS))
|
||||||
|
|
||||||
ifneq "$(wildcard $(ARCH)/makefile)" ""
|
ifneq "$(wildcard $(ARCH)/makefile)" ""
|
||||||
include $(ARCH)/makefile
|
include $(ARCH)/makefile
|
||||||
@@ -123,7 +125,8 @@ prog := make
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq "$(findstring gcc,$(CC))" ""
|
ifneq "$(findstring gcc,$(CC))" ""
|
||||||
CFLAGS = -g -W -Wunused -Wpointer-arith -Wreturn-type -Wswitch
|
CFLAGS = -g -Wall -Wtraditional -Wid-clash-31 -Wpointer-arith \
|
||||||
|
-Wbad-function-cast -Wconversion
|
||||||
else
|
else
|
||||||
CFLAGS = -g
|
CFLAGS = -g
|
||||||
endif
|
endif
|
||||||
@@ -148,12 +151,13 @@ $(prog): $(objs) $(globdep) #$(addprefix $(ARCH)/,gmalloc.o mcheck.o)
|
|||||||
$(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new
|
$(CC) $(LDFLAGS) $^ $(globlib) $(LOADLIBES) -o $@.new
|
||||||
mv -f $@.new $@
|
mv -f $@.new $@
|
||||||
|
|
||||||
globfiles = $(addprefix glob/,COPYING.LIB Makefile.in \
|
globfiles = $(addprefix glob/,COPYING.LIB configure.in configure Makefile.in \
|
||||||
glob.c fnmatch.c glob.h fnmatch.h)
|
configure.bat glob.c fnmatch.c glob.h fnmatch.h)
|
||||||
$(globfiles): stamp-glob ;
|
$(globfiles): stamp-glob ;
|
||||||
stamp-glob: /home/gd/gnu/libc/posix/glob.tar
|
stamp-glob: /home/gd/gnu/libc/posix/glob.tar
|
||||||
-rm -rf glob
|
-rm -f stamp-glob glob/*
|
||||||
tar xvf $< glob
|
tar xvf $< glob
|
||||||
|
cvs commit -m'Updated from libc' glob
|
||||||
touch $@
|
touch $@
|
||||||
/home/gd/gnu/libc/posix/glob.tar: force
|
/home/gd/gnu/libc/posix/glob.tar: force
|
||||||
$(MAKE) -C $(@D) $(@F) no_deps=t
|
$(MAKE) -C $(@D) $(@F) no_deps=t
|
||||||
@@ -176,6 +180,7 @@ Makefile.in: compatMakefile $(nolib-deps:remote-%.dep=remote-stub.dep)
|
|||||||
echo '# Automatically generated dependencies.'; \
|
echo '# Automatically generated dependencies.'; \
|
||||||
sed -e 's/ [^ ]*\.dep//' -e 's=$(archpfx)==' $(filter-out $<,$^) \
|
sed -e 's/ [^ ]*\.dep//' -e 's=$(archpfx)==' $(filter-out $<,$^) \
|
||||||
) > $@
|
) > $@
|
||||||
|
cvs commit -mRegenerated $@
|
||||||
|
|
||||||
.SUFFIXES: .dep
|
.SUFFIXES: .dep
|
||||||
# Maintain the automatically-generated dependencies.
|
# Maintain the automatically-generated dependencies.
|
||||||
@@ -198,7 +203,9 @@ build.sh.in: build.template compatMakefile
|
|||||||
$(patsubst $(archpfx)%,%,$(objs)))\
|
$(patsubst $(archpfx)%,%,$(objs)))\
|
||||||
$(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
|
$(patsubst %.c,%.o,$(filter %.c,$(globfiles)))@' \
|
||||||
$< > $@.new
|
$< > $@.new
|
||||||
|
chmod a+x $@.new
|
||||||
mv -f $@.new $@
|
mv -f $@.new $@
|
||||||
|
cvs commit -mRegenerated $@
|
||||||
|
|
||||||
# Make the distribution tar files.
|
# Make the distribution tar files.
|
||||||
|
|
||||||
@@ -210,18 +217,25 @@ tarfiles := make # make-doc
|
|||||||
tarfiles := $(addsuffix -$(version).tar,$(tarfiles))
|
tarfiles := $(addsuffix -$(version).tar,$(tarfiles))
|
||||||
tarfiles := $(tarfiles:%=%.gz) # no more compress $(tarfiles:%=%.Z)
|
tarfiles := $(tarfiles:%=%.gz) # no more compress $(tarfiles:%=%.Z)
|
||||||
# Depend on default and doc so we don't ship anything that won't compile.
|
# Depend on default and doc so we don't ship anything that won't compile.
|
||||||
dist: rcs-mark default info dvi tests tarfiles
|
dist: cvs-mark default info dvi tests tarfiles
|
||||||
.PHONY: tarfiles
|
.PHONY: tarfiles
|
||||||
tarfiles: $(tarfiles)
|
tarfiles: $(tarfiles)
|
||||||
|
|
||||||
|
distfiles=README INSTALL COPYING ChangeLog NEWS \
|
||||||
|
configure Makefile.in configure.in build.sh.in mkinstalldirs \
|
||||||
|
configh.dos configure.bat \
|
||||||
|
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
|
ifndef dist-flavor
|
||||||
dist-flavor = alpha
|
dist-flavor = alpha
|
||||||
endif
|
endif
|
||||||
.PHONY: rcs-mark rcs-mark-alpha rcs-mark-beta
|
.PHONY: cvs-mark
|
||||||
rcs-mark: rcs-mark-$(dist-flavor)
|
cvs-mark: $(distfiles)
|
||||||
rcs-mark-alpha:;rcs -sAlpha -Nmake-$(version-): RCS/[!=]*,v
|
cvs tag -F make-$(subst .,-,$(version))
|
||||||
rcs-mark-beta:;rcs -sBeta -Nmake-$(version-): RCS/[!=]*,v
|
|
||||||
version- = $(subst .,-,$(version))
|
|
||||||
|
|
||||||
dist: local-inst
|
dist: local-inst
|
||||||
.PHONY: local-inst
|
.PHONY: local-inst
|
||||||
@@ -245,6 +259,7 @@ $(alpha-dir)/%: %
|
|||||||
sed 's/VERSION/$(version)/' < $< > $@
|
sed 's/VERSION/$(version)/' < $< > $@
|
||||||
# Make sure I don't edit it by accident.
|
# Make sure I don't edit it by accident.
|
||||||
chmod a-w $@
|
chmod a-w $@
|
||||||
|
cvs commit -m'Regenerated for $(version)' $@
|
||||||
|
|
||||||
define make-tar
|
define make-tar
|
||||||
@rm -fr make-$(version)
|
@rm -fr make-$(version)
|
||||||
@@ -256,15 +271,7 @@ endef
|
|||||||
%.Z: %; compress -c $< > $@
|
%.Z: %; compress -c $< > $@
|
||||||
%.gz: %; gzip -9 -c -v $< > $@
|
%.gz: %; gzip -9 -c -v $< > $@
|
||||||
|
|
||||||
make-doc-$(version).tar: README-doc COPYING make.dvi make.info make.info*
|
make-$(version).tar: $(distfiles)
|
||||||
$(make-tar)
|
|
||||||
make-$(version).tar: README INSTALL COPYING ChangeLog NEWS \
|
|
||||||
configure Makefile.in configure.in build.sh.in mkinstalldirs \
|
|
||||||
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*
|
|
||||||
$(make-tar)
|
$(make-tar)
|
||||||
|
|
||||||
ifneq (,)
|
ifneq (,)
|
||||||
|
|||||||
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.
|
||||||
|
|
||||||
307
Makefile.in
Normal file
307
Makefile.in
Normal file
@@ -0,0 +1,307 @@
|
|||||||
|
# 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 = @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 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/libglob.a
|
||||||
|
|
||||||
|
# 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 \
|
||||||
|
$(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)
|
||||||
|
$(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 commands.h file.h variable.h job.h
|
||||||
|
job.o: job.c make.h commands.h job.h file.h variable.h
|
||||||
|
dir.o: dir.c make.h
|
||||||
|
file.o: file.c make.h commands.h dep.h file.h variable.h
|
||||||
|
misc.o: misc.c make.h dep.h
|
||||||
|
main.o: main.c make.h commands.h dep.h file.h variable.h job.h getopt.h
|
||||||
|
read.o: read.c make.h commands.h dep.h file.h variable.h glob/glob.h
|
||||||
|
remake.o: remake.c make.h commands.h job.h dep.h file.h
|
||||||
|
rule.o : rule.c make.h config.h commands.h dep.h file.h variable.h rule.h
|
||||||
|
implicit.o : implicit.c make.h rule.h dep.h file.h
|
||||||
|
default.o: default.c make.h rule.h dep.h file.h commands.h variable.h
|
||||||
|
variable.o : variable.c make.h commands.h variable.h dep.h file.h
|
||||||
|
expand.o: expand.c make.h commands.h file.h variable.h
|
||||||
|
function.o: function.c make.h variable.h dep.h commands.h job.h
|
||||||
|
vpath.o: vpath.c make.h file.h variable.h
|
||||||
|
version.o: version.c
|
||||||
|
ar.o : ar.c make.h file.h dep.h
|
||||||
|
arscan.o: arscan.c make.h
|
||||||
|
signame.o: signame.c signame.h
|
||||||
|
remote-stub.o : remote-stub.c make.h commands.h
|
||||||
|
getopt.o: getopt.c getopt.h
|
||||||
|
getopt1.o : getopt1.c getopt.h
|
||||||
|
getloadavg.o: getloadavg.c
|
||||||
562
NEWS
Normal file
562
NEWS
Normal file
@@ -0,0 +1,562 @@
|
|||||||
|
GNU make NEWS -- history of user-visible changes. 11 December 1995
|
||||||
|
|
||||||
|
Copyright (C) 1992, 1993, 1994, 1995 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.
|
||||||
|
|
||||||
|
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 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.2 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.
|
||||||
@@ -10,6 +10,10 @@ 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
|
in the current directory. Then you will have a Make program that you can
|
||||||
use for `make install', or whatever else.
|
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
|
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.
|
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.
|
It is said that using `cc' without `-O' does work.
|
||||||
|
|||||||
12
acconfig.h
12
acconfig.h
@@ -3,3 +3,15 @@
|
|||||||
|
|
||||||
/* Define this if the SCCS `get' command understands the `-G<file>' option. */
|
/* Define this if the SCCS `get' command understands the `-G<file>' option. */
|
||||||
#undef SCCS_GET_MINUS_G
|
#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
|
||||||
|
|||||||
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
|
||||||
14
alloca.c
14
alloca.c
@@ -22,11 +22,11 @@
|
|||||||
your main control loop, etc. to force garbage collection. */
|
your main control loop, etc. to force garbage collection. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#if defined (emacs) || defined (CONFIG_BROKETS)
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#else
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef emacs
|
||||||
|
#include "blockinput.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If compiling with GCC 2, this file's not needed. */
|
/* If compiling with GCC 2, this file's not needed. */
|
||||||
@@ -176,6 +176,10 @@ alloca (size)
|
|||||||
{
|
{
|
||||||
register header *hp; /* Traverses linked list. */
|
register header *hp; /* Traverses linked list. */
|
||||||
|
|
||||||
|
#ifdef emacs
|
||||||
|
BLOCK_INPUT;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (hp = last_alloca_header; hp != NULL;)
|
for (hp = last_alloca_header; hp != NULL;)
|
||||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||||
@@ -190,6 +194,10 @@ alloca (size)
|
|||||||
break; /* Rest are not deeper. */
|
break; /* Rest are not deeper. */
|
||||||
|
|
||||||
last_alloca_header = hp; /* -> last valid storage. */
|
last_alloca_header = hp; /* -> last valid storage. */
|
||||||
|
|
||||||
|
#ifdef emacs
|
||||||
|
UNBLOCK_INPUT;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
|
|||||||
17
arscan.c
17
arscan.c
@@ -1,5 +1,5 @@
|
|||||||
/* Library function for scanning an archive file.
|
/* Library function for scanning an archive file.
|
||||||
Copyright (C) 1987, 89, 91, 92, 93, 94 Free Software Foundation, Inc.
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -144,6 +144,13 @@ ar_scan (archive, function, arg)
|
|||||||
|
|
||||||
sscanf (fl_header.fl_fstmoff, "%12ld", &member_offset);
|
sscanf (fl_header.fl_fstmoff, "%12ld", &member_offset);
|
||||||
sscanf (fl_header.fl_lstmoff, "%12ld", &last_member_offset);
|
sscanf (fl_header.fl_lstmoff, "%12ld", &last_member_offset);
|
||||||
|
|
||||||
|
if (member_offset == 0)
|
||||||
|
{
|
||||||
|
/* Empty archive. */
|
||||||
|
close (desc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#ifndef M_XENIX
|
#ifndef M_XENIX
|
||||||
register long int member_offset = sizeof (int);
|
register long int member_offset = sizeof (int);
|
||||||
@@ -429,11 +436,11 @@ ar_name_equal (name, mem, truncated)
|
|||||||
struct ar_hdr hdr;
|
struct ar_hdr hdr;
|
||||||
return !strncmp (name, mem,
|
return !strncmp (name, mem,
|
||||||
sizeof (hdr.ar_name) -
|
sizeof (hdr.ar_name) -
|
||||||
#ifndef __hpux
|
#if !defined (__hpux) && !defined (cray)
|
||||||
1
|
1
|
||||||
#else
|
#else
|
||||||
2
|
2
|
||||||
#endif /* __hpux */
|
#endif /* !__hpux && !cray */
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -495,7 +502,11 @@ ar_member_touch (arname, memname)
|
|||||||
if (AR_HDR_SIZE != write (fd, (char *) &ar_hdr, AR_HDR_SIZE))
|
if (AR_HDR_SIZE != write (fd, (char *) &ar_hdr, AR_HDR_SIZE))
|
||||||
goto lose;
|
goto lose;
|
||||||
/* The file's mtime is the time we we want. */
|
/* The file's mtime is the time we we want. */
|
||||||
|
#ifdef EINTR
|
||||||
|
while (fstat (fd, &statbuf) < 0 && errno == EINTR);
|
||||||
|
#else
|
||||||
fstat (fd, &statbuf);
|
fstat (fd, &statbuf);
|
||||||
|
#endif
|
||||||
#if defined(ARFMAG) || defined(AIAMAG)
|
#if defined(ARFMAG) || defined(AIAMAG)
|
||||||
/* Advance member's time to that time */
|
/* Advance member's time to that time */
|
||||||
for (i = 0; i < sizeof ar_hdr.ar_date; i++)
|
for (i = 0; i < sizeof ar_hdr.ar_date; i++)
|
||||||
|
|||||||
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/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
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Shell script to build GNU Make in the absence of any `make' program.
|
# Shell script to build GNU Make in the absence of any `make' program.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright (C) 1993 Free Software Foundation, Inc.
|
# Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||||
# This file is part of GNU Make.
|
# This file is part of GNU Make.
|
||||||
#
|
#
|
||||||
# GNU Make is free software; you can redistribute it and/or modify
|
# GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
srcdir='@srcdir@'
|
srcdir='@srcdir@'
|
||||||
CC='@CC@'
|
CC='@CC@'
|
||||||
CFLAGS='@CFLAGS@'
|
CFLAGS='@CFLAGS@'
|
||||||
|
CPPFLAGS='@CPPFLAGS@'
|
||||||
LDFLAGS='@LDFLAGS@'
|
LDFLAGS='@LDFLAGS@'
|
||||||
defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"'
|
defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"'
|
||||||
ALLOCA='@ALLOCA@'
|
ALLOCA='@ALLOCA@'
|
||||||
@@ -32,9 +33,9 @@ extras='@LIBOBJS@'
|
|||||||
REMOTE='@REMOTE@'
|
REMOTE='@REMOTE@'
|
||||||
|
|
||||||
# Common prefix for machine-independent installed files.
|
# Common prefix for machine-independent installed files.
|
||||||
prefix=/usr/local
|
prefix='@prefix@'
|
||||||
# Common prefix for machine-dependent installed files.
|
# Common prefix for machine-dependent installed files.
|
||||||
exec_prefix=/usr/local
|
exec_prefix='@exec_prefix@'
|
||||||
# Directory to find libraries in for `-lXXX'.
|
# Directory to find libraries in for `-lXXX'.
|
||||||
libdir=${exec_prefix}/lib
|
libdir=${exec_prefix}/lib
|
||||||
# Directory to search by default for included makefiles.
|
# Directory to search by default for included makefiles.
|
||||||
@@ -49,7 +50,8 @@ objs="%objs% remote-${REMOTE}.o ${extras} ${ALLOCA}"
|
|||||||
# Compile the source files into those objects.
|
# Compile the source files into those objects.
|
||||||
for file in `echo ${objs} | sed 's/\.o/.c/g'`; do
|
for file in `echo ${objs} | sed 's/\.o/.c/g'`; do
|
||||||
echo compiling ${file}...
|
echo compiling ${file}...
|
||||||
$CC $CFLAGS $defines -c -I. -I${srcdir} -I${srcdir}/glob ${srcdir}/$file
|
$CC $defines $CPPFLAGS $CFLAGS \
|
||||||
|
-c -I. -I${srcdir} -I${srcdir}/glob ${srcdir}/$file
|
||||||
done
|
done
|
||||||
|
|
||||||
# The object files were actually all put in the current directory.
|
# The object files were actually all put in the current directory.
|
||||||
|
|||||||
76
commands.c
76
commands.c
@@ -1,5 +1,5 @@
|
|||||||
/* Command processing for GNU Make.
|
/* Command processing for GNU Make.
|
||||||
Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -87,7 +87,7 @@ set_file_variables (file)
|
|||||||
for (d = enter_file (".SUFFIXES")->deps; d != 0; d = d->next)
|
for (d = enter_file (".SUFFIXES")->deps; d != 0; d = d->next)
|
||||||
{
|
{
|
||||||
unsigned int slen = strlen (dep_name (d));
|
unsigned int slen = strlen (dep_name (d));
|
||||||
if (len > slen && !strncmp (dep_name (d), name + len - slen, slen))
|
if (len > slen && !strncmp (dep_name (d), name + (len - slen), slen))
|
||||||
{
|
{
|
||||||
file->stem = savestring (name, len - slen);
|
file->stem = savestring (name, len - slen);
|
||||||
break;
|
break;
|
||||||
@@ -116,34 +116,64 @@ set_file_variables (file)
|
|||||||
DEFINE_VARIABLE ("@", 1, at);
|
DEFINE_VARIABLE ("@", 1, at);
|
||||||
DEFINE_VARIABLE ("%", 1, percent);
|
DEFINE_VARIABLE ("%", 1, percent);
|
||||||
|
|
||||||
/* Make sure that no dependencies are repeated. This does not
|
/* Compute the values for $^, $+, and $?. */
|
||||||
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 $?. */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register unsigned int caret_len, qmark_len;
|
register unsigned int qmark_len, plus_len;
|
||||||
char *caret_value;
|
char *caret_value, *plus_value;
|
||||||
register char *cp;
|
register char *cp;
|
||||||
char *qmark_value;
|
char *qmark_value;
|
||||||
register char *qp;
|
register char *qp;
|
||||||
register struct dep *d;
|
register struct dep *d;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
||||||
caret_len = qmark_len = 0;
|
/* 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)
|
for (d = file->deps; d != 0; d = d->next)
|
||||||
{
|
{
|
||||||
register unsigned int i = strlen (dep_name (d)) + 1;
|
char *c = dep_name (d);
|
||||||
caret_len += i;
|
|
||||||
if (d->changed)
|
#ifndef NO_ARCHIVES
|
||||||
qmark_len += i;
|
if (ar_name (c))
|
||||||
|
{
|
||||||
|
c = index (c, '(') + 1;
|
||||||
|
len = strlen (c) - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
len = strlen (c);
|
||||||
|
|
||||||
|
bcopy (c, cp, len);
|
||||||
|
cp += len;
|
||||||
|
*cp++ = ' ';
|
||||||
|
|
||||||
|
if (! d->changed)
|
||||||
|
qmark_len -= len + 1; /* Don't space in $? for this one. */
|
||||||
}
|
}
|
||||||
|
|
||||||
len = caret_len == 0 ? 1 : caret_len;
|
/* Kill the last space and define the variable. */
|
||||||
cp = caret_value = (char *) alloca (len);
|
|
||||||
|
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;
|
len = qmark_len == 0 ? 1 : qmark_len;
|
||||||
qp = qmark_value = (char *) alloca (len);
|
qp = qmark_value = (char *) alloca (len);
|
||||||
|
|
||||||
@@ -329,6 +359,10 @@ RETSIGTYPE
|
|||||||
fatal_error_signal (sig)
|
fatal_error_signal (sig)
|
||||||
int sig;
|
int sig;
|
||||||
{
|
{
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
remove_intermediates (1);
|
||||||
|
exit (1);
|
||||||
|
#else /* Not MSDOS. */
|
||||||
handling_fatal_signal = 1;
|
handling_fatal_signal = 1;
|
||||||
|
|
||||||
/* Set the handling for this signal to the default.
|
/* Set the handling for this signal to the default.
|
||||||
@@ -385,6 +419,7 @@ fatal_error_signal (sig)
|
|||||||
will be unblocked when we return and arrive then to kill us. */
|
will be unblocked when we return and arrive then to kill us. */
|
||||||
if (kill (getpid (), sig) < 0)
|
if (kill (getpid (), sig) < 0)
|
||||||
pfatal_with_name ("kill");
|
pfatal_with_name ("kill");
|
||||||
|
#endif /* MSDOS. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete FILE unless it's precious or not actually a file (phony),
|
/* Delete FILE unless it's precious or not actually a file (phony),
|
||||||
@@ -424,11 +459,12 @@ delete_target (file, on_behalf_of)
|
|||||||
error ("*** [%s] Deleting file `%s'", on_behalf_of, file->name);
|
error ("*** [%s] Deleting file `%s'", on_behalf_of, file->name);
|
||||||
else
|
else
|
||||||
error ("*** Deleting file `%s'", file->name);
|
error ("*** Deleting file `%s'", file->name);
|
||||||
if (unlink (file->name) < 0)
|
if (unlink (file->name) < 0
|
||||||
|
&& errno != ENOENT) /* It disappeared; so what. */
|
||||||
perror_with_name ("unlink: ", file->name);
|
perror_with_name ("unlink: ", file->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Delete all non-precious targets of CHILD unless they were already deleted.
|
/* Delete all non-precious targets of CHILD unless they were already deleted.
|
||||||
Set the flag in CHILD to say they've been deleted. */
|
Set the flag in CHILD to say they've been deleted. */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# NOTE: If you have no `make' program at all to process this makefile, run
|
# NOTE: If you have no `make' program at all to process this makefile, run
|
||||||
# `build.sh' instead.
|
# `build.sh' instead.
|
||||||
#
|
#
|
||||||
# Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
# Copyright (C) 1988, 89, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||||
# This file is part of GNU Make.
|
# This file is part of GNU Make.
|
||||||
#
|
#
|
||||||
# GNU Make is free software; you can redistribute it and/or modify
|
# GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -30,11 +30,9 @@ srcdir = @srcdir@
|
|||||||
CC = @CC@
|
CC = @CC@
|
||||||
|
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
||||||
# How to invoke ranlib. This is only used by the `glob' subdirectory.
|
|
||||||
RANLIB = @RANLIB@
|
|
||||||
|
|
||||||
# Define these for your system as follows:
|
# Define these for your system as follows:
|
||||||
# -DNO_ARCHIVES To disable `ar' archive support.
|
# -DNO_ARCHIVES To disable `ar' archive support.
|
||||||
# -DNO_FLOAT To avoid using floating-point numbers.
|
# -DNO_FLOAT To avoid using floating-point numbers.
|
||||||
@@ -77,9 +75,9 @@ LOADLIBES = @LIBS@
|
|||||||
extras = @LIBOBJS@
|
extras = @LIBOBJS@
|
||||||
|
|
||||||
# Common prefix for machine-independent installed files.
|
# Common prefix for machine-independent installed files.
|
||||||
prefix = /usr/local
|
prefix = @prefix@
|
||||||
# Common prefix for machine-dependent installed files.
|
# Common prefix for machine-dependent installed files.
|
||||||
exec_prefix = $(prefix)
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
# Directory to install `make' in.
|
# Directory to install `make' in.
|
||||||
bindir = $(exec_prefix)/bin
|
bindir = $(exec_prefix)/bin
|
||||||
@@ -119,8 +117,8 @@ MAKEINFO = makeinfo
|
|||||||
TEXI2DVI = texi2dvi
|
TEXI2DVI = texi2dvi
|
||||||
|
|
||||||
# Programs to make tags files.
|
# Programs to make tags files.
|
||||||
ETAGS = etags -tw
|
ETAGS = etags -w
|
||||||
CTAGS = ctags -tw
|
CTAGS = ctags -w
|
||||||
|
|
||||||
objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \
|
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 \
|
rule.o implicit.o default.o variable.o expand.o function.o \
|
||||||
@@ -144,10 +142,9 @@ srcs = $(srcdir)/commands.c $(srcdir)/job.c $(srcdir)/dir.c \
|
|||||||
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
|
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo
|
||||||
|
|
||||||
all: make
|
all: make
|
||||||
check: # No tests.
|
|
||||||
info: make.info
|
info: make.info
|
||||||
dvi: make.dvi
|
dvi: make.dvi
|
||||||
# Some makes apparently use .PHONY as the default goal is it is before `all'.
|
# Some makes apparently use .PHONY as the default goal if it is before `all'.
|
||||||
.PHONY: all check info dvi
|
.PHONY: all check info dvi
|
||||||
|
|
||||||
make.info: make.texinfo
|
make.info: make.texinfo
|
||||||
@@ -166,17 +163,14 @@ make: $(objs)
|
|||||||
# -I. is needed to find config.h in the build directory.
|
# -I. is needed to find config.h in the build directory.
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \
|
$(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \
|
||||||
$(CFLAGS) $< $(OUTPUT_OPTION)
|
$(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
|
||||||
|
|
||||||
# For some losing Unix makes.
|
# For some losing Unix makes.
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
MAKE = make
|
MAKE = make
|
||||||
|
|
||||||
glob/libglob.a: FORCE config.h
|
glob/libglob.a: FORCE config.h
|
||||||
cd glob; $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS) -I..' \
|
cd glob; $(MAKE) libglob.a
|
||||||
CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H' \
|
|
||||||
RANLIB='$(RANLIB)' \
|
|
||||||
libglob.a
|
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
tagsrcs = $(srcs) $(srcdir)/remote-*.c
|
tagsrcs = $(srcs) $(srcdir)/remote-*.c
|
||||||
@@ -201,7 +195,7 @@ $(bindir)/$(binprefix)make: make
|
|||||||
else \
|
else \
|
||||||
echo "$@ needs to be owned by group $(group) and setgid;"; \
|
echo "$@ needs to be owned by group $(group) and setgid;"; \
|
||||||
echo "otherwise the \`-l' option will probably not work."; \
|
echo "otherwise the \`-l' option will probably not work."; \
|
||||||
echo "You may need special priveleges to install $@."; \
|
echo "You may need special privileges to install $@."; \
|
||||||
fi; \
|
fi; \
|
||||||
else true; fi
|
else true; fi
|
||||||
# Some systems can't deal with renaming onto a running binary.
|
# Some systems can't deal with renaming onto a running binary.
|
||||||
@@ -222,6 +216,7 @@ $(infodir)/make.info: make.info
|
|||||||
# We use `$(SHELL) -c' because some shells do not
|
# We use `$(SHELL) -c' because some shells do not
|
||||||
# fail gracefully when there is an unknown command.
|
# fail gracefully when there is an unknown command.
|
||||||
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
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; \
|
install-info --infodir=$(infodir) $$dir/make.info; \
|
||||||
else true; fi
|
else true; fi
|
||||||
|
|
||||||
@@ -229,9 +224,14 @@ $(mandir)/$(manprefix)make.$(manext): make.man
|
|||||||
$(INSTALL_DATA) $(srcdir)/make.man $@
|
$(INSTALL_DATA) $(srcdir)/make.man $@
|
||||||
|
|
||||||
|
|
||||||
loadavg: getloadavg.c config.h
|
loadavg: loadavg.c config.h
|
||||||
$(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
|
$(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
|
||||||
$(srcdir)/getloadavg.c $(LOADLIBES) -o $@
|
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
|
check-loadavg: loadavg
|
||||||
@echo The system uptime program believes the load average to be:
|
@echo The system uptime program believes the load average to be:
|
||||||
-uptime
|
-uptime
|
||||||
@@ -242,12 +242,15 @@ check: check-loadavg
|
|||||||
|
|
||||||
.PHONY: clean realclean distclean mostlyclean
|
.PHONY: clean realclean distclean mostlyclean
|
||||||
clean: glob-clean
|
clean: glob-clean
|
||||||
-rm -f make loadavg *.o core make.info* make.dvi
|
-rm -f make loadavg *.o core make.dvi
|
||||||
distclean: clean glob-realclean
|
distclean: clean glob-realclean
|
||||||
-rm -f Makefile config.h config.status build.sh stamp-config
|
-rm -f Makefile config.h config.status build.sh stamp-config
|
||||||
|
-rm -f config.log config.cache
|
||||||
-rm -f TAGS tags
|
-rm -f TAGS tags
|
||||||
-rm -f make.?? make.??s make.log make.toc make.*aux
|
-rm -f make.?? make.??s make.log make.toc make.*aux
|
||||||
|
-rm -f loadavg.c
|
||||||
realclean: distclean
|
realclean: distclean
|
||||||
|
-rm -f make.info*
|
||||||
mostlyclean: clean
|
mostlyclean: clean
|
||||||
|
|
||||||
.PHONY: glob-clean glob-realclean
|
.PHONY: glob-clean glob-realclean
|
||||||
@@ -263,11 +266,10 @@ stamp-config: config.status $(srcdir)/config.h.in
|
|||||||
$(SHELL) config.status
|
$(SHELL) config.status
|
||||||
touch stamp-config
|
touch stamp-config
|
||||||
|
|
||||||
# These rules cause too much trouble.
|
#configure: configure.in aclocal.m4
|
||||||
#configure: configure.in
|
# cd $(srcdir) && autoconf $(ACFLAGS)
|
||||||
# autoconf $(ACFLAGS)
|
#config.h.in: configure.in aclocal.m4
|
||||||
#config.h.in: configure.in
|
# cd $(srcdir) && autoheader $(ACFLAGS)
|
||||||
# autoheader $(ACFLAGS)
|
|
||||||
|
|
||||||
# This tells versions [3.59,3.63) of GNU make not to export all variables.
|
# This tells versions [3.59,3.63) of GNU make not to export all variables.
|
||||||
.NOEXPORT:
|
.NOEXPORT:
|
||||||
|
|||||||
267
config.h.in
Normal file
267
config.h.in
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
/* 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 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. */
|
||||||
|
#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 ..
|
||||||
97
configure.in
97
configure.in
@@ -1,72 +1,91 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_REVISION([$Id$])
|
AC_REVISION([$Id$])
|
||||||
AC_INIT(vpath.c) dnl A distinctive file to look for in srcdir.
|
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_HEADER(config.h)
|
||||||
|
AC_CONFIG_SUBDIRS(glob) dnl Run configure in glob subdirectory.
|
||||||
|
|
||||||
# We want these before the checks, so the checks can modify their values.
|
AC_PROG_MAKE_SET
|
||||||
test -z "$CFLAGS" && CFLAGS=-g AC_SUBST(CFLAGS)
|
|
||||||
test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS)
|
|
||||||
|
|
||||||
AC_SET_MAKE
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_RANLIB
|
|
||||||
AC_PROG_CPP dnl Later checks need this.
|
AC_PROG_CPP dnl Later checks need this.
|
||||||
AC_AIX
|
AC_AIX
|
||||||
AC_ISC_POSIX
|
AC_ISC_POSIX
|
||||||
AC_MINIX
|
AC_MINIX
|
||||||
AC_STDC_HEADERS
|
AC_HEADER_STDC
|
||||||
AC_DIR_HEADER
|
AC_HEADER_DIRENT
|
||||||
AC_UID_T dnl Also does gid_t.
|
AC_TYPE_UID_T dnl Also does gid_t.
|
||||||
AC_GETGROUPS_T
|
AC_TYPE_PID_T
|
||||||
AC_PID_T
|
AC_TYPE_SIGNAL
|
||||||
AC_RETSIGTYPE
|
AC_CHECK_HEADERS(unistd.h limits.h sys/param.h fcntl.h string.h memory.h \
|
||||||
AC_HAVE_HEADERS(unistd.h limits.h sys/param.h fcntl.h string.h memory.h \
|
sys/timeb.h)
|
||||||
sys/timeb.h)
|
AC_PROG_CC_C_O
|
||||||
AC_MINUS_C_MINUS_O
|
AC_C_CONST dnl getopt needs this.
|
||||||
AC_CONST dnl getopt needs this.
|
AC_HEADER_STAT
|
||||||
AC_STAT_MACROS_BROKEN
|
|
||||||
|
|
||||||
AC_SUBST(LIBOBJS)
|
AC_SUBST(LIBOBJS)
|
||||||
|
|
||||||
AC_HAVE_FUNCS(getdtablesize sys_siglist _sys_siglist psignal \
|
AC_DEFUN(AC_CHECK_SYMBOL, [dnl
|
||||||
dup2 getcwd sigsetmask getgroups setlinebuf \
|
AC_MSG_CHECKING(for $1)
|
||||||
seteuid setegid setreuid setregid strerror)
|
AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
|
||||||
AC_ALLOCA
|
AC_TRY_LINK(, [extern char *sys_siglist[]; puts(*sys_siglist);],
|
||||||
AC_VFORK
|
ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
|
||||||
AC_SETVBUF_REVERSED
|
if test "$ac_cv_check_symbol_$1" = yes; then
|
||||||
AC_GETLOADAVG
|
changequote(,)dnl
|
||||||
AC_STRCOLL
|
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 Check out the wait reality.
|
AC_CHECK_FUNCS(psignal mktemp \
|
||||||
AC_HAVE_HEADERS(sys/wait.h) AC_HAVE_FUNCS(waitpid wait3)
|
dup2 getcwd sigsetmask getgroups setlinebuf \
|
||||||
AC_COMPILE_CHECK(union wait, [#include <sys/types.h>
|
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>],
|
#include <sys/wait.h>],
|
||||||
[union wait status; int pid; pid = wait (&status);
|
[union wait status; int pid; pid = wait (&status);
|
||||||
#ifdef WEXITSTATUS
|
#ifdef WEXITSTATUS
|
||||||
/* Some POSIXoid systems have both the new-style macros and the old
|
/* Some POSIXoid systems have both the new-style macros and the old
|
||||||
union wait type, and they do not work together. If union wait
|
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. */
|
conflicts with WEXITSTATUS et al, we don't want to use it at all. */
|
||||||
if (WEXITSTATUS (status) != 0) pid = -1;
|
if (WEXITSTATUS (status) != 0) pid = -1;
|
||||||
|
#ifdef WTERMSIG
|
||||||
|
/* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
|
||||||
|
-- blow chunks here --
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_WAITPID
|
#ifdef HAVE_WAITPID
|
||||||
/* Make sure union wait works with waitpid. */
|
/* Make sure union wait works with waitpid. */
|
||||||
pid = waitpid (-1, &status, 0);
|
pid = waitpid (-1, &status, 0);
|
||||||
#endif
|
#endif
|
||||||
],
|
],
|
||||||
AC_DEFINE(HAVE_UNION_WAIT))
|
[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_SYS_SIGLIST_DECLARED
|
AC_DECL_SYS_SIGLIST
|
||||||
|
|
||||||
# The presence of the following is not meant to imply
|
# The presence of the following is not meant to imply
|
||||||
# that make necessarily works on those systems.
|
# that make necessarily works on those systems.
|
||||||
AC_DYNIX_SEQ
|
AC_CHECK_LIB(sun, getpwnam)
|
||||||
AC_XENIX_DIR
|
|
||||||
AC_IRIX_SUN
|
|
||||||
|
|
||||||
AC_SUBST(REMOTE) REMOTE=stub
|
AC_SUBST(REMOTE) REMOTE=stub
|
||||||
AC_WITH(customs, [REMOTE=cstms
|
AC_ARG_WITH(customs, [export jobs with the Customs daemon (NOT SUPPORTED)],
|
||||||
LIBS="$LIBS libcustoms.a"])
|
[REMOTE=cstms LIBS="$LIBS libcustoms.a"])
|
||||||
|
|
||||||
echo checking for location of SCCS get command
|
echo checking for location of SCCS get command
|
||||||
if test -f /usr/sccs/get; then
|
if test -f /usr/sccs/get; then
|
||||||
@@ -81,14 +100,14 @@ if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
|
|||||||
test -f s.conftest; then
|
test -f s.conftest; then
|
||||||
# We successfully created an SCCS file.
|
# We successfully created an SCCS file.
|
||||||
echo checking if SCCS get command understands -G
|
echo checking if SCCS get command understands -G
|
||||||
if $SCCS_GET s.conftest -Gconftoast >/dev/null 2>&1 &&
|
if $SCCS_GET -Gconftoast s.conftest >/dev/null 2>&1 &&
|
||||||
test -f conftoast; then
|
test -f conftoast; then
|
||||||
AC_DEFINE(SCCS_GET_MINUS_G)
|
AC_DEFINE(SCCS_GET_MINUS_G)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f s.conftest conftoast
|
rm -f s.conftest conftoast
|
||||||
|
|
||||||
AC_OUTPUT(Makefile build.sh glob/Makefile, [
|
AC_OUTPUT(Makefile build.sh, [
|
||||||
# Makefile uses this timestamp file to know when to remake Makefile,
|
# Makefile uses this timestamp file to know when to remake Makefile,
|
||||||
# build.sh, and glob/Makefile.
|
# build.sh, and glob/Makefile.
|
||||||
touch stamp-config])
|
touch stamp-config])
|
||||||
|
|||||||
61
default.c
61
default.c
@@ -1,5 +1,5 @@
|
|||||||
/* Data base of default implicit rules for GNU Make.
|
/* Data base of default implicit rules for GNU Make.
|
||||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -23,6 +23,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "variable.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.
|
/* This is the default list of suffixes for suffix rules.
|
||||||
`.s' must come last, so that a `.o' file will be made from
|
`.s' must come last, so that a `.o' file will be made from
|
||||||
@@ -63,9 +69,9 @@ static struct pspec default_terminal_rules[] =
|
|||||||
|
|
||||||
/* SCCS. */
|
/* SCCS. */
|
||||||
{ "%", "s.%",
|
{ "%", "s.%",
|
||||||
"$(GET) $(GFLAGS) $< $(SCCS_OUTPUT_OPTION)" },
|
"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
|
||||||
{ "%", "SCCS/s.%",
|
{ "%", "SCCS/s.%",
|
||||||
"$(GET) $(GFLAGS) $< $(SCCS_OUTPUT_OPTION)" },
|
"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
|
||||||
|
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
@@ -95,24 +101,16 @@ static char *default_suffix_rules[] =
|
|||||||
".mod",
|
".mod",
|
||||||
"$(COMPILE.mod) -o $@ -e $@ $^",
|
"$(COMPILE.mod) -o $@ -e $@ $^",
|
||||||
|
|
||||||
".def.sym",
|
".def.sym",
|
||||||
"$(COMPILE.def) -o $@ $<",
|
"$(COMPILE.def) -o $@ $<",
|
||||||
|
|
||||||
".sh",
|
".sh",
|
||||||
"cat $< >$@ \n chmod a+x $@",
|
"cat $< >$@ \n chmod a+x $@",
|
||||||
|
|
||||||
".s.o",
|
".s.o",
|
||||||
#if !defined(M_XENIX) || defined(__GNUC__)
|
|
||||||
"$(COMPILE.s) -o $@ $<",
|
"$(COMPILE.s) -o $@ $<",
|
||||||
#else /* Xenix. */
|
|
||||||
"$(COMPILE.s) -o$@ $<",
|
|
||||||
#endif /* Not Xenix. */
|
|
||||||
".S.o",
|
".S.o",
|
||||||
#if !defined(M_XENIX) || defined(__GNUC__)
|
|
||||||
"$(COMPILE.S) -o $@ $<",
|
"$(COMPILE.S) -o $@ $<",
|
||||||
#else /* Xenix. */
|
|
||||||
"$(COMPILE.S) -o$@ $<",
|
|
||||||
#endif /* Not Xenix. */
|
|
||||||
".c.o",
|
".c.o",
|
||||||
"$(COMPILE.c) $< $(OUTPUT_OPTION)",
|
"$(COMPILE.c) $< $(OUTPUT_OPTION)",
|
||||||
".cc.o",
|
".cc.o",
|
||||||
@@ -133,12 +131,20 @@ static char *default_suffix_rules[] =
|
|||||||
".c.ln",
|
".c.ln",
|
||||||
"$(LINT.c) -C$* $<",
|
"$(LINT.c) -C$* $<",
|
||||||
".y.ln",
|
".y.ln",
|
||||||
|
#ifndef __MSDOS__
|
||||||
"$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
|
"$(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",
|
".l.ln",
|
||||||
"@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
|
"@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
|
||||||
|
|
||||||
".y.c",
|
".y.c",
|
||||||
|
#ifndef __MSDOS__
|
||||||
"$(YACC.y) $< \n mv -f y.tab.c $@",
|
"$(YACC.y) $< \n mv -f y.tab.c $@",
|
||||||
|
#else
|
||||||
|
"$(YACC.y) $< \n mv -f y_tab.c $@",
|
||||||
|
#endif
|
||||||
".l.c",
|
".l.c",
|
||||||
"@$(RM) $@ \n $(LEX.l) $< > $@",
|
"@$(RM) $@ \n $(LEX.l) $< > $@",
|
||||||
|
|
||||||
@@ -195,16 +201,15 @@ static char *default_suffix_rules[] =
|
|||||||
static char *default_variables[] =
|
static char *default_variables[] =
|
||||||
{
|
{
|
||||||
"AR", "ar",
|
"AR", "ar",
|
||||||
#ifndef __hpux
|
|
||||||
"ARFLAGS", "rv",
|
"ARFLAGS", "rv",
|
||||||
#else
|
|
||||||
/* HPUX ar's f flag says to truncate the file names to archive member
|
|
||||||
name length in comparisons, so replacement notices the equality. */
|
|
||||||
"ARFLAGS", "rfv",
|
|
||||||
#endif
|
|
||||||
"AS", "as",
|
"AS", "as",
|
||||||
|
#ifdef GCC_IS_NATIVE
|
||||||
|
"CC", "gcc",
|
||||||
|
"CXX", "gcc",
|
||||||
|
#else
|
||||||
"CC", "cc",
|
"CC", "cc",
|
||||||
"CXX", "g++",
|
"CXX", "g++",
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
|
/* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
|
||||||
and to the empty string if $@ does exist. */
|
and to the empty string if $@ does exist. */
|
||||||
@@ -237,7 +242,11 @@ static char *default_variables[] =
|
|||||||
#endif /* Cray. */
|
#endif /* Cray. */
|
||||||
"GET", SCCS_GET,
|
"GET", SCCS_GET,
|
||||||
"LD", "ld",
|
"LD", "ld",
|
||||||
|
#ifdef GCC_IS_NATIVE
|
||||||
|
"LEX", "flex",
|
||||||
|
#else
|
||||||
"LEX", "lex",
|
"LEX", "lex",
|
||||||
|
#endif
|
||||||
"LINT", "lint",
|
"LINT", "lint",
|
||||||
"M2C", "m2c",
|
"M2C", "m2c",
|
||||||
#ifdef pyr
|
#ifdef pyr
|
||||||
@@ -250,7 +259,11 @@ static char *default_variables[] =
|
|||||||
"PC", "pc",
|
"PC", "pc",
|
||||||
#endif /* CRAY. */
|
#endif /* CRAY. */
|
||||||
#endif /* pyr. */
|
#endif /* pyr. */
|
||||||
|
#ifdef GCC_IS_NATIVE
|
||||||
|
"YACC", "bison -y",
|
||||||
|
#else
|
||||||
"YACC", "yacc", /* Or "bison -y" */
|
"YACC", "yacc", /* Or "bison -y" */
|
||||||
|
#endif
|
||||||
"MAKEINFO", "makeinfo",
|
"MAKEINFO", "makeinfo",
|
||||||
"TEX", "tex",
|
"TEX", "tex",
|
||||||
"TEXI2DVI", "texi2dvi",
|
"TEXI2DVI", "texi2dvi",
|
||||||
@@ -284,21 +297,13 @@ static char *default_variables[] =
|
|||||||
"COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
|
"COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
|
||||||
"LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
|
"LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
|
||||||
"COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
|
"COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
|
||||||
#if !defined(M_XENIX) || defined(__GNUC__)
|
|
||||||
"PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
|
"PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
|
||||||
#else /* Xenix. */
|
|
||||||
"PREPROCESS.S", "$(CC) -EP $(CPPFLAGS)",
|
|
||||||
#endif /* Not Xenix. */
|
|
||||||
"PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
|
"PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
|
||||||
"PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
|
"PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
|
||||||
"LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
"LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
||||||
|
|
||||||
#ifndef NO_MINUS_C_MINUS_O
|
#ifndef NO_MINUS_C_MINUS_O
|
||||||
#if !defined(M_XENIX) || defined(__GNUC__)
|
|
||||||
"OUTPUT_OPTION", "-o $@",
|
"OUTPUT_OPTION", "-o $@",
|
||||||
#else /* Xenix. */
|
|
||||||
"OUTPUT_OPTION", "-Fo$@",
|
|
||||||
#endif /* Not Xenix. */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SCCS_GET_MINUS_G
|
#ifdef SCCS_GET_MINUS_G
|
||||||
@@ -336,7 +341,7 @@ void
|
|||||||
install_default_suffix_rules ()
|
install_default_suffix_rules ()
|
||||||
{
|
{
|
||||||
register char **s;
|
register char **s;
|
||||||
|
|
||||||
if (no_builtin_rules_flag)
|
if (no_builtin_rules_flag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -361,7 +366,7 @@ void
|
|||||||
install_default_implicit_rules ()
|
install_default_implicit_rules ()
|
||||||
{
|
{
|
||||||
register struct pspec *p;
|
register struct pspec *p;
|
||||||
|
|
||||||
if (no_builtin_rules_flag)
|
if (no_builtin_rules_flag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
135
dir.c
135
dir.c
@@ -1,5 +1,5 @@
|
|||||||
/* Directory hashing for GNU Make.
|
/* Directory hashing for GNU Make.
|
||||||
Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -18,35 +18,78 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
|
|
||||||
#include "make.h"
|
#include "make.h"
|
||||||
|
|
||||||
#if defined (POSIX) || defined (DIRENT) || defined (__GNU_LIBRARY__)
|
#if defined (POSIX) || defined (HAVE_DIRENT_H) || defined (__GNU_LIBRARY__)
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#ifndef __GNU_LIBRARY__
|
#if defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
|
||||||
#define D_NAMLEN(d) strlen((d)->d_name)
|
#define HAVE_D_NAMLEN
|
||||||
#else /* GNU C library. */
|
#endif /* GNU C library. */
|
||||||
#define D_NAMLEN(d) ((d)->d_namlen)
|
#else /* Not POSIX or HAVE_DIRENT_H. */
|
||||||
#endif /* Not GNU C library. */
|
|
||||||
#else /* Not POSIX or DIRENT. */
|
|
||||||
#define direct dirent
|
#define direct dirent
|
||||||
#define D_NAMLEN(d) ((d)->d_namlen)
|
#define HAVE_D_NAMLEN
|
||||||
#ifdef SYSNDIR
|
#ifdef HAVE_SYS_NDIR_H
|
||||||
#include <sys/ndir.h>
|
#include <sys/ndir.h>
|
||||||
#endif /* SYSNDIR */
|
#endif /* HAVE_SYS_NDIR_H */
|
||||||
#ifdef SYSDIR
|
#ifdef HAVE_SYS_DIR_H
|
||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
#endif /* SYSDIR */
|
#endif /* HAVE_SYS_DIR_H */
|
||||||
#ifdef NDIR
|
#ifdef HAVE_NDIR_H
|
||||||
#include <ndir.h>
|
#include <ndir.h>
|
||||||
#endif /* NDIR */
|
#endif /* HAVE_NDIR_H */
|
||||||
#endif /* POSIX or DIRENT or __GNU_LIBRARY__. */
|
#endif /* POSIX or HAVE_DIRENT_H or __GNU_LIBRARY__. */
|
||||||
|
|
||||||
#if defined (POSIX) && !defined (__GNU_LIBRARY__)
|
#if defined (POSIX) && !defined (__GNU_LIBRARY__)
|
||||||
/* Posix does not require that the d_ino field be present, and some
|
/* Posix does not require that the d_ino field be present, and some
|
||||||
systems do not provide it. */
|
systems do not provide it. */
|
||||||
#define REAL_DIR_ENTRY(dp) 1
|
#define REAL_DIR_ENTRY(dp) 1
|
||||||
|
#define FAKE_DIR_ENTRY(dp)
|
||||||
#else
|
#else
|
||||||
#define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
|
#define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
|
||||||
|
#define FAKE_DIR_ENTRY(dp) (dp->d_ino = 1)
|
||||||
#endif /* POSIX */
|
#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
|
||||||
|
|
||||||
/* Hash table of directories. */
|
/* Hash table of directories. */
|
||||||
|
|
||||||
#ifndef DIRECTORY_BUCKETS
|
#ifndef DIRECTORY_BUCKETS
|
||||||
@@ -213,6 +256,10 @@ dir_contents_file_exists_p (dir, filename)
|
|||||||
/* The directory could not be stat'd or opened. */
|
/* The directory could not be stat'd or opened. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
filename = dosify (filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
hash = 0;
|
hash = 0;
|
||||||
if (filename != 0)
|
if (filename != 0)
|
||||||
{
|
{
|
||||||
@@ -248,9 +295,13 @@ dir_contents_file_exists_p (dir, filename)
|
|||||||
if (!REAL_DIR_ENTRY (d))
|
if (!REAL_DIR_ENTRY (d))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
len = D_NAMLEN (d);
|
#ifdef HAVE_D_NAMLEN
|
||||||
|
len = d->d_namlen;
|
||||||
while (d->d_name[len - 1] == '\0')
|
while (d->d_name[len - 1] == '\0')
|
||||||
--len;
|
--len;
|
||||||
|
#else
|
||||||
|
len = strlen (d->d_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
HASH (newhash, d->d_name[i]);
|
HASH (newhash, d->d_name[i]);
|
||||||
@@ -397,13 +448,17 @@ file_impossible_p (filename)
|
|||||||
bcopy (p, dirname, dirend - p);
|
bcopy (p, dirname, dirend - p);
|
||||||
dirname[dirend - p] = '\0';
|
dirname[dirend - p] = '\0';
|
||||||
dir = find_directory (dirname)->contents;
|
dir = find_directory (dirname)->contents;
|
||||||
p = dirend + 1;
|
p = filename = dirend + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir == 0 || dir->files == 0)
|
if (dir == 0 || dir->files == 0)
|
||||||
/* There are no files entered for this directory. */
|
/* There are no files entered for this directory. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
p = filename = dosify (p);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (hash = 0; *p != '\0'; ++p)
|
for (hash = 0; *p != '\0'; ++p)
|
||||||
HASH (hash, *p);
|
HASH (hash, *p);
|
||||||
hash %= DIRFILE_BUCKETS;
|
hash %= DIRFILE_BUCKETS;
|
||||||
@@ -506,7 +561,7 @@ struct dirstream
|
|||||||
|
|
||||||
/* Forward declarations. */
|
/* Forward declarations. */
|
||||||
static __ptr_t open_dirstream __P ((const char *));
|
static __ptr_t open_dirstream __P ((const char *));
|
||||||
static const char *read_dirstream __P ((__ptr_t));
|
static struct dirent *read_dirstream __P ((__ptr_t));
|
||||||
|
|
||||||
static __ptr_t
|
static __ptr_t
|
||||||
open_dirstream (directory)
|
open_dirstream (directory)
|
||||||
@@ -533,12 +588,14 @@ open_dirstream (directory)
|
|||||||
return (__ptr_t) new;
|
return (__ptr_t) new;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static struct dirent *
|
||||||
read_dirstream (stream)
|
read_dirstream (stream)
|
||||||
__ptr_t stream;
|
__ptr_t stream;
|
||||||
{
|
{
|
||||||
struct dirstream *const ds = (struct dirstream *) stream;
|
struct dirstream *const ds = (struct dirstream *) stream;
|
||||||
register struct dirfile *df;
|
register struct dirfile *df;
|
||||||
|
static char *buf;
|
||||||
|
static unsigned int bufsz;
|
||||||
|
|
||||||
while (ds->bucket < DIRFILE_BUCKETS)
|
while (ds->bucket < DIRFILE_BUCKETS)
|
||||||
{
|
{
|
||||||
@@ -546,7 +603,28 @@ read_dirstream (stream)
|
|||||||
{
|
{
|
||||||
ds->elt = df->next;
|
ds->elt = df->next;
|
||||||
if (!df->impossible)
|
if (!df->impossible)
|
||||||
return df->name;
|
{
|
||||||
|
/* 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 HAVE_D_NAMLEN
|
||||||
|
d->d_namlen = len - 1;
|
||||||
|
#endif
|
||||||
|
memcpy (d->d_name, df->name, len);
|
||||||
|
return d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (++ds->bucket == DIRFILE_BUCKETS)
|
if (++ds->bucket == DIRFILE_BUCKETS)
|
||||||
break;
|
break;
|
||||||
@@ -557,9 +635,16 @@ read_dirstream (stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
init_dir ()
|
dir_setup_glob (gl)
|
||||||
|
glob_t *gl;
|
||||||
{
|
{
|
||||||
__glob_opendir_hook = open_dirstream;
|
extern int stat ();
|
||||||
__glob_readdir_hook = read_dirstream;
|
|
||||||
__glob_closedir_hook = (void (*) __P ((__ptr_t stream))) free;
|
/* 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. */
|
||||||
}
|
}
|
||||||
|
|||||||
208
expand.c
208
expand.c
@@ -1,5 +1,5 @@
|
|||||||
/* Variable expansion functions for GNU Make.
|
/* Variable expansion functions for GNU Make.
|
||||||
Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 91, 92, 93, 95 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -197,9 +197,9 @@ variable_expand (line)
|
|||||||
char openparen = *p;
|
char openparen = *p;
|
||||||
char closeparen = (openparen == '(') ? ')' : '}';
|
char closeparen = (openparen == '(') ? ')' : '}';
|
||||||
register char *beg = p + 1;
|
register char *beg = p + 1;
|
||||||
|
int free_beg = 0;
|
||||||
char *op, *begp;
|
char *op, *begp;
|
||||||
char *end;
|
char *end, *colon;
|
||||||
char *colon = 0;
|
|
||||||
|
|
||||||
op = o;
|
op = o;
|
||||||
begp = p;
|
begp = p;
|
||||||
@@ -213,10 +213,18 @@ variable_expand (line)
|
|||||||
/* Is there a variable reference inside the parens or braces?
|
/* Is there a variable reference inside the parens or braces?
|
||||||
If so, expand it before expanding the entire reference. */
|
If so, expand it before expanding the entire reference. */
|
||||||
|
|
||||||
p1 = index (beg, closeparen);
|
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)
|
if (p1 != 0)
|
||||||
p1 = lindex (beg, p1, '$');
|
|
||||||
if (p1 != 0 && lindex (beg, p1, ':') == 0)
|
|
||||||
{
|
{
|
||||||
/* BEG now points past the opening paren or brace.
|
/* BEG now points past the opening paren or brace.
|
||||||
Count parens or braces until it is matched. */
|
Count parens or braces until it is matched. */
|
||||||
@@ -227,133 +235,109 @@ variable_expand (line)
|
|||||||
++count;
|
++count;
|
||||||
else if (*p == closeparen && --count < 0)
|
else if (*p == closeparen && --count < 0)
|
||||||
break;
|
break;
|
||||||
else if (colon == 0 && count == 0 && *p == ':')
|
|
||||||
/* Record where we found a colon, which
|
|
||||||
indicates a substitution reference.
|
|
||||||
We want to expand the text before the
|
|
||||||
reference only. */
|
|
||||||
colon = p;
|
|
||||||
}
|
}
|
||||||
/* If COUNT is >= 0, there were unmatched opening parens
|
/* If COUNT is >= 0, there were unmatched opening parens
|
||||||
or braces, so we go to the simple case of a variable name
|
or braces, so we go to the simple case of a variable name
|
||||||
such as `$($(a)'. */
|
such as `$($(a)'. */
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
{
|
{
|
||||||
char *name = expand_argument (beg, colon == 0 ? p : colon);
|
beg = expand_argument (beg, p); /* Expand the name. */
|
||||||
unsigned int namelen = strlen (name);
|
free_beg = 1; /* Remember to free BEG when finished. */
|
||||||
if (colon == 0)
|
end = index (beg, '\0');
|
||||||
{
|
|
||||||
/* This is a simple reference to the expanded name. */
|
|
||||||
o = reference_variable (o, name, namelen);
|
|
||||||
free (name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This is a substitution reference to the expanded
|
|
||||||
name. We replace the pending text with a copy
|
|
||||||
containing the expanded name in place of the
|
|
||||||
original name, and then fall through to
|
|
||||||
the normal substitution reference code below. */
|
|
||||||
unsigned int restlen = strlen (colon) + 1;
|
|
||||||
beg = (char *) alloca (namelen + restlen);
|
|
||||||
bcopy (name, beg, namelen);
|
|
||||||
bcopy (colon, &beg[namelen], restlen);
|
|
||||||
/* Point COLON into the new copy. */
|
|
||||||
colon = &beg[namelen];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
|
/* This is not a reference to a built-in function and
|
||||||
it does not contain any variable references inside.
|
any variable references inside are now expanded.
|
||||||
There are several things it could be. */
|
Is the resultant text a substitution reference? */
|
||||||
|
|
||||||
if (colon == 0)
|
colon = lindex (beg, end, ':');
|
||||||
colon = index (beg, ':');
|
if (colon != 0)
|
||||||
if (colon != 0 && lindex (beg, colon, closeparen) == 0)
|
|
||||||
{
|
{
|
||||||
/* This is a substitution reference: $(FOO:A=B). */
|
/* This looks like a substitution reference: $(FOO:A=B). */
|
||||||
int count;
|
|
||||||
char *subst_beg, *subst_end, *replace_beg, *replace_end;
|
char *subst_beg, *subst_end, *replace_beg, *replace_end;
|
||||||
|
|
||||||
v = lookup_variable (beg, colon - beg);
|
|
||||||
if (v == 0)
|
|
||||||
warn_undefined (beg, colon - beg);
|
|
||||||
|
|
||||||
subst_beg = colon + 1;
|
subst_beg = colon + 1;
|
||||||
count = 0;
|
subst_end = index (subst_beg, '=');
|
||||||
for (p = subst_beg; *p != '\0'; ++p)
|
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
|
||||||
{
|
{
|
||||||
if (*p == openparen)
|
replace_beg = subst_end + 1;
|
||||||
++count;
|
replace_end = end;
|
||||||
else if (*p == closeparen)
|
|
||||||
--count;
|
/* Extract the variable name before the colon
|
||||||
else if (*p == '=' && count <= 0)
|
and look up that variable. */
|
||||||
break;
|
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 (count > 0)
|
|
||||||
/* There were unmatched opening parens. */
|
|
||||||
return initialize_variable_output ();
|
|
||||||
subst_end = p;
|
|
||||||
|
|
||||||
replace_beg = p + 1;
|
|
||||||
count = 0;
|
|
||||||
for (p = replace_beg; *p != '\0'; ++p)
|
|
||||||
{
|
|
||||||
if (*p == openparen)
|
|
||||||
++count;
|
|
||||||
else if (*p == closeparen && --count < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (count > 0)
|
|
||||||
/* There were unmatched opening parens. */
|
|
||||||
return initialize_variable_output ();
|
|
||||||
end = p;
|
|
||||||
replace_end = p;
|
|
||||||
|
|
||||||
p = expand_argument (subst_beg, subst_end);
|
|
||||||
p1 = expand_argument (replace_beg, replace_end);
|
|
||||||
|
|
||||||
if (v != 0 && *v->value != '\0')
|
|
||||||
{
|
|
||||||
char *value = (v->recursive ? recursively_expand (v)
|
|
||||||
: v->value);
|
|
||||||
char *percent = find_percent (p);
|
|
||||||
if (percent != 0)
|
|
||||||
o = patsubst_expand (o, value, p, p1,
|
|
||||||
percent, (char *) 0);
|
|
||||||
else
|
|
||||||
o = subst_expand (o, value,
|
|
||||||
p, p1, strlen (p), strlen (p1),
|
|
||||||
0, 1);
|
|
||||||
if (v->recursive)
|
|
||||||
free (value);
|
|
||||||
}
|
|
||||||
|
|
||||||
free (p);
|
|
||||||
free (p1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No, this must be an ordinary variable reference. */
|
if (colon == 0)
|
||||||
else
|
/* This is an ordinary variable reference.
|
||||||
{
|
Look up the value of the variable. */
|
||||||
/* Look up the value of the variable. */
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
o = reference_variable (o, beg, end - beg);
|
o = reference_variable (o, beg, end - beg);
|
||||||
}
|
|
||||||
|
|
||||||
/* Advance p past the variable reference to resume scan. */
|
if (free_beg)
|
||||||
p = end;
|
free (beg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
58
file.c
58
file.c
@@ -1,5 +1,5 @@
|
|||||||
/* Target file hash table management for GNU Make.
|
/* Target file hash table management for GNU Make.
|
||||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -21,6 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#include "dep.h"
|
#include "dep.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
/* Hash table of files the makefile knows how to make. */
|
/* Hash table of files the makefile knows how to make. */
|
||||||
@@ -294,7 +295,9 @@ remove_intermediates (sig)
|
|||||||
register struct file *f;
|
register struct file *f;
|
||||||
char doneany;
|
char doneany;
|
||||||
|
|
||||||
if (!sig && just_print_flag)
|
if (question_flag || touch_flag)
|
||||||
|
return;
|
||||||
|
if (sig && just_print_flag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
doneany = 0;
|
doneany = 0;
|
||||||
@@ -303,7 +306,11 @@ remove_intermediates (sig)
|
|||||||
if (f->intermediate && (f->dontcare || !f->precious))
|
if (f->intermediate && (f->dontcare || !f->precious))
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
if (just_print_flag)
|
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;
|
status = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -383,6 +390,47 @@ snap_deps ()
|
|||||||
f = lookup_file (".EXPORT_ALL_VARIABLES");
|
f = lookup_file (".EXPORT_ALL_VARIABLES");
|
||||||
if (f != 0 && f->is_target)
|
if (f != 0 && f->is_target)
|
||||||
export_all_variables = 1;
|
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. */
|
/* Print the data base of files. */
|
||||||
@@ -450,6 +498,10 @@ print_file (f)
|
|||||||
puts ("# Successfully updated.");
|
puts ("# Successfully updated.");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
assert (question_flag);
|
||||||
|
puts ("# Needs to be updated (-q is set).");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
puts ("# Failed to be updated.");
|
puts ("# Failed to be updated.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
4
file.h
4
file.h
@@ -25,7 +25,8 @@ struct file
|
|||||||
struct file *next;
|
struct file *next;
|
||||||
char *name;
|
char *name;
|
||||||
struct dep *deps;
|
struct dep *deps;
|
||||||
struct commands *cmds; /* Commands to execute for this target */
|
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
|
char *stem; /* Implicit stem, if an implicit
|
||||||
rule has been used */
|
rule has been used */
|
||||||
struct dep *also_make; /* Targets that are made by making this. */
|
struct dep *also_make; /* Targets that are made by making this. */
|
||||||
@@ -85,6 +86,7 @@ extern struct file *default_goal_file, *suffix_file, *default_file;
|
|||||||
extern struct file *lookup_file (), *enter_file ();
|
extern struct file *lookup_file (), *enter_file ();
|
||||||
extern void remove_intermediates (), snap_deps ();
|
extern void remove_intermediates (), snap_deps ();
|
||||||
extern void rename_file (), file_hash_enter ();
|
extern void rename_file (), file_hash_enter ();
|
||||||
|
extern void set_command_state ();
|
||||||
|
|
||||||
|
|
||||||
extern time_t f_mtime ();
|
extern time_t f_mtime ();
|
||||||
|
|||||||
71
function.c
71
function.c
@@ -1,5 +1,5 @@
|
|||||||
/* Variable function expansion for GNU Make.
|
/* Variable function expansion for GNU Make.
|
||||||
Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -22,6 +22,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "job.h"
|
#include "job.h"
|
||||||
|
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
#include <process.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *string_glob ();
|
static char *string_glob ();
|
||||||
|
|
||||||
/* Store into VARIABLE_BUFFER at O the result of scanning TEXT and replacing
|
/* Store into VARIABLE_BUFFER at O the result of scanning TEXT and replacing
|
||||||
@@ -371,6 +376,7 @@ expand_function (o, function, text, end)
|
|||||||
else
|
else
|
||||||
error_prefix = "";
|
error_prefix = "";
|
||||||
|
|
||||||
|
#ifndef __MSDOS__
|
||||||
if (pipe (pipedes) < 0)
|
if (pipe (pipedes) < 0)
|
||||||
{
|
{
|
||||||
perror_with_name (error_prefix, "pipe");
|
perror_with_name (error_prefix, "pipe");
|
||||||
@@ -475,6 +481,69 @@ expand_function (o, function, text, end)
|
|||||||
|
|
||||||
free (buffer);
|
free (buffer);
|
||||||
}
|
}
|
||||||
|
#else /* MSDOS. */
|
||||||
|
{
|
||||||
|
/* MS-DOS can't do fork, but it can do spawn. However, this
|
||||||
|
means that we don't have an opportunity to reopen stdout to
|
||||||
|
trap it. Thus, we save our own stdout onto a new descriptor
|
||||||
|
and dup a temp file's descriptor onto our stdout temporarily.
|
||||||
|
After we spawn the shell program, we dup our own stdout back
|
||||||
|
to the stdout descriptor. The buffer reading is the same as
|
||||||
|
above, except that we're now reading from a file. */
|
||||||
|
|
||||||
|
int save_stdout;
|
||||||
|
int child_stdout;
|
||||||
|
char tmp_output[FILENAME_MAX];
|
||||||
|
FILE *child_stream;
|
||||||
|
unsigned int maxlen = 200;
|
||||||
|
int cc;
|
||||||
|
char *buffer;
|
||||||
|
|
||||||
|
strcpy (tmp_output, "shXXXXXX");
|
||||||
|
mktemp (tmp_output);
|
||||||
|
child_stdout = open (tmp_output,
|
||||||
|
O_WRONLY|O_CREAT|O_TRUNC|O_TEXT, 0644);
|
||||||
|
save_stdout = dup (1);
|
||||||
|
dup2 (child_stdout, 1);
|
||||||
|
spawnvp (P_WAIT, argv[0], argv);
|
||||||
|
dup2 (save_stdout, 1);
|
||||||
|
close (child_stdout);
|
||||||
|
close (save_stdout);
|
||||||
|
|
||||||
|
child_stdout = open (tmp_output, O_RDONLY|O_TEXT, 0644);
|
||||||
|
|
||||||
|
buffer = xmalloc (maxlen);
|
||||||
|
i = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (i == maxlen)
|
||||||
|
{
|
||||||
|
maxlen += 512;
|
||||||
|
buffer = (char *) xrealloc (buffer, maxlen + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cc = read (child_stdout, &buffer[i], maxlen - i);
|
||||||
|
if (cc > 0)
|
||||||
|
i += cc;
|
||||||
|
} while (cc > 0);
|
||||||
|
|
||||||
|
close (child_stdout);
|
||||||
|
unlink (tmp_output);
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
if (buffer[i - 1] == '\n')
|
||||||
|
buffer[--i] = '\0';
|
||||||
|
else
|
||||||
|
buffer[i] = '\0';
|
||||||
|
p = buffer;
|
||||||
|
while ((p = index (p, '\n')) != 0)
|
||||||
|
*p++ = ' ';
|
||||||
|
o = variable_buffer_output (o, buffer, i);
|
||||||
|
}
|
||||||
|
free (buffer);
|
||||||
|
}
|
||||||
|
#endif /* Not MSDOS. */
|
||||||
|
|
||||||
free (text);
|
free (text);
|
||||||
break;
|
break;
|
||||||
|
|||||||
133
getloadavg.c
133
getloadavg.c
@@ -1,5 +1,5 @@
|
|||||||
/* Get the system load averages.
|
/* Get the system load averages.
|
||||||
Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93
|
Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93, 1994, 1995
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
apollo
|
apollo
|
||||||
BSD Real BSD, not just BSD-like.
|
BSD Real BSD, not just BSD-like.
|
||||||
|
convex
|
||||||
DGUX
|
DGUX
|
||||||
eunice UNIX emulator under VMS.
|
eunice UNIX emulator under VMS.
|
||||||
hpux
|
hpux
|
||||||
@@ -59,6 +60,11 @@
|
|||||||
We also #define LDAV_PRIVILEGED if a program will require
|
We also #define LDAV_PRIVILEGED if a program will require
|
||||||
special installation to be able to call getloadavg. */
|
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>
|
#include <sys/types.h>
|
||||||
|
|
||||||
/* Both the Emacs and non-Emacs sections want this. Some
|
/* Both the Emacs and non-Emacs sections want this. Some
|
||||||
@@ -69,20 +75,17 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#if defined (emacs) || defined (CONFIG_BROKETS)
|
|
||||||
/* 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 it found this file in $srcdir). */
|
|
||||||
#include <config.h>
|
|
||||||
#else
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Exclude all the code except the test program at the end
|
/* Exclude all the code except the test program at the end
|
||||||
if the system has its own `getloadavg' function. */
|
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
|
#ifndef HAVE_GETLOADAVG
|
||||||
|
|
||||||
@@ -141,6 +144,7 @@
|
|||||||
|
|
||||||
#if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
|
#if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
|
||||||
#define OSF_ALPHA
|
#define OSF_ALPHA
|
||||||
|
#include <sys/table.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__osf__) && (defined (mips) || defined (__mips__))
|
#if defined (__osf__) && (defined (mips) || defined (__mips__))
|
||||||
@@ -203,6 +207,21 @@
|
|||||||
#define LOAD_AVE_TYPE long
|
#define LOAD_AVE_TYPE long
|
||||||
#endif
|
#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. */
|
#endif /* No LOAD_AVE_TYPE. */
|
||||||
|
|
||||||
#ifdef OSF_ALPHA
|
#ifdef OSF_ALPHA
|
||||||
@@ -212,6 +231,13 @@
|
|||||||
#define FSCALE 1024.0
|
#define FSCALE 1024.0
|
||||||
#endif
|
#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
|
#ifndef FSCALE
|
||||||
|
|
||||||
@@ -240,6 +266,10 @@
|
|||||||
#define FSCALE 100.0
|
#define FSCALE 100.0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _AIX
|
||||||
|
#define FSCALE 65536.0
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* Not FSCALE. */
|
#endif /* Not FSCALE. */
|
||||||
|
|
||||||
#if !defined (LDAV_CVT) && defined (FSCALE)
|
#if !defined (LDAV_CVT) && defined (FSCALE)
|
||||||
@@ -289,7 +319,7 @@
|
|||||||
#define NLIST_STRUCT
|
#define NLIST_STRUCT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef tex4300
|
#ifdef tek4300
|
||||||
#define NLIST_STRUCT
|
#define NLIST_STRUCT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -297,6 +327,14 @@
|
|||||||
#define NLIST_STRUCT
|
#define NLIST_STRUCT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(alliant) && defined(i860) /* Alliant FX/2800 */
|
||||||
|
#define NLIST_STRUCT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _AIX
|
||||||
|
#define NLIST_STRUCT
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* defined (NLIST_STRUCT) */
|
#endif /* defined (NLIST_STRUCT) */
|
||||||
|
|
||||||
|
|
||||||
@@ -322,7 +360,7 @@
|
|||||||
#define LDAV_SYMBOL "_Loadavg"
|
#define LDAV_SYMBOL "_Loadavg"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(LDAV_SYMBOL) && ((defined(hpux) && !defined(hp9000s300)) || defined(_SEQUENT_) || defined(SVR4) || defined(ISC) || defined(sgi) || (defined (ardent) && defined (titan)))
|
#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"
|
#define LDAV_SYMBOL "avenrun"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -331,11 +369,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#ifndef errno
|
|
||||||
extern int errno;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* LOAD_AVE_TYPE should only get defined if we're going to use the
|
/* LOAD_AVE_TYPE should only get defined if we're going to use the
|
||||||
nlist method. */
|
nlist method. */
|
||||||
@@ -699,6 +732,18 @@ getloadavg (loadavg, nelem)
|
|||||||
: (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
|
: (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
|
||||||
#endif /* OSF_MIPS */
|
#endif /* OSF_MIPS */
|
||||||
|
|
||||||
|
#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)
|
#if !defined (LDAV_DONE) && defined (VMS)
|
||||||
/* VMS specific code -- read from the Load Ave driver. */
|
/* VMS specific code -- read from the Load Ave driver. */
|
||||||
|
|
||||||
@@ -765,23 +810,29 @@ getloadavg (loadavg, nelem)
|
|||||||
#endif /* NLIST_STRUCT */
|
#endif /* NLIST_STRUCT */
|
||||||
|
|
||||||
#ifndef SUNOS_5
|
#ifndef SUNOS_5
|
||||||
if (nlist (KERNEL_FILE, nl) >= 0)
|
if (
|
||||||
/* Omit "&& nl[0].n_type != 0 " -- it breaks on Sun386i. */
|
#if !(defined (_AIX) && !defined (ps2))
|
||||||
{
|
nlist (KERNEL_FILE, nl)
|
||||||
#ifdef FIXUP_KERNEL_SYMBOL_ADDR
|
#else /* _AIX */
|
||||||
FIXUP_KERNEL_SYMBOL_ADDR (nl);
|
knlist (nl, 1, sizeof (nl[0]))
|
||||||
#endif
|
#endif
|
||||||
offset = nl[0].n_value;
|
>= 0)
|
||||||
}
|
/* Omit "&& nl[0].n_type != 0 " -- it breaks on Sun386i. */
|
||||||
#endif /* !SUNOS_5 */
|
{
|
||||||
#else /* sgi */
|
#ifdef FIXUP_KERNEL_SYMBOL_ADDR
|
||||||
int ldav_off;
|
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);
|
ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
|
||||||
if (ldav_off != -1)
|
if (ldav_off != -1)
|
||||||
offset = (long) ldav_off & 0x7fffffff;
|
offset = (long) ldav_off & 0x7fffffff;
|
||||||
#endif /* sgi */
|
#endif /* sgi */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we have /dev/kmem open. */
|
/* Make sure we have /dev/kmem open. */
|
||||||
if (!getloadavg_initialized)
|
if (!getloadavg_initialized)
|
||||||
@@ -789,7 +840,17 @@ getloadavg (loadavg, nelem)
|
|||||||
#ifndef SUNOS_5
|
#ifndef SUNOS_5
|
||||||
channel = open ("/dev/kmem", 0);
|
channel = open ("/dev/kmem", 0);
|
||||||
if (channel >= 0)
|
if (channel >= 0)
|
||||||
getloadavg_initialized = 1;
|
{
|
||||||
|
/* 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 */
|
#else /* SUNOS_5 */
|
||||||
/* We pass 0 for the kernel, corefile, and swapfile names
|
/* We pass 0 for the kernel, corefile, and swapfile names
|
||||||
to use the currently running kernel. */
|
to use the currently running kernel. */
|
||||||
|
|||||||
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!
|
||||||
93
glob/ChangeLog
Normal file
93
glob/ChangeLog
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
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 .. $@
|
||||||
1547
glob/configure
vendored
Executable file
1547
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)
|
||||||
200
glob/fnmatch.c
Normal file
200
glob/fnmatch.c
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
/* 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. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#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++;
|
||||||
|
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 == '\\')
|
||||||
|
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 == '\\')
|
||||||
|
/* 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 */
|
||||||
784
glob/glob.c
Normal file
784
glob/glob.c
Normal file
@@ -0,0 +1,784 @@
|
|||||||
|
/* Copyright (C) 1991, 1992, 1993, 1994, 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. */
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
|
#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
|
||||||
|
extern int errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#define NULL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (POSIX) || defined (HAVE_DIRENT_H) || defined (__GNU_LIBRARY__)
|
||||||
|
#include <dirent.h>
|
||||||
|
#ifndef __GNU_LIBRARY__
|
||||||
|
#define D_NAMLEN(d) strlen((d)->d_name)
|
||||||
|
#else /* GNU C library. */
|
||||||
|
#define D_NAMLEN(d) ((d)->d_namlen)
|
||||||
|
#endif /* Not GNU C library. */
|
||||||
|
#else /* Not POSIX or HAVE_DIRENT_H. */
|
||||||
|
#define direct dirent
|
||||||
|
#define D_NAMLEN(d) ((d)->d_namlen)
|
||||||
|
#ifdef HAVE_SYS_NDIR_H
|
||||||
|
#include <sys/ndir.h>
|
||||||
|
#endif /* HAVE_SYS_NDIR_H */
|
||||||
|
#ifdef HAVE_SYS_DIR_H
|
||||||
|
#include <sys/dir.h>
|
||||||
|
#endif /* HAVE_SYS_DIR_H */
|
||||||
|
#ifdef HAVE_NDIR_H
|
||||||
|
#include <ndir.h>
|
||||||
|
#endif /* HAVE_NDIR_H */
|
||||||
|
#endif /* POSIX or HAVE_DIRENT_H or __GNU_LIBRARY__. */
|
||||||
|
|
||||||
|
#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
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
#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)
|
||||||
|
{
|
||||||
|
const char *end = strchr (begin + 1, '}');
|
||||||
|
if (end != NULL && end != begin + 1)
|
||||||
|
{
|
||||||
|
size_t restlen = strlen (end + 1) + 1;
|
||||||
|
const char *p, *comma;
|
||||||
|
char *buf;
|
||||||
|
size_t bufsz = 0;
|
||||||
|
int firstc;
|
||||||
|
if (!(flags & GLOB_APPEND))
|
||||||
|
{
|
||||||
|
pglob->gl_pathc = 0;
|
||||||
|
pglob->gl_pathv = NULL;
|
||||||
|
}
|
||||||
|
firstc = pglob->gl_pathc;
|
||||||
|
for (p = begin + 1;; p = comma + 1)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
comma = strchr (p, ',');
|
||||||
|
if (comma == NULL)
|
||||||
|
comma = strchr (p, '\0');
|
||||||
|
if ((begin - pattern) + (comma - p) + 1 > bufsz)
|
||||||
|
{
|
||||||
|
if (bufsz * 2 < comma - p + 1)
|
||||||
|
bufsz *= 2;
|
||||||
|
else
|
||||||
|
bufsz = comma - p + 1;
|
||||||
|
buf = __alloca (bufsz);
|
||||||
|
}
|
||||||
|
memcpy (buf, pattern, begin - pattern);
|
||||||
|
memcpy (buf + (begin - pattern), p, comma - p);
|
||||||
|
memcpy (buf + (begin - pattern) + (comma - p), end, restlen);
|
||||||
|
result = glob (buf, (flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC) |
|
||||||
|
GLOB_APPEND), errfunc, pglob);
|
||||||
|
if (result && result != GLOB_NOMATCH)
|
||||||
|
return result;
|
||||||
|
if (*comma == '\0')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (pglob->gl_pathc == firstc &&
|
||||||
|
!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
|
||||||
|
return GLOB_NOMATCH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the filename. */
|
||||||
|
filename = strrchr (pattern, '/');
|
||||||
|
if (filename == NULL)
|
||||||
|
{
|
||||||
|
filename = pattern;
|
||||||
|
dirname = (char *) ".";
|
||||||
|
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");
|
||||||
|
if (dirname == NULL || dirname[0] == '\0')
|
||||||
|
{
|
||||||
|
extern char *getlogin ();
|
||||||
|
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. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Look up specific user's home directory. */
|
||||||
|
struct passwd *p = getpwnam (dirname + 1);
|
||||||
|
if (p != NULL)
|
||||||
|
dirname = p->pw_dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
#ifdef HAVE_D_NAMLEN
|
||||||
|
len = d->d_namlen;
|
||||||
|
#else
|
||||||
|
len = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (fnmatch (pattern, name,
|
||||||
|
(!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
|
||||||
|
((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)) == 0)
|
||||||
|
{
|
||||||
|
struct globlink *new
|
||||||
|
= (struct globlink *) __alloca (sizeof (struct globlink));
|
||||||
|
if (len == 0)
|
||||||
|
len = strlen (name);
|
||||||
|
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 */
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
@display
|
@display
|
||||||
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
|
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
|
||||||
675 Mass Ave, Cambridge, MA 02139, USA
|
59 Temple Place -- Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ pattern_search (file, archive, depth, recursions)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we have found a matching rule that won't match all filenames,
|
/* If we have found a matching rule that won't match all filenames,
|
||||||
retroactively reject any "terminal" rules that do always match. */
|
retroactively reject any non-"terminal" rules that do always match. */
|
||||||
if (specific_rule_matched)
|
if (specific_rule_matched)
|
||||||
for (i = 0; i < nrules; ++i)
|
for (i = 0; i < nrules; ++i)
|
||||||
if (!tryrules[i]->terminal)
|
if (!tryrules[i]->terminal)
|
||||||
|
|||||||
554
job.c
554
job.c
@@ -1,5 +1,5 @@
|
|||||||
/* Job execution and handling for GNU Make.
|
/* Job execution and handling for GNU Make.
|
||||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -21,13 +21,27 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#include "job.h"
|
#include "job.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
|
#include <assert.h>
|
||||||
/* Default path to search for executables. */
|
|
||||||
static char default_path[] = ":/bin:/usr/bin";
|
|
||||||
|
|
||||||
/* Default shell to use. */
|
/* Default shell to use. */
|
||||||
char default_shell[] = "/bin/sh";
|
char default_shell[] = "/bin/sh";
|
||||||
|
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
#include <process.h>
|
||||||
|
static int dos_pid = 123;
|
||||||
|
static int dos_status;
|
||||||
|
static char *dos_bname;
|
||||||
|
static char *dos_bename;
|
||||||
|
static int dos_batch_file;
|
||||||
|
#endif /* MSDOS. */
|
||||||
|
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <sys/file.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* If NGROUPS_MAX == 0 then try other methods for finding a real value. */
|
/* If NGROUPS_MAX == 0 then try other methods for finding a real value. */
|
||||||
#if defined (NGROUPS_MAX) && NGROUPS_MAX == 0
|
#if defined (NGROUPS_MAX) && NGROUPS_MAX == 0
|
||||||
#undef NGROUPS_MAX
|
#undef NGROUPS_MAX
|
||||||
@@ -41,7 +55,7 @@ char default_shell[] = "/bin/sh";
|
|||||||
#endif /* POSIX. */
|
#endif /* POSIX. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#if defined (HAVE_SYS_WAIT_H) || defined (HAVE_UNION_WAIT)
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -110,24 +124,12 @@ extern int geteuid (), getegid ();
|
|||||||
extern int setgid (), getgid ();
|
extern int setgid (), getgid ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef getdtablesize
|
|
||||||
#ifdef HAVE_GETDTABLESIZE
|
|
||||||
extern int getdtablesize ();
|
|
||||||
#else
|
|
||||||
#include <sys/param.h>
|
|
||||||
#define getdtablesize() NOFILE
|
|
||||||
#if !defined (NOFILE) && defined (NOFILES_MAX)
|
|
||||||
/* SCO 3.2 "devsys 4.2" defines NOFILES_{MIN,MAX} in lieu of NOFILE. */
|
|
||||||
#define NOFILE NOFILES_MAX
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int getloadavg ();
|
extern int getloadavg ();
|
||||||
extern int start_remote_job_p ();
|
extern int start_remote_job_p ();
|
||||||
extern int start_remote_job (), remote_status ();
|
extern int start_remote_job (), remote_status ();
|
||||||
|
|
||||||
RETSIGTYPE child_handler ();
|
RETSIGTYPE child_handler ();
|
||||||
|
void unblock_sigs ();
|
||||||
static void free_child (), start_job_command ();
|
static void free_child (), start_job_command ();
|
||||||
static int load_too_high (), job_next_command ();
|
static int load_too_high (), job_next_command ();
|
||||||
|
|
||||||
@@ -157,19 +159,17 @@ child_error (target_name, exit_code, exit_sig, coredump, ignored)
|
|||||||
int exit_code, exit_sig, coredump;
|
int exit_code, exit_sig, coredump;
|
||||||
int ignored;
|
int ignored;
|
||||||
{
|
{
|
||||||
|
if (ignored && silent_flag)
|
||||||
|
return;
|
||||||
|
|
||||||
if (exit_sig == 0)
|
if (exit_sig == 0)
|
||||||
error (ignored ? "[%s] Error %d (ignored)" :
|
error (ignored ? "[%s] Error %d (ignored)" :
|
||||||
"*** [%s] Error %d",
|
"*** [%s] Error %d",
|
||||||
target_name, exit_code);
|
target_name, exit_code);
|
||||||
else
|
else
|
||||||
{
|
error ("*** [%s] %s%s",
|
||||||
char *coredump_string = coredump ? " (core dumped)" : "";
|
target_name, strsignal (exit_sig),
|
||||||
if (exit_sig > 0 && exit_sig < NSIG)
|
coredump ? " (core dumped)" : "");
|
||||||
error ("*** [%s] %s%s",
|
|
||||||
target_name, sys_siglist[exit_sig], coredump_string);
|
|
||||||
else
|
|
||||||
error ("*** [%s] Signal %d%s", target_name, exit_sig, coredump_string);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int dead_children = 0;
|
static unsigned int dead_children = 0;
|
||||||
@@ -260,6 +260,7 @@ reap_children (block, err)
|
|||||||
}
|
}
|
||||||
else if (pid == 0)
|
else if (pid == 0)
|
||||||
{
|
{
|
||||||
|
#ifndef __MSDOS__
|
||||||
/* No remote children. Check for local children. */
|
/* No remote children. Check for local children. */
|
||||||
|
|
||||||
if (any_local)
|
if (any_local)
|
||||||
@@ -308,6 +309,14 @@ reap_children (block, err)
|
|||||||
exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
|
exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
|
||||||
coredump = WCOREDUMP (status);
|
coredump = WCOREDUMP (status);
|
||||||
}
|
}
|
||||||
|
#else /* MSDOS. */
|
||||||
|
/* Life is very different on MSDOS. */
|
||||||
|
pid = dos_pid - 1;
|
||||||
|
status = dos_status;
|
||||||
|
exit_code = dos_status;
|
||||||
|
exit_sig = 0;
|
||||||
|
coredump = 0;
|
||||||
|
#endif /* Not MSDOS. */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* We got a remote child. */
|
/* We got a remote child. */
|
||||||
@@ -359,9 +368,15 @@ reap_children (block, err)
|
|||||||
{
|
{
|
||||||
/* The commands failed. Write an error message,
|
/* The commands failed. Write an error message,
|
||||||
delete non-precious targets, and abort. */
|
delete non-precious targets, and abort. */
|
||||||
|
static int delete_on_error = -1;
|
||||||
child_error (c->file->name, exit_code, exit_sig, coredump, 0);
|
child_error (c->file->name, exit_code, exit_sig, coredump, 0);
|
||||||
c->file->update_status = 1;
|
c->file->update_status = 2;
|
||||||
if (exit_sig != 0)
|
if (delete_on_error == -1)
|
||||||
|
{
|
||||||
|
struct file *f = lookup_file (".DELETE_ON_ERROR");
|
||||||
|
delete_on_error = f != 0 && f->is_target;
|
||||||
|
}
|
||||||
|
if (exit_sig != 0 || delete_on_error)
|
||||||
delete_child_targets (c);
|
delete_child_targets (c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -383,8 +398,7 @@ reap_children (block, err)
|
|||||||
Since there are more commands that wanted to be run,
|
Since there are more commands that wanted to be run,
|
||||||
the target was not completely remade. So we treat
|
the target was not completely remade. So we treat
|
||||||
this as if a command had failed. */
|
this as if a command had failed. */
|
||||||
c->file->command_state = cs_finished;
|
c->file->update_status = 2;
|
||||||
c->file->update_status = 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -394,32 +408,38 @@ reap_children (block, err)
|
|||||||
by start_remote_job_p. */
|
by start_remote_job_p. */
|
||||||
c->remote = start_remote_job_p ();
|
c->remote = start_remote_job_p ();
|
||||||
start_job_command (c);
|
start_job_command (c);
|
||||||
|
/* Fatal signals are left blocked in case we were
|
||||||
|
about to put that child on the chain. But it is
|
||||||
|
already there, so it is safe for a fatal signal to
|
||||||
|
arrive now; it will clean up this child's targets. */
|
||||||
|
unblock_sigs ();
|
||||||
|
if (c->file->command_state == cs_running)
|
||||||
|
/* We successfully started the new command.
|
||||||
|
Loop to reap more children. */
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (c->file->command_state)
|
|
||||||
{
|
|
||||||
case cs_running:
|
|
||||||
/* Successfully started. Loop to reap more children. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case cs_finished:
|
|
||||||
if (c->file->update_status != 0)
|
if (c->file->update_status != 0)
|
||||||
/* We failed to start the commands. */
|
/* We failed to start the commands. */
|
||||||
delete_child_targets (c);
|
delete_child_targets (c);
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
error ("internal error: `%s' has bogus command_state \
|
|
||||||
%d in reap_children",
|
|
||||||
c->file->name, (int) c->file->command_state);
|
|
||||||
abort ();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
/* There are no more commands. We got through them all
|
||||||
|
without an unignored error. Now the target has been
|
||||||
|
successfully updated. */
|
||||||
|
c->file->update_status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When we get here, all the commands for C->file are finished
|
||||||
|
(or aborted) and C->file->update_status contains 0 or 2. But
|
||||||
|
C->file->command_state is still cs_running if all the commands
|
||||||
|
ran; notice_finish_file looks for cs_running to tell it that
|
||||||
|
it's interesting to check the file's modtime again now. */
|
||||||
|
|
||||||
if (! handling_fatal_signal)
|
if (! handling_fatal_signal)
|
||||||
/* Notice if the target of the commands has been changed. */
|
/* Notice if the target of the commands has been changed.
|
||||||
|
This also propagates its values for command_state and
|
||||||
|
update_status to its also_make files. */
|
||||||
notice_finished_file (c->file);
|
notice_finished_file (c->file);
|
||||||
|
|
||||||
if (debug_flag)
|
if (debug_flag)
|
||||||
@@ -475,6 +495,13 @@ free_child (child)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
void
|
||||||
|
unblock_sigs ()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
extern sigset_t fatal_signal_set;
|
extern sigset_t fatal_signal_set;
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -485,9 +512,14 @@ unblock_sigs ()
|
|||||||
sigprocmask (SIG_SETMASK, &empty, (sigset_t *) 0);
|
sigprocmask (SIG_SETMASK, &empty, (sigset_t *) 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Start a job to run the commands specified in CHILD.
|
/* Start a job to run the commands specified in CHILD.
|
||||||
CHILD is updated to reflect the commands and ID of the child process. */
|
CHILD is updated to reflect the commands and ID of the child process.
|
||||||
|
|
||||||
|
NOTE: On return fatal signals are blocked! The caller is responsible
|
||||||
|
for calling `unblock_sigs', once the new child is safely on the chain so
|
||||||
|
it can be cleaned up in the event of a fatal signal. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
start_job_command (child)
|
start_job_command (child)
|
||||||
@@ -495,9 +527,14 @@ start_job_command (child)
|
|||||||
{
|
{
|
||||||
static int bad_stdin = -1;
|
static int bad_stdin = -1;
|
||||||
register char *p;
|
register char *p;
|
||||||
int flags = child->file->cmds->lines_flags[child->command_line - 1];
|
int flags;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
|
/* Combine the flags parsed for the line itself with
|
||||||
|
the flags specified globally for this target. */
|
||||||
|
flags = (child->file->command_flags
|
||||||
|
| child->file->cmds->lines_flags[child->command_line - 1]);
|
||||||
|
|
||||||
p = child->command_ptr;
|
p = child->command_ptr;
|
||||||
child->noerror = flags & COMMANDS_NOERROR;
|
child->noerror = flags & COMMANDS_NOERROR;
|
||||||
while (*p != '\0')
|
while (*p != '\0')
|
||||||
@@ -517,18 +554,18 @@ start_job_command (child)
|
|||||||
1 tells the user that -q is saying `something to do'; the exit status
|
1 tells the user that -q is saying `something to do'; the exit status
|
||||||
for a random error is 2. */
|
for a random error is 2. */
|
||||||
if (question_flag && !(flags & COMMANDS_RECURSE))
|
if (question_flag && !(flags & COMMANDS_RECURSE))
|
||||||
{
|
{
|
||||||
child->file->update_status = 1;
|
child->file->update_status = 1;
|
||||||
child->file->command_state = cs_finished;
|
notice_finished_file (child->file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There may be some preceding whitespace left if there
|
/* There may be some preceding whitespace left if there
|
||||||
was nothing but a backslash on the first line. */
|
was nothing but a backslash on the first line. */
|
||||||
p = next_token (p);
|
p = next_token (p);
|
||||||
|
|
||||||
/* Figure out an argument list from this command line. */
|
/* Figure out an argument list from this command line. */
|
||||||
|
|
||||||
{
|
{
|
||||||
char *end;
|
char *end;
|
||||||
argv = construct_command_argv (p, &end, child->file);
|
argv = construct_command_argv (p, &end, child->file);
|
||||||
@@ -552,16 +589,25 @@ start_job_command (child)
|
|||||||
|
|
||||||
if (argv == 0)
|
if (argv == 0)
|
||||||
{
|
{
|
||||||
|
next_command:
|
||||||
/* This line has no commands. Go to the next. */
|
/* This line has no commands. Go to the next. */
|
||||||
if (job_next_command (child))
|
if (job_next_command (child))
|
||||||
start_job_command (child);
|
start_job_command (child);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No more commands. All done. */
|
||||||
|
child->file->update_status = 0;
|
||||||
|
notice_finished_file (child->file);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print out the command. */
|
/* Print out the command. If silent, we call `message' with null so it
|
||||||
|
can log the working directory before the command's own error messages
|
||||||
|
appear. */
|
||||||
|
|
||||||
if (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
|
message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
|
||||||
puts (p);
|
? "%s" : (char *) 0, p);
|
||||||
|
|
||||||
/* Tell update_goal_chain that a command has been started on behalf of
|
/* Tell update_goal_chain that a command has been started on behalf of
|
||||||
this target. It is important that this happens here and not in
|
this target. It is important that this happens here and not in
|
||||||
@@ -578,16 +624,14 @@ start_job_command (child)
|
|||||||
{
|
{
|
||||||
free (argv[0]);
|
free (argv[0]);
|
||||||
free ((char *) argv);
|
free ((char *) argv);
|
||||||
if (job_next_command (child))
|
goto next_command;
|
||||||
start_job_command (child);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush the output streams so they won't have things written twice. */
|
/* Flush the output streams so they won't have things written twice. */
|
||||||
|
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
|
|
||||||
/* Set up a bad standard input that reads from a broken pipe. */
|
/* Set up a bad standard input that reads from a broken pipe. */
|
||||||
|
|
||||||
if (bad_stdin == -1)
|
if (bad_stdin == -1)
|
||||||
@@ -601,6 +645,16 @@ start_job_command (child)
|
|||||||
(void) close (pd[1]);
|
(void) close (pd[1]);
|
||||||
/* Save the read side. */
|
/* Save the read side. */
|
||||||
bad_stdin = pd[0];
|
bad_stdin = pd[0];
|
||||||
|
|
||||||
|
/* Set the descriptor to close on exec, so it does not litter any
|
||||||
|
child's descriptor table. When it is dup2'd onto descriptor 0,
|
||||||
|
that descriptor will not close on exec. */
|
||||||
|
#ifdef FD_SETFD
|
||||||
|
#ifndef FD_CLOEXEC
|
||||||
|
#define FD_CLOEXEC 1
|
||||||
|
#endif
|
||||||
|
(void) fcntl (bad_stdin, F_SETFD, FD_CLOEXEC);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,6 +672,8 @@ start_job_command (child)
|
|||||||
if (child->environment == 0)
|
if (child->environment == 0)
|
||||||
child->environment = target_environment (child->file);
|
child->environment = target_environment (child->file);
|
||||||
|
|
||||||
|
#ifndef __MSDOS__
|
||||||
|
|
||||||
/* start_waiting_job has set CHILD->remote if we can start a remote job. */
|
/* start_waiting_job has set CHILD->remote if we can start a remote job. */
|
||||||
if (child->remote)
|
if (child->remote)
|
||||||
{
|
{
|
||||||
@@ -641,6 +697,8 @@ start_job_command (child)
|
|||||||
{
|
{
|
||||||
/* Fork the child process. */
|
/* Fork the child process. */
|
||||||
|
|
||||||
|
char **parent_environ;
|
||||||
|
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
(void) sigprocmask (SIG_BLOCK, &fatal_signal_set, (sigset_t *) 0);
|
(void) sigprocmask (SIG_BLOCK, &fatal_signal_set, (sigset_t *) 0);
|
||||||
#else
|
#else
|
||||||
@@ -650,7 +708,9 @@ start_job_command (child)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
child->remote = 0;
|
child->remote = 0;
|
||||||
|
parent_environ = environ;
|
||||||
child->pid = vfork ();
|
child->pid = vfork ();
|
||||||
|
environ = parent_environ; /* Restore value child may have clobbered. */
|
||||||
if (child->pid == 0)
|
if (child->pid == 0)
|
||||||
{
|
{
|
||||||
/* We are the child side. */
|
/* We are the child side. */
|
||||||
@@ -667,10 +727,26 @@ start_job_command (child)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* MSDOS. */
|
||||||
|
dos_status = spawnvpe (P_WAIT, argv[0], argv, child->environment);
|
||||||
|
++dead_children;
|
||||||
|
child->pid = dos_pid++;
|
||||||
|
if (dos_batch_file)
|
||||||
|
{
|
||||||
|
dos_batch_file = 0;
|
||||||
|
remove (dos_bname); /* Ignore errors. */
|
||||||
|
if (access (dos_bename, 0))
|
||||||
|
dos_status = 1;
|
||||||
|
else
|
||||||
|
dos_status = 0;
|
||||||
|
remove (dos_bename);
|
||||||
|
}
|
||||||
|
#endif /* Not MSDOS. */
|
||||||
|
|
||||||
/* We are the parent side. Set the state to
|
/* We are the parent side. Set the state to
|
||||||
say the commands are running and return. */
|
say the commands are running and return. */
|
||||||
|
|
||||||
child->file->command_state = cs_running;
|
set_command_state (child->file, cs_running);
|
||||||
|
|
||||||
/* Free the storage used by the child's argument list. */
|
/* Free the storage used by the child's argument list. */
|
||||||
|
|
||||||
@@ -681,7 +757,7 @@ start_job_command (child)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
child->file->update_status = 2;
|
child->file->update_status = 2;
|
||||||
child->file->command_state = cs_finished;
|
notice_finished_file (child->file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to start a child running.
|
/* Try to start a child running.
|
||||||
@@ -704,7 +780,7 @@ start_waiting_job (c)
|
|||||||
{
|
{
|
||||||
/* Put this child on the chain of children waiting
|
/* Put this child on the chain of children waiting
|
||||||
for the load average to go down. */
|
for the load average to go down. */
|
||||||
c->file->command_state = cs_running;
|
set_command_state (c->file, cs_running);
|
||||||
c->next = waiting_jobs;
|
c->next = waiting_jobs;
|
||||||
waiting_jobs = c;
|
waiting_jobs = c;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -727,15 +803,18 @@ start_waiting_job (c)
|
|||||||
unblock_sigs ();
|
unblock_sigs ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case cs_not_started:
|
||||||
|
/* All the command lines turned out to be empty. */
|
||||||
|
c->file->update_status = 0;
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case cs_finished:
|
case cs_finished:
|
||||||
notice_finished_file (c->file);
|
notice_finished_file (c->file);
|
||||||
free_child (c);
|
free_child (c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error ("internal error: `%s' command_state == %d in new_job",
|
assert (c->file->command_state == cs_finished);
|
||||||
c->file->name, (int) c->file->command_state);
|
|
||||||
abort ();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,20 +959,17 @@ new_job (file)
|
|||||||
c->environment = 0;
|
c->environment = 0;
|
||||||
|
|
||||||
/* Fetch the first command line to be run. */
|
/* Fetch the first command line to be run. */
|
||||||
if (! job_next_command (c))
|
job_next_command (c);
|
||||||
/* There were no commands! */
|
|
||||||
free_child (c);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* The job is now primed. Start it running. */
|
|
||||||
start_waiting_job (c);
|
|
||||||
|
|
||||||
if (job_slots == 1)
|
/* The job is now primed. Start it running.
|
||||||
/* Since there is only one job slot, make things run linearly.
|
(This will notice if there are in fact no commands.) */
|
||||||
Wait for the child to die, setting the state to `cs_finished'. */
|
start_waiting_job (c);
|
||||||
while (file->command_state == cs_running)
|
|
||||||
reap_children (1, 0);
|
if (job_slots == 1)
|
||||||
}
|
/* Since there is only one job slot, make things run linearly.
|
||||||
|
Wait for the child to die, setting the state to `cs_finished'. */
|
||||||
|
while (file->command_state == cs_running)
|
||||||
|
reap_children (1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move CHILD's pointers to the next command for it to execute.
|
/* Move CHILD's pointers to the next command for it to execute.
|
||||||
@@ -903,15 +979,13 @@ static int
|
|||||||
job_next_command (child)
|
job_next_command (child)
|
||||||
struct child *child;
|
struct child *child;
|
||||||
{
|
{
|
||||||
if (child->command_ptr == 0 || *child->command_ptr == '\0')
|
while (child->command_ptr == 0 || *child->command_ptr == '\0')
|
||||||
{
|
{
|
||||||
/* There are no more lines in the expansion of this line. */
|
/* There are no more lines in the expansion of this line. */
|
||||||
if (child->command_line == child->file->cmds->ncommand_lines)
|
if (child->command_line == child->file->cmds->ncommand_lines)
|
||||||
{
|
{
|
||||||
/* There are no more lines to be expanded. */
|
/* There are no more lines to be expanded. */
|
||||||
child->command_ptr = 0;
|
child->command_ptr = 0;
|
||||||
child->file->command_state = cs_finished;
|
|
||||||
child->file->update_status = 0;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -924,6 +998,9 @@ job_next_command (child)
|
|||||||
static int
|
static int
|
||||||
load_too_high ()
|
load_too_high ()
|
||||||
{
|
{
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
extern int getloadavg ();
|
extern int getloadavg ();
|
||||||
double load;
|
double load;
|
||||||
|
|
||||||
@@ -949,6 +1026,7 @@ load_too_high ()
|
|||||||
user_access ();
|
user_access ();
|
||||||
|
|
||||||
return load >= max_load_average;
|
return load >= max_load_average;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start jobs that are waiting for the load to be lower. */
|
/* Start jobs that are waiting for the load to be lower. */
|
||||||
@@ -988,112 +1066,15 @@ child_execute_job (stdin_fd, stdout_fd, argv, envp)
|
|||||||
(void) dup2 (stdin_fd, 0);
|
(void) dup2 (stdin_fd, 0);
|
||||||
if (stdout_fd != 1)
|
if (stdout_fd != 1)
|
||||||
(void) dup2 (stdout_fd, 1);
|
(void) dup2 (stdout_fd, 1);
|
||||||
|
if (stdin_fd != 0)
|
||||||
/* Free up file descriptors. */
|
(void) close (stdin_fd);
|
||||||
{
|
if (stdout_fd != 1)
|
||||||
register int d;
|
(void) close (stdout_fd);
|
||||||
int max = getdtablesize ();
|
|
||||||
for (d = 3; d < max; ++d)
|
|
||||||
(void) close (d);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Run the command. */
|
/* Run the command. */
|
||||||
exec_command (argv, envp);
|
exec_command (argv, envp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search PATH for FILE.
|
|
||||||
If successful, store the full pathname in PROGRAM and return 1.
|
|
||||||
If not sucessful, return zero. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
search_path (file, path, program)
|
|
||||||
char *file, *path, *program;
|
|
||||||
{
|
|
||||||
if (path == 0 || path[0] == '\0')
|
|
||||||
path = default_path;
|
|
||||||
|
|
||||||
if (index (file, '/') != 0)
|
|
||||||
{
|
|
||||||
strcpy (program, file);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned int len;
|
|
||||||
|
|
||||||
#ifdef HAVE_GETGROUPS
|
|
||||||
#ifndef HAVE_UNISTD_H
|
|
||||||
extern int getgroups ();
|
|
||||||
#endif
|
|
||||||
static int ngroups = -1;
|
|
||||||
#ifdef NGROUPS_MAX
|
|
||||||
static GETGROUPS_T groups[NGROUPS_MAX];
|
|
||||||
#define ngroups_max NGROUPS_MAX
|
|
||||||
#else
|
|
||||||
static GETGROUPS_T *groups = 0;
|
|
||||||
static int ngroups_max;
|
|
||||||
if (groups == 0)
|
|
||||||
{
|
|
||||||
ngroups_max = GET_NGROUPS_MAX;
|
|
||||||
groups = (GETGROUPS_T *) malloc (ngroups_max * sizeof (GETGROUPS_T));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (groups != 0 && ngroups == -1)
|
|
||||||
ngroups = getgroups (ngroups_max, groups);
|
|
||||||
#endif /* Have getgroups. */
|
|
||||||
|
|
||||||
len = strlen (file) + 1;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
int perm;
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
p = index (path, ':');
|
|
||||||
if (p == 0)
|
|
||||||
p = path + strlen (path);
|
|
||||||
|
|
||||||
if (p == path)
|
|
||||||
bcopy (file, program, len);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bcopy (path, program, p - path);
|
|
||||||
program[p - path] = '/';
|
|
||||||
bcopy (file, program + (p - path) + 1, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat (program, &st) == 0
|
|
||||||
&& S_ISREG (st.st_mode))
|
|
||||||
{
|
|
||||||
if (st.st_uid == geteuid ())
|
|
||||||
perm = (st.st_mode & 0100);
|
|
||||||
else if (st.st_gid == getegid ())
|
|
||||||
perm = (st.st_mode & 0010);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef HAVE_GETGROUPS
|
|
||||||
register int i;
|
|
||||||
for (i = 0; i < ngroups; ++i)
|
|
||||||
if (groups[i] == st.st_gid)
|
|
||||||
break;
|
|
||||||
if (i < ngroups)
|
|
||||||
perm = (st.st_mode & 0010);
|
|
||||||
else
|
|
||||||
#endif /* Have getgroups. */
|
|
||||||
perm = (st.st_mode & 0001);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (perm != 0)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
path = p + 1;
|
|
||||||
} while (*path != '\0');
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Replace the current process with one running the command in ARGV,
|
/* Replace the current process with one running the command in ARGV,
|
||||||
with environment ENVP. This function does not return. */
|
with environment ENVP. This function does not return. */
|
||||||
|
|
||||||
@@ -1101,82 +1082,65 @@ void
|
|||||||
exec_command (argv, envp)
|
exec_command (argv, envp)
|
||||||
char **argv, **envp;
|
char **argv, **envp;
|
||||||
{
|
{
|
||||||
char *shell, *path;
|
|
||||||
PATH_VAR (program);
|
|
||||||
register char **ep;
|
|
||||||
|
|
||||||
shell = path = 0;
|
|
||||||
for (ep = envp; *ep != 0; ++ep)
|
|
||||||
{
|
|
||||||
if (shell == 0 && !strncmp(*ep, "SHELL=", 6))
|
|
||||||
shell = &(*ep)[6];
|
|
||||||
else if (path == 0 && !strncmp(*ep, "PATH=", 5))
|
|
||||||
path = &(*ep)[5];
|
|
||||||
else if (path != 0 && shell != 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Be the user, permanently. */
|
/* Be the user, permanently. */
|
||||||
child_access ();
|
child_access ();
|
||||||
|
|
||||||
if (!search_path (argv[0], path, program))
|
/* Run the program. */
|
||||||
error ("%s: Command not found", argv[0]);
|
environ = envp;
|
||||||
else
|
execvp (argv[0], argv);
|
||||||
|
|
||||||
|
switch (errno)
|
||||||
{
|
{
|
||||||
/* Run the program. */
|
case ENOENT:
|
||||||
execve (program, argv, envp);
|
error ("%s: Command not found", argv[0]);
|
||||||
|
break;
|
||||||
|
case ENOEXEC:
|
||||||
|
{
|
||||||
|
/* The file is not executable. Try it as a shell script. */
|
||||||
|
extern char *getenv ();
|
||||||
|
char *shell;
|
||||||
|
char **new_argv;
|
||||||
|
int argc;
|
||||||
|
|
||||||
if (errno == ENOEXEC)
|
shell = getenv ("SHELL");
|
||||||
{
|
if (shell == 0)
|
||||||
PATH_VAR (shell_program);
|
shell = default_shell;
|
||||||
char *shell_path;
|
|
||||||
if (shell == 0)
|
|
||||||
shell_path = default_shell;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (search_path (shell, path, shell_program))
|
|
||||||
shell_path = shell_program;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shell_path = 0;
|
|
||||||
error ("%s: Shell program not found", shell);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shell_path != 0)
|
argc = 1;
|
||||||
{
|
while (argv[argc] != 0)
|
||||||
char **new_argv;
|
++argc;
|
||||||
int argc;
|
|
||||||
|
|
||||||
argc = 1;
|
new_argv = (char **) alloca ((1 + argc + 1) * sizeof (char *));
|
||||||
while (argv[argc] != 0)
|
new_argv[0] = shell;
|
||||||
++argc;
|
new_argv[1] = argv[0];
|
||||||
|
while (argc > 0)
|
||||||
|
{
|
||||||
|
new_argv[1 + argc] = argv[argc];
|
||||||
|
--argc;
|
||||||
|
}
|
||||||
|
|
||||||
new_argv = (char **) alloca ((1 + argc + 1) * sizeof (char *));
|
execvp (shell, new_argv);
|
||||||
new_argv[0] = shell_path;
|
if (errno == ENOENT)
|
||||||
new_argv[1] = program;
|
error ("%s: Shell program not found", shell);
|
||||||
while (argc > 0)
|
else
|
||||||
{
|
perror_with_name ("execvp: ", shell);
|
||||||
new_argv[1 + argc] = argv[argc];
|
break;
|
||||||
--argc;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
execve (shell_path, new_argv, envp);
|
default:
|
||||||
perror_with_name ("execve: ", shell_path);
|
perror_with_name ("execvp: ", argv[0]);
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
else
|
|
||||||
perror_with_name ("execve: ", program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit (127);
|
_exit (127);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out the argument list necessary to run LINE as a command.
|
/* Figure out the argument list necessary to run LINE as a command. Try to
|
||||||
Try to avoid using a shell. This routine handles only ' quoting.
|
avoid using a shell. This routine handles only ' quoting, and " quoting
|
||||||
Starting quotes may be escaped with a backslash. If any of the
|
when no backslash, $ or ` characters are seen in the quotes. Starting
|
||||||
characters in sh_chars[] is seen, or any of the builtin commands
|
quotes may be escaped with a backslash. If any of the characters in
|
||||||
listed in sh_cmds[] is the first word of a line, the shell is used.
|
sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[]
|
||||||
|
is the first word of a line, the shell is used.
|
||||||
|
|
||||||
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
|
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
|
||||||
If *RESTP is NULL, newlines will be ignored.
|
If *RESTP is NULL, newlines will be ignored.
|
||||||
@@ -1189,12 +1153,22 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
|||||||
char *line, **restp;
|
char *line, **restp;
|
||||||
char *shell, *ifs;
|
char *shell, *ifs;
|
||||||
{
|
{
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
static char sh_chars[] = "\"|<>";
|
||||||
|
static char *sh_cmds[] = { "break", "call", "cd", "chcp", "chdir", "cls",
|
||||||
|
"copy", "ctty", "date", "del", "dir", "echo",
|
||||||
|
"erase", "exit", "for", "goto", "if", "if", "md",
|
||||||
|
"mkdir", "path", "pause", "prompt", "rem", "ren",
|
||||||
|
"rename", "set", "shift", "time", "type",
|
||||||
|
"ver", "verify", "vol", ":", 0 };
|
||||||
|
#else
|
||||||
static char sh_chars[] = "#;\"*?[]&|<>(){}$`^";
|
static char sh_chars[] = "#;\"*?[]&|<>(){}$`^";
|
||||||
static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login",
|
static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login",
|
||||||
"logout", "set", "umask", "wait", "while", "for",
|
"logout", "set", "umask", "wait", "while", "for",
|
||||||
"case", "if", ":", ".", "break", "continue",
|
"case", "if", ":", ".", "break", "continue",
|
||||||
"export", "read", "readonly", "shift", "times",
|
"export", "read", "readonly", "shift", "times",
|
||||||
"trap", "switch", 0 };
|
"trap", "switch", 0 };
|
||||||
|
#endif
|
||||||
register int i;
|
register int i;
|
||||||
register char *p;
|
register char *p;
|
||||||
register char *ap;
|
register char *ap;
|
||||||
@@ -1241,9 +1215,23 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
|||||||
|
|
||||||
if (instring)
|
if (instring)
|
||||||
{
|
{
|
||||||
/* Inside a string, just copy any char except a closing quote. */
|
string_char:
|
||||||
if (*p == '\'')
|
/* Inside a string, just copy any char except a closing quote
|
||||||
|
or a backslash-newline combination. */
|
||||||
|
if (*p == instring)
|
||||||
instring = 0;
|
instring = 0;
|
||||||
|
else if (*p == '\\' && p[1] == '\n')
|
||||||
|
goto swallow_escaped_newline;
|
||||||
|
else if (*p == '\n' && restp != NULL)
|
||||||
|
{
|
||||||
|
/* End of the command line. */
|
||||||
|
*restp = p;
|
||||||
|
goto end_of_line;
|
||||||
|
}
|
||||||
|
/* Backslash, $, and ` are special inside double quotes.
|
||||||
|
If we see any of those, punt. */
|
||||||
|
else if (instring == '"' && index ("\\$`", *p) != 0)
|
||||||
|
goto slow;
|
||||||
else
|
else
|
||||||
*ap++ = *p;
|
*ap++ = *p;
|
||||||
}
|
}
|
||||||
@@ -1269,6 +1257,8 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
|||||||
/* Backslash-newline combinations are eaten. */
|
/* Backslash-newline combinations are eaten. */
|
||||||
if (p[1] == '\n')
|
if (p[1] == '\n')
|
||||||
{
|
{
|
||||||
|
swallow_escaped_newline:
|
||||||
|
|
||||||
/* Eat the backslash, the newline, and following whitespace,
|
/* Eat the backslash, the newline, and following whitespace,
|
||||||
replacing it all with a single space. */
|
replacing it all with a single space. */
|
||||||
p += 2;
|
p += 2;
|
||||||
@@ -1280,13 +1270,18 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
|||||||
if (*p == '\t')
|
if (*p == '\t')
|
||||||
strcpy (p, p + 1);
|
strcpy (p, p + 1);
|
||||||
|
|
||||||
if (ap != new_argv[i])
|
if (instring)
|
||||||
/* Treat this as a space, ending the arg.
|
goto string_char;
|
||||||
But if it's at the beginning of the arg, it should
|
|
||||||
just get eaten, rather than becoming an empty arg. */
|
|
||||||
goto end_of_arg;
|
|
||||||
else
|
else
|
||||||
p = next_token (p) - 1;
|
{
|
||||||
|
if (ap != new_argv[i])
|
||||||
|
/* Treat this as a space, ending the arg.
|
||||||
|
But if it's at the beginning of the arg, it should
|
||||||
|
just get eaten, rather than becoming an empty arg. */
|
||||||
|
goto end_of_arg;
|
||||||
|
else
|
||||||
|
p = next_token (p) - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (p[1] != '\0')
|
else if (p[1] != '\0')
|
||||||
/* Copy and skip the following char. */
|
/* Copy and skip the following char. */
|
||||||
@@ -1294,7 +1289,8 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '\'':
|
case '\'':
|
||||||
instring = 1;
|
case '"':
|
||||||
|
instring = *p;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\n':
|
case '\n':
|
||||||
@@ -1385,19 +1381,47 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
|||||||
free (new_argv);
|
free (new_argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
{
|
||||||
|
FILE *batch;
|
||||||
|
dos_batch_file = 1;
|
||||||
|
if (dos_bname == 0)
|
||||||
|
{
|
||||||
|
dos_bname = tempnam (".", "mk");
|
||||||
|
for (i = 0; dos_bname[i] != '\0'; ++i)
|
||||||
|
if (dos_bname[i] == '/')
|
||||||
|
dos_bname[i] = '\\';
|
||||||
|
dos_bename = (char *) xmalloc (strlen (dos_bname) + 5);
|
||||||
|
strcpy (dos_bename, dos_bname);
|
||||||
|
strcat (dos_bname, ".bat");
|
||||||
|
strcat (dos_bename, ".err");
|
||||||
|
}
|
||||||
|
batch = fopen (dos_bename, "w"); /* Create a file. */
|
||||||
|
if (batch != NULL)
|
||||||
|
fclose (batch);
|
||||||
|
batch = fopen (dos_bname, "w");
|
||||||
|
fputs ("@echo off\n", batch);
|
||||||
|
fputs (line, batch);
|
||||||
|
fprintf (batch, "\nif errorlevel 1 del %s\n", dos_bename);
|
||||||
|
fclose (batch);
|
||||||
|
new_argv = (char **) xmalloc(2 * sizeof(char *));
|
||||||
|
new_argv[0] = strdup (dos_bname);
|
||||||
|
new_argv[1] = 0;
|
||||||
|
}
|
||||||
|
#else /* Not MSDOS. */
|
||||||
{
|
{
|
||||||
/* SHELL may be a multi-word command. Construct a command line
|
/* SHELL may be a multi-word command. Construct a command line
|
||||||
"SHELL -c LINE", with all special chars in LINE escaped.
|
"SHELL -c LINE", with all special chars in LINE escaped.
|
||||||
Then recurse, expanding this command line to get the final
|
Then recurse, expanding this command line to get the final
|
||||||
argument list. */
|
argument list. */
|
||||||
|
|
||||||
unsigned int shell_len = strlen (shell);
|
unsigned int shell_len = strlen (shell);
|
||||||
static char minus_c[] = " -c ";
|
static char minus_c[] = " -c ";
|
||||||
unsigned int line_len = strlen (line);
|
unsigned int line_len = strlen (line);
|
||||||
|
|
||||||
char *new_line = (char *) alloca (shell_len + (sizeof (minus_c) - 1)
|
char *new_line = (char *) alloca (shell_len + (sizeof (minus_c) - 1)
|
||||||
+ (line_len * 2) + 1);
|
+ (line_len * 2) + 1);
|
||||||
|
|
||||||
ap = new_line;
|
ap = new_line;
|
||||||
bcopy (shell, ap, shell_len);
|
bcopy (shell, ap, shell_len);
|
||||||
ap += shell_len;
|
ap += shell_len;
|
||||||
@@ -1431,26 +1455,28 @@ construct_command_argv_internal (line, restp, shell, ifs)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p == '\\' || *p == '\''
|
if (*p == '\\' || *p == '\'' || *p == '"'
|
||||||
|| isspace (*p)
|
|| isspace (*p)
|
||||||
|| index (sh_chars, *p) != 0)
|
|| index (sh_chars, *p) != 0)
|
||||||
*ap++ = '\\';
|
*ap++ = '\\';
|
||||||
*ap++ = *p;
|
*ap++ = *p;
|
||||||
}
|
}
|
||||||
*ap = '\0';
|
*ap = '\0';
|
||||||
|
|
||||||
new_argv = construct_command_argv_internal (new_line, (char **) NULL,
|
new_argv = construct_command_argv_internal (new_line, (char **) NULL,
|
||||||
(char *) 0, (char *) 0);
|
(char *) 0, (char *) 0);
|
||||||
}
|
}
|
||||||
|
#endif /* MSDOS. */
|
||||||
|
|
||||||
return new_argv;
|
return new_argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out the argument list necessary to run LINE as a command.
|
/* Figure out the argument list necessary to run LINE as a command. Try to
|
||||||
Try to avoid using a shell. This routine handles only ' quoting.
|
avoid using a shell. This routine handles only ' quoting, and " quoting
|
||||||
Starting quotes may be escaped with a backslash. If any of the
|
when no backslash, $ or ` characters are seen in the quotes. Starting
|
||||||
characters in sh_chars[] is seen, or any of the builtin commands
|
quotes may be escaped with a backslash. If any of the characters in
|
||||||
listed in sh_cmds[] is the first word of a line, the shell is used.
|
sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[]
|
||||||
|
is the first word of a line, the shell is used.
|
||||||
|
|
||||||
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
|
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
|
||||||
If *RESTP is NULL, newlines will be ignored.
|
If *RESTP is NULL, newlines will be ignored.
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
644
main.c
644
main.c
@@ -1,5 +1,5 @@
|
|||||||
/* Argument parsing and main program of GNU Make.
|
/* Argument parsing and main program of GNU Make.
|
||||||
Copyright (C) 1988, 89, 90, 91, 94 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 90, 91, 94, 1995 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -23,6 +23,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
#include "job.h"
|
#include "job.h"
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
extern void print_variable_data_base ();
|
extern void print_variable_data_base ();
|
||||||
@@ -42,10 +43,10 @@ extern double atof ();
|
|||||||
#endif
|
#endif
|
||||||
extern char *mktemp ();
|
extern char *mktemp ();
|
||||||
|
|
||||||
static void log_working_directory ();
|
|
||||||
static void print_data_base (), print_version ();
|
static void print_data_base (), print_version ();
|
||||||
static void decode_switches (), decode_env_switches ();
|
static void decode_switches (), decode_env_switches ();
|
||||||
static void define_makeflags ();
|
static void define_makeflags ();
|
||||||
|
static char *quote_as_word ();
|
||||||
|
|
||||||
/* The structure that describes an accepted command switch. */
|
/* The structure that describes an accepted command switch. */
|
||||||
|
|
||||||
@@ -271,13 +272,13 @@ static const struct command_switch switches[] =
|
|||||||
{ 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0, 0,
|
{ 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0, 0,
|
||||||
"print-directory", 0,
|
"print-directory", 0,
|
||||||
"Print the current directory" },
|
"Print the current directory" },
|
||||||
{ 1, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
|
{ 2, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
|
||||||
"no-print-directory", 0,
|
"no-print-directory", 0,
|
||||||
"Turn off -w, even if it was turned on implicitly" },
|
"Turn off -w, even if it was turned on implicitly" },
|
||||||
{ 'W', string, (char *) &new_files, 0, 0, 0, 0, 0,
|
{ 'W', string, (char *) &new_files, 0, 0, 0, 0, 0,
|
||||||
"what-if", "FILE",
|
"what-if", "FILE",
|
||||||
"Consider FILE to be infinitely new" },
|
"Consider FILE to be infinitely new" },
|
||||||
{ 2, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
|
{ 3, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
|
||||||
"warn-undefined-variables", 0,
|
"warn-undefined-variables", 0,
|
||||||
"Warn when an undefined variable is referenced" },
|
"Warn when an undefined variable is referenced" },
|
||||||
{ '\0', }
|
{ '\0', }
|
||||||
@@ -304,14 +305,28 @@ static struct option long_option_aliases[] =
|
|||||||
|
|
||||||
#define DESCRIPTION_COLUMN 30
|
#define DESCRIPTION_COLUMN 30
|
||||||
|
|
||||||
/* List of non-switch arguments. */
|
/* List of goal targets. */
|
||||||
|
|
||||||
struct stringlist *other_args = 0;
|
static struct dep *goals, *lastgoal;
|
||||||
|
|
||||||
|
/* List of variables which were defined on the command line
|
||||||
|
(or, equivalently, in MAKEFLAGS). */
|
||||||
|
|
||||||
|
struct command_variable
|
||||||
|
{
|
||||||
|
struct command_variable *next;
|
||||||
|
struct variable *variable;
|
||||||
|
};
|
||||||
|
static struct command_variable *command_variables;
|
||||||
|
|
||||||
/* The name we were invoked with. */
|
/* The name we were invoked with. */
|
||||||
|
|
||||||
char *program;
|
char *program;
|
||||||
|
|
||||||
|
/* Our current directory before processing any -C options. */
|
||||||
|
|
||||||
|
char *directory_before_chdir;
|
||||||
|
|
||||||
/* Our current directory after processing all -C options. */
|
/* Our current directory after processing all -C options. */
|
||||||
|
|
||||||
char *starting_directory;
|
char *starting_directory;
|
||||||
@@ -331,6 +346,11 @@ struct file *default_goal_file;
|
|||||||
This is zero if the makefiles do not define .DEFAULT. */
|
This is zero if the makefiles do not define .DEFAULT. */
|
||||||
|
|
||||||
struct file *default_file;
|
struct file *default_file;
|
||||||
|
|
||||||
|
/* Nonzero if we have seen the magic `.POSIX' target.
|
||||||
|
This turns on pedantic compliance with POSIX.2. */
|
||||||
|
|
||||||
|
int posix_pedantic;
|
||||||
|
|
||||||
/* Mask of signals that are being caught with fatal_error_signal. */
|
/* Mask of signals that are being caught with fatal_error_signal. */
|
||||||
|
|
||||||
@@ -346,6 +366,9 @@ static struct file *
|
|||||||
enter_command_line_file (name)
|
enter_command_line_file (name)
|
||||||
char *name;
|
char *name;
|
||||||
{
|
{
|
||||||
|
if (name[0] == '\0')
|
||||||
|
fatal ("empty string invalid as file name");
|
||||||
|
|
||||||
if (name[0] == '~')
|
if (name[0] == '~')
|
||||||
{
|
{
|
||||||
char *expanded = tilde_expand (name);
|
char *expanded = tilde_expand (name);
|
||||||
@@ -363,7 +386,7 @@ enter_command_line_file (name)
|
|||||||
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
|
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
|
||||||
++name;
|
++name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*name == '\0')
|
if (*name == '\0')
|
||||||
{
|
{
|
||||||
/* It was all slashes! Move back to the dot and truncate
|
/* It was all slashes! Move back to the dot and truncate
|
||||||
@@ -377,30 +400,33 @@ enter_command_line_file (name)
|
|||||||
return enter_file (savestring (name, strlen (name)));
|
return enter_file (savestring (name, strlen (name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Toggle -d on receipt of SIGUSR1. */
|
||||||
|
|
||||||
|
static RETSIGTYPE
|
||||||
|
debug_signal_handler (sig)
|
||||||
|
int sig;
|
||||||
|
{
|
||||||
|
debug_flag = ! debug_flag;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv, envp)
|
main (argc, argv, envp)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
char **envp;
|
char **envp;
|
||||||
{
|
{
|
||||||
extern void init_dir ();
|
|
||||||
extern RETSIGTYPE fatal_error_signal (), child_handler ();
|
extern RETSIGTYPE fatal_error_signal (), child_handler ();
|
||||||
register struct file *f;
|
register struct file *f;
|
||||||
register unsigned int i;
|
register unsigned int i;
|
||||||
register char *cmd_defs;
|
|
||||||
register unsigned int cmd_defs_len, cmd_defs_idx;
|
|
||||||
char **p;
|
char **p;
|
||||||
struct dep *goals = 0;
|
|
||||||
register struct dep *lastgoal;
|
|
||||||
struct dep *read_makefiles;
|
struct dep *read_makefiles;
|
||||||
PATH_VAR (current_directory);
|
PATH_VAR (current_directory);
|
||||||
char *directory_before_chdir;
|
|
||||||
|
|
||||||
default_goal_file = 0;
|
default_goal_file = 0;
|
||||||
reading_filename = 0;
|
reading_filename = 0;
|
||||||
reading_lineno_ptr = 0;
|
reading_lineno_ptr = 0;
|
||||||
|
|
||||||
#ifndef HAVE_SYS_SIGLIST
|
#if !defined (HAVE_STRSIGNAL) && !defined (HAVE_SYS_SIGLIST)
|
||||||
signame_init ();
|
signame_init ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -452,18 +478,21 @@ main (argc, argv, envp)
|
|||||||
#endif /* setvbuf reversed. */
|
#endif /* setvbuf reversed. */
|
||||||
#endif /* setlinebuf missing. */
|
#endif /* setlinebuf missing. */
|
||||||
|
|
||||||
/* Initialize the directory hashing code. */
|
|
||||||
init_dir ();
|
|
||||||
|
|
||||||
/* Figure out where this program lives. */
|
/* Figure out where this program lives. */
|
||||||
|
|
||||||
if (argv[0] == 0)
|
if (argv[0] == 0)
|
||||||
argv[0] = "";
|
argv[0] = "";
|
||||||
if (argv[0][0] == '\0')
|
if (argv[0][0] == '\0')
|
||||||
program = "make";
|
program = "make";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
program = rindex (argv[0], '/');
|
program = rindex (argv[0], '/');
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
if (program == 0)
|
||||||
|
program = rindex (argv[0], '\\');
|
||||||
|
if (program == 0)
|
||||||
|
program = rindex (argv[0], ':');
|
||||||
|
#endif
|
||||||
if (program == 0)
|
if (program == 0)
|
||||||
program = argv[0];
|
program = argv[0];
|
||||||
else
|
else
|
||||||
@@ -490,8 +519,8 @@ main (argc, argv, envp)
|
|||||||
strlen (current_directory));
|
strlen (current_directory));
|
||||||
|
|
||||||
/* Read in variables from the environment. It is important that this be
|
/* Read in variables from the environment. It is important that this be
|
||||||
done before `MAKE' and `MAKEOVERRIDES' are figured out so their
|
done before $(MAKE) is are figured out so its definitions will not be
|
||||||
definitions will not be ones from the environment. */
|
one from the environment. */
|
||||||
|
|
||||||
for (i = 0; envp[i] != 0; ++i)
|
for (i = 0; envp[i] != 0; ++i)
|
||||||
{
|
{
|
||||||
@@ -531,76 +560,7 @@ main (argc, argv, envp)
|
|||||||
if (print_version_flag)
|
if (print_version_flag)
|
||||||
die (0);
|
die (0);
|
||||||
|
|
||||||
/* Search for command line arguments that define variables,
|
#ifndef __MSDOS__
|
||||||
and do the definitions. Also save up the text of these
|
|
||||||
arguments in CMD_DEFS so we can put them into the values
|
|
||||||
of $(MAKEOVERRIDES) and $(MAKE). */
|
|
||||||
|
|
||||||
cmd_defs_len = 200;
|
|
||||||
cmd_defs = (char *) xmalloc (cmd_defs_len);
|
|
||||||
cmd_defs_idx = 0;
|
|
||||||
|
|
||||||
for (i = 1; other_args->list[i] != 0; ++i)
|
|
||||||
{
|
|
||||||
if (other_args->list[i][0] == '\0')
|
|
||||||
/* Ignore empty arguments, so they can't kill enter_file. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Try a variable definition. */
|
|
||||||
if (try_variable_definition ((char *) 0, 0,
|
|
||||||
other_args->list[i], o_command))
|
|
||||||
{
|
|
||||||
/* It succeeded. The variable is already defined.
|
|
||||||
Backslash-quotify it and append it to CMD_DEFS, then clobber it
|
|
||||||
to 0 in the list so that it won't be taken for a goal target. */
|
|
||||||
register char *p = other_args->list[i];
|
|
||||||
unsigned int l = strlen (p);
|
|
||||||
if (cmd_defs_idx + (l * 2) + 1 > cmd_defs_len)
|
|
||||||
{
|
|
||||||
if (l * 2 > cmd_defs_len)
|
|
||||||
cmd_defs_len += l * 2;
|
|
||||||
else
|
|
||||||
cmd_defs_len *= 2;
|
|
||||||
cmd_defs = (char *) xrealloc (cmd_defs, cmd_defs_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*p != '\0')
|
|
||||||
{
|
|
||||||
if (index ("^;'\"*?[]$<>(){}|&~`\\ \t\r\n\f\v", *p) != 0)
|
|
||||||
cmd_defs[cmd_defs_idx++] = '\\';
|
|
||||||
cmd_defs[cmd_defs_idx++] = *p++;
|
|
||||||
}
|
|
||||||
cmd_defs[cmd_defs_idx++] = ' ';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* It was not a variable definition, so it is a target to be made.
|
|
||||||
Enter it as a file and add it to the dep chain of goals. */
|
|
||||||
f = enter_command_line_file (other_args->list[i]);
|
|
||||||
f->cmd_target = 1;
|
|
||||||
|
|
||||||
if (goals == 0)
|
|
||||||
{
|
|
||||||
goals = (struct dep *) xmalloc (sizeof (struct dep));
|
|
||||||
lastgoal = goals;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lastgoal->next = (struct dep *) xmalloc (sizeof (struct dep));
|
|
||||||
lastgoal = lastgoal->next;
|
|
||||||
}
|
|
||||||
lastgoal->name = 0;
|
|
||||||
lastgoal->file = f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd_defs_idx > 0)
|
|
||||||
{
|
|
||||||
cmd_defs[cmd_defs_idx - 1] = '\0';
|
|
||||||
(void) define_variable ("MAKEOVERRIDES", 13, cmd_defs, o_default, 0);
|
|
||||||
}
|
|
||||||
free (cmd_defs);
|
|
||||||
|
|
||||||
/* Set the "MAKE_COMMAND" variable to the name we were invoked with.
|
/* Set the "MAKE_COMMAND" variable to the name we were invoked with.
|
||||||
(If it is a relative pathname with a slash, prepend our directory name
|
(If it is a relative pathname with a slash, prepend our directory name
|
||||||
so the result will run the same program regardless of the current dir.
|
so the result will run the same program regardless of the current dir.
|
||||||
@@ -610,17 +570,62 @@ main (argc, argv, envp)
|
|||||||
if (current_directory[0] != '\0'
|
if (current_directory[0] != '\0'
|
||||||
&& argv[0] != 0 && argv[0][0] != '/' && index (argv[0], '/') != 0)
|
&& argv[0] != 0 && argv[0][0] != '/' && index (argv[0], '/') != 0)
|
||||||
argv[0] = concat (current_directory, "/", argv[0]);
|
argv[0] = concat (current_directory, "/", argv[0]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The extra indirection through $(MAKE_COMMAND) is done
|
||||||
|
for hysterical raisins. */
|
||||||
(void) define_variable ("MAKE_COMMAND", 12, argv[0], o_default, 0);
|
(void) define_variable ("MAKE_COMMAND", 12, argv[0], o_default, 0);
|
||||||
|
(void) define_variable ("MAKE", 4, "$(MAKE_COMMAND)", o_default, 1);
|
||||||
|
|
||||||
/* Append the command-line variable definitions gathered above
|
if (command_variables != 0)
|
||||||
so sub-makes will get them as command-line definitions. */
|
{
|
||||||
|
struct command_variable *cv;
|
||||||
|
struct variable *v;
|
||||||
|
unsigned int len = 0;
|
||||||
|
char *value, *p;
|
||||||
|
|
||||||
(void) define_variable ("MAKE", 4,
|
/* Figure out how much space will be taken up by the command-line
|
||||||
"$(MAKE_COMMAND) $(MAKEOVERRIDES)", o_default, 1);
|
variable definitions. */
|
||||||
|
for (cv = command_variables; cv != 0; cv = cv->next)
|
||||||
|
{
|
||||||
|
v = cv->variable;
|
||||||
|
len += 2 * strlen (v->name);
|
||||||
|
if (! v->recursive)
|
||||||
|
++len;
|
||||||
|
++len;
|
||||||
|
len += 2 * strlen (v->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now allocate a buffer big enough and fill it. */
|
||||||
|
p = value = (char *) alloca (len);
|
||||||
|
for (cv = command_variables; cv != 0; cv = cv->next)
|
||||||
|
{
|
||||||
|
v = cv->variable;
|
||||||
|
p = quote_as_word (p, v->name, 0);
|
||||||
|
if (! v->recursive)
|
||||||
|
*p++ = ':';
|
||||||
|
*p++ = '=';
|
||||||
|
p = quote_as_word (p, v->value, 0);
|
||||||
|
*p++ = ' ';
|
||||||
|
}
|
||||||
|
p[-1] = '\0'; /* Kill the final space and terminate. */
|
||||||
|
|
||||||
|
/* Define an unchangeable variable with a name that no POSIX.2
|
||||||
|
makefile could validly use for its own variable. */
|
||||||
|
(void) define_variable ("-*-command-variables-*-", 23,
|
||||||
|
value, o_automatic, 0);
|
||||||
|
|
||||||
|
/* Define the variable; this will not override any user definition.
|
||||||
|
Normally a reference to this variable is written into the value of
|
||||||
|
MAKEFLAGS, allowing the user to override this value to affect the
|
||||||
|
exported value of MAKEFLAGS. In POSIX-pedantic mode, we cannot
|
||||||
|
allow the user's setting of MAKEOVERRIDES to affect MAKEFLAGS, so
|
||||||
|
a reference to this hidden variable is written instead. */
|
||||||
|
(void) define_variable ("MAKEOVERRIDES", 13,
|
||||||
|
"${-*-command-variables-*-}", o_env, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/* If there were -C flags, move ourselves about. */
|
/* If there were -C flags, move ourselves about. */
|
||||||
|
|
||||||
if (directories != 0)
|
if (directories != 0)
|
||||||
for (i = 0; directories->list[i] != 0; ++i)
|
for (i = 0; directories->list[i] != 0; ++i)
|
||||||
{
|
{
|
||||||
@@ -678,10 +683,6 @@ main (argc, argv, envp)
|
|||||||
starting_directory = current_directory;
|
starting_directory = current_directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell the user where he is. */
|
|
||||||
|
|
||||||
if (print_directory_flag)
|
|
||||||
log_working_directory (1);
|
|
||||||
|
|
||||||
/* Read any stdin makefiles into temporary files. */
|
/* Read any stdin makefiles into temporary files. */
|
||||||
|
|
||||||
@@ -694,11 +695,16 @@ main (argc, argv, envp)
|
|||||||
/* This makefile is standard input. Since we may re-exec
|
/* This makefile is standard input. Since we may re-exec
|
||||||
and thus re-read the makefiles, we read standard input
|
and thus re-read the makefiles, we read standard input
|
||||||
into a temporary file and read from that. */
|
into a temporary file and read from that. */
|
||||||
static char name[] = "/tmp/GmXXXXXX";
|
|
||||||
FILE *outfile;
|
FILE *outfile;
|
||||||
|
|
||||||
/* Make a unique filename. */
|
/* Make a unique filename. */
|
||||||
|
#ifdef HAVE_MKTEMP
|
||||||
|
static char name[] = "/tmp/GmXXXXXX";
|
||||||
(void) mktemp (name);
|
(void) mktemp (name);
|
||||||
|
#else
|
||||||
|
static char name[L_tmpnam];
|
||||||
|
(void) tmpnam (name);
|
||||||
|
#endif
|
||||||
|
|
||||||
outfile = fopen (name, "w");
|
outfile = fopen (name, "w");
|
||||||
if (outfile == 0)
|
if (outfile == 0)
|
||||||
@@ -747,6 +753,11 @@ main (argc, argv, envp)
|
|||||||
(void) signal (SIGCLD, child_handler);
|
(void) signal (SIGCLD, child_handler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Let the user send us SIGUSR1 to toggle the -d flag during the run. */
|
||||||
|
#ifdef SIGUSR1
|
||||||
|
(void) signal (SIGUSR1, debug_signal_handler);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define the initial list of suffixes for old-style rules. */
|
/* Define the initial list of suffixes for old-style rules. */
|
||||||
|
|
||||||
set_default_suffixes ();
|
set_default_suffixes ();
|
||||||
@@ -788,12 +799,8 @@ main (argc, argv, envp)
|
|||||||
|
|
||||||
define_makeflags (1, 0);
|
define_makeflags (1, 0);
|
||||||
|
|
||||||
ignore_errors_flag |= lookup_file (".IGNORE") != 0;
|
/* Make each `struct dep' point at the `struct file' for the file
|
||||||
|
depended on. Also do magic for special targets. */
|
||||||
silent_flag |= lookup_file (".SILENT") != 0;
|
|
||||||
|
|
||||||
/* Make each `struct dep' point at the
|
|
||||||
`struct file' for the file depended on. */
|
|
||||||
|
|
||||||
snap_deps ();
|
snap_deps ();
|
||||||
|
|
||||||
@@ -904,21 +911,24 @@ main (argc, argv, envp)
|
|||||||
d = d->next;
|
d = d->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up `MAKEFLAGS' specially while remaking makefiles. */
|
/* Set up `MAKEFLAGS' specially while remaking makefiles. */
|
||||||
define_makeflags (1, 1);
|
define_makeflags (1, 1);
|
||||||
|
|
||||||
switch (update_goal_chain (read_makefiles, 1))
|
switch (update_goal_chain (read_makefiles, 1))
|
||||||
{
|
{
|
||||||
|
case 1:
|
||||||
default:
|
default:
|
||||||
abort ();
|
#define BOGUS_UPDATE_STATUS 0
|
||||||
|
assert (BOGUS_UPDATE_STATUS);
|
||||||
|
break;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
/* Did nothing. */
|
/* Did nothing. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 2:
|
||||||
/* Failed to update. Figure out if we care. */
|
/* Failed to update. Figure out if we care. */
|
||||||
{
|
{
|
||||||
/* Nonzero if any makefile was successfully remade. */
|
/* Nonzero if any makefile was successfully remade. */
|
||||||
@@ -991,8 +1001,7 @@ main (argc, argv, envp)
|
|||||||
if (print_data_base_flag)
|
if (print_data_base_flag)
|
||||||
print_data_base ();
|
print_data_base ();
|
||||||
|
|
||||||
if (print_directory_flag)
|
log_working_directory (0);
|
||||||
log_working_directory (0);
|
|
||||||
|
|
||||||
if (makefiles != 0)
|
if (makefiles != 0)
|
||||||
{
|
{
|
||||||
@@ -1123,7 +1132,7 @@ main (argc, argv, envp)
|
|||||||
|
|
||||||
/* Parsing of arguments, decoding of switches. */
|
/* Parsing of arguments, decoding of switches. */
|
||||||
|
|
||||||
static char options[sizeof (switches) / sizeof (switches[0]) * 3];
|
static char options[1 + sizeof (switches) / sizeof (switches[0]) * 3];
|
||||||
static struct option long_options[(sizeof (switches) / sizeof (switches[0])) +
|
static struct option long_options[(sizeof (switches) / sizeof (switches[0])) +
|
||||||
(sizeof (long_option_aliases) /
|
(sizeof (long_option_aliases) /
|
||||||
sizeof (long_option_aliases[0]))];
|
sizeof (long_option_aliases[0]))];
|
||||||
@@ -1141,6 +1150,11 @@ init_switches ()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
p = options;
|
p = options;
|
||||||
|
|
||||||
|
/* Return switch and non-switch args in order, regardless of
|
||||||
|
POSIXLY_CORRECT. Non-switch args are returned as option 1. */
|
||||||
|
*p++ = '-';
|
||||||
|
|
||||||
for (i = 0; switches[i].c != '\0'; ++i)
|
for (i = 0; switches[i].c != '\0'; ++i)
|
||||||
{
|
{
|
||||||
long_options[i].name = (switches[i].long_name == 0 ? "" :
|
long_options[i].name = (switches[i].long_name == 0 ? "" :
|
||||||
@@ -1181,6 +1195,51 @@ init_switches ()
|
|||||||
long_options[i].name = 0;
|
long_options[i].name = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_non_switch_argument (arg, env)
|
||||||
|
char *arg;
|
||||||
|
int env;
|
||||||
|
{
|
||||||
|
/* Non-option argument. It might be a variable definition. */
|
||||||
|
struct variable *v;
|
||||||
|
if (arg[0] == '-' && arg[1] == '\0')
|
||||||
|
/* Ignore plain `-' for compatibility. */
|
||||||
|
return;
|
||||||
|
v = try_variable_definition ((char *) 0, 0, arg, o_command);
|
||||||
|
if (v != 0)
|
||||||
|
{
|
||||||
|
/* It is indeed a variable definition. Record a pointer to
|
||||||
|
the variable for later use in define_makeflags. */
|
||||||
|
struct command_variable *cv
|
||||||
|
= (struct command_variable *) xmalloc (sizeof (*cv));
|
||||||
|
cv->variable = v;
|
||||||
|
cv->next = command_variables;
|
||||||
|
command_variables = cv;
|
||||||
|
}
|
||||||
|
else if (! env)
|
||||||
|
{
|
||||||
|
/* Not an option or variable definition; it must be a goal
|
||||||
|
target! Enter it as a file and add it to the dep chain of
|
||||||
|
goals. */
|
||||||
|
struct file *f = enter_command_line_file (arg);
|
||||||
|
f->cmd_target = 1;
|
||||||
|
|
||||||
|
if (goals == 0)
|
||||||
|
{
|
||||||
|
goals = (struct dep *) xmalloc (sizeof (struct dep));
|
||||||
|
lastgoal = goals;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastgoal->next
|
||||||
|
= (struct dep *) xmalloc (sizeof (struct dep));
|
||||||
|
lastgoal = lastgoal->next;
|
||||||
|
}
|
||||||
|
lastgoal->name = 0;
|
||||||
|
lastgoal->file = f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Decode switches from ARGC and ARGV.
|
/* Decode switches from ARGC and ARGV.
|
||||||
They came from the environment if ENV is nonzero. */
|
They came from the environment if ENV is nonzero. */
|
||||||
|
|
||||||
@@ -1195,15 +1254,6 @@ decode_switches (argc, argv, env)
|
|||||||
register struct stringlist *sl;
|
register struct stringlist *sl;
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
if (!env)
|
|
||||||
{
|
|
||||||
other_args = (struct stringlist *) xmalloc (sizeof (struct stringlist));
|
|
||||||
other_args->max = argc + 1;
|
|
||||||
other_args->list = (char **) xmalloc ((argc + 1) * sizeof (char *));
|
|
||||||
other_args->idx = 1;
|
|
||||||
other_args->list[0] = argv[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* getopt does most of the parsing for us.
|
/* getopt does most of the parsing for us.
|
||||||
First, get its vectors set up. */
|
First, get its vectors set up. */
|
||||||
|
|
||||||
@@ -1215,10 +1265,17 @@ decode_switches (argc, argv, env)
|
|||||||
/* Reset getopt's state. */
|
/* Reset getopt's state. */
|
||||||
optind = 0;
|
optind = 0;
|
||||||
|
|
||||||
while ((c = getopt_long (argc, argv,
|
while (optind < argc)
|
||||||
options, long_options, (int *) 0)) != EOF)
|
|
||||||
{
|
{
|
||||||
if (c == '?')
|
/* Parse the next argument. */
|
||||||
|
c = getopt_long (argc, argv, options, long_options, (int *) 0);
|
||||||
|
if (c == EOF)
|
||||||
|
/* End of arguments, or "--" marker seen. */
|
||||||
|
break;
|
||||||
|
else if (c == 1)
|
||||||
|
/* An argument not starting with a dash. */
|
||||||
|
handle_non_switch_argument (optarg, env);
|
||||||
|
else if (c == '?')
|
||||||
/* Bad option. We will print a usage message and die later.
|
/* Bad option. We will print a usage message and die later.
|
||||||
But continue to parse the other options so the user can
|
But continue to parse the other options so the user can
|
||||||
see all he did wrong. */
|
see all he did wrong. */
|
||||||
@@ -1308,41 +1365,39 @@ positive integral argument",
|
|||||||
optarg = argv[optind++];
|
optarg = argv[optind++];
|
||||||
|
|
||||||
if (doit)
|
if (doit)
|
||||||
*(double *) cs->value_ptr
|
*(double *) cs->value_ptr
|
||||||
= (optarg != 0 ? atof (optarg)
|
= (optarg != 0 ? atof (optarg)
|
||||||
: *(double *) cs->noarg_value);
|
: *(double *) cs->noarg_value);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We've found the switch. Stop looking. */
|
/* We've found the switch. Stop looking. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!env)
|
/* There are no more options according to getting getopt, but there may
|
||||||
{
|
be some arguments left. Since we have asked for non-option arguments
|
||||||
/* Collect the remaining args in the `other_args' string list. */
|
to be returned in order, this only happens when there is a "--"
|
||||||
|
argument to prevent later arguments from being options. */
|
||||||
|
while (optind < argc)
|
||||||
|
handle_non_switch_argument (argv[optind++], env);
|
||||||
|
|
||||||
while (optind < argc)
|
|
||||||
{
|
|
||||||
char *arg = argv[optind++];
|
|
||||||
if (arg[0] != '-' || arg[1] != '\0')
|
|
||||||
other_args->list[other_args->idx++] = arg;
|
|
||||||
}
|
|
||||||
other_args->list[other_args->idx] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!env && (bad || print_usage_flag))
|
if (!env && (bad || print_usage_flag))
|
||||||
{
|
{
|
||||||
/* Print a nice usage message. */
|
/* Print a nice usage message. */
|
||||||
|
FILE *usageto;
|
||||||
|
|
||||||
if (print_version_flag)
|
if (print_version_flag)
|
||||||
print_version ();
|
print_version ();
|
||||||
|
|
||||||
fprintf (stderr, "Usage: %s [options] [target] ...\n", program);
|
usageto = bad ? stderr : stdout;
|
||||||
|
|
||||||
fputs ("Options:\n", stderr);
|
fprintf (usageto, "Usage: %s [options] [target] ...\n", program);
|
||||||
|
|
||||||
|
fputs ("Options:\n", usageto);
|
||||||
for (cs = switches; cs->c != '\0'; ++cs)
|
for (cs = switches; cs->c != '\0'; ++cs)
|
||||||
{
|
{
|
||||||
char buf[1024], shortarg[50], longarg[50], *p;
|
char buf[1024], shortarg[50], longarg[50], *p;
|
||||||
@@ -1413,11 +1468,11 @@ positive integral argument",
|
|||||||
line with the description, leaving at least two spaces.
|
line with the description, leaving at least two spaces.
|
||||||
Print it on its own line instead. */
|
Print it on its own line instead. */
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s\n", buf);
|
fprintf (usageto, "%s\n", buf);
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (stderr, "%*s%s.\n",
|
fprintf (usageto, "%*s%s.\n",
|
||||||
- DESCRIPTION_COLUMN,
|
- DESCRIPTION_COLUMN,
|
||||||
buf, cs->description);
|
buf, cs->description);
|
||||||
}
|
}
|
||||||
@@ -1437,7 +1492,7 @@ decode_env_switches (envar, len)
|
|||||||
unsigned int len;
|
unsigned int len;
|
||||||
{
|
{
|
||||||
char *varref = (char *) alloca (2 + len + 2);
|
char *varref = (char *) alloca (2 + len + 2);
|
||||||
char *value, *args;
|
char *value, *p;
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
@@ -1455,37 +1510,95 @@ decode_env_switches (envar, len)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Make a copy of the value in ARGS, where we will munge it.
|
|
||||||
If it does not begin with a dash, prepend one.
|
|
||||||
We must allocate lasting storage for this (and we never free it) because
|
|
||||||
decode_switches may save pointers into it for string-valued switches. */
|
|
||||||
args = (char *) xmalloc (1 + len + 2);
|
|
||||||
if (value[0] != '-')
|
|
||||||
args[0] = '-';
|
|
||||||
bcopy (value, value[0] == '-' ? args : &args[1], len + 1);
|
|
||||||
/* Write an extra null terminator so our loop below will
|
|
||||||
never be in danger of looking past the end of the string. */
|
|
||||||
args[(value[0] == '-' ? 0 : 1) + len + 1] = '\0';
|
|
||||||
|
|
||||||
/* Allocate a vector that is definitely big enough. */
|
/* Allocate a vector that is definitely big enough. */
|
||||||
argv = (char **) alloca ((1 + len + 1) * sizeof (char *));
|
argv = (char **) alloca ((1 + len + 1) * sizeof (char *));
|
||||||
|
|
||||||
|
/* Allocate a buffer to copy the value into while we split it into words
|
||||||
|
and unquote it. We must use permanent storage for this because
|
||||||
|
decode_switches may store pointers into the passed argument words. */
|
||||||
|
p = (char *) xmalloc (2 * len);
|
||||||
|
|
||||||
/* getopt will look at the arguments starting at ARGV[1].
|
/* getopt will look at the arguments starting at ARGV[1].
|
||||||
Prepend a spacer word. */
|
Prepend a spacer word. */
|
||||||
argv[0] = 0;
|
argv[0] = 0;
|
||||||
argc = 1;
|
argc = 1;
|
||||||
do
|
argv[argc] = p;
|
||||||
|
while (*value != '\0')
|
||||||
{
|
{
|
||||||
argv[argc++] = args;
|
if (*value == '\\')
|
||||||
args = end_of_token (args);
|
++value; /* Skip the backslash. */
|
||||||
*args++ = '\0';
|
else if (isblank (*value))
|
||||||
} while (*args != '\0');
|
{
|
||||||
argv[argc] = 0;
|
/* End of the word. */
|
||||||
|
*p++ = '\0';
|
||||||
|
argv[++argc] = p;
|
||||||
|
do
|
||||||
|
++value;
|
||||||
|
while (isblank (*value));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
*p++ = *value++;
|
||||||
|
}
|
||||||
|
*p = '\0';
|
||||||
|
argv[++argc] = 0;
|
||||||
|
|
||||||
|
if (argc == 2 && argv[1][0] != '-')
|
||||||
|
{
|
||||||
|
/* There is just one word in the value, and it is not a switch.
|
||||||
|
Either this is the single-word form and we should prepend a dash
|
||||||
|
before calling decode_switches, or this is the multi-word form and
|
||||||
|
there is no dash because it is a variable definition. */
|
||||||
|
struct variable *v;
|
||||||
|
v = try_variable_definition ((char *) 0, 0, argv[1], o_command);
|
||||||
|
if (v != 0)
|
||||||
|
{
|
||||||
|
/* It was indeed a variable definition, and now it has been
|
||||||
|
processed. There is nothing for decode_switches to do.
|
||||||
|
Record a pointer to the variable for later use in
|
||||||
|
define_makeflags. */
|
||||||
|
struct command_variable *cv
|
||||||
|
= (struct command_variable *) xmalloc (sizeof (*cv));
|
||||||
|
cv->variable = v;
|
||||||
|
cv->next = command_variables;
|
||||||
|
command_variables = cv;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* It wasn't a variable definition, so it's some switches without a
|
||||||
|
leading dash. Add one and pass it along to decode_switches. We
|
||||||
|
need permanent storage for this in case decode_switches saves
|
||||||
|
pointers into the value. */
|
||||||
|
argv[1] = concat ("-", argv[1], "");
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse those words. */
|
/* Parse those words. */
|
||||||
decode_switches (argc, argv, 1);
|
decode_switches (argc, argv, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Quote the string IN so that it will be interpreted as a single word with
|
||||||
|
no magic by the shell; if DOUBLE_DOLLARS is nonzero, also double dollar
|
||||||
|
signs to avoid variable expansion in make itself. Write the result into
|
||||||
|
OUT, returning the address of the next character to be written.
|
||||||
|
Allocating space for OUT twice the length of IN (thrice if
|
||||||
|
DOUBLE_DOLLARS is nonzero) is always sufficient. */
|
||||||
|
|
||||||
|
static char *
|
||||||
|
quote_as_word (out, in, double_dollars)
|
||||||
|
char *out, *in;
|
||||||
|
int double_dollars;
|
||||||
|
{
|
||||||
|
while (*in != '\0')
|
||||||
|
{
|
||||||
|
if (index ("^;'\"*?[]$<>(){}|&~`\\ \t\r\n\f\v", *in) != 0)
|
||||||
|
*out++ = '\\';
|
||||||
|
if (double_dollars && *in == '$')
|
||||||
|
*out++ = '$';
|
||||||
|
*out++ = *in++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
/* Define the MAKEFLAGS and MFLAGS variables to reflect the settings of the
|
/* Define the MAKEFLAGS and MFLAGS variables to reflect the settings of the
|
||||||
command switches. Include options with args if ALL is nonzero.
|
command switches. Include options with args if ALL is nonzero.
|
||||||
Don't include options with the `no_makefile' flag set if MAKEFILE. */
|
Don't include options with the `no_makefile' flag set if MAKEFILE. */
|
||||||
@@ -1494,8 +1607,12 @@ static void
|
|||||||
define_makeflags (all, makefile)
|
define_makeflags (all, makefile)
|
||||||
int all, makefile;
|
int all, makefile;
|
||||||
{
|
{
|
||||||
|
static const char ref[] = "$(MAKEOVERRIDES)";
|
||||||
|
static const char posixref[] = "$(-*-command-variables-*-)";
|
||||||
register const struct command_switch *cs;
|
register const struct command_switch *cs;
|
||||||
char *flagstring;
|
char *flagstring;
|
||||||
|
register char *p;
|
||||||
|
unsigned int words;
|
||||||
struct variable *v;
|
struct variable *v;
|
||||||
|
|
||||||
/* We will construct a linked list of `struct flag's describing
|
/* We will construct a linked list of `struct flag's describing
|
||||||
@@ -1508,7 +1625,6 @@ define_makeflags (all, makefile)
|
|||||||
struct flag *next;
|
struct flag *next;
|
||||||
const struct command_switch *cs;
|
const struct command_switch *cs;
|
||||||
char *arg;
|
char *arg;
|
||||||
unsigned int arglen;
|
|
||||||
};
|
};
|
||||||
struct flag *flags = 0;
|
struct flag *flags = 0;
|
||||||
unsigned int flagslen = 0;
|
unsigned int flagslen = 0;
|
||||||
@@ -1517,13 +1633,12 @@ define_makeflags (all, makefile)
|
|||||||
struct flag *new = (struct flag *) alloca (sizeof (struct flag)); \
|
struct flag *new = (struct flag *) alloca (sizeof (struct flag)); \
|
||||||
new->cs = cs; \
|
new->cs = cs; \
|
||||||
new->arg = (ARG); \
|
new->arg = (ARG); \
|
||||||
new->arglen = (LEN); \
|
|
||||||
new->next = flags; \
|
new->next = flags; \
|
||||||
flags = new; \
|
flags = new; \
|
||||||
if (new->arg == 0) \
|
if (new->arg == 0) \
|
||||||
++flagslen; /* Just a single flag letter. */ \
|
++flagslen; /* Just a single flag letter. */ \
|
||||||
else \
|
else \
|
||||||
flagslen += 1 + 1 + 1 + 1 + new->arglen; /* " -x foo" */ \
|
flagslen += 1 + 1 + 1 + 1 + 3 * (LEN); /* " -x foo" */ \
|
||||||
if (!isalnum (cs->c)) \
|
if (!isalnum (cs->c)) \
|
||||||
/* This switch has no single-letter version, so we use the long. */ \
|
/* This switch has no single-letter version, so we use the long. */ \
|
||||||
flagslen += 2 + strlen (cs->long_name); \
|
flagslen += 2 + strlen (cs->long_name); \
|
||||||
@@ -1607,87 +1722,137 @@ define_makeflags (all, makefile)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flagslen += 4 + sizeof posixref; /* Four more for the possible " -- ". */
|
||||||
|
|
||||||
#undef ADD_FLAG
|
#undef ADD_FLAG
|
||||||
|
|
||||||
if (flags == 0)
|
/* Construct the value in FLAGSTRING.
|
||||||
/* No flags. Use a string of two nulls so [1] works below. */
|
We allocate enough space for a preceding dash and trailing null. */
|
||||||
flagstring = "\0";
|
flagstring = (char *) alloca (1 + flagslen + 1);
|
||||||
else
|
p = flagstring;
|
||||||
|
words = 1;
|
||||||
|
*p++ = '-';
|
||||||
|
while (flags != 0)
|
||||||
{
|
{
|
||||||
/* Construct the value in FLAGSTRING.
|
/* Add the flag letter or name to the string. */
|
||||||
We allocate enough space for a preceding dash and trailing null. */
|
if (!isalnum (flags->cs->c))
|
||||||
register char *p;
|
|
||||||
flagstring = (char *) alloca (1 + flagslen + 1);
|
|
||||||
p = flagstring;
|
|
||||||
*p++ = '-';
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
/* Add the flag letter or name to the string. */
|
*p++ = '-';
|
||||||
if (!isalnum (flags->cs->c))
|
strcpy (p, flags->cs->long_name);
|
||||||
|
p += strlen (p);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*p++ = flags->cs->c;
|
||||||
|
if (flags->arg != 0)
|
||||||
|
{
|
||||||
|
/* A flag that takes an optional argument which in this case is
|
||||||
|
omitted is specified by ARG being "". We must distinguish
|
||||||
|
because a following flag appended without an intervening " -"
|
||||||
|
is considered the arg for the first. */
|
||||||
|
if (flags->arg[0] != '\0')
|
||||||
{
|
{
|
||||||
*p++ = '-';
|
/* Add its argument too. */
|
||||||
strcpy (p, flags->cs->long_name);
|
*p++ = !isalnum (flags->cs->c) ? '=' : ' ';
|
||||||
p += strlen (p);
|
p = quote_as_word (p, flags->arg, 1);
|
||||||
}
|
}
|
||||||
else
|
++words;
|
||||||
*p++ = flags->cs->c;
|
/* Write a following space and dash, for the next flag. */
|
||||||
if (flags->arg != 0)
|
*p++ = ' ';
|
||||||
{
|
*p++ = '-';
|
||||||
/* A flag that takes an optional argument which in this case
|
}
|
||||||
is omitted is specified by ARG being "" and ARGLEN being 0.
|
else if (!isalnum (flags->cs->c))
|
||||||
We must distinguish because a following flag appended without
|
{
|
||||||
an intervening " -" is considered the arg for the first. */
|
++words;
|
||||||
if (flags->arglen > 0)
|
/* Long options must each go in their own word,
|
||||||
{
|
so we write the following space and dash. */
|
||||||
/* Add its argument too. */
|
*p++ = ' ';
|
||||||
*p++ = !isalnum (flags->cs->c) ? '=' : ' ';
|
*p++ = '-';
|
||||||
bcopy (flags->arg, p, flags->arglen);
|
}
|
||||||
p += flags->arglen;
|
flags = flags->next;
|
||||||
}
|
|
||||||
/* Write a following space and dash, for the next flag. */
|
|
||||||
*p++ = ' ';
|
|
||||||
*p++ = '-';
|
|
||||||
}
|
|
||||||
else if (!isalnum (flags->cs->c))
|
|
||||||
{
|
|
||||||
/* Long options must each go in their own word,
|
|
||||||
so we write the following space and dash. */
|
|
||||||
*p++ = ' ';
|
|
||||||
*p++ = '-';
|
|
||||||
}
|
|
||||||
flags = flags->next;
|
|
||||||
} while (flags != 0);
|
|
||||||
|
|
||||||
if (p[-1] == '-')
|
|
||||||
/* Kill the final space and dash. */
|
|
||||||
p -= 2;
|
|
||||||
|
|
||||||
/* Terminate the string. */
|
|
||||||
*p = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Define MFLAGS before appending variable definitions. */
|
||||||
|
|
||||||
|
if (p == &flagstring[1])
|
||||||
|
/* No flags. */
|
||||||
|
flagstring[0] = '\0';
|
||||||
|
else if (p[-1] == '-')
|
||||||
|
/* Kill the final space and dash. */
|
||||||
|
p[-2] = '\0';
|
||||||
|
else
|
||||||
|
/* Terminate the string. */
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
|
/* Since MFLAGS is not parsed for flags, there is no reason to
|
||||||
|
override any makefile redefinition. */
|
||||||
|
(void) define_variable ("MFLAGS", 6, flagstring, o_env, 1);
|
||||||
|
|
||||||
|
|
||||||
|
if (all && command_variables != 0)
|
||||||
|
{
|
||||||
|
/* Now write a reference to $(MAKEOVERRIDES), which contains all the
|
||||||
|
command-line variable definitions. */
|
||||||
|
|
||||||
|
if (p == &flagstring[1])
|
||||||
|
/* No flags written, so elide the leading dash already written. */
|
||||||
|
p = flagstring;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Separate the variables from the switches with a "--" arg. */
|
||||||
|
if (p[-1] != '-')
|
||||||
|
{
|
||||||
|
/* We did not already write a trailing " -". */
|
||||||
|
*p++ = ' ';
|
||||||
|
*p++ = '-';
|
||||||
|
}
|
||||||
|
/* There is a trailing " -"; fill it out to " -- ". */
|
||||||
|
*p++ = '-';
|
||||||
|
*p++ = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy in the string. */
|
||||||
|
if (posix_pedantic)
|
||||||
|
{
|
||||||
|
bcopy (posixref, p, sizeof posixref - 1);
|
||||||
|
p += sizeof posixref - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bcopy (ref, p, sizeof ref - 1);
|
||||||
|
p += sizeof ref - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (p == &flagstring[1])
|
||||||
|
{
|
||||||
|
words = 0;
|
||||||
|
--p;
|
||||||
|
}
|
||||||
|
else if (p[-1] == '-')
|
||||||
|
/* Kill the final space and dash. */
|
||||||
|
p -= 2;
|
||||||
|
/* Terminate the string. */
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
v = define_variable ("MAKEFLAGS", 9,
|
v = define_variable ("MAKEFLAGS", 9,
|
||||||
/* On Sun, the value of MFLAGS starts with a `-' but
|
/* If there is just a single word of switches,
|
||||||
the value of MAKEFLAGS lacks the `-'.
|
omit the leading dash unless it is a single
|
||||||
Be compatible with this unless FLAGSTRING starts
|
long option with two leading dashes. */
|
||||||
with a long option `--foo', since removing the
|
&flagstring[(words == 1 && command_variables == 0
|
||||||
first dash would result in the bogus `-foo'. */
|
&& flagstring[1] != '-')
|
||||||
flagstring[1] == '-' ? flagstring : &flagstring[1],
|
? 1 : 0],
|
||||||
/* This used to use o_env, but that lost when a
|
/* This used to use o_env, but that lost when a
|
||||||
makefile defined MAKEFLAGS. Makefiles set
|
makefile defined MAKEFLAGS. Makefiles set
|
||||||
MAKEFLAGS to add switches, but we still want
|
MAKEFLAGS to add switches, but we still want
|
||||||
to redefine its value with the full set of
|
to redefine its value with the full set of
|
||||||
switches. Of course, an override or command
|
switches. Of course, an override or command
|
||||||
definition will still take precedence. */
|
definition will still take precedence. */
|
||||||
o_file, 0);
|
o_file, 1);
|
||||||
if (! all)
|
if (! all)
|
||||||
/* The first time we are called, set MAKEFLAGS to always be exported.
|
/* The first time we are called, set MAKEFLAGS to always be exported.
|
||||||
We should not do this again on the second call, because that is
|
We should not do this again on the second call, because that is
|
||||||
after reading makefiles which might have done `unexport MAKEFLAGS'. */
|
after reading makefiles which might have done `unexport MAKEFLAGS'. */
|
||||||
v->export = v_export;
|
v->export = v_export;
|
||||||
/* Since MFLAGS is not parsed for flags, there is no reason to
|
|
||||||
override any makefile redefinition. */
|
|
||||||
(void) define_variable ("MFLAGS", 6, flagstring, o_env, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print version information. */
|
/* Print version information. */
|
||||||
@@ -1708,7 +1873,7 @@ print_version ()
|
|||||||
printf ("-%s", remote_description);
|
printf ("-%s", remote_description);
|
||||||
|
|
||||||
printf (", by Richard Stallman and Roland McGrath.\n\
|
printf (", by Richard Stallman and Roland McGrath.\n\
|
||||||
%sCopyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.\n\
|
%sCopyright (C) 1988, 89, 90, 91, 92, 93, 94, 95 Free Software Foundation, Inc.\n\
|
||||||
%sThis is free software; see the source for copying conditions.\n\
|
%sThis is free software; see the source for copying conditions.\n\
|
||||||
%sThere is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
|
%sThere is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
|
||||||
%sPARTICULAR PURPOSE.\n\n", precede, precede, precede, precede);
|
%sPARTICULAR PURPOSE.\n\n", precede, precede, precede, precede);
|
||||||
@@ -1755,6 +1920,13 @@ die (status)
|
|||||||
|
|
||||||
dying = 1;
|
dying = 1;
|
||||||
|
|
||||||
|
/* Try to move back to the original directory. This is essential on
|
||||||
|
MS-DOS (where there is really only one process), and on Unix it
|
||||||
|
puts core files in the original directory instead of the -C
|
||||||
|
directory. */
|
||||||
|
if (directory_before_chdir != 0)
|
||||||
|
chdir (directory_before_chdir);
|
||||||
|
|
||||||
if (print_version_flag)
|
if (print_version_flag)
|
||||||
print_version ();
|
print_version ();
|
||||||
|
|
||||||
@@ -1768,8 +1940,7 @@ die (status)
|
|||||||
if (print_data_base_flag)
|
if (print_data_base_flag)
|
||||||
print_data_base ();
|
print_data_base ();
|
||||||
|
|
||||||
if (print_directory_flag)
|
log_working_directory (0);
|
||||||
log_working_directory (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exit (status);
|
exit (status);
|
||||||
@@ -1778,20 +1949,21 @@ die (status)
|
|||||||
/* Write a message indicating that we've just entered or
|
/* Write a message indicating that we've just entered or
|
||||||
left (according to ENTERING) the current directory. */
|
left (according to ENTERING) the current directory. */
|
||||||
|
|
||||||
static void
|
void
|
||||||
log_working_directory (entering)
|
log_working_directory (entering)
|
||||||
int entering;
|
int entering;
|
||||||
{
|
{
|
||||||
static int entered = 0;
|
static int entered = 0;
|
||||||
char *message = entering ? "Entering" : "Leaving";
|
char *message = entering ? "Entering" : "Leaving";
|
||||||
|
|
||||||
if (entering)
|
/* Print nothing without the flag. Don't print the entering message
|
||||||
entered = 1;
|
again if we already have. Don't print the leaving message if we
|
||||||
else if (!entered)
|
haven't printed the entering message. */
|
||||||
/* Don't print the leaving message if we
|
if (! print_directory_flag || entering == entered)
|
||||||
haven't printed the entering message. */
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
entered = entering;
|
||||||
|
|
||||||
if (print_data_base_flag)
|
if (print_data_base_flag)
|
||||||
fputs ("# ", stdout);
|
fputs ("# ", stdout);
|
||||||
|
|
||||||
|
|||||||
383
make-stds.texi
383
make-stds.texi
@@ -32,6 +32,20 @@ to avoid trouble on systems where the @code{SHELL} variable might be
|
|||||||
inherited from the environment. (This is never a problem with GNU
|
inherited from the environment. (This is never a problem with GNU
|
||||||
@code{make}.)
|
@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
|
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
|
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
|
make, please make sure that it uses @file{./} if the program is built as
|
||||||
@@ -43,33 +57,34 @@ The distinction between @file{./} and @file{$(srcdir)/} is important
|
|||||||
when using the @samp{--srcdir} option to @file{configure}. A rule of
|
when using the @samp{--srcdir} option to @file{configure}. A rule of
|
||||||
the form:
|
the form:
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
foo.1 : foo.man sedscript
|
foo.1 : foo.man sedscript
|
||||||
sed -e sedscript foo.man > foo.1
|
sed -e sedscript foo.man > foo.1
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
will fail when the current directory is not the source directory,
|
will fail when the current directory is not the source directory,
|
||||||
because @file{foo.man} and @file{sedscript} are not in the current
|
because @file{foo.man} and @file{sedscript} are not in the current
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
Relying on @samp{VPATH} to find the source file will work in the case
|
When using GNU @code{make}, relying on @samp{VPATH} to find the source
|
||||||
where there is a single dependency file, since the @file{make} automatic
|
file will work in the case where there is a single dependency file,
|
||||||
variable @samp{$<} will represent the source file wherever it is. A
|
since the @file{make} automatic variable @samp{$<} will represent the
|
||||||
makefile target like
|
source file wherever it is. (Many versions of @code{make} set @samp{$<}
|
||||||
|
only in implicit rules.) A makefile target like
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
foo.o : bar.c
|
foo.o : bar.c
|
||||||
$(CC) $(CFLAGS) -I. -I$(srcdir) -c bar.c -o foo.o
|
$(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
should instead be written as
|
should instead be written as
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
foo.o : bar.c
|
foo.o : bar.c
|
||||||
$(CC) $(CFLAGS) $< -o $@@
|
$(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@@
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
in order to allow @samp{VPATH} to work correctly. When the target has
|
in order to allow @samp{VPATH} to work correctly. When the target has
|
||||||
@@ -77,10 +92,10 @@ multiple dependencies, using an explicit @samp{$(srcdir)} is the easiest
|
|||||||
way to make the rule work well. For example, the target above for
|
way to make the rule work well. For example, the target above for
|
||||||
@file{foo.1} is best written as:
|
@file{foo.1} is best written as:
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
foo.1 : foo.man sedscript
|
foo.1 : foo.man sedscript
|
||||||
sed -s $(srcdir)/sedscript $(srcdir)/foo.man > foo.1
|
sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@@
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
@node Utilities in Makefiles
|
@node Utilities in Makefiles
|
||||||
@section Utilities in Makefiles
|
@section Utilities in Makefiles
|
||||||
@@ -107,12 +122,21 @@ user can substitute alternatives. Here are some of the programs we
|
|||||||
mean:
|
mean:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
ar bison cc flex install ld lex make ranlib yacc
|
ar bison cc flex install ld lex
|
||||||
|
make makeinfo ranlib texi2dvi yacc
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
When you use @code{ranlib}, you should test whether it exists, and run
|
Use the following @code{make} variables:
|
||||||
it only if it exists, so that the distribution will work on systems that
|
|
||||||
don't have @code{ranlib}.
|
@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.
|
||||||
|
|
||||||
If you use symbolic links, you should implement a fallback for systems
|
If you use symbolic links, you should implement a fallback for systems
|
||||||
that don't have symbolic links.
|
that don't have symbolic links.
|
||||||
@@ -129,29 +153,70 @@ All GNU programs should have the following targets in their Makefiles:
|
|||||||
@table @samp
|
@table @samp
|
||||||
@item all
|
@item all
|
||||||
Compile the entire program. This should be the default target. This
|
Compile the entire program. This should be the default target. This
|
||||||
target need not rebuild any documentation files; info files should
|
target need not rebuild any documentation files; Info files should
|
||||||
normally be included in the distribution, and DVI files should be made
|
normally be included in the distribution, and DVI files should be made
|
||||||
only when explicitly asked for.
|
only when explicitly asked for.
|
||||||
|
|
||||||
@item install
|
@item install
|
||||||
Compile the program and copy the executables, libraries, and so on to
|
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
|
the file names where they should reside for actual use. If there is a
|
||||||
simple test to verify that a program is properly installed then run that
|
simple test to verify that a program is properly installed, this target
|
||||||
test.
|
should run that test.
|
||||||
|
|
||||||
|
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
|
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
|
@code{make} will ignore any errors. This is in case there are systems
|
||||||
that don't have the Unix man page documentation system installed.
|
that don't have the Unix man page documentation system installed.
|
||||||
|
|
||||||
In the future, when we have a standard way of installing info files,
|
The way to install Info files is to copy them into @file{$(infodir)}
|
||||||
@samp{install} targets will be the proper place to do so.
|
with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run
|
||||||
|
the @code{install-info} program if it is present. @code{install-info}
|
||||||
|
is a script that edits the Info @file{dir} file to add or update the
|
||||||
|
menu entry for the given Info file; it will be 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 --infodir=$(infodir) $$d/foo.info; \
|
||||||
|
else true; fi
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
@item uninstall
|
@item uninstall
|
||||||
Delete all the installed files that the @samp{install} target would
|
Delete all the installed files that the @samp{install} target would
|
||||||
create (but not the noninstalled files such as @samp{make all} would
|
create (but not the noninstalled files such as @samp{make all} would
|
||||||
create).
|
create).
|
||||||
|
|
||||||
|
This rule should not modify the directories where compilation is done,
|
||||||
|
only the directories where files are installed.
|
||||||
|
|
||||||
|
@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
|
@item clean
|
||||||
|
|
||||||
Delete all files from the current directory that are normally created by
|
Delete all files from the current directory that are normally created by
|
||||||
building the program. Don't delete the files that record the
|
building the program. Don't delete the files that record the
|
||||||
configuration. Also preserve files that could be made by building, but
|
configuration. Also preserve files that could be made by building, but
|
||||||
@@ -171,50 +236,68 @@ normally don't want to recompile. For example, the @samp{mostlyclean}
|
|||||||
target for GCC does not delete @file{libgcc.a}, because recompiling it
|
target for GCC does not delete @file{libgcc.a}, because recompiling it
|
||||||
is rarely necessary and takes a lot of time.
|
is rarely necessary and takes a lot of time.
|
||||||
|
|
||||||
@item realclean
|
@item maintainer-clean
|
||||||
Delete everything from the current directory that can be reconstructed
|
Delete almost everything from the current directory that can be
|
||||||
with this Makefile. This typically includes everything deleted by
|
reconstructed with this Makefile. This typically includes everything
|
||||||
distclean, plus more: C source files produced by Bison, tags tables,
|
deleted by @code{distclean}, plus more: C source files produced by
|
||||||
info files, and so on.
|
Bison, tags tables, Info files, and so on.
|
||||||
|
|
||||||
One exception, however: @samp{make realclean} should not delete
|
The reason we say ``almost everything'' is that running the command
|
||||||
@file{configure} even if @file{configure} can be remade using a rule in
|
@samp{make maintainer-clean} should not delete @file{configure} even if
|
||||||
the Makefile. More generally, @samp{make realclean} should not delete
|
it can be remade using a rule in the Makefile. More generally,
|
||||||
anything that needs to exist in order to run @file{configure}
|
@samp{make maintainer-clean} should not delete anything that needs to
|
||||||
and then begin to build the program.
|
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} 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 require special tools to rebuild."
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
@item TAGS
|
@item TAGS
|
||||||
Update a tags table for this program.
|
Update a tags table for this program.
|
||||||
|
|
||||||
@item info
|
@item info
|
||||||
Generate any info files needed. The best way to write the rules is as
|
Generate any Info files needed. The best way to write the rules is as
|
||||||
follows:
|
follows:
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
info: foo.info
|
info: foo.info
|
||||||
|
|
||||||
foo.info: $(srcdir)/foo.texi $(srcdir)/chap1.texi $(srcdir)/chap2.texi
|
foo.info: foo.texi chap1.texi chap2.texi
|
||||||
$(MAKEINFO) $(srcdir)/foo.texi
|
$(MAKEINFO) $(srcdir)/foo.texi
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
You must define the variable @code{MAKEINFO} in the Makefile.
|
You must define the variable @code{MAKEINFO} in the Makefile. It should
|
||||||
It should run the Makeinfo program, which is part of the Texinfo2 distribution.
|
run the @code{makeinfo} program, which is part of the Texinfo
|
||||||
|
distribution.
|
||||||
|
|
||||||
@item dvi
|
@item dvi
|
||||||
Generate DVI files for all TeXinfo documentation.
|
Generate DVI files for all TeXinfo documentation.
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
dvi: foo.dvi
|
dvi: foo.dvi
|
||||||
|
|
||||||
foo.dvi: $(srcdir)/foo.texi $(srcdir)/chap1.texi $(srcdir)/chap2.texi
|
foo.dvi: foo.texi chap1.texi chap2.texi
|
||||||
$(TEXI2DVI) $(srcdir)/foo.texi
|
$(TEXI2DVI) $(srcdir)/foo.texi
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
You must define the variable @code{TEXI2DVI} in the Makefile. It should
|
You must define the variable @code{TEXI2DVI} in the Makefile. It should
|
||||||
run the program @code{texi2dvi}, which is part of the Texinfo2
|
run the program @code{texi2dvi}, which is part of the Texinfo
|
||||||
distribution. Alternatively, write just the dependencies, and allow GNU
|
distribution. Alternatively, write just the dependencies, and allow GNU
|
||||||
Make to provide the command.
|
Make to provide the command.
|
||||||
|
|
||||||
@@ -243,6 +326,37 @@ the self-tests so that they work when the program is built but not
|
|||||||
installed.
|
installed.
|
||||||
@end table
|
@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; 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
|
||||||
|
|
||||||
@node Command Variables
|
@node Command Variables
|
||||||
@section Variables for Specifying Commands
|
@section Variables for Specifying Commands
|
||||||
|
|
||||||
@@ -274,12 +388,12 @@ Instead, arrange to pass the necessary options to the C compiler
|
|||||||
independently of @code{CFLAGS}, by writing them explicitly in the
|
independently of @code{CFLAGS}, by writing them explicitly in the
|
||||||
compilation commands or by defining an implicit rule, like this:
|
compilation commands or by defining an implicit rule, like this:
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
CFLAGS = -g
|
CFLAGS = -g
|
||||||
ALL_CFLAGS = $(CFLAGS) -I.
|
ALL_CFLAGS = -I. $(CFLAGS)
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $<
|
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
Do include the @samp{-g} option in @code{CFLAGS}, because that is not
|
Do include the @samp{-g} option in @code{CFLAGS}, because that is not
|
||||||
@emph{required} for proper compilation. You can consider it a default
|
@emph{required} for proper compilation. You can consider it a default
|
||||||
@@ -287,11 +401,15 @@ 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}
|
compiled with GCC by default, then you might as well include @samp{-O}
|
||||||
in the default value of @code{CFLAGS} as well.
|
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
|
Every Makefile should define the variable @code{INSTALL}, which is the
|
||||||
basic command for installing a file into the system.
|
basic command for installing a file into the system.
|
||||||
|
|
||||||
Every Makefile should also define variables @code{INSTALL_PROGRAM} and
|
Every Makefile should also define the variables @code{INSTALL_PROGRAM}
|
||||||
@code{INSTALL_DATA}. (The default for each of these should be
|
and @code{INSTALL_DATA}. (The default for each of these should be
|
||||||
@code{$(INSTALL)}.) Then it should use those variables as the commands
|
@code{$(INSTALL)}.) Then it should use those variables as the commands
|
||||||
for actual installation, for executables and nonexecutables
|
for actual installation, for executables and nonexecutables
|
||||||
respectively. Use these variables as follows:
|
respectively. Use these variables as follows:
|
||||||
@@ -311,48 +429,123 @@ installed.
|
|||||||
|
|
||||||
Installation directories should always be named by variables, so it is
|
Installation directories should always be named by variables, so it is
|
||||||
easy to install in a nonstandard place. The standard names for these
|
easy to install in a nonstandard place. The standard names for these
|
||||||
variables are:
|
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
|
@table @samp
|
||||||
@item prefix
|
@item prefix
|
||||||
A prefix used in constructing the default values of the variables listed
|
A prefix used in constructing the default values of the variables listed
|
||||||
below. The default value of @code{prefix} should be @file{/usr/local}
|
below. The default value of @code{prefix} should be @file{/usr/local}.
|
||||||
(at least for now).
|
When building the complete GNU system, the prefix will be empty and
|
||||||
|
@file{/usr} will be a symbolic link to @file{/}.
|
||||||
|
|
||||||
@item exec_prefix
|
@item exec_prefix
|
||||||
A prefix used in constructing the default values of the some of the
|
A prefix used in constructing the default values of some of the
|
||||||
variables listed below. The default value of @code{exec_prefix} should
|
variables listed below. The default value of @code{exec_prefix} should
|
||||||
be @code{$(prefix)}.
|
be @code{$(prefix)}.
|
||||||
|
|
||||||
Generally, @code{$(exec_prefix)} is used for directories that contain
|
Generally, @code{$(exec_prefix)} is used for directories that contain
|
||||||
machine-specific files (such as executables and subroutine libraries),
|
machine-specific files (such as executables and subroutine libraries),
|
||||||
while @code{$(prefix)} is used directly for other directories.
|
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
|
@item bindir
|
||||||
The directory for installing executable programs that users can run.
|
The directory for installing executable programs that users can run.
|
||||||
This should normally be @file{/usr/local/bin}, but write it as
|
This should normally be @file{/usr/local/bin}, but write it as
|
||||||
@file{$(exec_prefix)/bin}.
|
@file{$(exec_prefix)/bin}.
|
||||||
|
|
||||||
|
@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}.
|
||||||
|
|
||||||
|
@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}.
|
||||||
|
@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 of 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}. 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}.
|
||||||
|
|
||||||
|
@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}.
|
||||||
|
|
||||||
|
@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}.
|
||||||
|
|
||||||
@item libdir
|
@item libdir
|
||||||
The directory for installing executable files to be run by the program
|
The directory for object files and libraries of object code. Do not
|
||||||
rather than by users. Object files and libraries of object code should
|
install executables here, they probably belong in @file{$(libexecdir)}
|
||||||
also go in this directory. The idea is that this directory is used for
|
instead. The value of @code{libdir} should normally be
|
||||||
files that pertain to a specific machine architecture, but need not be
|
|
||||||
in the path for commands. The value of @code{libdir} should normally be
|
|
||||||
@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}.
|
@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}.
|
||||||
|
|
||||||
@item datadir
|
@item infodir
|
||||||
The directory for installing read-only data files which the programs
|
The directory for installing the Info files for this package. By
|
||||||
refer to while they run. This directory is used for files which are
|
default, it should be @file{/usr/local/info}, but it should be written
|
||||||
independent of the type of machine being used. This should normally be
|
as @file{$(prefix)/info}.
|
||||||
@file{/usr/local/lib}, but write it as @file{$(prefix)/lib}.
|
|
||||||
|
|
||||||
@item statedir
|
|
||||||
The directory for installing data files which the programs modify while
|
|
||||||
they run. These files should be independent of the type of machine
|
|
||||||
being used, and it should be possible to share them among machines at a
|
|
||||||
network installation. This should normally be @file{/usr/local/lib},
|
|
||||||
but write it as @file{$(prefix)/lib}.
|
|
||||||
|
|
||||||
@item includedir
|
@item includedir
|
||||||
@c rewritten to avoid overfull hbox --roland
|
@c rewritten to avoid overfull hbox --roland
|
||||||
@@ -384,22 +577,25 @@ 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
|
@file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo
|
||||||
package.
|
package.
|
||||||
|
|
||||||
The way to tell whether @file{foo.h} came from the Foo package is to put
|
To tell whether @file{foo.h} came from the Foo package, put a magic
|
||||||
a magic string in the file---part of a comment---and grep for that
|
string in the file---part of a comment---and grep for that string.
|
||||||
string.
|
@end table
|
||||||
|
|
||||||
|
Unix-style man pages are installed in one of the following:
|
||||||
|
|
||||||
|
@table @samp
|
||||||
@item mandir
|
@item mandir
|
||||||
The directory for installing the man pages (if any) for this package.
|
The top-level directory for installing the man pages (if any) for this
|
||||||
It should include the suffix for the proper section of the
|
package. It will normally be @file{/usr/local/man}, but you should
|
||||||
manual---usually @samp{1} for a utility.
|
write it as @file{$(prefix)/man}.
|
||||||
|
|
||||||
@item man1dir
|
@item man1dir
|
||||||
The directory for installing section 1 man pages.
|
The directory for installing section 1 man pages. Write it as
|
||||||
|
@file{$(mandir)/man1}.
|
||||||
@item man2dir
|
@item man2dir
|
||||||
The directory for installing section 2 man pages.
|
The directory for installing section 2 man pages. Write it as
|
||||||
|
@file{$(mandir)/man2}.
|
||||||
@item @dots{}
|
@item @dots{}
|
||||||
Use these names instead of @samp{mandir} if the package needs to install man
|
|
||||||
pages in more than one section of the manual.
|
|
||||||
|
|
||||||
@strong{Don't make the primary documentation for any GNU software be a
|
@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
|
man page. Write a manual in Texinfo instead. Man pages are just for
|
||||||
@@ -408,13 +604,20 @@ application only.}
|
|||||||
|
|
||||||
@item manext
|
@item manext
|
||||||
The file name extension for the installed man page. This should contain
|
The file name extension for the installed man page. This should contain
|
||||||
a period followed by the appropriate digit.
|
a period followed by the appropriate digit; it should normally be @samp{.1}.
|
||||||
|
|
||||||
@item infodir
|
@item man1ext
|
||||||
The directory for installing the info files for this package. By
|
The file name extension for installed section 1 man pages.
|
||||||
default, it should be @file{/usr/local/info}, but it should be written
|
@item man2ext
|
||||||
as @file{$(prefix)/info}.
|
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
|
@item srcdir
|
||||||
The directory for the sources being compiled. The value of this
|
The directory for the sources being compiled. The value of this
|
||||||
variable is normally inserted by the @code{configure} shell script.
|
variable is normally inserted by the @code{configure} shell script.
|
||||||
@@ -422,7 +625,7 @@ variable is normally inserted by the @code{configure} shell script.
|
|||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
@c I have changed some of the comments here slightly to fix an overfull
|
@c I have changed some of the comments here slightly to fix an overfull
|
||||||
@c hbox, so the make manual can format correctly. --roland
|
@c hbox, so the make manual can format correctly. --roland
|
||||||
# Common prefix for installation directories.
|
# Common prefix for installation directories.
|
||||||
@@ -432,10 +635,10 @@ exec_prefix = $(prefix)
|
|||||||
# Where to put the executable for the command `gcc'.
|
# Where to put the executable for the command `gcc'.
|
||||||
bindir = $(exec_prefix)/bin
|
bindir = $(exec_prefix)/bin
|
||||||
# Where to put the directories used by the compiler.
|
# Where to put the directories used by the compiler.
|
||||||
libdir = $(exec_prefix)/lib
|
libexecdir = $(exec_prefix)/libexec
|
||||||
# Where to put the Info files.
|
# Where to put the Info files.
|
||||||
infodir = $(prefix)/info
|
infodir = $(prefix)/info
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
If your program installs a large number of files into one of the
|
If your program installs a large number of files into one of the
|
||||||
standard user-specified directories, it might be useful to group them
|
standard user-specified directories, it might be useful to group them
|
||||||
|
|||||||
30
make.h
30
make.h
@@ -1,5 +1,5 @@
|
|||||||
/* Miscellaneous global declarations and portability cruft for GNU Make.
|
/* Miscellaneous global declarations and portability cruft for GNU Make.
|
||||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -59,13 +59,15 @@ extern int errno;
|
|||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef _POSIX_VERSION
|
/* 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
|
#define POSIX
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some systems define _POSIX_VERSION but are not really POSIX.1. */
|
/* Some systems define _POSIX_VERSION but are not really POSIX.1. */
|
||||||
#if (defined (butterfly) || \
|
#if (defined (butterfly) || defined (__arm) || \
|
||||||
(defined (__mips) && defined (_SYSTYPE_SVR3)) || \
|
(defined (__mips) && defined (_SYSTYPE_SVR3)) || \
|
||||||
(defined (sequent) && defined (i386)))
|
(defined (sequent) && defined (i386)))
|
||||||
#undef POSIX
|
#undef POSIX
|
||||||
@@ -171,7 +173,6 @@ extern unsigned int get_path_max ();
|
|||||||
extern char *malloc (), *realloc ();
|
extern char *malloc (), *realloc ();
|
||||||
extern void free ();
|
extern void free ();
|
||||||
|
|
||||||
extern void qsort ();
|
|
||||||
extern void abort (), exit ();
|
extern void abort (), exit ();
|
||||||
|
|
||||||
#endif /* Standard headers. */
|
#endif /* Standard headers. */
|
||||||
@@ -250,8 +251,15 @@ extern char *alloca ();
|
|||||||
#define ENUM_BITFIELD(bits)
|
#define ENUM_BITFIELD(bits)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
#define PATH_SEPARATOR_CHAR ';'
|
||||||
|
#else
|
||||||
|
#define PATH_SEPARATOR_CHAR ':'
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void die ();
|
extern void die ();
|
||||||
extern void message (), fatal (), error ();
|
extern void message (), fatal (), error ();
|
||||||
|
extern void log_working_directory ();
|
||||||
extern void makefile_error (), makefile_fatal ();
|
extern void makefile_error (), makefile_fatal ();
|
||||||
extern void pfatal_with_name (), perror_with_name ();
|
extern void pfatal_with_name (), perror_with_name ();
|
||||||
extern char *savestring (), *concat ();
|
extern char *savestring (), *concat ();
|
||||||
@@ -297,17 +305,12 @@ extern void user_access (), make_access (), child_access ();
|
|||||||
#include <vfork.h>
|
#include <vfork.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined (__GNU_LIBRARY__) && !defined (POSIX)
|
/* 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)
|
||||||
|
|
||||||
#ifdef HAVE_SIGSETMASK
|
|
||||||
extern int sigsetmask ();
|
|
||||||
extern int sigblock ();
|
|
||||||
#endif
|
|
||||||
extern int kill ();
|
|
||||||
extern int atoi ();
|
|
||||||
extern long int atol ();
|
extern long int atol ();
|
||||||
extern int unlink (), stat (), fstat ();
|
|
||||||
extern int pipe (), close (), read (), write (), open ();
|
|
||||||
extern long int lseek ();
|
extern long int lseek ();
|
||||||
|
|
||||||
#endif /* Not GNU C library or POSIX. */
|
#endif /* Not GNU C library or POSIX. */
|
||||||
@@ -328,6 +331,7 @@ 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 debug_flag, print_data_base_flag, question_flag, touch_flag;
|
||||||
extern int env_overrides, no_builtin_rules_flag, print_version_flag;
|
extern int env_overrides, no_builtin_rules_flag, print_version_flag;
|
||||||
extern int print_directory_flag, warn_undefined_variables_flag;
|
extern int print_directory_flag, warn_undefined_variables_flag;
|
||||||
|
extern int posix_pedantic;
|
||||||
|
|
||||||
extern unsigned int job_slots;
|
extern unsigned int job_slots;
|
||||||
extern double max_load_average;
|
extern double max_load_average;
|
||||||
|
|||||||
303
make.texinfo
303
make.texinfo
@@ -8,10 +8,12 @@
|
|||||||
@c FSF publishers: format makebook.texi instead of using this file directly.
|
@c FSF publishers: format makebook.texi instead of using this file directly.
|
||||||
|
|
||||||
@set RCSID $Id$
|
@set RCSID $Id$
|
||||||
@set EDITION 0.45
|
@set EDITION 0.49
|
||||||
@set VERSION 3.71 Beta
|
@set VERSION 3.74 Beta
|
||||||
@set UPDATED 20 April 1994
|
@set UPDATED 14 August 1995
|
||||||
@set UPDATE-MONTH April 1994
|
@set UPDATE-MONTH August 1995
|
||||||
|
@comment The ISBN number might need to change on next publication.
|
||||||
|
@set ISBN 1-882114-78-7
|
||||||
|
|
||||||
@c finalout
|
@c finalout
|
||||||
|
|
||||||
@@ -30,7 +32,8 @@ and issues the commands to recompile them.
|
|||||||
This is Edition @value{EDITION}, last updated @value{UPDATED},
|
This is Edition @value{EDITION}, last updated @value{UPDATED},
|
||||||
of @cite{The GNU Make Manual}, for @code{make}, Version @value{VERSION}.
|
of @cite{The GNU Make Manual}, for @code{make}, Version @value{VERSION}.
|
||||||
|
|
||||||
Copyright (C) 1988, '89, '90, '91, '92, '93, '94 Free Software Foundation, Inc.
|
Copyright (C) 1988, '89, '90, '91, '92, '93, '94, '95
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of
|
Permission is granted to make and distribute verbatim copies of
|
||||||
this manual provided the copyright notice and this permission notice
|
this manual provided the copyright notice and this permission notice
|
||||||
@@ -65,13 +68,13 @@ by the Free Software Foundation.
|
|||||||
@author Richard M. Stallman and Roland McGrath
|
@author Richard M. Stallman and Roland McGrath
|
||||||
@page
|
@page
|
||||||
@vskip 0pt plus 1filll
|
@vskip 0pt plus 1filll
|
||||||
Copyright @copyright{} 1988, '89, '90, '91, '92, '93, '94 Free Software Foundation, Inc.
|
Copyright @copyright{} 1988, '89, '90, '91, '92, '93, '94, '95 Free Software Foundation, Inc.
|
||||||
@sp 2
|
@sp 2
|
||||||
Published by the Free Software Foundation @*
|
Published by the Free Software Foundation @*
|
||||||
675 Massachusetts Avenue, @*
|
59 Temple Place -- Suite 330, @*
|
||||||
Cambridge, MA 02139 USA @*
|
Boston, MA 02111-1307 USA @*
|
||||||
Printed copies are available for $20 each. @*
|
Printed copies are available for $20 each. @*
|
||||||
ISBN 1-882114-16-7 @*
|
ISBN @value{ISBN} @*
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of
|
Permission is granted to make and distribute verbatim copies of
|
||||||
this manual provided the copyright notice and this permission notice
|
this manual provided the copyright notice and this permission notice
|
||||||
@@ -432,14 +435,6 @@ get this information with the command @samp{make --version}.
|
|||||||
Be sure also to include the type of machine and operating system you are
|
Be sure also to include the type of machine and operating system you are
|
||||||
using. If possible, include the contents of the file @file{config.h}
|
using. If possible, include the contents of the file @file{config.h}
|
||||||
that is generated by the configuration process.
|
that is generated by the configuration process.
|
||||||
|
|
||||||
Non-bug suggestions are always welcome as well. If you have questions
|
|
||||||
about things that are unclear in the documentation or are just obscure
|
|
||||||
features, send a message to the bug reporting address. We cannot
|
|
||||||
guarantee you'll get help with your problem, but many seasoned
|
|
||||||
@code{make} users read the mailing list and they will probably try to
|
|
||||||
help you out. The maintainers sometimes answer such questions as well,
|
|
||||||
when time permits.
|
|
||||||
|
|
||||||
@node Introduction, Makefiles, Overview, Top
|
@node Introduction, Makefiles, Overview, Top
|
||||||
@comment node-name, next, previous, up
|
@comment node-name, next, previous, up
|
||||||
@@ -637,11 +632,10 @@ from @code{rm} or any other command.
|
|||||||
@cindex processing a makefile
|
@cindex processing a makefile
|
||||||
@cindex makefile, how @code{make} processes
|
@cindex makefile, how @code{make} processes
|
||||||
|
|
||||||
By default, @code{make} starts with the first rule (not counting rules
|
By default, @code{make} starts with the first target (not targets whose
|
||||||
whose target names start with @samp{.}). This is called the
|
names start with @samp{.}). This is called the @dfn{default goal}.
|
||||||
@dfn{default goal}. (@dfn{Goals} are the targets that @code{make}
|
(@dfn{Goals} are the targets that @code{make} strives ultimately to
|
||||||
strives ultimately to update. @xref{Goals, , Arguments to Specify the
|
update. @xref{Goals, , Arguments to Specify the Goals}.)
|
||||||
Goals}.)
|
|
||||||
@cindex default goal
|
@cindex default goal
|
||||||
@cindex goal, default
|
@cindex goal, default
|
||||||
@cindex goal
|
@cindex goal
|
||||||
@@ -1247,13 +1241,12 @@ include one in the other, and add more targets or variable definitions.
|
|||||||
However, if the two makefiles give different commands for the same
|
However, if the two makefiles give different commands for the same
|
||||||
target, @code{make} will not let you just do this. But there is another way.
|
target, @code{make} will not let you just do this. But there is another way.
|
||||||
|
|
||||||
@cindex @code{.DEFAULT}, used to override
|
@cindex match-anything rule, used to override
|
||||||
In the containing makefile (the one that wants to include the other),
|
In the containing makefile (the one that wants to include the other),
|
||||||
you can use the @code{.DEFAULT} special target to say that to remake
|
you can use a match-anything pattern rule to say that to remake any
|
||||||
any target that cannot be made from the information in the containing
|
target that cannot be made from the information in the containing
|
||||||
makefile, @code{make} should look in another makefile.
|
makefile, @code{make} should look in another makefile.
|
||||||
@xref{Last Resort, , Defining Last-Resort Default Rules},
|
@xref{Pattern Rules}, for more information on pattern rules.
|
||||||
for more information on @code{.DEFAULT}.
|
|
||||||
|
|
||||||
For example, if you have a makefile called @file{Makefile} that says how
|
For example, if you have a makefile called @file{Makefile} that says how
|
||||||
to make the target @samp{foo} (and other targets), you can write a
|
to make the target @samp{foo} (and other targets), you can write a
|
||||||
@@ -1263,18 +1256,27 @@ makefile called @file{GNUmakefile} that contains:
|
|||||||
foo:
|
foo:
|
||||||
frobnicate > foo
|
frobnicate > foo
|
||||||
|
|
||||||
.DEFAULT:
|
%: force
|
||||||
@@$(MAKE) -f Makefile $@@
|
@@$(MAKE) -f Makefile $@@
|
||||||
|
force: ;
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
If you say @samp{make foo}, @code{make} will find @file{GNUmakefile},
|
If you say @samp{make foo}, @code{make} will find @file{GNUmakefile},
|
||||||
read it, and see that to make @file{foo}, it needs to run the command
|
read it, and see that to make @file{foo}, it needs to run the command
|
||||||
@samp{frobnicate > foo}. If you say @samp{make bar}, @code{make} will
|
@samp{frobnicate > foo}. If you say @samp{make bar}, @code{make} will
|
||||||
find no way to make @file{bar} in @file{GNUmakefile}, so it will use the
|
find no way to make @file{bar} in @file{GNUmakefile}, so it will use the
|
||||||
commands from @code{.DEFAULT}: @samp{make -f Makefile bar}. If
|
commands from the pattern rule: @samp{make -f Makefile bar}. If
|
||||||
@file{Makefile} provides a rule for updating @file{bar}, @code{make}
|
@file{Makefile} provides a rule for updating @file{bar}, @code{make}
|
||||||
will apply the rule. And likewise for any other target that
|
will apply the rule. And likewise for any other target that
|
||||||
@file{GNUmakefile} does not say how to make.@refill
|
@file{GNUmakefile} does not say how to make.
|
||||||
|
|
||||||
|
The way this works is that the pattern rule has a pattern of just
|
||||||
|
@samp{%}, so it matches any target whatever. The rule specifies a
|
||||||
|
dependency @file{force}, to guarantee that the commands will be run even
|
||||||
|
if the target file already exists. We give @file{force} target empty
|
||||||
|
commands to prevent @code{make} from searching for an implicit rule to
|
||||||
|
build it---otherwise it would apply the same match-anything rule to
|
||||||
|
@file{force} itself and create a dependency loop!
|
||||||
|
|
||||||
@node Rules, Commands, Makefiles, Top
|
@node Rules, Commands, Makefiles, Top
|
||||||
@chapter Writing Rules
|
@chapter Writing Rules
|
||||||
@@ -1666,9 +1668,9 @@ names of source files in the dependencies as if they all existed in the
|
|||||||
current directory. @xref{Commands/Search, ,Writing Shell Commands with
|
current directory. @xref{Commands/Search, ,Writing Shell Commands with
|
||||||
Directory Search}.
|
Directory Search}.
|
||||||
|
|
||||||
In the @code{VPATH} variable, directory names are separated by colons.
|
In the @code{VPATH} variable, directory names are separated by colons or
|
||||||
The order in which directories are listed is the order followed by
|
blanks. The order in which directories are listed is the order followed
|
||||||
@code{make} in its search.
|
by @code{make} in its search.
|
||||||
|
|
||||||
For example,
|
For example,
|
||||||
|
|
||||||
@@ -1714,9 +1716,9 @@ There are three forms of the @code{vpath} directive:
|
|||||||
Specify the search path @var{directories} for file names that match
|
Specify the search path @var{directories} for file names that match
|
||||||
@var{pattern}.
|
@var{pattern}.
|
||||||
|
|
||||||
The search path, @var{directories}, is a colon-separated list of
|
The search path, @var{directories}, is a list of directories to be
|
||||||
directories to be searched, just like the search path used in the
|
searched, separated by colons or blanks, just like the search path used
|
||||||
@code{VPATH} variable.
|
in the @code{VPATH} variable.
|
||||||
|
|
||||||
@item vpath @var{pattern}
|
@item vpath @var{pattern}
|
||||||
Clear out the search path associated with @var{pattern}.
|
Clear out the search path associated with @var{pattern}.
|
||||||
@@ -2132,24 +2134,28 @@ match that file's name.
|
|||||||
@findex .IGNORE
|
@findex .IGNORE
|
||||||
@item .IGNORE
|
@item .IGNORE
|
||||||
|
|
||||||
Simply by being mentioned as a target, @code{.IGNORE} says to ignore
|
If you specify dependencies for @code{.IGNORE}, then @code{make} will
|
||||||
errors in execution of commands. The dependencies and commands for
|
ignore errors in execution of the commands run for those particular
|
||||||
@code{.IGNORE} are not meaningful.
|
files. The commands for @code{.IGNORE} are not meaningful.
|
||||||
|
|
||||||
@samp{.IGNORE} exists for historical compatibility. Since
|
If mentioned as a target with no dependencies, @code{.IGNORE} says to
|
||||||
@code{.IGNORE} affects every command in the makefile, it is not very
|
ignore errors in execution of commands for all files. This usage of
|
||||||
useful; we recommend you use the more selective ways to ignore errors
|
@samp{.IGNORE} is supported only for historical compatibility. Since
|
||||||
in specific commands. @xref{Errors, ,Errors in Commands}.
|
this affects every command in the makefile, it is not very useful; we
|
||||||
|
recommend you use the more selective ways to ignore errors in specific
|
||||||
|
commands. @xref{Errors, ,Errors in Commands}.
|
||||||
|
|
||||||
@findex .SILENT
|
@findex .SILENT
|
||||||
@item .SILENT
|
@item .SILENT
|
||||||
|
|
||||||
Simply by being mentioned as a target, @code{.SILENT} says not to
|
If you specify dependencies for @code{.SILENT}, then @code{make} will
|
||||||
print commands before executing them. The dependencies and commands
|
not the print commands to remake those particular files before executing
|
||||||
for @code{.SILENT} are not meaningful.
|
them. The commands for @code{.SILENT} are not meaningful.
|
||||||
|
|
||||||
@samp{.SILENT} exists for historical compatibility. We recommend you
|
If mentioned as a target with no dependencies, @code{.SILENT} says not
|
||||||
use the more selective ways to silence specific commands.
|
to print any commands before executing them. This usage of
|
||||||
|
@samp{.SILENT} is supported only for historical compatibility. We
|
||||||
|
recommend you use the more selective ways to silence specific commands.
|
||||||
@xref{Echoing, ,Command Echoing}. If you want to silence all commands
|
@xref{Echoing, ,Command Echoing}. If you want to silence all commands
|
||||||
for a particular run of @code{make}, use the @samp{-s} or
|
for a particular run of @code{make}, use the @samp{-s} or
|
||||||
@w{@samp{--silent}} option (@pxref{Options Summary}).
|
@w{@samp{--silent}} option (@pxref{Options Summary}).
|
||||||
@@ -2570,12 +2576,13 @@ the new dependencies.
|
|||||||
Here is the pattern rule to generate a file of dependencies (i.e., a makefile)
|
Here is the pattern rule to generate a file of dependencies (i.e., a makefile)
|
||||||
called @file{@var{name}.d} from a C source file called @file{@var{name}.c}:
|
called @file{@var{name}.d} from a C source file called @file{@var{name}.c}:
|
||||||
|
|
||||||
@example
|
@smallexample
|
||||||
@group
|
@group
|
||||||
%.d: %.c
|
%.d: %.c
|
||||||
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< | sed '\''s/$*.o/& $@@/g'\'' > $@@'
|
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< \
|
||||||
|
| sed '\''s/$*\\.o[ :]*/& $@@/g'\'' > $@@'
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
@xref{Pattern Rules}, for information on defining pattern rules. The
|
@xref{Pattern Rules}, for information on defining pattern rules. The
|
||||||
@@ -2586,6 +2593,12 @@ shell exits with the status of the last command in the pipeline
|
|||||||
status from the compiler.
|
status from the compiler.
|
||||||
@cindex @code{-e} (shell flag)
|
@cindex @code{-e} (shell flag)
|
||||||
|
|
||||||
|
@cindex @code{-MM} (to GNU compiler)
|
||||||
|
With the GNU C compiler, you may wish to use the @samp{-MM} flag instead
|
||||||
|
of @samp{-M}. This omits dependencies on system header files.
|
||||||
|
@xref{Preprocessor Options, , Options Controlling the Preprocessor,
|
||||||
|
gcc.info, Using GNU CC}, for details.
|
||||||
|
|
||||||
@cindex @code{sed} (shell command)
|
@cindex @code{sed} (shell command)
|
||||||
The purpose of the @code{sed} command is to translate (for example):
|
The purpose of the @code{sed} command is to translate (for example):
|
||||||
|
|
||||||
@@ -2633,11 +2646,13 @@ with no further work from you. @xref{Remaking Makefiles}.
|
|||||||
@cindex rule commands
|
@cindex rule commands
|
||||||
@cindex writing rule commands
|
@cindex writing rule commands
|
||||||
|
|
||||||
The commands of a rule consist of shell command lines to be executed one by
|
The commands of a rule consist of shell command lines to be executed one
|
||||||
one. Each command line must start with a tab, except that the first
|
by one. Each command line must start with a tab, except that the first
|
||||||
command line may be attached to the target-and-dependencies line with a
|
command line may be attached to the target-and-dependencies line with a
|
||||||
semicolon in between. Blank lines and lines of just comments may appear
|
semicolon in between. Blank lines and lines of just comments may appear
|
||||||
among the command lines; they are ignored.
|
among the command lines; they are ignored. (But beware, an apparently
|
||||||
|
``blank'' line that begins with a tab is @emph{not} blank! It is an
|
||||||
|
empty command; @pxref{Empty Commands}.)
|
||||||
|
|
||||||
Users use many different shell programs, but commands in makefiles are
|
Users use many different shell programs, but commands in makefiles are
|
||||||
always interpreted by @file{/bin/sh} unless the makefile specifies
|
always interpreted by @file{/bin/sh} unless the makefile specifies
|
||||||
@@ -2703,7 +2718,7 @@ actually doing them.
|
|||||||
The @samp{-s} or @samp{--silent}
|
The @samp{-s} or @samp{--silent}
|
||||||
flag to @code{make} prevents all echoing, as if all commands
|
flag to @code{make} prevents all echoing, as if all commands
|
||||||
started with @samp{@@}. A rule in the makefile for the special target
|
started with @samp{@@}. A rule in the makefile for the special target
|
||||||
@code{.SILENT} has the same effect
|
@code{.SILENT} without dependencies has the same effect
|
||||||
(@pxref{Special Targets, ,Special Built-in Target Names}).
|
(@pxref{Special Targets, ,Special Built-in Target Names}).
|
||||||
@code{.SILENT} is essentially obsolete since @samp{@@} is more flexible.@refill
|
@code{.SILENT} is essentially obsolete since @samp{@@} is more flexible.@refill
|
||||||
|
|
||||||
@@ -2892,10 +2907,10 @@ This causes @code{rm} to continue even if it is unable to remove a file.
|
|||||||
@cindex @code{--ignore-errors}
|
@cindex @code{--ignore-errors}
|
||||||
@findex .IGNORE
|
@findex .IGNORE
|
||||||
When you run @code{make} with the @samp{-i} or @samp{--ignore-errors}
|
When you run @code{make} with the @samp{-i} or @samp{--ignore-errors}
|
||||||
flag, errors are ignored in
|
flag, errors are ignored in all commands of all rules. A rule in the
|
||||||
all commands of all rules. A rule in the makefile for the special target
|
makefile for the special target @code{.IGNORE} has the same effect, if
|
||||||
@code{.IGNORE} has the same effect. These ways of ignoring errors are
|
there are no dependencies. These ways of ignoring errors are obsolete
|
||||||
obsolete because @samp{-} is more flexible.
|
because @samp{-} is more flexible.
|
||||||
|
|
||||||
When errors are to be ignored, because of either a @samp{-} or the
|
When errors are to be ignored, because of either a @samp{-} or the
|
||||||
@samp{-i} flag, @code{make} treats an error return just like success,
|
@samp{-i} flag, @code{make} treats an error return just like success,
|
||||||
@@ -2908,6 +2923,7 @@ can any other that depends on it either directly or indirectly. No further
|
|||||||
commands will be executed for these targets, since their preconditions
|
commands will be executed for these targets, since their preconditions
|
||||||
have not been achieved.
|
have not been achieved.
|
||||||
|
|
||||||
|
|
||||||
@cindex @code{-k}
|
@cindex @code{-k}
|
||||||
@cindex @code{--keep-going}
|
@cindex @code{--keep-going}
|
||||||
Normally @code{make} gives up immediately in this circumstance, returning a
|
Normally @code{make} gives up immediately in this circumstance, returning a
|
||||||
@@ -2929,11 +2945,28 @@ is why Emacs' @code{compile} command passes the @samp{-k} flag by
|
|||||||
default.
|
default.
|
||||||
@cindex Emacs (@code{M-x compile})
|
@cindex Emacs (@code{M-x compile})
|
||||||
|
|
||||||
|
@findex .DELETE_ON_ERROR
|
||||||
|
@cindex deletion of target files
|
||||||
|
@cindex removal of target files
|
||||||
|
@cindex target, deleting on error
|
||||||
|
Usually when a command fails, if it has changed the target file at all,
|
||||||
|
the file is corrupted and cannot be used---or at least it is not
|
||||||
|
completely updated. Yet the file's timestamp says that it is now up to
|
||||||
|
date, so the next time @code{make} runs, it will not try to update that
|
||||||
|
file. The situation is just the same as when the command is killed by a
|
||||||
|
signal; @pxref{Interrupts}. So generally the right thing to do is to
|
||||||
|
delete the target file if the command fails after beginning to change
|
||||||
|
the file. @code{make} will do this if @code{.DELETE_ON_ERROR} appears
|
||||||
|
as a target. This is almost always what you want @code{make} to do, but
|
||||||
|
it is not historical practice; so for compatibility, you must explicitly
|
||||||
|
request it.
|
||||||
|
|
||||||
@node Interrupts, Recursion, Errors, Commands
|
@node Interrupts, Recursion, Errors, Commands
|
||||||
@section Interrupting or Killing @code{make}
|
@section Interrupting or Killing @code{make}
|
||||||
@cindex interrupt
|
@cindex interrupt
|
||||||
@cindex signal
|
@cindex signal
|
||||||
@cindex deletion of target files
|
@cindex deletion of target files
|
||||||
|
@cindex removal of target files
|
||||||
@cindex target, deleting on interrupt
|
@cindex target, deleting on interrupt
|
||||||
@cindex killing (interruption)
|
@cindex killing (interruption)
|
||||||
|
|
||||||
@@ -3024,28 +3057,6 @@ is @samp{cd subdir; /bin/make}. If you use a special version of
|
|||||||
executed for recursive invocations.
|
executed for recursive invocations.
|
||||||
@cindex @code{cd} (shell command)
|
@cindex @code{cd} (shell command)
|
||||||
|
|
||||||
Also, any arguments that define variable values are added to @code{MAKE},
|
|
||||||
so the sub-@code{make} gets them too. Thus, if you do @samp{make
|
|
||||||
CFLAGS=-O}, so that all C compilations will be optimized, the
|
|
||||||
sub-@code{make} is run with @samp{cd subdir; /bin/make CFLAGS=-O}.@refill
|
|
||||||
|
|
||||||
@vindex MAKE_COMMAND
|
|
||||||
@vindex MAKEOVERRIDES
|
|
||||||
The @code{MAKE} variable actually just refers to two other variables
|
|
||||||
which contain these special values. In fact, @code{MAKE} is always
|
|
||||||
defined as @samp{$(MAKE_COMMAND) $(MAKEOVERRIDES)}. The variable
|
|
||||||
@code{MAKE_COMMAND} is the file name with which @code{make} was invoked
|
|
||||||
(such as @file{/bin/make}, above). The variable @code{MAKEOVERRIDES}
|
|
||||||
contains definitions for the variables defined on the command line; in
|
|
||||||
the above example, its value is @samp{CFLAGS=-O}. If you @emph{do not}
|
|
||||||
want these variable definitions done in all recursive @code{make}
|
|
||||||
invocations, you can redefine the @code{MAKEOVERRIDES} variable to
|
|
||||||
remove them. You do this in any of the normal ways for defining
|
|
||||||
variables: in a makefile (@pxref{Setting, ,Setting Variables}); on the command
|
|
||||||
line with an argument like @samp{MAKEOVERRIDES=}
|
|
||||||
(@pxref{Overriding, ,Overriding Variables}); or with an environment variable
|
|
||||||
(@pxref{Environment, ,Variables from the Environment}).
|
|
||||||
|
|
||||||
As a special feature, using the variable @code{MAKE} in the commands of
|
As a special feature, using the variable @code{MAKE} in the commands of
|
||||||
a rule alters the effects of the @samp{-t} (@samp{--touch}), @samp{-n}
|
a rule alters the effects of the @samp{-t} (@samp{--touch}), @samp{-n}
|
||||||
(@samp{--just-print}), or @samp{-q} (@w{@samp{--question}}) option.
|
(@samp{--just-print}), or @samp{-q} (@w{@samp{--question}}) option.
|
||||||
@@ -3088,9 +3099,9 @@ commands, is propagated to the subsystem.@refill
|
|||||||
Variable values of the top-level @code{make} can be passed to the
|
Variable values of the top-level @code{make} can be passed to the
|
||||||
sub-@code{make} through the environment by explicit request. These
|
sub-@code{make} through the environment by explicit request. These
|
||||||
variables are defined in the sub-@code{make} as defaults, but do not
|
variables are defined in the sub-@code{make} as defaults, but do not
|
||||||
override what is specified in the sub-@code{make}'s makefile unless
|
override what is specified in the makefile used by the sub-@code{make}
|
||||||
you use the @samp{-e} switch
|
makefile unless you use the @samp{-e} switch (@pxref{Options Summary,
|
||||||
(@pxref{Options Summary, ,Summary of Options}).@refill
|
,Summary of Options}).@refill
|
||||||
|
|
||||||
To pass down, or @dfn{export}, a variable, @code{make} adds the variable
|
To pass down, or @dfn{export}, a variable, @code{make} adds the variable
|
||||||
and its value to the environment for running each command. The
|
and its value to the environment for running each command. The
|
||||||
@@ -3108,6 +3119,15 @@ The special variables @code{SHELL} and @code{MAKEFLAGS} are always
|
|||||||
exported (unless you unexport them).
|
exported (unless you unexport them).
|
||||||
@code{MAKEFILES} is exported if you set it to anything.
|
@code{MAKEFILES} is exported if you set it to anything.
|
||||||
|
|
||||||
|
@code{make} automatically passes down variable values that were defined
|
||||||
|
on the command line, by putting them in the @code{MAKEFLAGS} variable.
|
||||||
|
@iftex
|
||||||
|
See the next section.
|
||||||
|
@end iftex
|
||||||
|
@ifinfo
|
||||||
|
@xref{Options/Recursion}.
|
||||||
|
@end ifinfo
|
||||||
|
|
||||||
Variables are @emph{not} normally passed down if they were created by
|
Variables are @emph{not} normally passed down if they were created by
|
||||||
default by @code{make} (@pxref{Implicit Variables, ,Variables Used by
|
default by @code{make} (@pxref{Implicit Variables, ,Variables Used by
|
||||||
Implicit Rules}). The sub-@code{make} will define these for
|
Implicit Rules}). The sub-@code{make} will define these for
|
||||||
@@ -3256,25 +3276,31 @@ in its environment. In response, it takes the flags from that value and
|
|||||||
processes them as if they had been given as arguments.
|
processes them as if they had been given as arguments.
|
||||||
@xref{Options Summary, ,Summary of Options}.
|
@xref{Options Summary, ,Summary of Options}.
|
||||||
|
|
||||||
|
@cindex command line variable definitions, and recursion
|
||||||
|
@cindex variables, command line, and recursion
|
||||||
|
@cindex recursion, and command line variable definitions
|
||||||
|
Likewise variables defined on the command line are passed to the
|
||||||
|
sub-@code{make} through @code{MAKEFLAGS}. Words in the value of
|
||||||
|
@code{MAKEFLAGS} that contain @samp{=}, @code{make} treats as variable
|
||||||
|
definitions just as if they appeared on the command line.
|
||||||
|
@xref{Overriding, ,Overriding Variables}.
|
||||||
|
|
||||||
@cindex @code{-C}, and recursion
|
@cindex @code{-C}, and recursion
|
||||||
@cindex @code{-f}, and recursion
|
@cindex @code{-f}, and recursion
|
||||||
@cindex @code{-I}, and recursion
|
|
||||||
@cindex @code{-o}, and recursion
|
@cindex @code{-o}, and recursion
|
||||||
@cindex @code{-W}, and recursion
|
@cindex @code{-W}, and recursion
|
||||||
@cindex @code{--directory}, and recursion
|
@cindex @code{--directory}, and recursion
|
||||||
@cindex @code{--file}, and recursion
|
@cindex @code{--file}, and recursion
|
||||||
@cindex @code{--include-dir}, and recursion
|
|
||||||
@cindex @code{--old-file}, and recursion
|
@cindex @code{--old-file}, and recursion
|
||||||
@cindex @code{--assume-old}, and recursion
|
@cindex @code{--assume-old}, and recursion
|
||||||
@cindex @code{--assume-new}, and recursion
|
@cindex @code{--assume-new}, and recursion
|
||||||
@cindex @code{--new-file}, and recursion
|
@cindex @code{--new-file}, and recursion
|
||||||
@cindex recursion, and @code{-C}
|
@cindex recursion, and @code{-C}
|
||||||
@cindex recursion, and @code{-f}
|
@cindex recursion, and @code{-f}
|
||||||
@cindex recursion, and @code{-I}
|
|
||||||
@cindex recursion, and @code{-o}
|
@cindex recursion, and @code{-o}
|
||||||
@cindex recursion, and @code{-W}
|
@cindex recursion, and @code{-W}
|
||||||
The options @samp{-C}, @samp{-f}, @samp{-I}, @samp{-o}, and @samp{-W}
|
The options @samp{-C}, @samp{-f}, @samp{-o}, and @samp{-W} are not put
|
||||||
are not put into @code{MAKEFLAGS}; these options are not passed down.@refill
|
into @code{MAKEFLAGS}; these options are not passed down.@refill
|
||||||
|
|
||||||
@cindex @code{-j}, and recursion
|
@cindex @code{-j}, and recursion
|
||||||
@cindex @code{--jobs}, and recursion
|
@cindex @code{--jobs}, and recursion
|
||||||
@@ -3305,13 +3331,39 @@ subsystem:
|
|||||||
cd subdir; $(MAKE) MAKEFLAGS=
|
cd subdir; $(MAKE) MAKEFLAGS=
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@vindex MAKEOVERRIDES
|
||||||
|
The command line variable definitions really appear in the variable
|
||||||
|
@code{MAKEOVERRIDES}, and @code{MAKEFLAGS} contains a reference to this
|
||||||
|
variable. If you do want to pass flags down normally, but don't want to
|
||||||
|
pass down the command line variable definitions, you can reset
|
||||||
|
@code{MAKEOVERRIDES} to empty, like this:
|
||||||
|
|
||||||
|
@example
|
||||||
|
MAKEOVERRIDES =
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
@cindex Arg list too long
|
||||||
|
@cindex E2BIG
|
||||||
|
This is not usually useful to do. However, some systems have a small
|
||||||
|
fixed limit on the size of the environment, and putting so much
|
||||||
|
information in into the value of @code{MAKEFLAGS} can exceed it.
|
||||||
|
If you see the error message @samp{Arg list too long}, this may be the problem.
|
||||||
|
@findex .POSIX
|
||||||
|
@cindex POSIX.2
|
||||||
|
(For strict compliance with POSIX.2, changing @code{MAKEOVERRIDES} does
|
||||||
|
not affect @code{MAKEFLAGS} if the special target @samp{.POSIX} appears
|
||||||
|
in the makefile. You probably do not care about this.)
|
||||||
|
|
||||||
@vindex MFLAGS
|
@vindex MFLAGS
|
||||||
A similar variable @code{MFLAGS} exists also, for historical compatibility.
|
A similar variable @code{MFLAGS} exists also, for historical
|
||||||
It has the same value as @code{MAKEFLAGS} except that it always begins with
|
compatibility. It has the same value as @code{MAKEFLAGS} except that it
|
||||||
a hyphen unless it is empty (@code{MAKEFLAGS} begins with a hyphen only when
|
does not contain the command line variable definitions, and it always
|
||||||
it begins with an option that has no single-letter version, such as
|
begins with a hyphen unless it is empty (@code{MAKEFLAGS} begins with a
|
||||||
@samp{--warn-undefined-variables}). @code{MFLAGS} was traditionally used
|
hyphen only when it begins with an option that has no single-letter
|
||||||
explicitly in the recursive @code{make} command, like this:
|
version, such as @samp{--warn-undefined-variables}). @code{MFLAGS} was
|
||||||
|
traditionally used explicitly in the recursive @code{make} command, like
|
||||||
|
this:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
subsystem:
|
subsystem:
|
||||||
@@ -3512,6 +3564,14 @@ from getting implicit commands (from implicit rules or the
|
|||||||
@code{.DEFAULT} special target; @pxref{Implicit Rules} and
|
@code{.DEFAULT} special target; @pxref{Implicit Rules} and
|
||||||
@pxref{Last Resort, ,Defining Last-Resort Default Rules}).@refill
|
@pxref{Last Resort, ,Defining Last-Resort Default Rules}).@refill
|
||||||
|
|
||||||
|
@c !!! another reason is for canonical stamp files:
|
||||||
|
@ignore
|
||||||
|
foo: stamp-foo ;
|
||||||
|
stamp-foo: foo.in
|
||||||
|
create foo frm foo.in
|
||||||
|
touch $@
|
||||||
|
@end ignore
|
||||||
|
|
||||||
You may be inclined to define empty command strings for targets that are
|
You may be inclined to define empty command strings for targets that are
|
||||||
not actual files, but only exist so that their dependencies can be
|
not actual files, but only exist so that their dependencies can be
|
||||||
remade. However, this is not the best way to do that, because the
|
remade. However, this is not the best way to do that, because the
|
||||||
@@ -5338,12 +5398,12 @@ variable names because many strange things are valid variable names, but
|
|||||||
are probably not what you intended. For example,
|
are probably not what you intended. For example,
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
files := $(foreach Es escrito en espanol!,b c ch,$(find_files))
|
files := $(foreach Esta escrito en espanol!,b c ch,$(find_files))
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
might be useful if the value of @code{find_files} references the variable
|
might be useful if the value of @code{find_files} references the variable
|
||||||
whose name is @samp{Es escrito en espanol!} (es un nombre bastante largo,
|
whose name is @samp{Esta escrito en espanol!} (es un nombre bastante largo,
|
||||||
no?), but it is more likely to be a mistake.
|
no?), but it is more likely to be a mistake.
|
||||||
|
|
||||||
@node Origin Function, Shell Function, Foreach Function, Functions
|
@node Origin Function, Shell Function, Foreach Function, Functions
|
||||||
@@ -5573,7 +5633,9 @@ dependencies of goals, or dependencies of dependencies of goals, etc.
|
|||||||
By default, the goal is the first target in the makefile (not counting
|
By default, the goal is the first target in the makefile (not counting
|
||||||
targets that start with a period). Therefore, makefiles are usually
|
targets that start with a period). Therefore, makefiles are usually
|
||||||
written so that the first target is for compiling the entire program or
|
written so that the first target is for compiling the entire program or
|
||||||
programs they describe.
|
programs they describe. If the first rule in the makefile has several
|
||||||
|
targets, only the first target in the rule becomes the default goal, not
|
||||||
|
the whole list.
|
||||||
|
|
||||||
You can specify a different goal or goals with arguments to @code{make}.
|
You can specify a different goal or goals with arguments to @code{make}.
|
||||||
Use the name of the goal as an argument. If you specify several goals,
|
Use the name of the goal as an argument. If you specify several goals,
|
||||||
@@ -7098,6 +7160,14 @@ the value of @code{$^} contains just one copy of the name.
|
|||||||
@cindex dependencies, list of all
|
@cindex dependencies, list of all
|
||||||
@cindex list of all dependencies
|
@cindex list of all dependencies
|
||||||
|
|
||||||
|
@vindex $+
|
||||||
|
@vindex + @r{(automatic variable)}
|
||||||
|
@item $+
|
||||||
|
This is like @samp{$^}, but dependencies listed more than once are
|
||||||
|
duplicated in the order they were listed in the makefile. This is
|
||||||
|
primarily useful for use in linking commands where it is meaningful to
|
||||||
|
repeat library file names in a particular order.
|
||||||
|
|
||||||
@vindex $*
|
@vindex $*
|
||||||
@vindex * @r{(automatic variable)}
|
@vindex * @r{(automatic variable)}
|
||||||
@item $*
|
@item $*
|
||||||
@@ -7612,6 +7682,7 @@ main use is as subroutine libraries for linking.
|
|||||||
@menu
|
@menu
|
||||||
* Archive Members:: Archive members as targets.
|
* Archive Members:: Archive members as targets.
|
||||||
* Archive Update:: The implicit rule for archive member targets.
|
* Archive Update:: The implicit rule for archive member targets.
|
||||||
|
* Archive Pitfalls:: Dangers to watch out for when using archives.
|
||||||
* Archive Suffix Rules:: You can write a special kind of suffix rule
|
* Archive Suffix Rules:: You can write a special kind of suffix rule
|
||||||
for updating archives.
|
for updating archives.
|
||||||
@end menu
|
@end menu
|
||||||
@@ -7668,7 +7739,7 @@ example, @w{@samp{foolib(*.o)}} expands to all existing members of the
|
|||||||
@file{foolib} archive whose names end in @samp{.o}; perhaps
|
@file{foolib} archive whose names end in @samp{.o}; perhaps
|
||||||
@samp{@w{foolib(hack.o)} @w{foolib(kludge.o)}}.
|
@samp{@w{foolib(hack.o)} @w{foolib(kludge.o)}}.
|
||||||
|
|
||||||
@node Archive Update, Archive Suffix Rules, Archive Members, Archives
|
@node Archive Update
|
||||||
@section Implicit Rule for Archive Member Targets
|
@section Implicit Rule for Archive Member Targets
|
||||||
|
|
||||||
Recall that a target that looks like @file{@var{a}(@var{m})} stands for the
|
Recall that a target that looks like @file{@var{a}(@var{m})} stands for the
|
||||||
@@ -7758,7 +7829,24 @@ files into the archive, as described in the preceding section.
|
|||||||
This is not necessary when using the GNU @code{ar} program, which
|
This is not necessary when using the GNU @code{ar} program, which
|
||||||
updates the @file{__.SYMDEF} member automatically.
|
updates the @file{__.SYMDEF} member automatically.
|
||||||
|
|
||||||
@node Archive Suffix Rules, , Archive Update, Archives
|
@node Archive Pitfalls
|
||||||
|
@section Dangers When Using Archives
|
||||||
|
@cindex archive, and parallel execution
|
||||||
|
@cindex parallel execution, and archive update
|
||||||
|
@cindex archive, and @code{-j}
|
||||||
|
@cindex @code{-j}, and archive update
|
||||||
|
|
||||||
|
It is important to be careful when using parallel execution (the
|
||||||
|
@code{-j} switch; @pxref{Parallel, ,Parallel Execution}) and archives.
|
||||||
|
If multiple @code{ar} commands run at the same time on the same archive
|
||||||
|
file, they will not know about each other and can corrupt the file.
|
||||||
|
|
||||||
|
Possibly a future version of @code{make} will provide a mechanism to
|
||||||
|
circumvent this problem by serializing all commands that operate on the
|
||||||
|
same archive file. But for the time being, you must either write your
|
||||||
|
makefiles to avoid this problem in some other way, or not use @code{-j}.
|
||||||
|
|
||||||
|
@node Archive Suffix Rules, , Archive Pitfalls, Archives
|
||||||
@section Suffix Rules for Archive Files
|
@section Suffix Rules for Archive Files
|
||||||
@cindex suffix rule, for archive
|
@cindex suffix rule, for archive
|
||||||
@cindex archive, suffix rule for
|
@cindex archive, suffix rule for
|
||||||
@@ -7904,8 +7992,9 @@ same time. @xref{Chained Rules, ,Chains of Implicit Rules}.
|
|||||||
|
|
||||||
@item
|
@item
|
||||||
The automatic variable @code{$^} containing a list of all dependencies
|
The automatic variable @code{$^} containing a list of all dependencies
|
||||||
of the current target. We did not invent this, but we have no idea who did.
|
of the current target. We did not invent this, but we have no idea who
|
||||||
@xref{Automatic, ,Automatic Variables}.
|
did. @xref{Automatic, ,Automatic Variables}. The automatic variable
|
||||||
|
@code{$+} is a simple extension of @code{$^}.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
The ``what if'' flag (@samp{-W} in GNU @code{make}) was (as far as we know)
|
The ``what if'' flag (@samp{-W} in GNU @code{make}) was (as far as we know)
|
||||||
@@ -8373,9 +8462,11 @@ For dependencies which are archive members, only
|
|||||||
the member named is used (@pxref{Archives}).
|
the member named is used (@pxref{Archives}).
|
||||||
|
|
||||||
@item $^
|
@item $^
|
||||||
|
@itemx $+
|
||||||
The names of all the dependencies, with spaces between them. For
|
The names of all the dependencies, with spaces between them. For
|
||||||
dependencies which are archive members, only the member named is used
|
dependencies which are archive members, only the member named is used
|
||||||
(@pxref{Archives}).
|
(@pxref{Archives}). The value of @code{$^} omits duplicate
|
||||||
|
dependencies, while @code{$+} retains them and preserves their order.
|
||||||
|
|
||||||
@item $*
|
@item $*
|
||||||
The stem with which an implicit rule matches
|
The stem with which an implicit rule matches
|
||||||
@@ -8401,6 +8492,10 @@ The directory part and the file-within-directory part of @code{$<}.
|
|||||||
@itemx $(^F)
|
@itemx $(^F)
|
||||||
The directory part and the file-within-directory part of @code{$^}.
|
The directory part and the file-within-directory part of @code{$^}.
|
||||||
|
|
||||||
|
@item $(+D)
|
||||||
|
@itemx $(+F)
|
||||||
|
The directory part and the file-within-directory part of @code{$+}.
|
||||||
|
|
||||||
@item $(?D)
|
@item $(?D)
|
||||||
@itemx $(?F)
|
@itemx $(?F)
|
||||||
The directory part and the file-within-directory part of @code{$?}.
|
The directory part and the file-within-directory part of @code{$?}.
|
||||||
|
|||||||
61
misc.c
61
misc.c
@@ -1,5 +1,5 @@
|
|||||||
/* Miscellaneous generic support functions for GNU Make.
|
/* Miscellaneous generic support functions for GNU Make.
|
||||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -50,9 +50,8 @@ collapse_continuations (line)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
out = in;
|
out = in;
|
||||||
if (out > line)
|
while (out > line && out[-1] == '\\')
|
||||||
while (out[-1] == '\\')
|
--out;
|
||||||
--out;
|
|
||||||
|
|
||||||
while (*in != '\0')
|
while (*in != '\0')
|
||||||
{
|
{
|
||||||
@@ -126,7 +125,7 @@ remove_comments (line)
|
|||||||
{
|
{
|
||||||
char *comment;
|
char *comment;
|
||||||
|
|
||||||
comment = find_char_unquote (line, '#', 0);
|
comment = find_char_unquote (line, "#", 0);
|
||||||
|
|
||||||
if (comment != 0)
|
if (comment != 0)
|
||||||
/* Cut off the line at the #. */
|
/* Cut off the line at the #. */
|
||||||
@@ -174,15 +173,25 @@ concat (s1, s2, s3)
|
|||||||
/* Print a message on stdout. */
|
/* Print a message on stdout. */
|
||||||
|
|
||||||
void
|
void
|
||||||
message (s1, s2, s3, s4, s5, s6)
|
message (prefix, s1, s2, s3, s4, s5, s6)
|
||||||
|
int prefix;
|
||||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||||
{
|
{
|
||||||
if (makelevel == 0)
|
log_working_directory (1);
|
||||||
printf ("%s: ", program);
|
|
||||||
else
|
if (s1 != 0)
|
||||||
printf ("%s[%u]: ", program, makelevel);
|
{
|
||||||
printf (s1, s2, s3, s4, s5, s6);
|
if (prefix)
|
||||||
putchar ('\n');
|
{
|
||||||
|
if (makelevel == 0)
|
||||||
|
printf ("%s: ", program);
|
||||||
|
else
|
||||||
|
printf ("%s[%u]: ", program, makelevel);
|
||||||
|
}
|
||||||
|
printf (s1, s2, s3, s4, s5, s6);
|
||||||
|
putchar ('\n');
|
||||||
|
}
|
||||||
|
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +202,8 @@ void
|
|||||||
fatal (s1, s2, s3, s4, s5, s6)
|
fatal (s1, s2, s3, s4, s5, s6)
|
||||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||||
{
|
{
|
||||||
|
log_working_directory (1);
|
||||||
|
|
||||||
if (makelevel == 0)
|
if (makelevel == 0)
|
||||||
fprintf (stderr, "%s: *** ", program);
|
fprintf (stderr, "%s: *** ", program);
|
||||||
else
|
else
|
||||||
@@ -211,6 +222,8 @@ void
|
|||||||
error (s1, s2, s3, s4, s5, s6)
|
error (s1, s2, s3, s4, s5, s6)
|
||||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||||
{
|
{
|
||||||
|
log_working_directory (1);
|
||||||
|
|
||||||
if (makelevel == 0)
|
if (makelevel == 0)
|
||||||
fprintf (stderr, "%s: ", program);
|
fprintf (stderr, "%s: ", program);
|
||||||
else
|
else
|
||||||
@@ -226,6 +239,8 @@ makefile_error (file, lineno, s1, s2, s3, s4, s5, s6)
|
|||||||
unsigned int lineno;
|
unsigned int lineno;
|
||||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||||
{
|
{
|
||||||
|
log_working_directory (1);
|
||||||
|
|
||||||
fprintf (stderr, "%s:%u: ", file, lineno);
|
fprintf (stderr, "%s:%u: ", file, lineno);
|
||||||
fprintf (stderr, s1, s2, s3, s4, s5, s6);
|
fprintf (stderr, s1, s2, s3, s4, s5, s6);
|
||||||
putc ('\n', stderr);
|
putc ('\n', stderr);
|
||||||
@@ -238,6 +253,8 @@ makefile_fatal (file, lineno, s1, s2, s3, s4, s5, s6)
|
|||||||
unsigned int lineno;
|
unsigned int lineno;
|
||||||
char *s1, *s2, *s3, *s4, *s5, *s6;
|
char *s1, *s2, *s3, *s4, *s5, *s6;
|
||||||
{
|
{
|
||||||
|
log_working_directory (1);
|
||||||
|
|
||||||
fprintf (stderr, "%s:%u: *** ", file, lineno);
|
fprintf (stderr, "%s:%u: *** ", file, lineno);
|
||||||
fprintf (stderr, s1, s2, s3, s4, s5, s6);
|
fprintf (stderr, s1, s2, s3, s4, s5, s6);
|
||||||
fputs (". Stop.\n", stderr);
|
fputs (". Stop.\n", stderr);
|
||||||
@@ -260,7 +277,7 @@ strerror (errnum)
|
|||||||
if (errno < sys_nerr)
|
if (errno < sys_nerr)
|
||||||
return sys_errlist[errnum];
|
return sys_errlist[errnum];
|
||||||
|
|
||||||
sprintf ("Unknown error %d", buf, errnum);
|
sprintf (buf, "Unknown error %d", errnum);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -454,19 +471,27 @@ dep_name (dep)
|
|||||||
#ifdef GETLOADAVG_PRIVILEGED
|
#ifdef GETLOADAVG_PRIVILEGED
|
||||||
|
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
|
|
||||||
/* Hopefully if a system says it's POSIX.1 and has the setuid and setgid
|
/* 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,
|
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
|
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
|
setregid functions, but they don't work as in BSD and only the POSIX.1
|
||||||
way works. */
|
way works. */
|
||||||
|
|
||||||
#if defined (HAVE_SETREUID) && defined (HAVE_SETUID)
|
|
||||||
#undef HAVE_SETREUID
|
#undef HAVE_SETREUID
|
||||||
#endif
|
|
||||||
#if defined (HAVE_SETREGID) && defined (HAVE_SETGID)
|
|
||||||
#undef HAVE_SETREGID
|
#undef HAVE_SETREGID
|
||||||
#endif
|
|
||||||
#endif
|
#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
|
#ifndef HAVE_UNISTD_H
|
||||||
extern int getuid (), getgid (), geteuid (), getegid ();
|
extern int getuid (), getgid (), geteuid (), getegid ();
|
||||||
|
|||||||
222
read.c
222
read.c
@@ -1,5 +1,5 @@
|
|||||||
/* Reading and parsing of makefiles for GNU Make.
|
/* Reading and parsing of makefiles for GNU Make.
|
||||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -37,7 +37,6 @@ static int read_makefile ();
|
|||||||
static unsigned int readline (), do_define ();
|
static unsigned int readline (), do_define ();
|
||||||
static int conditional_line ();
|
static int conditional_line ();
|
||||||
static void record_files ();
|
static void record_files ();
|
||||||
static char *find_semicolon ();
|
|
||||||
|
|
||||||
|
|
||||||
/* A `struct linebuffer' is a structure which holds a line of text.
|
/* A `struct linebuffer' is a structure which holds a line of text.
|
||||||
@@ -75,7 +74,7 @@ struct conditionals
|
|||||||
|
|
||||||
static struct conditionals toplevel_conditionals;
|
static struct conditionals toplevel_conditionals;
|
||||||
static struct conditionals *conditionals = &toplevel_conditionals;
|
static struct conditionals *conditionals = &toplevel_conditionals;
|
||||||
|
|
||||||
|
|
||||||
/* Default directories to search for include files in */
|
/* Default directories to search for include files in */
|
||||||
|
|
||||||
@@ -192,6 +191,9 @@ read_all_makefiles (makefiles)
|
|||||||
/* No default makefile was found. Add the default makefiles to the
|
/* No default makefile was found. Add the default makefiles to the
|
||||||
`read_makefiles' chain so they will be updated if possible. */
|
`read_makefiles' chain so they will be updated if possible. */
|
||||||
struct dep *tail = read_makefiles;
|
struct dep *tail = read_makefiles;
|
||||||
|
/* Add them to the tail, after any MAKEFILES variable makefiles. */
|
||||||
|
while (tail != 0 && tail->next != 0)
|
||||||
|
tail = tail->next;
|
||||||
for (p = default_makefiles; *p != 0; ++p)
|
for (p = default_makefiles; *p != 0; ++p)
|
||||||
{
|
{
|
||||||
struct dep *d = (struct dep *) xmalloc (sizeof (struct dep));
|
struct dep *d = (struct dep *) xmalloc (sizeof (struct dep));
|
||||||
@@ -240,6 +242,7 @@ read_makefile (filename, flags)
|
|||||||
char *p2;
|
char *p2;
|
||||||
int ignoring = 0, in_ignored_define = 0;
|
int ignoring = 0, in_ignored_define = 0;
|
||||||
int no_targets = 0; /* Set when reading a rule without targets. */
|
int no_targets = 0; /* Set when reading a rule without targets. */
|
||||||
|
char *passed_filename = filename;
|
||||||
|
|
||||||
struct nameseq *filenames = 0;
|
struct nameseq *filenames = 0;
|
||||||
struct dep *deps;
|
struct dep *deps;
|
||||||
@@ -288,7 +291,6 @@ read_makefile (filename, flags)
|
|||||||
if (!(flags & RM_NO_TILDE) && filename[0] == '~')
|
if (!(flags & RM_NO_TILDE) && filename[0] == '~')
|
||||||
{
|
{
|
||||||
char *expanded = tilde_expand (filename);
|
char *expanded = tilde_expand (filename);
|
||||||
/* This is a possible memory leak, but I don't care. */
|
|
||||||
if (expanded != 0)
|
if (expanded != 0)
|
||||||
filename = expanded;
|
filename = expanded;
|
||||||
}
|
}
|
||||||
@@ -330,6 +332,8 @@ read_makefile (filename, flags)
|
|||||||
if (flags & RM_DONTCARE)
|
if (flags & RM_DONTCARE)
|
||||||
deps->file->dontcare = 1;
|
deps->file->dontcare = 1;
|
||||||
}
|
}
|
||||||
|
if (filename != passed_filename)
|
||||||
|
free (filename);
|
||||||
filename = deps->file->name;
|
filename = deps->file->name;
|
||||||
deps->changed = flags;
|
deps->changed = flags;
|
||||||
deps = 0;
|
deps = 0;
|
||||||
@@ -360,6 +364,47 @@ read_makefile (filename, flags)
|
|||||||
lineno += nlines;
|
lineno += nlines;
|
||||||
nlines = readline (&lb, infile, filename, lineno);
|
nlines = readline (&lb, infile, filename, lineno);
|
||||||
|
|
||||||
|
/* Check for a shell command line first.
|
||||||
|
If it is not one, we can stop treating tab specially. */
|
||||||
|
if (lb.buffer[0] == '\t')
|
||||||
|
{
|
||||||
|
/* This line is a probably shell command. */
|
||||||
|
unsigned int len;
|
||||||
|
|
||||||
|
if (no_targets)
|
||||||
|
/* Ignore the commands in a rule with no targets. */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* If there is no preceding rule line, don't treat this line
|
||||||
|
as a command, even though it begins with a tab character.
|
||||||
|
SunOS 4 make appears to behave this way. */
|
||||||
|
|
||||||
|
if (filenames != 0)
|
||||||
|
{
|
||||||
|
if (ignoring)
|
||||||
|
/* Yep, this is a shell command, and we don't care. */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Append this command line to the line being accumulated. */
|
||||||
|
p = lb.buffer;
|
||||||
|
if (commands_idx == 0)
|
||||||
|
commands_started = lineno;
|
||||||
|
len = strlen (p);
|
||||||
|
if (len + 1 + commands_idx > commands_len)
|
||||||
|
{
|
||||||
|
commands_len = (len + 1 + commands_idx) * 2;
|
||||||
|
commands = (char *) xrealloc (commands, commands_len);
|
||||||
|
}
|
||||||
|
bcopy (p, &commands[commands_idx], len);
|
||||||
|
commands_idx += len;
|
||||||
|
commands[commands_idx++] = '\n';
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This line is not a shell command line. Don't worry about tabs. */
|
||||||
|
|
||||||
if (collapsed_length < lb.size)
|
if (collapsed_length < lb.size)
|
||||||
{
|
{
|
||||||
collapsed_length = lb.size;
|
collapsed_length = lb.size;
|
||||||
@@ -372,17 +417,20 @@ read_makefile (filename, flags)
|
|||||||
collapse_continuations (collapsed);
|
collapse_continuations (collapsed);
|
||||||
remove_comments (collapsed);
|
remove_comments (collapsed);
|
||||||
|
|
||||||
p = collapsed;
|
|
||||||
while (isspace (*p) && *p != '\t')
|
|
||||||
++p;
|
|
||||||
/* We cannot consider a line containing just a tab to be empty
|
|
||||||
because it might constitute an empty command for a target. */
|
|
||||||
if (*p == '\0' && lb.buffer[0] != '\t')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* strncmp is first to avoid dereferencing out into space. */
|
/* strncmp is first to avoid dereferencing out into space. */
|
||||||
#define word1eq(s, l) (!strncmp (s, p, l) \
|
#define word1eq(s, l) (!strncmp (s, p, l) \
|
||||||
&& (p[l] == '\0' || isblank (p[l])))
|
&& (p[l] == '\0' || isblank (p[l])))
|
||||||
|
p = collapsed;
|
||||||
|
while (isspace (*p))
|
||||||
|
++p;
|
||||||
|
if (*p == '\0')
|
||||||
|
/* This line is completely empty. */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* We must first check for conditional and `define' directives before
|
||||||
|
ignoring anything, since they control what we will do with
|
||||||
|
following lines. */
|
||||||
|
|
||||||
if (!in_ignored_define
|
if (!in_ignored_define
|
||||||
&& (word1eq ("ifdef", 5) || word1eq ("ifndef", 6)
|
&& (word1eq ("ifdef", 5) || word1eq ("ifndef", 6)
|
||||||
|| word1eq ("ifeq", 4) || word1eq ("ifneq", 5)
|
|| word1eq ("ifeq", 4) || word1eq ("ifneq", 5)
|
||||||
@@ -458,40 +506,7 @@ read_makefile (filename, flags)
|
|||||||
/* Ignore the line. We continue here so conditionals
|
/* Ignore the line. We continue here so conditionals
|
||||||
can appear in the middle of a rule. */
|
can appear in the middle of a rule. */
|
||||||
continue;
|
continue;
|
||||||
else if (lb.buffer[0] == '\t')
|
else if (word1eq ("export", 6))
|
||||||
{
|
|
||||||
/* This line is a shell command. */
|
|
||||||
unsigned int len;
|
|
||||||
|
|
||||||
if (no_targets)
|
|
||||||
/* Ignore the commands in a rule with no targets. */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* If there is no preceding rule line, don't treat this line
|
|
||||||
as a command, even though it begins with a tab character.
|
|
||||||
SunOS 4 make appears to behave this way. */
|
|
||||||
|
|
||||||
if (filenames != 0)
|
|
||||||
{
|
|
||||||
/* Append this command line to the line being accumulated. */
|
|
||||||
p = lb.buffer;
|
|
||||||
if (commands_idx == 0)
|
|
||||||
commands_started = lineno;
|
|
||||||
len = strlen (p);
|
|
||||||
if (len + 1 + commands_idx > commands_len)
|
|
||||||
{
|
|
||||||
commands_len = (len + 1 + commands_idx) * 2;
|
|
||||||
commands = (char *) xrealloc (commands, commands_len);
|
|
||||||
}
|
|
||||||
bcopy (p, &commands[commands_idx], len);
|
|
||||||
commands_idx += len;
|
|
||||||
commands[commands_idx++] = '\n';
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (word1eq ("export", 6))
|
|
||||||
{
|
{
|
||||||
struct variable *v;
|
struct variable *v;
|
||||||
p2 = next_token (p + 6);
|
p2 = next_token (p + 6);
|
||||||
@@ -618,7 +633,7 @@ read_makefile (filename, flags)
|
|||||||
;
|
;
|
||||||
else if (lb.buffer[0] == '\t')
|
else if (lb.buffer[0] == '\t')
|
||||||
{
|
{
|
||||||
p = lb.buffer;
|
p = collapsed; /* Ignore comments. */
|
||||||
while (isblank (*p))
|
while (isblank (*p))
|
||||||
++p;
|
++p;
|
||||||
if (*p == '\0')
|
if (*p == '\0')
|
||||||
@@ -641,9 +656,16 @@ read_makefile (filename, flags)
|
|||||||
|
|
||||||
record_waiting_files ();
|
record_waiting_files ();
|
||||||
|
|
||||||
/* Look for a semicolon in the unexpanded line. */
|
/* Search the line for an unquoted ; that is not after an
|
||||||
cmdleft = find_semicolon (lb.buffer);
|
unquoted #. */
|
||||||
if (cmdleft != 0)
|
cmdleft = find_char_unquote (lb.buffer, ";#", 0);
|
||||||
|
if (cmdleft != 0 && *cmdleft == '#')
|
||||||
|
{
|
||||||
|
/* We found a comment before a semicolon. */
|
||||||
|
*cmdleft = '\0';
|
||||||
|
cmdleft = 0;
|
||||||
|
}
|
||||||
|
else if (cmdleft != 0)
|
||||||
/* Found one. Cut the line short there before expanding it. */
|
/* Found one. Cut the line short there before expanding it. */
|
||||||
*cmdleft = '\0';
|
*cmdleft = '\0';
|
||||||
|
|
||||||
@@ -655,15 +677,12 @@ read_makefile (filename, flags)
|
|||||||
|
|
||||||
if (cmdleft == 0)
|
if (cmdleft == 0)
|
||||||
/* Look for a semicolon in the expanded line. */
|
/* Look for a semicolon in the expanded line. */
|
||||||
cmdleft = find_semicolon (p);
|
cmdleft = find_char_unquote (p, ";", 0);
|
||||||
|
|
||||||
if (cmdleft != 0)
|
if (cmdleft != 0)
|
||||||
/* Cut the line short at the semicolon. */
|
/* Cut the line short at the semicolon. */
|
||||||
*cmdleft = '\0';
|
*cmdleft = '\0';
|
||||||
|
|
||||||
/* Remove comments from the line. */
|
|
||||||
remove_comments (p);
|
|
||||||
|
|
||||||
p2 = next_token (p);
|
p2 = next_token (p);
|
||||||
if (*p2 == '\0')
|
if (*p2 == '\0')
|
||||||
{
|
{
|
||||||
@@ -710,6 +729,11 @@ read_makefile (filename, flags)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
/* For MS-DOS, skip a "C:\...". */
|
||||||
|
if (p != 0 && p[1] == '\\' && isalpha (p[-1]))
|
||||||
|
p = 0;
|
||||||
|
#endif
|
||||||
if (p != 0)
|
if (p != 0)
|
||||||
{
|
{
|
||||||
struct nameseq *target;
|
struct nameseq *target;
|
||||||
@@ -811,12 +835,13 @@ do_define (name, namelen, origin, lineno, infile, filename)
|
|||||||
{
|
{
|
||||||
lineno += nlines;
|
lineno += nlines;
|
||||||
nlines = readline (&lb, infile, filename, lineno);
|
nlines = readline (&lb, infile, filename, lineno);
|
||||||
p = next_token (lb.buffer);
|
|
||||||
|
|
||||||
|
collapse_continuations (lb.buffer);
|
||||||
|
|
||||||
|
p = next_token (lb.buffer);
|
||||||
if ((p[5] == '\0' || isblank (p[5])) && !strncmp (p, "endef", 5))
|
if ((p[5] == '\0' || isblank (p[5])) && !strncmp (p, "endef", 5))
|
||||||
{
|
{
|
||||||
p += 5;
|
p += 5;
|
||||||
collapse_continuations (p);
|
|
||||||
remove_comments (p);
|
remove_comments (p);
|
||||||
if (*next_token (p) != '\0')
|
if (*next_token (p) != '\0')
|
||||||
makefile_error (filename, lineno,
|
makefile_error (filename, lineno,
|
||||||
@@ -833,7 +858,7 @@ do_define (name, namelen, origin, lineno, infile, filename)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int len = strlen (p);
|
unsigned int len = strlen (lb.buffer);
|
||||||
|
|
||||||
/* Increase the buffer size if necessary. */
|
/* Increase the buffer size if necessary. */
|
||||||
if (idx + len + 1 > length)
|
if (idx + len + 1 > length)
|
||||||
@@ -842,7 +867,7 @@ do_define (name, namelen, origin, lineno, infile, filename)
|
|||||||
definition = (char *) xrealloc (definition, length + 1);
|
definition = (char *) xrealloc (definition, length + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bcopy (p, &definition[idx], len);
|
bcopy (lb.buffer, &definition[idx], len);
|
||||||
idx += len;
|
idx += len;
|
||||||
/* Separate lines with a newline. */
|
/* Separate lines with a newline. */
|
||||||
definition[idx++] = '\n';
|
definition[idx++] = '\n';
|
||||||
@@ -1229,7 +1254,7 @@ record_files (filenames, pattern, pattern_percent, deps, commands_started,
|
|||||||
d->name = savestring (buffer, o - buffer);
|
d->name = savestring (buffer, o - buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!two_colon)
|
if (!two_colon)
|
||||||
{
|
{
|
||||||
/* Single-colon. Combine these dependencies
|
/* Single-colon. Combine these dependencies
|
||||||
@@ -1418,9 +1443,9 @@ record_files (filenames, pattern, pattern_percent, deps, commands_started,
|
|||||||
one, or nil if there are none. */
|
one, or nil if there are none. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
find_char_unquote (string, stopchar, blank)
|
find_char_unquote (string, stopchars, blank)
|
||||||
char *string;
|
char *string;
|
||||||
int stopchar;
|
char *stopchars;
|
||||||
int blank;
|
int blank;
|
||||||
{
|
{
|
||||||
unsigned int string_len = strlen (string);
|
unsigned int string_len = strlen (string);
|
||||||
@@ -1428,19 +1453,12 @@ find_char_unquote (string, stopchar, blank)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (blank)
|
while (*p != '\0' && index (stopchars, *p) == 0
|
||||||
{
|
&& (!blank || !isblank (*p)))
|
||||||
while (*p != '\0' && *p != stopchar && !isblank (*p))
|
++p;
|
||||||
++p;
|
if (*p == '\0')
|
||||||
if (*p == '\0')
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p = index (p, stopchar);
|
|
||||||
if (p == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (p > string && p[-1] == '\\')
|
if (p > string && p[-1] == '\\')
|
||||||
{
|
{
|
||||||
/* Search for more backslashes. */
|
/* Search for more backslashes. */
|
||||||
@@ -1474,17 +1492,7 @@ char *
|
|||||||
find_percent (pattern)
|
find_percent (pattern)
|
||||||
char *pattern;
|
char *pattern;
|
||||||
{
|
{
|
||||||
return find_char_unquote (pattern, '%', 0);
|
return find_char_unquote (pattern, "%", 0);
|
||||||
}
|
|
||||||
|
|
||||||
/* Search STRING for an unquoted ; that is not after an unquoted #. */
|
|
||||||
|
|
||||||
static char *
|
|
||||||
find_semicolon (string)
|
|
||||||
char *string;
|
|
||||||
{
|
|
||||||
return (find_char_unquote (string, '#', 0) == 0
|
|
||||||
? find_char_unquote (string, ';', 0) : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse a string into a sequence of filenames represented as a
|
/* Parse a string into a sequence of filenames represented as a
|
||||||
@@ -1512,6 +1520,9 @@ parse_file_seq (stringp, stopchar, size, strip)
|
|||||||
register char *p = *stringp;
|
register char *p = *stringp;
|
||||||
char *q;
|
char *q;
|
||||||
char *name;
|
char *name;
|
||||||
|
char stopchars[2];
|
||||||
|
stopchars[0] = stopchar;
|
||||||
|
stopchars[1] = '\0';
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -1523,7 +1534,12 @@ parse_file_seq (stringp, stopchar, size, strip)
|
|||||||
break;
|
break;
|
||||||
/* Yes, find end of next name. */
|
/* Yes, find end of next name. */
|
||||||
q = p;
|
q = p;
|
||||||
p = find_char_unquote (q, stopchar, 1);
|
p = find_char_unquote (q, stopchars, 1);
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
/* For MS-DOS, skip a "C:\...". */
|
||||||
|
if (stopchar == ':' && p != 0 && p[1] == '\\' && isalpha (p[-1]))
|
||||||
|
p = 0;
|
||||||
|
#endif
|
||||||
if (p == 0)
|
if (p == 0)
|
||||||
p = q + strlen (q);
|
p = q + strlen (q);
|
||||||
|
|
||||||
@@ -1559,7 +1575,9 @@ parse_file_seq (stringp, stopchar, size, strip)
|
|||||||
an elt further down the chain (i.e., previous in the file list)
|
an elt further down the chain (i.e., previous in the file list)
|
||||||
with an unmatched `(' (e.g., "lib(mem"). */
|
with an unmatched `(' (e.g., "lib(mem"). */
|
||||||
|
|
||||||
for (new1 = new, lastnew1 = 0; new1 != 0; lastnew1 = new1, new1 = new1->next)
|
new1 = new;
|
||||||
|
lastnew1 = 0;
|
||||||
|
while (new1 != 0)
|
||||||
if (new1->name[0] != '(' /* Don't catch "(%)" and suchlike. */
|
if (new1->name[0] != '(' /* Don't catch "(%)" and suchlike. */
|
||||||
&& new1->name[strlen (new1->name) - 1] == ')'
|
&& new1->name[strlen (new1->name) - 1] == ')'
|
||||||
&& index (new1->name, '(') == 0)
|
&& index (new1->name, '(') == 0)
|
||||||
@@ -1634,20 +1652,27 @@ parse_file_seq (stringp, stopchar, size, strip)
|
|||||||
/* Trace back from NEW1 (the end of the list) until N
|
/* Trace back from NEW1 (the end of the list) until N
|
||||||
(the beginning of the list), rewriting each name
|
(the beginning of the list), rewriting each name
|
||||||
with the full archive reference. */
|
with the full archive reference. */
|
||||||
|
|
||||||
while (new1 != n)
|
while (new1 != n)
|
||||||
{
|
{
|
||||||
name = concat (libname, new1->name, ")");
|
name = concat (libname, new1->name, ")");
|
||||||
free (new1->name);
|
free (new1->name);
|
||||||
new1->name = name;
|
new1->name = name;
|
||||||
|
lastnew1 = new1;
|
||||||
new1 = new1->next;
|
new1 = new1->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new1 == 0)
|
|
||||||
/* We might have slurped up the whole list,
|
|
||||||
and continuing the loop would dereference NEW1. */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No frobnication happening. Just step down the list. */
|
||||||
|
lastnew1 = new1;
|
||||||
|
new1 = new1->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastnew1 = new1;
|
||||||
|
new1 = new1->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1729,7 +1754,7 @@ readline (linebuffer, stream, filename, lineno)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!backslash)
|
if (!backslash)
|
||||||
{
|
{
|
||||||
p[-1] = '\0';
|
p[-1] = '\0';
|
||||||
@@ -1850,7 +1875,7 @@ tilde_expand (name)
|
|||||||
|
|
||||||
warn_undefined_variables_flag = save;
|
warn_undefined_variables_flag = save;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_variable = home_dir[0] != '\0';
|
is_variable = home_dir[0] != '\0';
|
||||||
if (!is_variable)
|
if (!is_variable)
|
||||||
{
|
{
|
||||||
@@ -1913,13 +1938,16 @@ multi_glob (chain, size)
|
|||||||
struct nameseq *chain;
|
struct nameseq *chain;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
{
|
{
|
||||||
|
extern void dir_setup_glob ();
|
||||||
register struct nameseq *new = 0;
|
register struct nameseq *new = 0;
|
||||||
register struct nameseq *old;
|
register struct nameseq *old;
|
||||||
struct nameseq *nexto;
|
struct nameseq *nexto;
|
||||||
|
glob_t gl;
|
||||||
|
|
||||||
|
dir_setup_glob (&gl);
|
||||||
|
|
||||||
for (old = chain; old != 0; old = nexto)
|
for (old = chain; old != 0; old = nexto)
|
||||||
{
|
{
|
||||||
glob_t gl;
|
|
||||||
#ifndef NO_ARCHIVES
|
#ifndef NO_ARCHIVES
|
||||||
char *memname;
|
char *memname;
|
||||||
#endif
|
#endif
|
||||||
@@ -1953,7 +1981,7 @@ multi_glob (chain, size)
|
|||||||
memname = 0;
|
memname = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (glob (old->name, GLOB_NOCHECK, NULL, &gl))
|
switch (glob (old->name, GLOB_NOCHECK|GLOB_ALTDIRFUNC, NULL, &gl))
|
||||||
{
|
{
|
||||||
case 0: /* Success. */
|
case 0: /* Success. */
|
||||||
{
|
{
|
||||||
|
|||||||
121
remake.c
121
remake.c
@@ -1,5 +1,5 @@
|
|||||||
/* Basic dependency engine for GNU Make.
|
/* Basic dependency engine for GNU Make.
|
||||||
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -21,6 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#include "job.h"
|
#include "job.h"
|
||||||
#include "dep.h"
|
#include "dep.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -132,7 +133,7 @@ update_goal_chain (goals, makefiles)
|
|||||||
by calling update_file above. We check this flag below to
|
by calling update_file above. We check this flag below to
|
||||||
decide when to give an "up to date" diagnostic. */
|
decide when to give an "up to date" diagnostic. */
|
||||||
g->changed += commands_started - ocommands_started;
|
g->changed += commands_started - ocommands_started;
|
||||||
|
|
||||||
stop = 0;
|
stop = 0;
|
||||||
if (x != 0 || file->updated)
|
if (x != 0 || file->updated)
|
||||||
{
|
{
|
||||||
@@ -194,14 +195,10 @@ update_goal_chain (goals, makefiles)
|
|||||||
&& file->update_status == 0 && !g->changed
|
&& file->update_status == 0 && !g->changed
|
||||||
/* Never give a message under -s or -q. */
|
/* Never give a message under -s or -q. */
|
||||||
&& !silent_flag && !question_flag)
|
&& !silent_flag && !question_flag)
|
||||||
{
|
message (1, ((file->phony || file->cmds == 0)
|
||||||
if (file->phony || file->cmds == 0)
|
? "Nothing to be done for `%s'."
|
||||||
message ("Nothing to be done for `%s'.",
|
: "`%s' is up to date."),
|
||||||
file->name);
|
file->name);
|
||||||
else
|
|
||||||
message ("`%s' is up to date.", file->name);
|
|
||||||
fflush (stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This goal is finished. Remove it from the chain. */
|
/* This goal is finished. Remove it from the chain. */
|
||||||
if (lastgoal == 0)
|
if (lastgoal == 0)
|
||||||
@@ -277,9 +274,7 @@ update_file (file, depth)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error ("internal error: `%s' command_state == %d in update_file",
|
assert (f->command_state == cs_running);
|
||||||
f->name, (int) f->command_state);
|
|
||||||
abort ();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,7 +463,7 @@ update_file_1 (file, depth)
|
|||||||
|
|
||||||
if (running)
|
if (running)
|
||||||
{
|
{
|
||||||
file->command_state = cs_deps_running;
|
set_command_state (file, cs_deps_running);
|
||||||
--depth;
|
--depth;
|
||||||
DEBUGPR ("The dependencies of `%s' are being made.\n");
|
DEBUGPR ("The dependencies of `%s' are being made.\n");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -478,9 +473,8 @@ update_file_1 (file, depth)
|
|||||||
|
|
||||||
if (dep_status != 0)
|
if (dep_status != 0)
|
||||||
{
|
{
|
||||||
file->command_state = cs_finished;
|
|
||||||
file->update_status = dep_status;
|
file->update_status = dep_status;
|
||||||
file->updated = 1;
|
notice_finished_file (file);
|
||||||
|
|
||||||
depth--;
|
depth--;
|
||||||
|
|
||||||
@@ -493,7 +487,16 @@ update_file_1 (file, depth)
|
|||||||
return dep_status;
|
return dep_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
file->command_state = cs_not_started;
|
if (file->command_state == cs_deps_running)
|
||||||
|
/* The commands for some deps were running on the last iteration, but
|
||||||
|
they have finished now. Reset the command_state to not_started to
|
||||||
|
simplify later bookkeeping. It is important that we do this only
|
||||||
|
when the prior state was cs_deps_running, because that prior state
|
||||||
|
was definitely propagated to FILE's also_make's by set_command_state
|
||||||
|
(called above), but in another state an also_make may have
|
||||||
|
independently changed to finished state, and we would confuse that
|
||||||
|
file's bookkeeping (updated, but not_started is bogus state). */
|
||||||
|
set_command_state (file, cs_not_started);
|
||||||
|
|
||||||
/* Now record which dependencies are more
|
/* Now record which dependencies are more
|
||||||
recent than this file, so we can define $?. */
|
recent than this file, so we can define $?. */
|
||||||
@@ -549,9 +552,7 @@ update_file_1 (file, depth)
|
|||||||
if (!must_make)
|
if (!must_make)
|
||||||
{
|
{
|
||||||
DEBUGPR ("No need to remake target `%s'.\n");
|
DEBUGPR ("No need to remake target `%s'.\n");
|
||||||
file->command_state = cs_finished;
|
notice_finished_file (file);
|
||||||
file->update_status = 0;
|
|
||||||
file->updated = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,19 +569,18 @@ update_file_1 (file, depth)
|
|||||||
|
|
||||||
switch (file->update_status)
|
switch (file->update_status)
|
||||||
{
|
{
|
||||||
case 1:
|
case 2:
|
||||||
DEBUGPR ("Failed to remake target file `%s'.\n");
|
DEBUGPR ("Failed to remake target file `%s'.\n");
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
DEBUGPR ("Successfully remade target file `%s'.\n");
|
DEBUGPR ("Successfully remade target file `%s'.\n");
|
||||||
break;
|
break;
|
||||||
case -1:
|
case 1:
|
||||||
error ("internal error: `%s' update_status is -1 at cs_finished!",
|
DEBUGPR ("Target file `%s' needs remade under -q.\n");
|
||||||
file->name);
|
break;
|
||||||
abort ();
|
|
||||||
default:
|
default:
|
||||||
error ("internal error: `%s' update_status invalid!", file->name);
|
assert (file->update_status >= 0 && file->update_status <= 2);
|
||||||
abort ();
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
file->updated = 1;
|
file->updated = 1;
|
||||||
@@ -589,25 +589,28 @@ update_file_1 (file, depth)
|
|||||||
|
|
||||||
/* Set FILE's `updated' flag and re-check its mtime and the mtime's of all
|
/* Set FILE's `updated' flag and re-check its mtime and the mtime's of all
|
||||||
files listed in its `also_make' member. Under -t, this function also
|
files listed in its `also_make' member. Under -t, this function also
|
||||||
touches FILE. */
|
touches FILE.
|
||||||
|
|
||||||
|
On return, FILE->update_status will no longer be -1 if it was. */
|
||||||
|
|
||||||
void
|
void
|
||||||
notice_finished_file (file)
|
notice_finished_file (file)
|
||||||
register struct file *file;
|
register struct file *file;
|
||||||
{
|
{
|
||||||
struct dep *d;
|
struct dep *d;
|
||||||
|
int ran = file->command_state == cs_running;
|
||||||
|
|
||||||
file->command_state = cs_finished;
|
file->command_state = cs_finished;
|
||||||
file->updated = 1;
|
file->updated = 1;
|
||||||
|
|
||||||
if (touch_flag
|
if (touch_flag
|
||||||
/* The update status will be:
|
/* The update status will be:
|
||||||
-1 if no commands were run;
|
-1 if this target was not remade;
|
||||||
0 if some commands (+ or ${MAKE}) were run and won;
|
0 if 0 or more commands (+ or ${MAKE}) were run and won;
|
||||||
1 if some commands were run and lost.
|
1 if some commands were run and lost.
|
||||||
The only time we don't want to touch the target is if
|
We touch the target if it has commands which either were not run
|
||||||
it had some recursive commands, and they lost. */
|
or won when they ran (i.e. status is 0). */
|
||||||
&& file->update_status != 1)
|
&& file->update_status == 0)
|
||||||
{
|
{
|
||||||
if (file->cmds != 0 && file->cmds->any_recurse)
|
if (file->cmds != 0 && file->cmds->any_recurse)
|
||||||
{
|
{
|
||||||
@@ -629,7 +632,7 @@ notice_finished_file (file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file->phony)
|
if (ran && !file->phony)
|
||||||
{
|
{
|
||||||
struct file *f;
|
struct file *f;
|
||||||
|
|
||||||
@@ -645,7 +648,7 @@ notice_finished_file (file)
|
|||||||
f->last_mtime = file->last_mtime;
|
f->last_mtime = file->last_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->update_status != -1)
|
if (ran && file->update_status != -1)
|
||||||
/* We actually tried to update FILE, which has
|
/* We actually tried to update FILE, which has
|
||||||
updated its also_make's as well (if it worked).
|
updated its also_make's as well (if it worked).
|
||||||
If it didn't work, it wouldn't work again for them.
|
If it didn't work, it wouldn't work again for them.
|
||||||
@@ -656,13 +659,17 @@ notice_finished_file (file)
|
|||||||
d->file->updated = 1;
|
d->file->updated = 1;
|
||||||
d->file->update_status = file->update_status;
|
d->file->update_status = file->update_status;
|
||||||
|
|
||||||
if (!d->file->phony)
|
if (ran && !d->file->phony)
|
||||||
/* Fetch the new modification time.
|
/* Fetch the new modification time.
|
||||||
We do this instead of just invalidating the cached time
|
We do this instead of just invalidating the cached time
|
||||||
so that a vpath_search can happen. Otherwise, it would
|
so that a vpath_search can happen. Otherwise, it would
|
||||||
never be done because the target is already updated. */
|
never be done because the target is already updated. */
|
||||||
(void) f_mtime (d->file, 0);
|
(void) f_mtime (d->file, 0);
|
||||||
}
|
}
|
||||||
|
else if (file->update_status == -1)
|
||||||
|
/* Nothing was done for FILE, but it needed nothing done.
|
||||||
|
So mark it now as "succeeded". */
|
||||||
|
file->update_status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check whether another file (whose mtime is THIS_MTIME)
|
/* Check whether another file (whose mtime is THIS_MTIME)
|
||||||
@@ -738,7 +745,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
|
|||||||
/* Record that some of FILE's dependencies are still being made.
|
/* Record that some of FILE's dependencies are still being made.
|
||||||
This tells the upper levels to wait on processing it until
|
This tells the upper levels to wait on processing it until
|
||||||
the commands are finished. */
|
the commands are finished. */
|
||||||
file->command_state = cs_deps_running;
|
set_command_state (file, cs_deps_running);
|
||||||
|
|
||||||
lastd = d;
|
lastd = d;
|
||||||
d = d->next;
|
d = d->next;
|
||||||
@@ -758,10 +765,7 @@ touch_file (file)
|
|||||||
register struct file *file;
|
register struct file *file;
|
||||||
{
|
{
|
||||||
if (!silent_flag)
|
if (!silent_flag)
|
||||||
{
|
message (0, "touch %s", file->name);
|
||||||
printf ("touch %s\n", file->name);
|
|
||||||
fflush (stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NO_ARCHIVES
|
#ifndef NO_ARCHIVES
|
||||||
if (ar_name (file->name))
|
if (ar_name (file->name))
|
||||||
@@ -777,8 +781,16 @@ touch_file (file)
|
|||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
char buf;
|
char buf;
|
||||||
|
int status;
|
||||||
|
|
||||||
if (fstat (fd, &statbuf) < 0)
|
#ifdef EINTR
|
||||||
|
do
|
||||||
|
#endif
|
||||||
|
status = fstat (fd, &statbuf);
|
||||||
|
#ifdef EINTR
|
||||||
|
while (status < 0 && errno == EINTR);
|
||||||
|
#endif
|
||||||
|
if (status < 0)
|
||||||
TOUCH_ERROR ("touch: fstat: ");
|
TOUCH_ERROR ("touch: fstat: ");
|
||||||
/* Rewrite character 0 same as it already is. */
|
/* Rewrite character 0 same as it already is. */
|
||||||
if (read (fd, &buf, 1) < 0)
|
if (read (fd, &buf, 1) < 0)
|
||||||
@@ -823,15 +835,29 @@ remake_file (file)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* This is a dependency file we cannot remake. Fail. */
|
/* This is a dependency file we cannot remake. Fail. */
|
||||||
static char noway[] = "No rule to make target";
|
static const char msg_noparent[]
|
||||||
|
= "%sNo rule to make target `%s'%s";
|
||||||
|
static const char msg_parent[]
|
||||||
|
= "%sNo rule to make target `%s', needed by `%s'%s";
|
||||||
if (keep_going_flag || file->dontcare)
|
if (keep_going_flag || file->dontcare)
|
||||||
{
|
{
|
||||||
if (!file->dontcare)
|
if (!file->dontcare)
|
||||||
error ("*** %s `%s'.", noway, file->name);
|
{
|
||||||
file->update_status = 1;
|
if (file->parent == 0)
|
||||||
|
error (msg_noparent, "*** ", file->name, ".");
|
||||||
|
else
|
||||||
|
error (msg_parent, "*** ",
|
||||||
|
file->name, file->parent->name, ".");
|
||||||
|
}
|
||||||
|
file->update_status = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fatal ("%s `%s'", noway, file->name);
|
{
|
||||||
|
if (file->parent == 0)
|
||||||
|
fatal (msg_noparent, "", file->name, "");
|
||||||
|
else
|
||||||
|
fatal (msg_parent, "", file->name, file->parent->name, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -843,6 +869,9 @@ remake_file (file)
|
|||||||
execute_file_commands (file);
|
execute_file_commands (file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
/* This tells notice_finished_file it is ok to touch the file. */
|
||||||
|
file->update_status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This does the touching under -t. */
|
/* This does the touching under -t. */
|
||||||
|
|||||||
41
signame.c
41
signame.c
@@ -1,5 +1,5 @@
|
|||||||
/* Convert between signal names and numbers.
|
/* Convert between signal names and numbers.
|
||||||
Copyright (C) 1990, 1992, 1993 Free Software Foundation, Inc.
|
Copyright (C) 1990, 1992, 1993, 1995 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,21 +15,22 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program; see the file COPYING. If not, write to
|
along with this program; see the file COPYING. If not, write to
|
||||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h> /* Some systems need this for <signal.h>. */
|
#include <sys/types.h> /* Some systems need this for <signal.h>. */
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
/* Some systems declare `sys_siglist in <unistd.h>; if
|
||||||
#if defined (emacs) || defined (CONFIG_BROKETS)
|
configure defined SYS_SIGLIST_DECLARED, it may expect
|
||||||
/* We use <config.h> instead of "config.h" so that a compilation
|
to find the declaration there. */
|
||||||
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
|
#ifdef HAVE_UNISTD_H
|
||||||
(which it would do because it found this file in $srcdir). */
|
#include <unistd.h>
|
||||||
#include <config.h>
|
|
||||||
#else
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Some systems do not define NSIG in <signal.h>. */
|
/* Some systems do not define NSIG in <signal.h>. */
|
||||||
#ifndef NSIG
|
#ifndef NSIG
|
||||||
#ifdef _NSIG
|
#ifdef _NSIG
|
||||||
@@ -223,6 +224,9 @@ signame_init ()
|
|||||||
#if defined (SIGDANGER)
|
#if defined (SIGDANGER)
|
||||||
init_sig (SIGDANGER, "DANGER", "Danger signal");
|
init_sig (SIGDANGER, "DANGER", "Danger signal");
|
||||||
#endif
|
#endif
|
||||||
|
#if defined (SIGINFO)
|
||||||
|
init_sig (SIGINFO, "INFO", "Information request");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the abbreviation for signal NUMBER. */
|
/* Return the abbreviation for signal NUMBER. */
|
||||||
@@ -280,3 +284,20 @@ psignal (signal, message)
|
|||||||
fprintf (stderr, "%s: %s\n", message, sys_siglist[signal]);
|
fprintf (stderr, "%s: %s\n", message, sys_siglist[signal]);
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
||||||
|
|||||||
12
signame.h
12
signame.h
@@ -1,5 +1,5 @@
|
|||||||
/* Convert between signal names and numbers.
|
/* Convert between signal names and numbers.
|
||||||
Copyright (C) 1990, 1992, 1993 Free Software Foundation, Inc.
|
Copyright (C) 1990, 1992, 1993, 1995 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -29,7 +29,7 @@ char *sig_abbrev (int number);
|
|||||||
signal by that name. */
|
signal by that name. */
|
||||||
int sig_number (const char *abbrev);
|
int sig_number (const char *abbrev);
|
||||||
|
|
||||||
/* Avoid conflicts with a system header file that might define these two. */
|
/* Avoid conflicts with a system header file that might define these three. */
|
||||||
|
|
||||||
#ifndef HAVE_PSIGNAL
|
#ifndef HAVE_PSIGNAL
|
||||||
/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
|
/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
|
||||||
@@ -37,6 +37,11 @@ int sig_number (const char *abbrev);
|
|||||||
void psignal (int signal, const char *message);
|
void psignal (int signal, const char *message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_STRSIGNAL
|
||||||
|
/* Return the name of SIGNAL. */
|
||||||
|
char *strsignal (int signal);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined (HAVE_SYS_SIGLIST)
|
#if !defined (HAVE_SYS_SIGLIST)
|
||||||
/* Names for signals from 0 to NSIG-1. */
|
/* Names for signals from 0 to NSIG-1. */
|
||||||
extern const char *sys_siglist[];
|
extern const char *sys_siglist[];
|
||||||
@@ -50,6 +55,9 @@ int sig_number ();
|
|||||||
#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_PSIGNAL)
|
#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_PSIGNAL)
|
||||||
void psignal ();
|
void psignal ();
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HAVE_STRSIGNAL
|
||||||
|
char *strsignal ();
|
||||||
|
#endif
|
||||||
#if !defined (HAVE_SYS_SIGLIST)
|
#if !defined (HAVE_SYS_SIGLIST)
|
||||||
extern char *sys_siglist[];
|
extern char *sys_siglist[];
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -387,12 +387,14 @@ define_automatic_variables ()
|
|||||||
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);
|
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;
|
int export_all_variables;
|
||||||
|
|||||||
7
version.c
Normal file
7
version.c
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
char *version_string = "3.74.2";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Local variables:
|
||||||
|
version-control: never
|
||||||
|
End:
|
||||||
|
*/
|
||||||
19
vpath.c
19
vpath.c
@@ -1,5 +1,5 @@
|
|||||||
/* Implementation of pattern-matching file search paths for GNU Make.
|
/* Implementation of pattern-matching file search paths for GNU Make.
|
||||||
Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
|
Copyright (C) 1988, 89, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
@@ -177,7 +177,7 @@ construct_vpath_list (pattern, dirpath)
|
|||||||
maxelem = 2;
|
maxelem = 2;
|
||||||
p = dirpath;
|
p = dirpath;
|
||||||
while (*p != '\0')
|
while (*p != '\0')
|
||||||
if (*p++ == ':' || isblank (*p))
|
if (*p++ == PATH_SEPARATOR_CHAR || isblank (*p))
|
||||||
++maxelem;
|
++maxelem;
|
||||||
|
|
||||||
vpath = (char **) xmalloc (maxelem * sizeof (char *));
|
vpath = (char **) xmalloc (maxelem * sizeof (char *));
|
||||||
@@ -185,7 +185,7 @@ construct_vpath_list (pattern, dirpath)
|
|||||||
|
|
||||||
/* Skip over any initial colons and blanks. */
|
/* Skip over any initial colons and blanks. */
|
||||||
p = dirpath;
|
p = dirpath;
|
||||||
while (*p == ':' || isblank (*p))
|
while (*p == PATH_SEPARATOR_CHAR || isblank (*p))
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
elem = 0;
|
elem = 0;
|
||||||
@@ -196,7 +196,7 @@ construct_vpath_list (pattern, dirpath)
|
|||||||
|
|
||||||
/* Find the end of this entry. */
|
/* Find the end of this entry. */
|
||||||
v = p;
|
v = p;
|
||||||
while (*p != '\0' && *p != ':' && !isblank (*p))
|
while (*p != '\0' && *p != PATH_SEPARATOR_CHAR && !isblank (*p))
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
len = p - v;
|
len = p - v;
|
||||||
@@ -225,7 +225,7 @@ construct_vpath_list (pattern, dirpath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Skip over colons and blanks between entries. */
|
/* Skip over colons and blanks between entries. */
|
||||||
while (*p == ':' || isblank (*p))
|
while (*p == PATH_SEPARATOR_CHAR || isblank (*p))
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ selective_vpath_search (path, file, mtime_ptr)
|
|||||||
*n = '/';
|
*n = '/';
|
||||||
|
|
||||||
if (!exists_in_cache /* Makefile-mentioned file need not exist. */
|
if (!exists_in_cache /* Makefile-mentioned file need not exist. */
|
||||||
|| stat (name, &st) == 0) /* Does it really exist? */
|
|| stat (name, &st) == 0) /* Does it really exist? */
|
||||||
{
|
{
|
||||||
/* We have found a file.
|
/* We have found a file.
|
||||||
Store the name we found into *FILE for the caller. */
|
Store the name we found into *FILE for the caller. */
|
||||||
@@ -434,6 +434,8 @@ selective_vpath_search (path, file, mtime_ptr)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
exists = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +463,7 @@ print_vpath_data_base ()
|
|||||||
|
|
||||||
for (i = 0; v->searchpath[i] != 0; ++i)
|
for (i = 0; v->searchpath[i] != 0; ++i)
|
||||||
printf ("%s%c", v->searchpath[i],
|
printf ("%s%c", v->searchpath[i],
|
||||||
v->searchpath[i + 1] == 0 ? '\n' : ':');
|
v->searchpath[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vpaths == 0)
|
if (vpaths == 0)
|
||||||
@@ -479,6 +481,7 @@ print_vpath_data_base ()
|
|||||||
fputs ("\n# General (`VPATH' variable) search path:\n# ", stdout);
|
fputs ("\n# General (`VPATH' variable) search path:\n# ", stdout);
|
||||||
|
|
||||||
for (i = 0; path[i] != 0; ++i)
|
for (i = 0; path[i] != 0; ++i)
|
||||||
printf ("%s%c", path[i], path[i + 1] == 0 ? '\n' : ':');
|
printf ("%s%c", path[i],
|
||||||
|
path[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user