[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Automake-NG] [PATCH] [ng] dirstamp: remove, use inlined parent dire
From: |
Akim Demaille |
Subject: |
Re: [Automake-NG] [PATCH] [ng] dirstamp: remove, use inlined parent directory creation instead |
Date: |
Fri, 25 May 2012 09:58:25 +0200 |
Le 21 mai 2012 à 16:19, Stefano Lattarini a écrit :
> As a first step, instead of emitting rules like:
>
> sub/foo.o: sub/foo.c sub/.dirstamp
> $(CC) $(CFLAGS) sub/foo.c
> sub/.dirstamp:
> mkdir sub && touch sub/.dirstamp
>
> we might simply emit rules like:
>
> sub/foo.o: sub/foo.c
> $(MKDIR_P) $(@D)
> $(CC) $(CFLAGS) sub/foo.c
>
> But the above would be quite wasteful if we really called $(MKDIR_P) for
> every created object file, since the directory $(@D) will likely already
> exist (in an in-tree build, it will exist unconditionally and beforehand,
> and in a VPATH build will exists after the first object file in it has
> been created).
Maybe order-only prerequisites can help here?
address@hidden /tmp $ cat Makefile
all: foo/bar
foo/bar: | foo
echo $@ >$@
foo:
mkdir $@
address@hidden /tmp $ make
mkdir foo
echo foo/bar >foo/bar
address@hidden /tmp $ make
make: Nothing to be done for `all'.
address@hidden /tmp $ rm foo/bar
address@hidden /tmp $ make
echo foo/bar >foo/bar
address@hidden /tmp $ make
make: Nothing to be done for `all'.