⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 5 页
字号:
FC=fort77FFLAGS=-O 1<sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0">GET=getGFLAGS=SCCSFLAGS=SCCSGETFLAGS=-s<img src="../images/opt-end.gif" alt="[Option End]" border="0"><br></tt><i>SINGLE SUFFIX RULES</i><tt><br>.c:    $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $&lt;<br>.f:    $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $&lt;<br>.sh:    cp $&lt; $@    chmod a+x $@<br><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0">.c&#152;:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.c    $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $*.c<br>.f&#152;:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.f    $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $*.f<br>.sh&#152;:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.sh    cp $*.sh $@    chmod a+x $@<img src="../images/opt-end.gif" alt="[Option End]" border="0"><br></tt><i>DOUBLE SUFFIX RULES</i><tt><br>.c.o:    $(CC) $(CFLAGS) -c $&lt;<br>.f.o:    $(FC) $(FFLAGS) -c $&lt;<br>.y.o:    $(YACC) $(YFLAGS) $&lt;    $(CC) $(CFLAGS) -c y.tab.c    rm -f y.tab.c    mv y.tab.o $@<br>.l.o:    $(LEX) $(LFLAGS) $&lt;    $(CC) $(CFLAGS) -c lex.yy.c    rm -f lex.yy.c    mv lex.yy.o $@<br>.y.c:    $(YACC) $(YFLAGS) $&lt;    mv y.tab.c $@<br>.l.c:    $(LEX) $(LFLAGS) $&lt;    mv lex.yy.c $@<br><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0">.c&#152;.o:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.c    $(CC) $(CFLAGS) -c $*.c<br>.f&#152;.o:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.f    $(FC) $(FFLAGS) -c $*.f<br>.y&#152;.o:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.y    $(YACC) $(YFLAGS) $*.y    $(CC) $(CFLAGS) -c y.tab.c    rm -f y.tab.c    mv y.tab.o $@<br>.l&#152;.o:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.l    $(LEX) $(LFLAGS) $*.l    $(CC) $(CFLAGS) -c lex.yy.c    rm -f lex.yy.c    mv lex.yy.o $@<br>.y&#152;.c:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.y    $(YACC) $(YFLAGS) $*.y    mv y.tab.c $@<br>.l&#152;.c:    $(GET) $(GFLAGS) -p $&lt; &gt; $*.l    $(LEX) $(LFLAGS) $*.l    mv lex.yy.c $@<img src="../images/opt-end.gif" alt="[Option End]" border="0"><br>.c.a:    $(CC) -c $(CFLAGS) $&lt;    $(AR) $(ARFLAGS) $@ $*.o    rm -f $*.o<br>.f.a:    $(FC) -c $(FFLAGS) $&lt;    $(AR) $(ARFLAGS) $@ $*.o    rm -f $*.o</tt></pre></blockquote><h4><a name="tag_04_84_14"></a>EXIT STATUS</h4><blockquote><p>When the <b>-q</b> option is specified, the <i>make</i> utility shall exit with one of the following values:</p><dl compact><dt>&nbsp;0</dt><dd>Successful completion.</dd><dt>&nbsp;1</dt><dd>The target was not up-to-date.</dd><dt>&gt;1</dt><dd>An error occurred.</dd></dl><p>When the <b>-q</b> option is not specified, the <i>make</i> utility shall exit with one of the following values:</p><dl compact><dt>&nbsp;0</dt><dd>Successful completion.</dd><dt>&gt;0</dt><dd>An error occurred.</dd></dl></blockquote><h4><a name="tag_04_84_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>Default.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_84_16"></a>APPLICATION USAGE</h4><blockquote><p>If there is a source file (such as <b>./source.c</b>) and there are two SCCS files corresponding to it ( <b>./s.source.c</b> and<b>./SCCS/s.source.c</b>), on XSI-conformant systems <i>make</i> uses the SCCS file in the current directory. However, users areadvised to use the underlying SCCS utilities ( <a href="../utilities/admin.html"><i>admin</i></a>, <a href="../utilities/delta.html"><i>delta</i></a>, <a href="../utilities/get.html"><i>get</i></a>, and so on) or the <a href="../utilities/sccs.html"><i>sccs</i></a> utility for all source files in a given directory. If both forms are used for a givensource file, future developers are very likely to be confused.</p><p>It is incumbent upon portable makefiles to specify the <b>.POSIX</b> special target in order to guarantee that they are notaffected by local extensions.</p><p>The <b>-k</b> and <b>-S</b> options are both present so that the relationship between the command line, the <i>MAKEFLAGS</i>variable, and the makefile can be controlled precisely. If the <b>k</b> flag is passed in <i>MAKEFLAGS</i> and a command is of theform:</p><pre><tt>$(MAKE) -S foo</tt></pre><p>then the default behavior is restored for the child <i>make</i>.</p><p>When the <b>-n</b> option is specified, it is always added to <i>MAKEFLAGS .</i> This allows a recursive <i>make</i> <b>-n</b><i>target</i> to be used to see all of the action that would be taken to update <i>target</i>.</p><p>Because of widespread historical practice, interpreting a <tt>'#'</tt> number sign inside a variable as the start of a commenthas the unfortunate side effect of making it impossible to place a number sign in a variable, thus forbidding something like:</p><pre><tt>CFLAGS = "-D COMMENT_CHAR='#'"</tt></pre><p>Many historical <i>make</i> utilities stop chaining together inference rules when an intermediate target is nonexistent. Forexample, it might be possible for a <i>make</i> to determine that both <b>.y.c</b> and <b>.c.o</b> could be used to convert a<b>.y</b> to a <b>.o</b>. Instead, in this case, <i>make</i> requires the use of a <b>.y.o</b> rule.</p><p>The best way to provide portable makefiles is to include all of the rules needed in the makefile itself. The rules provided useonly features provided by other parts of this volume of IEEE&nbsp;Std&nbsp;1003.1-2001. The default rules include rules foroptional commands in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001. Only rules pertaining to commands that are provided are neededin an implementation's default set.</p><p>Macros used within other macros are evaluated when the new macro is used rather than when the new macro is defined.Therefore:</p><pre><tt>MACRO =</tt> <i>value1</i><tt>NEW   = $(MACRO)MACRO =</tt> <i>value2</i><tt><br>target:    echo $(NEW)</tt></pre><p>would produce <i>value2</i> and not <i>value1</i> since <b>NEW</b> was not expanded until it was needed in the <a href="../utilities/echo.html"><i>echo</i></a> command line.</p><p>Some historical applications have been known to intermix <i>target_name</i> and <i>macro=name</i> operands on the command line,expecting that all of the macros are processed before any of the targets are dealt with. Conforming applications do not do this,although some backwards-compatibility support may be included in some implementations.</p><p>The following characters in filenames may give trouble: <tt>'='</tt> , <tt>':'</tt> , <tt>'`'</tt> , <tt>'&quot;</tt> , and<tt>'@'</tt> . For inference rules, the description of $&lt; and $? seem similar. However, an example shows the minor difference.In a makefile containing:</p><pre><tt>foo.o: foo.h</tt></pre><p>if <b>foo.h</b> is newer than <b>foo.o</b>, yet <b>foo.c</b> is older than <b>foo.o</b>, the built-in rule to make <b>foo.o</b>from <b>foo.c</b> is used, with $&lt; equal to <b>foo.c</b> and $? equal to <b>foo.h</b>. If <b>foo.c</b> is also newer than<b>foo.o</b>, $&lt; is equal to <b>foo.c</b> and $? is equal to <b>foo.h foo.c</b>.</p></blockquote><h4><a name="tag_04_84_17"></a>EXAMPLES</h4><blockquote><ol><li><p>The following command:</p><pre><tt>make</tt></pre><p>makes the first target found in the makefile.</p></li><li><p>The following command:</p><pre><tt>make junk</tt></pre><p>makes the target <b>junk</b>.</p></li><li><p>The following makefile says that <b>pgm</b> depends on two files, <b>a.o</b> and <b>b.o</b>, and that they in turn depend ontheir corresponding source files ( <b>a.c</b> and <b>b.c</b>), and a common file <b>incl.h</b>:</p><pre><tt>pgm: a.o b.o    c99 a.o b.o -o pgma.o: incl.h a.c    c99 -c a.cb.o: incl.h b.c    c99 -c b.c</tt></pre></li>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -