[Top][All Lists]

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

Re: Expand % in wildcard function

From: Paul D. Smith
Subject: Re: Expand % in wildcard function
Date: Thu, 25 Mar 2004 18:15:36 -0500

%% address@hidden writes:

  d> Citeren Mike Gibson <address@hidden>:

  >> > What should I do to expand the % in the wildcard function?

  >> Like Paul said, you can't.  But there is a way to do it.  Use
  >> $(eval ...)  from version 3.80 and above.

  d> Thank you all for your replies. I tried this:

  d> define genalldocs
  d> xsl/alldocs_$(1).xsl: genalldocs.php $(wildcard $(DOCS)/$(1)/*.xml)
  d>    ${PHP} php/genalldocs.php $(CURDIR)/$(DOCS)/$(1)/ >$@

  d> endef

  d> $(call genalldocs,l)
  d> $(call genalldocs,k)
  d> $(call genalldocs,a)

Well, this can't work because you are not using $(eval ...)... As Mike
said you have to use $(eval ...).  You also have to escape some things.

I would do something like this instead:

  xsl/alldocs_%.xsl: php/genalldocs.php
        ${PHP} $< $(CURDIR)/$(DOCS)/$*/ > $@

  xsl/alldocs_l.xsl: $(wildcard $(DOCS)/l/*.xml)
  xsl/alldocs_k.xsl: $(wildcard $(DOCS)/k/*.xml)
  xsl/alldocs_a.xsl: $(wildcard $(DOCS)/a/*.xml)

Then you don't even need eval.  If you really want to do this in a loop
or something then you _would_ need eval:

  xsl/alldocs_%.xsl: php/genalldocs.php
        ${PHP} $< $(CURDIR)/$(DOCS)/$*/ > $@

  define genalldocs
  xsl/alldocs_$(1).xsl: genalldocs.php $$(wildcard $(DOCS)/$(1)/*.xml)

  DOCDIRS = l k a

  $(foreach D,$(DOCDIRS),$(eval $(call genalldocs,$(D))))

 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]