Files
oldlinux-files/study/Ref-docs/manual make/make_13.html
2024-02-19 00:25:23 -05:00

156 lines
5.5 KiB
HTML

<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.54
from ../texi/make.texinfo on 19 July 2000 -->
<TITLE>GNU make - Incompatibilities and Missing Features</TITLE>
<link href="make_14.html" rel=Next>
<link href="make_12.html" rel=Previous>
<link href="make_toc.html" rel=ToC>
</HEAD>
<BODY>
<p>Go to the <A HREF="make_1.html">first</A>, <A HREF="make_12.html">previous</A>, <A HREF="make_14.html">next</A>, <A HREF="make_19.html">last</A> section, <A HREF="make_toc.html">table of contents</A>.
<P><HR><P>
<H1><A NAME="SEC115" HREF="make_toc.html#TOC115">Incompatibilities and Missing Features</A></H1>
<P>
<A NAME="IDX914"></A>
<A NAME="IDX915"></A>
<A NAME="IDX916"></A>
</P>
<P>
The <CODE>make</CODE> programs in various other systems support a few features
that are not implemented in GNU <CODE>make</CODE>. The POSIX.2 standard
(<CITE>IEEE Standard 1003.2-1992</CITE>) which specifies <CODE>make</CODE> does not
require any of these features.
</P>
<UL>
<LI>
A target of the form <SAMP>`<VAR>file</VAR>((<VAR>entry</VAR>))'</SAMP> stands for a member
of archive file <VAR>file</VAR>. The member is chosen, not by name, but by
being an object file which defines the linker symbol <VAR>entry</VAR>.
This feature was not put into GNU <CODE>make</CODE> because of the
nonmodularity of putting knowledge into <CODE>make</CODE> of the internal
format of archive file symbol tables.
See section <A HREF="make_11.html#SEC111">Updating Archive Symbol Directories</A>.
<LI>
Suffixes (used in suffix rules) that end with the character <SAMP>`~'</SAMP>
have a special meaning to System V <CODE>make</CODE>;
they refer to the SCCS file that corresponds
to the file one would get without the <SAMP>`~'</SAMP>. For example, the
suffix rule <SAMP>`.c~.o'</SAMP> would make the file <TT>`<VAR>n</VAR>.o'</TT> from
the SCCS file <TT>`s.<VAR>n</VAR>.c'</TT>. For complete coverage, a whole
series of such suffix rules is required.
See section <A HREF="make_10.html#SEC106">Old-Fashioned Suffix Rules</A>.
In GNU <CODE>make</CODE>, this entire series of cases is handled by two
pattern rules for extraction from SCCS, in combination with the
general feature of rule chaining.
See section <A HREF="make_10.html#SEC97">Chains of Implicit Rules</A>.
<LI>
In System V <CODE>make</CODE>, the string <SAMP>`$$@'</SAMP> has the strange meaning
that, in the prerequisites of a rule with multiple targets, it stands
for the particular target that is being processed.
This is not defined in GNU <CODE>make</CODE> because <SAMP>`$$'</SAMP> should always
stand for an ordinary <SAMP>`$'</SAMP>.
It is possible to get portions of this functionality through the use of
static pattern rules (see section <A HREF="make_4.html#SEC39">Static Pattern Rules</A>).
The System V <CODE>make</CODE> rule:
<PRE>
$(targets): $$@.o lib.a
</PRE>
can be replaced with the GNU <CODE>make</CODE> static pattern rule:
<PRE>
$(targets): %: %.o lib.a
</PRE>
<LI>
In System V and 4.3 BSD <CODE>make</CODE>, files found by <CODE>VPATH</CODE> search
(see section <A HREF="make_4.html#SEC26">Searching Directories for Prerequisites</A>) have their names changed inside command
strings. We feel it is much cleaner to always use automatic variables
and thus make this feature obsolete.
<LI>
In some Unix <CODE>make</CODE>s, the automatic variable <CODE>$*</CODE> appearing in
the prerequisites of a rule has the amazingly strange "feature" of
expanding to the full name of the <EM>target of that rule</EM>. We cannot
imagine what went on in the minds of Unix <CODE>make</CODE> developers to do
this; it is utterly inconsistent with the normal definition of <CODE>$*</CODE>.
<A NAME="IDX917"></A>
<LI>
In some Unix <CODE>make</CODE>s, implicit rule search
(see section <A HREF="make_10.html#SEC93">Using Implicit Rules</A>) is apparently done for
<EM>all</EM> targets, not just those without commands. This means you can
do:
<PRE>
foo.o:
cc -c foo.c
</PRE>
and Unix <CODE>make</CODE> will intuit that <TT>`foo.o'</TT> depends on
<TT>`foo.c'</TT>.
We feel that such usage is broken. The prerequisite properties of
<CODE>make</CODE> are well-defined (for GNU <CODE>make</CODE>, at least),
and doing such a thing simply does not fit the model.
<LI>
GNU <CODE>make</CODE> does not include any built-in implicit rules for
compiling or preprocessing EFL programs. If we hear of anyone who is
using EFL, we will gladly add them.
<LI>
It appears that in SVR4 <CODE>make</CODE>, a suffix rule can be specified with
no commands, and it is treated as if it had empty commands
(see section <A HREF="make_5.html#SEC56">Using Empty Commands</A>). For example:
<PRE>
.c.a:
</PRE>
will override the built-in <TT>`.c.a'</TT> suffix rule.
We feel that it is cleaner for a rule without commands to always simply
add to the prerequisite list for the target. The above example can be
easily rewritten to get the desired behavior in GNU <CODE>make</CODE>:
<PRE>
.c.a: ;
</PRE>
<LI>
Some versions of <CODE>make</CODE> invoke the shell with the <SAMP>`-e'</SAMP> flag,
except under <SAMP>`-k'</SAMP> (see section <A HREF="make_9.html#SEC91">Testing the Compilation of a Program</A>). The <SAMP>`-e'</SAMP> flag tells the shell to exit as soon as any
program it runs returns a nonzero status. We feel it is cleaner to
write each shell command line to stand on its own and not require this
special treatment.
</UL>
<P><HR><P>
<p>Go to the <A HREF="make_1.html">first</A>, <A HREF="make_12.html">previous</A>, <A HREF="make_14.html">next</A>, <A HREF="make_19.html">last</A> section, <A HREF="make_toc.html">table of contents</A>.
</BODY>
</HTML>