Date: Wed, 3 Mar 1999 19:47:00 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Baraz Akos 950918 cc: djgpp AT delorie DOT com Subject: Re: a make problem In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com 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.