[PATCH 1/1] build: remove trailing '/.' when doing mkdir -p .deps/.

Jed Brown jed at 59A2.org
Sun Nov 3 07:35:03 PST 2013


Tomi Ollila <tomi.ollila at iki.fi> writes:

>  %.o: %.cc $(global_deps)
> -	@mkdir -p .deps/$(@D)
> +	@mkdir -p $(patsubst %/.,%,.deps/$(@D))
>  	$(call quiet,CXX $(CPPFLAGS) $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d

An alternative approach is to use directory marker files [1] to clean up
the recipes that need output directories and to satisfy Paul's second
rule of makefiles [2].

.SECONDEXPANSION:

%.o: %.cc $(global_deps) | .deps/$$(@D)/.DIR
	$(call quiet,CXX $(CPPFLAGS) $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d

%/.DIR:
	@mkdir -p $(patsubst %/.,%,$(@D))
	@touch $@

.PRECIOUS: %.DIR



[1] http://www.cmcrossroads.com/article/making-directories-gnu-make
[2] http://make.paulandlesley.org/rules.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20131103/6cd2f078/attachment.pgp>


More information about the notmuch mailing list