[Top][All Lists]

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

Re: duplicated targets

From: Paul D. Smith
Subject: Re: duplicated targets
Date: Thu, 21 Feb 2002 09:42:34 -0500

%% Maciej Walezak <address@hidden> writes:

  mw> I want to have one rule that removes object files from a
  mw> library. The library and file is defined in variables.

  mw> When I invoke 'make clean' cleanning is executed only once. I
  mw> suppose it is because 'remove-from-lib' occures two times
  mw> eventually and 'make' ignores the second occurence.

  mw> How can I force 'make' to do all the mentioned targets

I don't think there's any way.  Once make builds a target, it won't
build it again in that invocation.

  mw> or how can I achieve what I want in another way?

You can do recursive makes (I don't advise this, but it will work) or
you can just define clean1 and clean2 to actually run the command
instead of depending on another target to do it:

  REMOVE-FROM-LIB = ar -d $(LIB) $(MEM)

  clean1: LIB = dir1/libymy.a
  clean1: MEM = obj.o
  clean1: ; $(REMOVE-FROM-LIB)

  clean2: LIB = dir2/libymy.a
  clean2: MEM = obj.o
  clean2: ; $(REMOVE-FROM-LIB)

  clean: clean1 clean2

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "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]