Hi all...
I've got a makefile fragment below that I just can't figure out why it
doesn't behave like I'd expect.. Perhaps someone can shed some light on
what I'm doing wrong -- I'm using GNU Make 3.81 if that matters
In one area of the Makefile, I define the following which basically says
that there are some test stubs located elsewhere (not in the current
directory) and I'd like to have them compiled locally...
====================================================
TESTSTUB_SOURCES := \
${TOP_DIR}/teststubs/src/foo.cc \
${TOP_DIR}/teststubs/src/bar.cc
====================================================
Elsewhere later in the Makefile, I define the following and
when "all" is the target, it should invoke the "build_teststubs"
rule which it does.. However, in the build_teststubs rule, I'd
expect that for each file listed in TESTSTUB_SOURCES, I'd get a
"ln -s <filename> ." executed. See further comments below..
====================================================
build_teststubs: $(TESTSTUB_SOURCES)
$(foreach srcfile, $(TESTSTUB_SOURCES), ln -s $(srcfile) .)
all: build_teststubs $(OBJECTS)
====================================================
Once I run this I get output like the following :
ln -s /export/home/mylogin/foo/bar/bah/teststubs/src/foo.cc . ln -s
/export/home/mylogin/foo/bar/bah/teststubs/src/bar.cc .
ln: cannot create ./foo.cc: File exists
ln: cannot create ./.: Invalid argument
ln: cannot create ./ln: File exists
ln: cannot create ./-s: File exists
ln: cannot create ./bar.cc: File exists
make: *** [build_teststubs] Error 2
Also, in the directory where this was run, I find the following
files :
-s -> -s
ln -> ln
foo.cc -> /export/home/mylogin/foo/bar/bah/teststubs/src/foo.cc
bar.cc -> /export/home/mylogin/foo/bar/bah/teststubs/src/bar.cc
It seems to have done the work, but is doing extra stuff that's causing
problems.. Any ideas? Thanks!
-- Rick
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make