can't always get make to auto create build directory

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

can't always get make to auto create build directory

LMHmedchem
Hello,

I have a make file that gathers some local information and uses it (in theory) to create a locally named build directory if it doesn't exist.

SOURCELOC = ./src

# get version of g++
CMP := $(shell g++ --version | cut -d ' ' -f 3 | sed q)
CMP := gcc-$(CMP)

# create build location name
OS   := $(shell uname -s)
ARCH := $(shell uname -m)
KERN := $(shell uname -r | cut -d. -f 1,2)
BDIR := bld_$(OS)_$(KERN).$(ARCH)_$(CMP)

#test print
$(info OS is  : $(OS))
$(info BDIR is: $(BDIR))

# create build directory if it doesn't exist
$(BDIR):
	@mkdir -p $(BDIR)

The test print code prints what I would expect,
OS is  : CYGWIN_NT-5.1
BDIR is: bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3

When I run this from "make -f makefile al" I get an error,

Assembler messages:
Fatal error: can't create bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o: No such file or directory
MAKE_SMD1.mak:73: recipe for target 'bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o' failed
make: *** [bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o] Error 1

If I manually create the build directory, bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3, the compiler continues and creates the first object, main.o. I have had this issue off and on and can't seem to identify where the problem is. In some cases, the directory doesn't get created and in others it does. I use the same syntax for mkdir in every make file, so I'm not sure where I am going wrong. It's not the end of the world to have to manually create a directory but I am trying to set up some of this to be automated based on whatever system I am booted into. The "@ mkdir" statement is indented with a tab if that isn't clear with this formatting.

For now, I have replaced the make command,
# create build directory if it doesn't exist
$(BDIR):
	@mkdir -p $(BDIR)

with some shell commands,
# run ls to determine if build directory exists
EXISTS := $(shell ls -d $(BDIR))
# if the output of ls is empty, create directory
ifeq "$(EXISTS)" ""
   $(shell mkdir $(BDIR))
endif

This seems to work. The code creates the directory when it is not present and does nothing when it is. There are no error messages to deal with.

I would prefer to get this working with make commands instead of going to the shell but I do need to get this working with some solution. Can anyone point out why my make commands fail to create the directory when it doesn't exist? Is the shell method above a reasonable solution, meaning will it likely work on most platforms?

Suggestions would be appreciated.

LMHmedchem
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

Paul Smith-20
On Tue, 2016-06-28 at 09:08 -0700, LMHmedchem wrote:
> When I run this from "make -f makefile al" I get an error,

Well.  You could give us SOME information.  Without knowing (a) what
error you get, (b) what your makefile rule looks like, (c) how you're
invoking make, or even (d) what version of make you're using, there's
nothing we can say.

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

Yann Droneaud
In reply to this post by LMHmedchem
Hi,

Le mardi 28 juin 2016 à 09:08 -0700, LMHmedchem a écrit :

> View this message in context: http://gnu-make.2324884.n4.nabble.com/c
> an-t-always-get-make-to-auto-create-build-directory-tp17226.html
> Sent from the Gnu - Make - Help mailing list archive at Nabble.com.
>

Please use an email client (MUA) that doesn't munge the content of your
mail: you should not expect people to go read your complete message
through a web browser.

Regards.

-- 
Yann Droneaud
OPTEYA


_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

LMHmedchem
In reply to this post by Paul Smith-20
Paul Smith wrote:
> On Tue, 2016-06-28 at 09:08 -0700, LMHmedchem wrote:
>> When I run this from "make -f makefile al" I get an error,
>
> Well.  You could give us SOME information.  Without knowing (a) what
> error you get, (b) what your makefile rule looks like, (c) how you're
> invoking make, or even (d) what version of make you're using, there's
> nothing we can say.
>

Well when I first read this response, I was wondering what you had been smoking at
9:00 in the morning. Everything that you ask about was included in my post. I made
the post at nabble.com, here is the link for the post.

http://gnu-make.2324884.n4.nabble.com/can-t-always-get-make-to-auto-create-build-directory-td17226.html

Looking at the version of the post I got from email, everything I had posted in
[code] tags has been omitted from the post, which is not entirely helpful for a
programming forum. I have no idea why this happened. I can, of course, include a copy
of the makefile if the information I provided in the post above is not sufficient,
just let me know.

Thanks for taking the time to look at this,

LMH

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

LMHmedchem
In reply to this post by Yann Droneaud
Yann Droneaud wrote:

> Hi,
>
> Le mardi 28 juin 2016 à 09:08 -0700, LMHmedchem a écrit :
>>
>> View this message in context: http://gnu-make.2324884.n4.nabble.com/c
>> an-t-always-get-make-to-auto-create-build-directory-tp17226.html
>> Sent from the Gnu - Make - Help mailing list archive at Nabble.com.
>>
>
> Please use an email client (MUA) that doesn't munge the content of your
> mail: you should not expect people to go read your complete message
> through a web browser.
>
> Regards.
>
> --
> Yann Droneaud
> OPTEYA
>

I posted this topic at,

http://gnu-make.2324884.n4.nabble.com
http://gnu-make.2324884.n4.nabble.com/can-t-always-get-make-to-auto-create-build-directory-tp17226.html

because that is the site that was returned by my search on "gnu make help forum".
Like other programming forums I have posted in, I wrapped the text from my make file
and the output from my shell in [code] tags, as is usually requested on programming
forums. When I post a message to a forum from a browser, I generally expect that it
will be viewed and responded to in a browser. Is this not how internet help forums
typically work?

Apparently the forum I posted to forwards posts to a mailing list. For some reason,
everything I wrapped in code tags was omitted from the message on the mailing list. I
don't know where in the process this happened. It doesn't make much sense for nabble
to support formatting in their interface that is not supported by the mailing lists
that they send to, but I guess that is what happened.

I can re-send the message as a plain text email if users really don't want to go to
nabble.com to see what I posted. Is nabble not considered a safe site?

LMH






_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

Paul Smith-20
On Wed, 2016-06-29 at 12:41 -0400, LMH wrote:
> Apparently the forum I posted to forwards posts to a mailing list.

The GNU/FSF mailing lists have existed since the 1990's.  In that time
various external sites have come along and begun mirroring the mailing
lists, and some of them also provide the ability to post back to the
list.  We aren't involved with this.  If you have an issue with how
they do it, you should bring it up with them.

The mot reliable way to ask questions is to send directly to the
mailing lists, using text-mode rather than HTML.

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

Philip Guenther-2
On Wed, Jun 29, 2016 at 10:48 AM, Paul Smith <[hidden email]> wrote:
> On Wed, 2016-06-29 at 12:41 -0400, LMH wrote:
>> Apparently the forum I posted to forwards posts to a mailing list.
>
> The GNU/FSF mailing lists have existed since the 1990's.  In that time
> various external sites have come along and begun mirroring the mailing
> lists, and some of them also provide the ability to post back to the
> list.  We aren't involved with this.  If you have an issue with how
> they do it, you should bring it up with them.

Maybe they *want* to pay for support by spending their attention on
the advertising that these webforums put in front of them?  "If you
aren't the customer then you're the product being sold to
advertisers."


Phlip Guenther

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

LMHmedchem
In reply to this post by Paul Smith-20
Paul Smith wrote:
> On Wed, 2016-06-29 at 12:41 -0400, LMH wrote:
>> Apparently the forum I posted to forwards posts to a mailing list.
>
> The GNU/FSF mailing lists have existed since the 1990's.  In that time
> various external sites have come along and begun mirroring the mailing
> lists, and some of them also provide the ability to post back to the
> list.  We aren't involved with this.  If you have an issue with how
> they do it, you should bring it up with them.

I don't generally have an issue with anyone who is trying to be helpful, though the
nabble methodology seems to leave a bit to be desired in this case. It's just as easy
to post directly to the mailing list if that is preferable.

> The mot reliable way to ask questions is to send directly to the
> mailing lists, using text-mode rather than HTML.

I also never read email in HTML as it can be a considerable security risk. It is nice
to have code tags to preserve indents and such but in the case of a make file, that
should not be an issue. I just didn't realize that I was composing email.

Below is the text of my original post as I expected it would appear. Please let me
know if there are any questions or if I need to post any additional information.

Note:
I have added the line for my "all" target as it was left out of my earlier post.

LMH



Hello,

I have a make file that gathers some local information and uses it (in theory) to
create a locally named build directory if it doesn't exist.

SOURCELOC = ./src

# get version of g++
CMP := $(shell g++ --version | cut -d ' ' -f 3 | sed q)
CMP := gcc-$(CMP)

# create build location name
OS   := $(shell uname -s)
ARCH := $(shell uname -m)
KERN := $(shell uname -r | cut -d. -f 1,2)
BDIR := bld_$(OS)_$(KERN).$(ARCH)_$(CMP)

#test print
$(info OS is  : $(OS))
$(info BDIR is: $(BDIR))

# create build directory if it doesn't exist
$(BDIR):
        @mkdir -p $(BDIR)

all: $(BDIR)/SMD2_i386.exe


The test print code prints what I would expect,

OS is  : CYGWIN_NT-5.1
BDIR is: bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3


When I run this from "make -f makefile all" I get an error,

Assembler messages:
Fatal error: can't create bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o: No such file
or directory
MAKE_SMD1.mak:73: recipe for target 'bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o' failed
make: *** [bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o] Error 1


If I manually create the build directory, bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3, the
compiler continues and creates the first object, main.o. I have had this issue off
and on and can't seem to identify where the problem is. In some cases, the directory
doesn't get created and in others it does. I use the same syntax for mkdir in every
make file, so I'm not sure where I am going wrong. It's not the end of the world to
have to manually create a directory but I am trying to set up some of this to be
automated based on whatever system I am booted into. The "@ mkdir" statement is
indented with a tab if that isn't clear with this formatting.

For now, I have replaced the make command,

# create build directory if it doesn't exist
$(BDIR):
        @mkdir -p $(BDIR)


with some shell commands,

# run ls to determine if build directory exists
EXISTS := $(shell ls -d $(BDIR))
# if the output of ls is empty, create directory
ifeq "$(EXISTS)" ""
    $(shell mkdir $(BDIR))
endif


This seems to work. The code creates the directory when it is not present and does
nothing when it is. There are no error messages to deal with.

I would prefer to get this working with make commands instead of going to the shell
but I do need to get this working with some solution. Can anyone point out why my
make commands fail to create the directory when it doesn't exist? Is the shell method
above a reasonable solution, meaning will it likely work on most platforms?

Suggestions would be appreciated.


_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

Paul Smith-20
On Wed, 2016-06-29 at 14:03 -0400, LMH wrote:
> #create build directory if it doesn't exist
> $(BDIR):
>         @mkdir -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.

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

Eli Zaretskii
> From: Paul Smith <[hidden email]>
> Date: Wed, 29 Jun 2016 14:50:38 -0400
>
> directories do not act like normal files when it comes to
> modification times.

They do on MS-Windows.

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

LMHmedchem
In reply to this post by Paul Smith-20
Paul Smith wrote:

> On Wed, 2016-06-29 at 14:03 -0400, LMH wrote:
>> #create build directory if it doesn't exist
>> $(BDIR):
>>          @mkdir -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.
>


Going back through older versions of some of my makefiles, I find that I used to have
an "archdir" target defined along with the code to create the build directory.


archdir: ${BDIR}
${BDIR}:
        @mkdir -p $(BDIR)


The archdir target was included in the all target like,


all: archdir $(BDIR)/SMD2_i386.exe


Somewhere along the line, this archdir target seems to have been left out and I guess
this is where I started having problems in cases where the build directory didn't
already exist. The build directory likely did exist in many cases, so I probably
didn't notice right away or thought it was a problem esoteric to the OS I was booted
into.

If you don't mind my asking, how does the above "archdir" solution compare with what
you suggested as far as defining $(BDIR) as a prerequisite for $(BDIR)/SMD2_i386.exe?
Is there any difference?

Your shell solution is simpler than mine in that it doesn't need to actually check if
the directory exists and just suppresses the error message if it does. I am wondering
if there is any value to actually making the check, but I can't think of any off hand.

LMH





_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

David Boyce
The problem with the $(shell mkdir -p) solution is that it creates the
directory in all cases, notably "make -n" and "make clean". Not exactly
elegant. It's also a wasted process when the directory already exists, it's
mysterious (i.e. you do not see the directory being created) when it didn't
previously exist, and it will not abort the build on failure.

Directory creation within make turns out to be a surprisingly complex
topic, especially in parallel-build scenarios. I've done a good bit of
analysis and tried every technique and the only way I've found to be
completely robust is the order-only prerequisite. Paul's solution is also
parallel-safe if you can accept the problems noted above.

The primary complexity of mkdir within make is when the mkdir -p flag is
used because it causes a race to create the interior (parent) directories
in parallel builds[*]. Below I contribute a recursive make macro, within a
sample makefile, which solves this problem. It's the safest/most portable
method of directory creation I know.

[*] GNU mkdir contains code to address the race condition with a retry but
that's neither elegant nor portable.

-David

% cat Makefile
# The purpose of this macro is to avoid the need for full directory
# paths to be created via mkdir -p, since mkdir -p has an inherent
# race in parallel use cases. Interestingly, though it exists to
# make -p unnecessary, it actually uses -p. Why is that? It's to
# take advantage of a useful side effect of -p which is that it
# doesn't complain if the directory already exists. In other words
# it creates directories one at a time to avoid creating its *own*
# race but still uses mkdir -p to protect itself against races with
# unrelated processes.
# Usage: $(call target_needs_dir,<target>,<dir-path>)
define target_needs_dir
$(eval
$$1: | $$2
$$2: | $$(filter-out .,$$(patsubst %/,%,$$(dir $$2))); mkdir -p $$@
ifneq (,$$(findstring /,$$2))
  $$(call target_needs_dir,$$1,$$(patsubst %/,%,$$(dir $$2)))
endif
)
endef

$(call target_needs_dir,all,foo/bar/baz)
.PHONY: all
all:
ls -ld foo/bar/baz

.PHONY: clean
clean:
$(RM) -r foo

% make
mkdir -p foo
mkdir -p foo/bar
mkdir -p foo/bar/baz
ls -ld foo/bar/baz
drwxrwxr-x 2 dsb users 4096 Jun 29 21:11 foo/bar/baz

On Wed, Jun 29, 2016 at 5:34 PM, LMH <[hidden email]> wrote:

> Paul Smith wrote:
>
>> On Wed, 2016-06-29 at 14:03 -0400, LMH wrote:
>>
>>> #create build directory if it doesn't exist
>>> $(BDIR):
>>>          @mkdir -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.
>>
>>
>
> Going back through older versions of some of my makefiles, I find that I
> used to have an "archdir" target defined along with the code to create the
> build directory.
>
>
> archdir: ${BDIR}
> ${BDIR}:
>         @mkdir -p $(BDIR)
>
>
> The archdir target was included in the all target like,
>
>
> all: archdir $(BDIR)/SMD2_i386.exe
>
>
> Somewhere along the line, this archdir target seems to have been left out
> and I guess this is where I started having problems in cases where the
> build directory didn't already exist. The build directory likely did exist
> in many cases, so I probably didn't notice right away or thought it was a
> problem esoteric to the OS I was booted into.
>
> If you don't mind my asking, how does the above "archdir" solution compare
> with what you suggested as far as defining $(BDIR) as a prerequisite for
> $(BDIR)/SMD2_i386.exe? Is there any difference?
>
> Your shell solution is simpler than mine in that it doesn't need to
> actually check if the directory exists and just suppresses the error
> message if it does. I am wondering if there is any value to actually making
> the check, but I can't think of any off hand.
>
> LMH
>
>
>
>
>
>
> _______________________________________________
> Help-make mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-make
>
_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

Paul Smith-20
In reply to this post by LMHmedchem
On Wed, 2016-06-29 at 20:34 -0400, LMH wrote:
> If you don't mind my asking, how does the above "archdir" solution
> compare with what you suggested as far as defining $(BDIR) as a
> prerequisite for $(BDIR)/SMD2_i386.exe? 
> Is there any difference?

It's not good enough to list archdir as a prerequisite of the "all"
target, if you want to use parallel builds and make it reliable.

Make is free to build any targets which don't have a prerequisite
relationship with each other simultaneously.  So for:

  all: $(archdir) $(BDIR)/SMD2_i386.exe

make can invoke the recipes of both the archdir and the SMD2_i386.exe
targets at the same time.  Depending on which order the OS decided to
run them in or other factors, it's possible (although probably
unlikely), that the latter would try to use the archdir directory
before the former created it.

If you want to use real targets to create the directories, then you
must ensure that every target that expects to have the directory
already created, must list that directory target as a prerequisite.

> Your shell solution is simpler than mine in that it doesn't need to
> actually check if the directory exists and just suppresses the error
> message if it does. I am wondering if there is any value to actually
> making the check, but I can't think of any off hand.

Not only is there no value in it, it's actually LESS robust to make the
check because between the time make checks for the directory and the
time it runs "mkdir", some other program could have created it.  Since
you don't really care whether the directory existed before or not, you
just want to be sure it exists afterwards, you should use "mkdir -p"
(that's why it was created).

The downside of using a shell function as I did is that, since it's run
whenever make parses the makefile not when rules are invoked, the
directory will be created every time make is invoked, even if no target
actually needs to put a file in that directory.

The upside is you don't need to list the directory is a prerequisite of
every target since it's always created, so the implementation is
simpler.

So it's up to you.

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

David Boyce
On Wed, Jun 29, 2016 at 7:53 PM, Paul Smith <[hidden email]> wrote:

> Not only is there no value in it, it's actually LESS robust to make the
> check because between the time make checks for the directory and the
> time it runs "mkdir", some other program could have created it.


To be painfully precise, the same race condition exists with and without
the explicit check because mkdir -p does the same check+create internally.
The only difference is the width of the race window; internally to mkdir
the window is between two system calls (stat() and mkdir()) whereas with
the explicit check there's a fork/exec interposed which is much wider.
There's always a race when mkdir -p is used.

-David
_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: can't always get make to auto create build directory

Tony Theodore
In reply to this post by Paul Smith-20

> On 30 Jun 2016, at 04:50, Paul Smith <[hidden email]> wrote:
>
> 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.

We use a dummy file as an order-only prerequisite that plays nicely
with -j, -n, and -t options and recursive invocation:

%/.keep:
        +@mkdir -p '$(dir $@)'
        @touch '$@‘

Cheers,

Tony


_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make