[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "No targets" message with pattern rule
From: |
John Graham-Cumming |
Subject: |
Re: "No targets" message with pattern rule |
Date: |
Mon, 06 Feb 2006 09:08:27 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
August Karlstrom wrote:
OK I see. So what should I add to the makefile to tell make to create a
.suffix2 file for each .suffix1 file? I have tried the following but it
doesn't seem to work:
.PHONY: main
main: $(wildcard *.suffix2)
%.suffix2: %.suffix1
cp $< $@
That's because $(wildcard *.suffix2) ends up being an empty list and
hence the Makefile is equivalent to:
.PHONY: main
main:
%.suffix2: %.suffix1
cp $< $@
(i.e. because there are currently no .suffix2 files there are no prereqs
to main). You can solve this in a couple of ways. The simplest is to
take the output of the $(wildcard) and change the suffix on every file:
.PHONY: main
main: $(subst .suffix2,.suffix1,$(wilcard *.suffix2))
%.suffix2: %.suffix1
cp $< $@
John.
--
John Graham-Cumming
address@hidden
Home: http://www.jgc.org/
Blog: http://www.jgc.org/blog/
POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
GNU Make Debugger: http://gmd.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/
Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/