makefile mkdir

hi,
I am trying to create subdirectories under my ../objs directory within a make file.

my ../src directory has the following subdirectories:
source-a
source.1.1

so, I want to label the subdirectories under my ../objs directory with the same names as those in the ../src directory, so that I have:

../objs/source-a
../objs/source.1.1

I have written the following code:

SRCDIR = $(shell echo ../src/*)
OBJDIR = ../objs

subdirname :=$(notdir $(basename $(SRCDIR)))
objdirs := $(addprefix $(OBJDIR)/, $(subdirname))

all: makedir

makedir: $(objdirs)
mkdir $^

but that is not working, I get an error message as follows:
make: *** No rule to make target `../objs/source-a', needed by `makedir'. Stop.

How do I fix this?

thanks!
You need a tab before mkdir $^ (I think).
I do have a tab...it just didn't show up when I copied and pasted on the post here :-(
I don't have any local examples :(

I did find this with Google. Someone's posted exactly what you want.
http://stackoverflow.com/questions/1139271/makefiles-with-source-files-in-different-directories
thanks kbw, I appreciate the link :-)
hi kbw,
my subdirname variable above returns the following values:

source-a
source.1.1

if I wanted the second value to be source instead of source.1.1, do I need to use sed or is there a more straightforward and simple way of extracting the info.

thanks!
Topic archived. No new replies allowed.