help-make
[Top][All Lists]
Advanced

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

Re: Pattern matching dependency problem


From: Paul D. Smith
Subject: Re: Pattern matching dependency problem
Date: Fri, 13 Sep 2002 18:04:45 -0400

%% "George Shaw" <address@hidden> writes:

  gs> Can anybody suggest a way I implement this in my makefile, for
  gs> example process a list of files cfgtfr_xxx.c each dependent on the
  gs> file cfg_xxx.h, where the string xxx is variable for each item in
  gs> the list.

The only way to do this with the current version of GNU make is to use
dynamically constructed makefiles, combined with GNU make's auto-re-exec
capability.

That is, include a makefile:

  include generated.mk

but don't create generated.mk yourself, instead write a make rule that
generates it:

  generated.mk: Makefile
        rm -f $@
        for f in $(filter cfgtfr_%.c,$(ALL_FILES)); do \
          echo $$f : `echo $$f | sed 's/^cfgtfr/cfg/'` >> $@; \
        done

Done.

-- 
-------------------------------------------------------------------------------
 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]