Why GNU Make canned recipe doesn't work? -
i'm expecting see files foo1 , foo3 created makefile below. file foo3 created. me seems canned recipe make-foo ignored make. debug outcome of targets foo1 , foo2 (empty recipe) identical.
# why canned recipe doesn't work ? # http://www.gnu.org/software/make/manual/make.html#canned-recipes define make-foo = echo making $@ touch $@ endef .phony: all: foo1 foo2 foo3 # foo1 not created, why ? .phony: foo1 foo1: $(make-foo) # debug output similar foo1 .phony: foo2 foo2: # works .phony: foo3 foo3: echo making $@ touch $@
running make:
xxxx@xxxx:/dev/shm$ make -drr gnu make 3.81 copyright (c) 2006 free software foundation, inc. free software; see source copying conditions. there no warranty; not merchantability or fitness particular purpose. program built i686-pc-linux-gnu reading makefiles... reading makefile `makefile'... updating makefiles.... considering target file `makefile'. looking implicit rule `makefile'. no implicit rule found `makefile'. finished prerequisites of target file `makefile'. no need remake target `makefile'. updating goal targets.... considering target file `all'. file `all' not exist. considering target file `foo1'. file `foo1' not exist. finished prerequisites of target file `foo1'. must remake target `foo1'. remade target file `foo1'. considering target file `foo2'. file `foo2' not exist. finished prerequisites of target file `foo2'. must remake target `foo2'. remade target file `foo2'. considering target file `foo3'. file `foo3' not exist. finished prerequisites of target file `foo3'. must remake target `foo3'. echo making foo3 putting child 0x0914c5f0 (foo3) pid 3132 on chain. live child 0x0914c5f0 (foo3) pid 3132 making foo3 reaping winning child 0x0914c5f0 pid 3132 touch foo3 live child 0x0914c5f0 (foo3) pid 3133 reaping winning child 0x0914c5f0 pid 3133 removing child 0x0914c5f0 pid 3133 chain. remade target file `foo3'. finished prerequisites of target file `all'. must remake target `all'. remade target file `all'.
missing foo1:
xxxx@xxxx:/dev/shm$ ll foo* -rw-r--r-- 1 xxxx xxxx 0 2011-02-17 20:04 foo3
i think don't want =
@ end of define
line. makefile works here me:
define make-foo echo making $@ touch $@ endef .phony: foo1 foo1: $(make-foo)
example:
$ make echo making foo1 making foo1 touch foo1 $ ls makefile foo1
the gnu make manual seems indicate =
should fine, you, different behaviour if have there.
edit: asked:
gnu make differences in multiline variable declarations
to clarification on what's happening here...
Comments
Post a Comment