directory order-only dependencies with trailing slash

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

directory order-only dependencies with trailing slash

J.T. Conklin
One of my developers reported that our product's build fails with GNU
make >= 3.82.

I discovered the root cause of the issue was that we had order only
prerequisites of directories with trailing slashes, but the targets
used to create those directories did not.

In our framework, these differences result from a twisted maze of $(call
...)  and $(eval ...) expansions; but this simple Makefile demonstrates
the issue:

     foo/bar: | foo/
             touch $@

             mkdir $@

With GNU make 3.81 (as distributed by Ubuntu 14.04):

     $ make --version
     GNU Make 3.81
     Copyright (C) 2006  Free Software Foundation, Inc.
     This is free software; see the source for copying conditions.
     There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

     This program built for x86_64-pc-linux-gnu

     $ make
     mkdir foo
     touch foo/bar

With GNU make 3.82 (built from source on the same system):

     $ make --version
     GNU Make 3.82
     Built for x86_64-unknown-linux-gnu
     Copyright (C) 2010  Free Software Foundation, Inc.
     License GPLv3+: GNU GPL version 3 or later <>
     This is free software: you are free to change and redistribute it.
     There is NO WARRANTY, to the extent permitted by law.

     $ make
     make: *** No rule to make target 'foo/', needed by 'foo/bar'.  Stop.

I've checked the NEWS file and did not see this listed among the
backwards-incompatible changes.

Was this change intentional?  To some extent, it doesn't matter, as I'll
need change our makefile framework to strip trailing slashes for current
GNU make versions regardless.



Help-make mailing list
[hidden email]