📄 c-builder5.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> Projects </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-builder.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-builder4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-builder6.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="98349">4.5 Working With Build Specifications</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="98355"> </a>The project facility allows you to create, modify, and select specifications for any number of builds. A default build specification is defined when you create your project. While a BSP is usually designed for one CPU, you can create build specifications for different image types and optimization levels, specifications for builds that include debugging information and builds that don't, and so on. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="97696">4.5.1 Changing a Build Specification</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="92017"> </a>Each build specification consists of a set of options that define the VxWorks image type (for VxWorks and bootable application projects), makefile rules, macros, as well as compiler, assembler, and linker options.</p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/note.gif"></td><td><hr><div class="CalloutCell"><a name="102472"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE: </font></b></a>For detailed information about compiler, assembler, and linker options, see the <i class="title">GNU Toolkit User's Guide</i>.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dl class="margin"><dd><p class="Body"><a name="91906"> </a>You can change default or other previously defined build options by double-clicking on the build name in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Builds</font></b> view of the workspace window. The build's property sheet appears (<a href="c-builder5.html#101068">Figure 4-34</a>),<div class="frame"><h4 class="EntityTitle"><a name="101068"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-34: Build Property Sheet</font></a></h4><dl class="margin"><div class="CellBody"><a name="101074"> </a><img class="figure" border="0" src="images/c-builder0.gif"></div></dl></div></p><dd><p class="Body"><a name="101055"> </a>You can use the property sheet to modify:</p></dl><dl class="margin"><p class="listspace"><ul class="Bullet" type="disc"><li><a name="93316"> </a>build targets</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="93335"> </a>makefile rules</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="93326"> </a>makefile macros for the compiler and linker</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="93318"> </a>compiler options</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="91920"> </a>assembler options</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="91921"> </a>linker options</li></ul></p></dl><dl class="margin"><dd><p class="Body"><a name="105799"> </a>For information about build targets for downloadable applications, see <a href="c-builder2.html#97000"><i class="title">Build Specifications</i></a>. For information about build targets for bootable applications, see <a href="c-builder3.html#92122"><i class="title">4.3.4 Selecting the VxWorks Image Type</i></a>. Other features of the build property sheet are covered in the following sections. </p></dl><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/warning.gif"></td><td><hr><div class="CalloutCell"><a name="102490"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">WARNING: </font></b></a>As of this release the project facility does not note changes in build options when you attempt to rebuild a project, and it will report that the build is up to date. If the only changes you have made are to the build options, you must select <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Rebuild All</font></b> from the context menu to start a build with the new options.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="94479">Custom Makefile Rules</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="105738"> </a>The buttons at the bottom of the build property sheet allow you to create, edit, or delete makefile rules (default project entries cannot be deleted; only those created by a user can be deleted). When you click the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">New/Edit </font></b>button the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Create or Edit Rule</font></b> dialog box appears (<a href="c-builder5.html#105742">Figure 4-35</a>). Once you have created or edited an entry, click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">OK</font></b>. Note that the default is to invoke the rule before building the project (see checkbox). If the default is not selected, the rule is only invoked if it is the rule currently selected for the build (with the drop-down list in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Rules</font></b> page of the build property sheet). New rules are added to the <i class="textVariable">projectName</i><b class="file">.wpj</b> file and written to the makefile prior to a build. <div class="frame"><h4 class="EntityTitle"><a name="105742"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-35: Makefile Rule</font></a></h4><dl class="margin"><div class="CellBody"><a name="105747"> </a><img class="figure" border="0" src="images/c-buildera40.gif"></div></dl></div> </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="93401">Makefile Macros</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="98426"> </a>Select the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Macros</font></b> tab of the build specification property sheet to view the makefile macros associated with the current project, build specification, and rules (<a href="c-builder5.html#93395">Figure 4-36</a>). <div class="frame"><h4 class="EntityTitle"><a name="93395"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-36: Makefile Macros</font></a></h4><dl class="margin"><div class="CellBody"><a name="93400"> </a><img class="figure" border="0" src="images/c-buildera4.gif"></div></dl></div></p><dd><p class="Body"><a name="93402"> </a>You can use the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Macros</font></b> page to modify the values of existing makefile macros, as well as to create new rules to be executed at the end of the build. Use the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Delete</font></b> button to delete a macro from the build. To add a macro, change the name and value of an existing macro, and click the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Add/Set</font></b> button. To change an existing macro, modify the value and click the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Add/Set</font></b> button.</p><dd><p class="Body"><a name="103616"> </a>The recommended way to link library (archive) files to your project is to add the libraries to the list defined by the <b class="symbol_UC">LIBS</b> macro. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="93389">Compiler Options</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="98430"> </a>The <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">C/C++ compiler</font></b> page of the build specification property sheet displays compiler options. You can edit the options displayed in the text box (<a href="c-builder5.html#91934">Figure 4-37</a>). <div class="frame"><h4 class="EntityTitle"><a name="91934"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-37: Compiler Options</font></a></h4><dl class="margin"><div class="CellBody"><a name="91939"> </a><img class="figure" border="0" src="images/c-builder7.gif"></div></dl></div></p></dl></dl><dl class="margin"><dd><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/warning.gif"></td><td><hr><div class="CalloutCell"><a name="105000"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">WARNING: </font></b></a>The default compiler options include <b class="command">-g</b> for debugging information. Using <b class="command">-g</b> with the optimization option <b class="command">-O </b>set to anything but zero may produce unpredictable results. Selecting <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Include debug info</font></b> automatically sets optimization to zero. This can be changed by editing the option.</div></td></tr><tr valign="top"><td></td><td><hr></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -