📄 ref.make-object.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. --><!-- This material may be distributed only subject to the terms --><!-- and conditions set forth in the Open Publication License, v1.0 --><!-- or later (the latest version is presently available at --><!-- http://www.opencontent.org/openpub/). --><!-- Distribution of the work or derivative of the work in any --><!-- standard (paper) book form is prohibited unless prior --><!-- permission is obtained from the copyright holder. --><HTML><HEAD><TITLE>make_object</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="The eCos Component Writer's Guide"HREF="cdl-guide.html"><LINKREL="UP"TITLE="CDL Language Specification"HREF="reference.html"><LINKREL="PREVIOUS"TITLE="make"HREF="ref.make.html"><LINKREL="NEXT"TITLE="no_define"HREF="ref.no-define.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">The <SPANCLASS="APPLICATION">eCos</SPAN> Component Writer's Guide</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="ref.make.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="ref.no-define.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="REF.MAKE-OBJECT"><SPANCLASS="PROPERTY">make_object</SPAN></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN4770"></A><H2>Name</H2>Property <SPANCLASS="PROPERTY">make_object</SPAN> -- Define a custom build step, resulting in an object filethat should go into a library.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN4774"><H2>Synopsis</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SYNOPSIS">cdl_option <name> { make_object [-library=<library>] [-priority=<pri>] { <custom build step> } …}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4776"></A><H2>Description</H2><P>When building an <SPANCLASS="APPLICATION">eCos</SPAN> configuration the primary target is a singlelibrary, <TTCLASS="FILENAME">libtarget.a</TT>. Most of the object fileswhich go into this library will be generated as a result of <SPANCLASS="PROPERTY">compile</SPAN>properties. Occasionally it may be necessary to have special buildsteps for a given object file, and this can be achieved with a<SPANCLASS="PROPERTY">make_object</SPAN> property. The use of this property should be avoidedwhenever possible because it greatly increases the risk of portabilityproblems, both on the host side because of possible problems with thetools, and on the target side because a custom build step may notallow adequately for the wide variety of architectures supported by<SPANCLASS="APPLICATION">eCos</SPAN>.</P><P>The <SPANCLASS="PROPERTY">make_object</SPAN> property takes a single argument, which resembles amakefile rule: it consists of a target, a list of dependencies, andone or more commands that should be executed. The target should be anobject file. However the <SPANCLASS="PROPERTY">make_object</SPAN> argument is not a makefilefragment, and custom build steps may get executed in buildenvironments that do not involve make. For full details of custombuild steps see <AHREF="build.make.html#BUILD.CUSTOM">the Section called <I>Custom Build Steps</I> in Chapter 4</A>.</P><DIVCLASS="WARNING"><P></P><TABLECLASS="WARNING"BORDER="1"WIDTH="100%"><TR><TDALIGN="CENTER"><B>Warning</B></TD></TR><TR><TDALIGN="LEFT"><P>The exact syntax and limitations of custom build steps have not yetbeen finalized, and may change in future versions of theconfiguration tools.</P></TD></TR></TABLE></DIV><P>The <SPANCLASS="PROPERTY">make_object</SPAN> property takes an optional library argument. If nolibrary is specified then the default library for the current packagewill be used, which will be <TTCLASS="FILENAME">libtarget.a</TT> unlessthe <TTCLASS="LITERAL">cdl_package</TT> command contains a <SPANCLASS="PROPERTY">library</SPAN> property.</P><P>The <SPANCLASS="PROPERTY">make_object</SPAN> property also takes an optional priority argumentindicating the order in which build steps take place. This prioritycomplements the dependency list, and avoids problems with packagesneeding to know details of custom build steps in other packages (whichmay change between releases). The defined order is:</P><P></P><DIVCLASS="VARIABLELIST"><DL><DT>Priority 0</DT><DD><P>The header files exported by the current set of packages are copiedto the appropriate places in the<TTCLASS="FILENAME">include</TT> subdirectory of theinstall tree. Any unnecessary copies are avoided, to prevent rebuildsof package and application source modules caused by header file dependencies.</P><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>A possible future enhancement of the build system may result in thebuild and install trees being updated automatically if there has beena change to the <TTCLASS="FILENAME">ecos.ecc</TT> configuration savefile.</P></BLOCKQUOTE></DIV></DD><DT>Priority 100</DT><DD><P>All files specified in <SPANCLASS="PROPERTY">compile</SPAN> properties will get built, producingthe corresponding object files. In addition any custom build stepsdefined by <SPANCLASS="PROPERTY">make_object</SPAN> properties get executed, unless there is a<TTCLASS="LITERAL">-priority=</TT> option.</P></DD><DT>Priority 200</DT><DD><P>The libraries now get built using the appropriate object files.</P></DD><DT>Priority 300</DT><DD><P>Any custom build steps specified by <SPANCLASS="PROPERTY">make</SPAN> properties now getexecuted, unless the priority for a particular build step is changedfrom its default.</P></DD></DL></DIV><P>For example, if a custom build step needs to take place before any ofthe normal source files get compiled then it should be given apriority somewhere between 0 and 100. If a custom build step involvespost-processing an object file prior to its incorporation into alibrary then a priority between 100 and 200 should be used. It is notsensible to have a priority above 200, since that would imply buildingan additional object file for a library that has already been created.</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4823"></A><H2>Example</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_option XXX { … make_object { parser.o: parser.y yacc $< $(CC) $(CFLAGS) -o $@ y.tab.c }}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4826"></A><H2>See Also</H2><P>Properties <AHREF="ref.compile.html">compile</A>,<AHREF="ref.make.html">make</A> and<AHREF="ref.library.html">library</A>.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="ref.make.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="cdl-guide.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="ref.no-define.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><SPANCLASS="PROPERTY">make</SPAN></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="reference.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><SPANCLASS="PROPERTY">no_define</SPAN></TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -