Mail Archives: djgpp/1999/03/03/12:51:29
On Wed, 3 Mar 1999, Baraz Akos 950918 wrote:
> ONE_C = one1.cpp one2.cpp
> ONE_DEP = x.h y.h
>
> TWO_C = two1.cpp two2.cpp
> TWO_DEP = z.h x.h w.h
>
> and I want to compile them by ONE rule, but $(%) doesn't work in place of
> the deps.
I think you are trying to solve a problem that Make already solved for
you: it knows how to compile C++ files, so you don't need to tell it.
What you *do* need to tell Make is the dependencies.
So something like this should do:
all: $(ONE_C:.cpp=.o) $(TWO_C:.cpp=.o)
$(ONE_C:.cpp=.o): $(ONE_DEP)
$(TWO_C:.cpp=.o): $(TWO_DEP)
If you need to use non-default compiler options, like -g or -O2, set the
value of the variables CFLAGS, CPPFLAGS, etc.
The Make manual includes a section which lists all the built-in rules,
together with the variables (like CFLAGS above) that affect every rule.
- Raw text -