mozilla

Compare Revisions

Makefiles - Best practices and suggestions

Change Revisions

Revision 78843:

Revision 78843 by Joey Armstrong on

Revision 371675:

Revision 371675 by lahabana on

Title:
Makefiles - Best practices and suggestions
Makefiles - Best practices and suggestions
Slug:
How_Mozilla's_build_system_works/Makefiles_-_Best_practices_and_suggestions
How_Mozilla's_build_system_works/Makefiles_-_Best_practices_and_suggestions
Tags:
makefile
"makefile", "Best practices"
Content:

Revision 78843
Revision 371675
n54<span style="color:#008800;"># Transient directory for storing tin54<span style="color:#008800;"># Transient directory for storing ti
>mestamps<br>TS=.ts<br><br>#######################################>mestamps
>##############<br></span><span style="color:#008800;">## Extra de 
>p needed to synchronize parallel execution<br></span><span style= 
>"color:#008800;">################################################ 
>#####<br></span><span style="color:#008800;">$(TS): $(TS)/.done<b 
>r></span><span style="color:#008800;">$(TS)/.done:<br>  </span><s 
>pan style="color:#008800;">$(MKDIR) -p $(dir $@)<br>  </span><spa 
>n style="color:#008800;">touch $@ <br><br>#  "clean" target<br>GA 
>RBAGE_DIRS += $(TS)</span> 
55TS=.ts
56 
57#####################################################
58</span><span style="color:#008800;">## Extra dep needed to synchr
 >onize parallel execution
59</span><span style="color:#008800;">#############################
 >########################
60</span><span style="color:#008800;">$(TS): $(TS)/.done
61</span><span style="color:#008800;">$(TS)/.done:
62  </span><span style="color:#008800;">$(MKDIR) -p $(dir $@)
63  </span><span style="color:#008800;">touch $@ 
64 
65#  "clean" target
66GARBAGE_DIRS += $(TS)</span>
n61<span style="color: rgb(51, 153, 51);">targets = foo bar tans<br>n73<span style="color: rgb(51, 153, 51);">targets = foo bar tans
>timestampDIR = .ts<br><br>all: $(timestampDIR) $(targets)<br><br> 
>%: %.c<br>    $(CC) -o $@ $&lt;<br><br>$(timestampDIR):<br>    $( 
>MKDIR) $@<br><br># "clean" target<br>GARBAGE += $(targets)<br>GAR 
>BAGE_DIRS += $(timestampDIR)</span> 
74timestampDIR = .ts
75 
76all: $(timestampDIR) $(targets)
77 
78%: %.c
79    $(CC) -o $@ $&lt;
80 
81$(timestampDIR):
82    $(MKDIR) $@
83 
84# "clean" target
85GARBAGE += $(targets)
86GARBAGE_DIRS += $(timestampDIR)</span>
t68<span style="color: rgb(51, 153, 51);"><span class="quote">ifdef t93<span style="color: rgb(51, 153, 51);"><span class="quote">ifdef 
>ENABLE_TESTS <br>    ifeq ($(NULL),$(filter WINNT OS2,$(OS_ARCH))>ENABLE_TESTS 
>)<br>        DIRS += test <br>    endif # WIN<br>endif # ENABLE_T 
>ESTS</span></span> 
94    ifeq ($(NULL),$(filter WINNT OS2,$(OS_ARCH)))
95        DIRS += test 
96    endif # WIN
97endif # ENABLE_TESTS</span></span>

Back to History