I have a C++ small project using GNU Make. I\'d like to be able to turn the following source files:
src/
a.cpp
b/
b.cpp
c/
c.cpp
This is for Win32 mingw32-make. it's works. The most important part is
-mkdir $(patsubst %/,%,$(dir $@))
for win32. We need to strip the trailling / for win32.
GENERATED_DIRS = a b
# Dependency generator function
mkdir_deps =$(foreach dir,$(GENERATED_DIRS),$(dir)/.mkdir.done)
# Target rule to create the generated dependency.
# And create the .mkdir.done file for stop continuous recreate the dir
%/.mkdir.done: # target rule
-mkdir $(patsubst %/,%,$(dir $@))
echo $(patsubst %/,%,$(dir $@)) >$@
all: $(mkdir_deps)
@echo Begin
clean:
@echo Cleaning