help-make
[Top][All Lists]
Advanced

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

Re: make -B and the order-only prerequisites


From: Philip Guenther
Subject: Re: make -B and the order-only prerequisites
Date: Mon, 30 Apr 2012 17:55:15 -0700

On Mon, Apr 30, 2012 at 3:27 PM, John Gamboa <address@hidden> wrote:
> obj:
>        mkdir obj
> bin:
>        mkdir bin
...
>  When I run this make file for the first time, it works perfectly: before
> creating the bin/pseh file, it calls the "bin" rule (i.e., creates the bin
> directory); and before creating the obj/foo file, it calls the "obj" rule
> (and creates the obj directory). The problem is: when I run "make -B", make
> tries to call "obj" and "bin", and mkdir returns and error, that causes
> make to stop.

Is this a trick question?  How about having the command in the rule
only create the directory if it doesn't exist?

DIRS = obj bin
$(DIRS):
        test -d $@ || mkdir $@


Philip Guenther



reply via email to

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