I have a number of sources that I wish to compile into executables.
They can all be processed as:
file1: file1.o
$(CXX) -o $@ $(STUFF) $<
I tried to automate this for files 1-9 by:
EXEC_SRCS := file1.cc file2.cc file3.cc ... file9.cc
EXECS := $(EXEC_SRCS:.cc=)
$(EXECS): $(addsuffix .o,$@)
$(CXX) -o $@ $(STUFF) $<
Make won't let me use an action as a prerequisite. As a test I tried:
$(EXECS): $(addsuffix .o,$@)
@echo TEST $@
@echo TEST $(addsuffix .o,$@)
@echo TEST $<
and when I "make file1" I get
TEST file1
TEST file1.o
TEST
Why doesn't this work? Is there a way to automate a list of files like
this? I understand I could probably give all the executable files an
extension like .t and then use a pattern substitution to process them
all. Any way to do this without a special extension?
-
natch
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make