Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html

Issue 241753002: NaClSDK: Fix LINK+STRIP make rules to only apply to Release or PNaCl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comment Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | native_client_sdk/src/doc/devguide/tutorial/tutorial-part2.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {{+bindTo:partials.standard_nacl_article}} 1 {{+bindTo:partials.standard_nacl_article}}
2 2
3 <section id="c-tutorial-getting-started-part-2"> 3 <section id="c-tutorial-getting-started-part-2">
4 <span id="tutorial2"></span><h1 id="c-tutorial-getting-started-part-2"><span id= "tutorial2"></span>C++ Tutorial: Getting Started (Part 2)</h1> 4 <span id="tutorial2"></span><h1 id="c-tutorial-getting-started-part-2"><span id= "tutorial2"></span>C++ Tutorial: Getting Started (Part 2)</h1>
5 <div class="contents local" id="contents" style="display: none"> 5 <div class="contents local" id="contents" style="display: none">
6 <ul class="small-gap"> 6 <ul class="small-gap">
7 <li><a class="reference internal" href="#overview" id="id1">Overview</a></li> 7 <li><a class="reference internal" href="#overview" id="id1">Overview</a></li>
8 <li><p class="first"><a class="reference internal" href="#using-the-native-clien t-sdk-build-system" id="id2">Using the Native Client SDK build system</a></p> 8 <li><p class="first"><a class="reference internal" href="#using-the-native-clien t-sdk-build-system" id="id2">Using the Native Client SDK build system</a></p>
9 <ul class="small-gap"> 9 <ul class="small-gap">
10 <li><a class="reference internal" href="#simplifying-the-makefile" id="id3">Simp lifying the Makefile</a></li> 10 <li><a class="reference internal" href="#simplifying-the-makefile" id="id3">Simp lifying the Makefile</a></li>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 TARGET = part2 69 TARGET = part2
70 LIBS = ppapi_cpp ppapi 70 LIBS = ppapi_cpp ppapi
71 71
72 CFLAGS = -Wall 72 CFLAGS = -Wall
73 SOURCES = hello_tutorial.cc 73 SOURCES = hello_tutorial.cc
74 74
75 # Build rules generated by macros from common.mk: 75 # Build rules generated by macros from common.mk:
76 76
77 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) 77 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
78 78
79 ifeq ($(CONFIG),Release) 79 # The PNaCl workflow uses both an unstripped and finalized/stripped binary.
80 # On NaCl, only produce a stripped binary for Release configs (not Debug).
81 ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG))))
80 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) 82 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
81 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) 83 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
82 else 84 else
83 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) 85 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
84 endif 86 endif
85 87
86 $(eval $(call NMF_RULE,$(TARGET),)) 88 $(eval $(call NMF_RULE,$(TARGET),))
87 </pre> 89 </pre>
88 </section><section id="choosing-valid-toolchains-and-including-common-mk"> 90 </section><section id="choosing-valid-toolchains-and-including-common-mk">
89 <h3 id="choosing-valid-toolchains-and-including-common-mk">Choosing valid toolch ains, and including common.mk</h3> 91 <h3 id="choosing-valid-toolchains-and-including-common-mk">Choosing valid toolch ains, and including common.mk</h3>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 baz.cc \ 163 baz.cc \
162 quux.cc 164 quux.cc
163 </pre> 165 </pre>
164 </section><section id="build-macros"> 166 </section><section id="build-macros">
165 <h3 id="build-macros">Build macros</h3> 167 <h3 id="build-macros">Build macros</h3>
166 <p>For many projects, the following build macros do not need to be changed; they 168 <p>For many projects, the following build macros do not need to be changed; they
167 will use the variables we&#8217;ve defined above.</p> 169 will use the variables we&#8217;ve defined above.</p>
168 <pre class="prettyprint"> 170 <pre class="prettyprint">
169 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) 171 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
170 172
171 ifeq ($(CONFIG),Release) 173 ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG))))
172 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) 174 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
173 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) 175 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
174 else 176 else
175 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) 177 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
176 endif 178 endif
177 179
178 $(eval $(call NMF_RULE,$(TARGET),)) 180 $(eval $(call NMF_RULE,$(TARGET),))
179 </pre> 181 </pre>
180 <p>The first line defines rules to compile each source in <code>SOURCES</code>, using the 182 <p>The first line defines rules to compile each source in <code>SOURCES</code>, using the
181 flags in <code>CFLAGS</code>:</p> 183 flags in <code>CFLAGS</code>:</p>
182 <pre class="prettyprint"> 184 <pre class="prettyprint">
183 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) 185 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
184 </pre> 186 </pre>
185 <p>The next six lines define rules to link the object files into one or more 187 <p>The next six lines define rules to link the object files into one or more
186 executables. When <code>TOOLCHAIN</code> is <code>pnacl</code>, there is only on e executable 188 executables. When <code>TOOLCHAIN</code> is <code>pnacl</code>, there is only on e executable
187 generated: in the example above, <code>part2.pexe</code>. When using a NaCl tool chain, 189 generated: in the example above, <code>part2.pexe</code>. When using a NaCl tool chain,
188 there will be three executables generated, one for each architecture: in the 190 there will be three executables generated, one for each architecture: in the
189 example above, <code>part2_arm.nexe</code>, <code>part2_x86_32.nexe</code> and 191 example above, <code>part2_arm.nexe</code>, <code>part2_x86_32.nexe</code> and
190 <code>part2_x86_64.nexe</code>.</p> 192 <code>part2_x86_64.nexe</code>.</p>
191 <p>When <code>CONFIG</code> is <code>Release</code>, each executable is also str ipped to remove 193 <p>When <code>CONFIG</code> is <code>Release</code>, each executable is also str ipped to remove
192 debug information and reduce the file size:</p> 194 debug information and reduce the file size. Otherwise, when the <code>TOOLCHAIN< /code>
195 is <code>pnacl</code>, the workflow involves creating an unstripped binary for d ebugging
196 and then finalizing it and stripping it for publishing.</p>
193 <pre class="prettyprint"> 197 <pre class="prettyprint">
194 ifeq ($(CONFIG),Release) 198 ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG))))
195 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) 199 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
196 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) 200 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
197 else 201 else
198 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) 202 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
199 endif 203 endif
200 </pre> 204 </pre>
201 <p>Finally, the NMF rule generates a NaCl manifest file (<code>.nmf</code>) that references 205 <p>Finally, the NMF rule generates a NaCl manifest file (<code>.nmf</code>) that references
202 each executable generated in the previous step:</p> 206 each executable generated in the previous step:</p>
203 <pre class="prettyprint"> 207 <pre class="prettyprint">
204 $(eval $(call NMF_RULE,$(TARGET),)) 208 $(eval $(call NMF_RULE,$(TARGET),))
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // This function is called by common.js when a message is received from the 434 // This function is called by common.js when a message is received from the
431 // NaCl module. 435 // NaCl module.
432 function handleMessage(message) { 436 function handleMessage(message) {
433 var logEl = document.getElementById('log'); 437 var logEl = document.getElementById('log');
434 logEl.textContent += message.data; 438 logEl.textContent += message.data;
435 } 439 }
436 </pre> 440 </pre>
437 </section></section> 441 </section></section>
438 442
439 {{/partials.standard_nacl_article}} 443 {{/partials.standard_nacl_article}}
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/doc/devguide/tutorial/tutorial-part2.rst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698