www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/03/12:51:29

Date: Wed, 3 Mar 1999 19:47:00 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Baraz Akos 950918 <REBECCA AT TIGRIS DOT KLTE DOT HU>
cc: djgpp AT delorie DOT com
Subject: Re: a make problem
In-Reply-To: <Pine.VMS.3.91-A.990303165859.62709A-100000@tigris.klte.hu>
Message-ID: <Pine.SUN.3.91.990303193758.23628A-100000@is>
MIME-Version: 1.0
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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019