[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to create a single rule to build a directory as necessary
From: |
Paul Smith |
Subject: |
Re: how to create a single rule to build a directory as necessary |
Date: |
Tue, 22 Sep 2009 15:42:03 -0400 |
On Tue, 2009-09-22 at 11:29 -0700, Derek Clegg wrote:
> I always use order-only prerequisites for directories. For example,
>
> bar/foo.o: foo.c | bar
> cc -o $@ -c $<
>
> bar:
> mkdir -p $@
Yes, this works well. The downside is that EVERY target that needs to
use that directory has to have the order-only prereq defined, which is
kind of a PITA if you have lots of targets for that directory. Of
course if you build with just one or a few pattern rules, not a problem.
Generally I just don't even worry about it, and force all the
directories to be created up-front:
_dummy := $(shell mkdir -p $(SUBDIRS))
this means that just invoking make, even without running any rules, will
cause all the directories to be created, while the OO prereq, etc.,
solutions will only create directories that are going to be needed.
But, most of the time I don't create directories I won't need, and even
if so it doesn't bother me to have some extra empty directories lying
around.
YMMV.
- Re: how to create a single rule to build a directory as necessary, (continued)
- Re: how to create a single rule to build a directory as necessary, Philip Guenther, 2009/09/22
- Re: how to create a single rule to build a directory as necessary, Paul Smith, 2009/09/22
- Re: how to create a single rule to build a directory as necessary, Sam Steingold, 2009/09/22
- Re: how to create a single rule to build a directory as necessary, Mihai Draghicioiu, 2009/09/22
- Re: how to create a single rule to build a directory as necessary, Paul Smith, 2009/09/22
- Re: how to create a single rule to build a directory as necessary, Paul Smith, 2009/09/22
- Re: how to create a single rule to build a directory as necessary, Sam Steingold, 2009/09/22
- Re: how to create a single rule to build a directory as necessary, Mark Marshall, 2009/09/23
Re: how to create a single rule to build a directory as necessary, Kristof Provost, 2009/09/22