help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird question


From: Paul D. Smith
Subject: Re: Weird question
Date: Thu, 21 Mar 2002 09:43:49 -0500

%% "Alexandre P. Nunes" <address@hidden> writes:

  apn> I have a question: How in GNU make (I have 3.79.1) do I do
  apn> something like:

  apn> TARGETS := foo bar
  apn> foo_OBJS := test.o bleah.o
  apn> bar_OBJS := bar.o dumb.o bleah.o

  apn> $(TARGETS): $(address@hidden) whatever.a

  apn> I mean, to have each one of the targets referenced by $(TARGETS)
  apn> to depend on it's own setting on targetname_OBJS. Is there a way
  apn> to do this using GNU make?

Not directly.

The only thing you can do right now is use make's auto-re-exec feature
to include a makefile that provides all these definitions.  If you
provide a make rule to create it then make will build it when it's out
of date, and the re-exec itself to include it.

  TARGETS := foo bar
  foo_OBJS := test.o bleah.o
  bar_OBJS := bar.o dumb.o bleah.o

  include prereqs.mk

  prereqs.mk: Makefile
        @rm -f $@; \
         for t in $(TARGETS); do \
           echo "$$t : \$$($$t_OBJS) whatever.a" >> $@; \
         done

or whatever (the above is untested).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist



reply via email to

[Prev in Thread] Current Thread [Next in Thread]