4번독수리의 둥지

makefile multiple target에 각각 prerequisite 적용하기 본문

Makefile

makefile multiple target에 각각 prerequisite 적용하기

4번독수리 2019. 9. 16. 17:20

my-first-target은 first-prerequisite에, second, third, 등등에 의존하는 1개의 rule 작성

MULTIPLE_TARGET = my-first-target my-second-target my-third-target
$(MULTIPLE_TARGET): $$(patsubst my-%-target,%-prerequisite,$$@)
	# some recipe

 

https://www.gnu.org/software/make/manual/make.html#Multiple-Targets

https://www.gnu.org/software/make/manual/make.html#Secondary-Expansion

... If that special target is defined then in between the two phases mentioned above, right at the end of the read-in phase, all the prerequisites of the targets defined after the special target are expanded a second time. ...

... In order to take advantage of the secondary expansion phase of the parser, then, it’s necessary to escape the variable or function reference in the makefile. ...

https://www.gnu.org/software/make/manual/make.html#Text-Functions

 

'Makefile' 카테고리의 다른 글

makefile prerequisite by variable value  (0) 2019.09.10