Most targets in my makefile need to fail early if $(DESTDIR) is
defined. Simplest way I've found is to make them depend on a
target like this one :
.PHONY: destdir-unsafe
destdir-unsafe:
ifdef DESTDIR
@printf 'Target does not honour $$(DESTDIR)\n' >&2; false
else
@:
endif
.PHONY: target1
target1: destdir-unsafe
do something
.PHONY: target2
target2: destdir-unsafe
do something else
To eliminate some of the redundancy, I thought of doing this :
define tgt
.PHONY: $(1)
$(1): destdir-unsafe
endef
$(eval $(call tgt, target1))
do something
$(eval $(call tgt, target2))
do something else
Unfortunately, the splicing of the two lines coming from $(tgt)
and the "do something" line does not take place and Make bombs
with
Makefile:#: *** commands commence before first target. Stop.
on the "do something" line. Any way to make it work ? Thanks in
advance.
--
André Majorel http://www.teaser.fr/~amajorel/
_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make