mozilla

Revision 78833 of Makefiles - Best practices and suggestions

  • Revision slug: How_Mozilla's_build_system_works/Makefiles_-_Best_practices_and_suggestions
  • Revision title: Makefiles - Best practices and suggestions
  • Revision id: 78833
  • Created:
  • Creator: Joey Armstrong
  • Is current revision? No
  • Comment 34 words added

Revision Content

  • Always use dependencies with targets.
    • Initial make call will always be the workhorse: build, generate, deploy, install, etc.
    • All subsequent make calls must become a NOP unless sources or dependencies change or have been removed.
  • Directory dependencies
##################################################### ## Extra dep needed to synchronize parallel execution ##################################################### $(TS): $(TS)/.done $(TS)/.done: 	$(MKDIR) -p $(dir $@) 	touch $@ 

 

  • Wrapper check/unit tests with a ENABLE_TESTS conditional so tests can be disabled on demand.
ifdef ENABLE_TESTS 
ifeq ($(NULL),$(filter WINNT OS2,$(OS_ARCH)))
DIRS += test
endif # WIN
endif # ENABLE_TESTS > >

Revision Source

<ul> <li>Always use dependencies with targets. <ul> <li>Initial make call will always be the workhorse: build, generate, deploy, install, etc.</li> <li>All subsequent make calls must become a NOP unless sources or dependencies change or have been removed.</li> </ul> </li> <li>Directory dependencies</li>
</ul>
<pre><span style="color:#008800;">##################################################### </span><span style="color:#008800;">## Extra dep needed to synchronize parallel execution </span><span style="color:#008800;">##################################################### </span><span style="color:#008800;">$(TS): $(TS)/.done </span><span style="color:#008800;">$(TS)/.done: </span><span style="color:#008800;">	$(MKDIR) -p $(dir $@) </span><span style="color:#008800;">	touch $@ </span></pre>
<p> </p>
<ul> <li>Wrapper check/unit tests with a ENABLE_TESTS conditional so tests can be disabled on demand.</li>
</ul>
<pre class="bz_comment_text" id="comment_text_6"><span class="quote">ifdef ENABLE_TESTS <br>    ifeq ($(NULL),$(filter WINNT OS2,$(OS_ARCH)))<br>        DIRS += test <br>    endif # WIN<br>endif # ENABLE_TESTS &gt; &gt; </span>
</pre>
Revert to this revision