[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: can't always get make to auto create build directory
From: |
Paul Smith |
Subject: |
Re: can't always get make to auto create build directory |
Date: |
Wed, 29 Jun 2016 14:50:38 -0400 |
On Wed, 2016-06-29 at 14:03 -0400, LMH wrote:
> #create build directory if it doesn't exist
> $(BDIR):
> address@hidden -p $(BDIR)
>
> all: $(BDIR)/SMD2_i386.exe
Here you've created a target $(BDIR), but your "all" target depends
only on the object file $(BDIR)/SMD2_i386.exe.
Since nothing depends on the actual target $(BDIR), make will never try
to build that target.
In order for this to work you'd need to define the directory as a
prerequisite of the target which needs it, which in this case is
$(BDIR)/SMD2_i386.exe, so you'd need to write:
$(BDIR)/SMD2_i386.exe : <other prereqs> $(BDIR)
However, you should generally not have targets depend on directories,
because make treats them just like any other file when it checks
modification times; however directories do not act like normal files
when it comes to modification times.
I usually just use:
$(shell mkdir -p $(BDIR))
but other people prefer order-only prerequisites:
$(BDIR)/SMD2_i386.exe : <other prereqs> | $(BDIR)
(note the extra "|" there). Check the GNU make manual for details.
Note these are all specific to GNU make and not portable to other versions of
make.
- can't always get make to auto create build directory, LMHmedchem, 2016/06/28
- Re: can't always get make to auto create build directory, Paul Smith, 2016/06/29
- Re: can't always get make to auto create build directory, Yann Droneaud, 2016/06/29
- Re: can't always get make to auto create build directory, LMH, 2016/06/29
- Re: can't always get make to auto create build directory, Paul Smith, 2016/06/29
- Re: can't always get make to auto create build directory, Philip Guenther, 2016/06/29
- Re: can't always get make to auto create build directory, LMH, 2016/06/29
- Re: can't always get make to auto create build directory,
Paul Smith <=
- Re: can't always get make to auto create build directory, Eli Zaretskii, 2016/06/29
- Re: can't always get make to auto create build directory, LMH, 2016/06/29
- Re: can't always get make to auto create build directory, David Boyce, 2016/06/29
- Re: can't always get make to auto create build directory, Paul Smith, 2016/06/29
- Re: can't always get make to auto create build directory, David Boyce, 2016/06/29
- Re: can't always get make to auto create build directory, Tony Theodore, 2016/06/30