help-make
[Top][All Lists]
Advanced

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

Re: Static Rules Unceremoniously Dropped


From: Paul D. Smith
Subject: Re: Static Rules Unceremoniously Dropped
Date: Tue, 31 Jan 2006 17:35:09 -0500

%% William Ahern <address@hidden> writes:

  wa> Using 3.81beta3, it seems that one of our pattern rules
  wa>   CFLAGS_$(d) := -DFOO

  wa>   $(d)/%.o: $(d)/%.c -lfoo -lbar
  wa>           $(CC) $(CFLAGS_$(@D)) ...

  wa> is dropped without notice when -lbar is not found. Note that
  wa> LIBPATTERNS is nullified, and -lfoo and -lbar are explicit
  wa> .INTERMEDIATE targets (or are supposed to be when they're
  wa> present).

  wa> Then, the default %.o: %.c rule matches, but cannot properly
  wa> compile the source because of missing CFLAGS.

  wa> This seems like a bug, because there is absolsutely no notice that
  wa> the rule was dropped or the dependency could not be found. Maybe
  wa> this issue rises from LIBPATTERNS code, and thus slips thru the
  wa> cracks.

  wa> I've moved a HUGE source tree over to a non-recursive make model.
  wa> Fortunately this is the only bug we've hit so far, IIRC.

  wa> I've debugged and debugged. Rest assured that $(d) is defined
  wa> correctly, etc, etc. The only way to trigger it is to remove the
  wa> rule definition for -lbar.

I'm not exactly sure what you want make to do here.  As far as I can
understand from your explanation, the pattern rule wasn't dropped.
Rather, a pattern rule matches only if all the prerequisites either
exist or can be created.  If one or more don't, then the pattern rule
doesn't match and make looks for another pattern rule that does work.
If one of the prerequisites is an explicit file (not a pattern) then
that file still has to either exist or be creatable by make.

Make doesn't report every pattern rule that does not match; that would
generate a LOT of useless output.  If you use -d you should see it try
and discard that pattern because -lbar doesn't exist and make doesn't
know how to create it.

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