[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help needed understanding multiple target pattern rules
From: |
Lilie Weaver |
Subject: |
help needed understanding multiple target pattern rules |
Date: |
Tue, 13 Jan 2009 11:40:43 +0000 |
Dear all,
I am having trouble understanding what I need to do to achieve the following (simplified):
I have a number of files, lets call them foo.txt, bar.bar and baz.z. They are all dependant on another set of files, lets say makefoo, barmaker, and bazzer (the point is none of the file names follow a pattern), but are all made by a single command, lets say the shell script setup.sh
I want to write a rule with multiple targets like this:
foo.txt bar.bar baz.z: makefoo barmaker bazzer
./setup.sh
so that each time any of the pre-requisites are out of date, don't exist, or the files don't exist (i.e. setup has not been run before), setup.sh is run. (also, I suspect setup.sh should also be a pre-requisite?)
However, rules with multiple targets (unless they are pattern rules) run the command once for each target. This is obviously not what I want. So I tried making a pattern rule with multiple targets, because then (10.5.1) make knows that all the targets are made by a single command. The problem is (or may not be??) that the filenames don't follow a pattern:
f%o.txt b%r.bar b%z.z: makefoo barmaker bazzer
./setup.sh
That seemed to only run ./setup.sh once for any target that needed updating (good), but it also ran even when all the targets were current (not so much).
make -d told me that make couldn't find the file f%o.txt (even though there was a foo.txt). I guess it only looked for f%o.txt since it assumes that all the other targets will be updated by ./setup.sh (correct assumption)
Could anyone shed some light as to what I'm supposed to be trying to do? I have googled quite a lot of stuff on this but haven't come across anyone wanting to make a pattern rule without having a pattern... I have some experience with Makefiles, but only fairly basic stuff. I've been trying all sorts of things and have been getting myself in a right mess so I'm hoping that someone can clarify things a little for me. Sorry if this a little simplistic!
Thanks for your time
Joff
- help needed understanding multiple target pattern rules,
Lilie Weaver <=