I have a makefile that creates a normal directory creation:
$(Release_target_OBJDIR)/%.o: %.cpp mkdir -p $(dir $@) $(COMPILE.cpp) $< $(CFLAGS) $(INCLUDES) -o $@
Unfortunately, when I run this under scratchbox2, the mkdir -p command always fails.
I tried to execute the following kludge, which does not work:
$(Release_target_OBJDIR)/%.o: %.cpp mkdir $(dir $(dir $(dir $@))) mkdir $(dir $(dir $@)) mkdir $(dir $@) $(COMPILE.cpp) $< $(CFLAGS) $(INCLUDES) -o $@
It is output:
mkdir -p / home / foo / projects / htc / arm / obj / cbar / release /
mkdir -p / home / foo / projects / htc / arm / obj / cbar / release /
mkdir -p / home / foo / projects / htc / arm / obj / cbar / release /
... the trailing slash prevents the dir function from deleting the last directory the way I wanted.
Finishing up with a script or small C application to replicate the "-p" function, does anyone have any ideas for creating subdirectories in the makefile?
Without the -p option, mkdir will throw an error when the makefile tries to create a directory that already exists. I can do mkdir blah 2> / dev / null, but then I risk losing other error messages.
Does anyone have any thoughts on why mkdir -p does not work under scratchbox2?
EDIT
Based on bobbogo's suggestions, I put this together. It looks pretty confusing, but it seems to work even under scratchbox2.
# Generic variables for use in functions comma:= , empty:= space:= $(empty) $(empty)
mkdir gnu-make scratchbox
Simon elliott
source share