Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern rules with multiple targets #57

Open
sjackman opened this issue Jan 18, 2018 · 0 comments
Open

Pattern rules with multiple targets #57

sjackman opened this issue Jan 18, 2018 · 0 comments

Comments

@sjackman
Copy link
Contributor

sjackman commented Jan 18, 2018

Pattern rules may have more than one target. Unlike normal rules, this does not act as many different rules with the same prerequisites and recipe. If a pattern rule has multiple targets, make knows that the rule’s recipe is responsible for making all of the targets. The recipe is executed only once to make all the targets. When searching for a pattern rule to match a target, the target patterns of a rule other than the one that matches the target in need of a rule are incidental: make worries only about giving a recipe and prerequisites to the file presently in question. However, when this file’s recipe is run, the other targets are marked as having been updated themselves.

See https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html

In this example, the command touch ook.a ook.b should be run only once. biomake runs it twice.

all: foo bar ook.ab

foo bar ook:
	touch $@

%.a %.b: %
	touch $*.a $*.b

%.ab: %.a %.b
	cat $^ >$@
❯❯❯ make -n
touch foo
touch bar
touch ook
touch ook.a ook.b
cat ook.a ook.b >ook.ab
❯❯❯ biomake -n
 touch foo
 touch bar
   touch ook
  touch ook.a ook.b
  touch ook.a ook.b
 cat ook.a ook.b >ook.ab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants