bug-make
[Top][All Lists]
Advanced

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

Re: bug? limitation? by-design? :(


From: Paul D. Smith
Subject: Re: bug? limitation? by-design? :(
Date: Fri, 3 Aug 2001 14:45:26 -0400

%% Ian Ward <address@hidden> writes:

  iw> ## This dep-pattern doesn't work
  iw> ${pics:=.jpg} : %.jpg : ${%_long}

This is how it works for both normal and static pattern rules.
Variables in this context are expanded immediately when the line is read
in by make; that expansion happens well before any resolution of the
patterns.

See the GNU make manual section "How 'make' Reads a Makefile".

  iw> I've tried using function calls etc, but nothing will let me say
  iw> "look for the dependency in the variable called <pattern>_long".

Correct, there is no way, since as above _all_ that expansion happens
first, before the patterns expand.

  iw> Is switching to some other makefile generating language my only
  iw> solution?

I don't quite know what this means.


The only way to do this with the current version of make is to use
make's auto-generated makefile feature.  Do something like this:

  include prereqs.mk

  prereqs.mk: Makefile
        rm -f $@
        for p in $(pics); do \
          echo "$$p.jpg : \$$($${p}_long)" >> $@; \
        done

or similar.  The first time you run this (and, thereafter, each time
Makefile is changed) make will notice that the included file prereqs.mk
is nonexistent or out of date, and it will build it according to the
rule above then re-exec itself to include it.

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