views:

26

answers:

1

Is it possible to have wildcard targets for non-filenames, like:

build-%: pull-% build-%.stamp
pull-%:
  cd $* ; git log HEAD..origin/master | grep -q . && ( git pull ; $(RM) ../build-$*.stamp ) || true
build-%.stamp:
  cd $* ; ant
  touch $@

The idea is to call make build-foo, which will only call the build when there are new upstream changes (which get pulled).

However, the %-pattern matching appears to apply to filenames only, even when defining the expanded form ("build-foo") in .PHONY.

Do I have to use templates, as used in http://stackoverflow.com/questions/3064403 ?

+1  A: 

Ah! Put a semicolon after the build-% rule.

(I didn't notice this problem because I put a command in the rule: @echo $@.)

Beta