tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

make: conditionals inside muti-line commands



I would like to simplify Makefile fragments like

foobar:
	cp /dev/null ${.TARGET}
.ifdef(foo)
	printf "foo=%s\n" "${foo}" >>${.TARGET}
.endif
.ifdef(bar)
	printf "bar=%s\n" "${bar}" >>${.TARGET}
.endif

into something like

foobar:
	{\
.ifdef(foo)
		printf "foo=%s\n" "${foo}";\
.endif
.ifdef(bar)
		printf "bar=%s\n" "${bar}";\
.endif
	} >${.TARGET}

but I get error messages about open conditionals.

Is this a bug?

Is there another way to achieve what I want without opening the target 
multiple times?


Home | Main Index | Thread Index | Old Index