help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exception to Paul's Second Rule?


From: Benoit Poulot-Cazajous
Subject: Re: exception to Paul's Second Rule?
Date: 24 Oct 2003 00:22:37 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Noel Yap <address@hidden> writes:

> I've created the following rule:
> 
> .PRECIOUS: %/../...
> %/../...:
>       @mkdir -p $(dir $(patsubst %/,%,$(dir $(@D))))  &&  : >> $(dir 
> $(patsubst %/,%,$(dir $(@D))))$(@F)
> 
> which lets me do stuff like:
> 
> %.o: %.c %.o/../...
> 
> %.d: %.c %.d/../...
> 
> so that parent directories are automatically created.

You can also use something like this :

.PRECIOUS: %/.
%/.:; mkdir -p $@

$(OBJDIR)/%.o: %.c | $(OBJDIR)/.
        ...

or something like this :

.PRECIOUS: %/.
%/.:; mkdir -p $@

DIRSTOCREATE = some dirs to/create
.SECONDARY .PHONY: mkalldirs
mkalldirs: | $(DIRSTOCREATE:%=%/.)
%.o: %.c mkalldirs
        ...

  -- Benoit




reply via email to

[Prev in Thread] Current Thread [Next in Thread]