I’m trying to create a target which matches multiple directories, but no files. Is there any way to flag the target explicitly as being a directory?
For example:
output/%:
mkdir -p $@
matches files as well, which is definitely not something I want.
Basically, I have many variables which contain directory names which need to be created if they don’t exist, and the best way to do that, as far as I’ve found is this:
all: directories other_stuff
directories: $(dir1) $(dir2) ...
$(dir1):
mkdir -p $@
$(dir2):
mkdir -p $@
...
So, I’m OK with repeating the directory variables as dependencies for the directories target, but creating targets for each directory I add seems overkill and hard to maintain.
Here is one possibility:
See http://www.gnu.org/software/make/manual/make.html#Multiple-Targets.