mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 18:25:14 +00:00
Add ability to specify prerequsites and phony targets. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
35 lines
659 B
Makefile
35 lines
659 B
Makefile
ifndef ____nmk_defined__macro
|
|
|
|
#
|
|
# Helper to include makefile only once.
|
|
#
|
|
define include-once
|
|
ifndef $(join ____nmk_defined__,$(1:.mk=))
|
|
include $(__nmk_dir)$(1)
|
|
endif
|
|
endef
|
|
|
|
# Helper to build built-in target in directory.
|
|
# $(eval $(call gen-built-in,<dir>,<prerequsite>,<phony>))
|
|
define gen-built-in
|
|
$(1)/%: $(2)
|
|
$$(Q) $$(MAKE) $$(build)=$(1) $$@
|
|
ifneq ($(3),)
|
|
$(3): $(2)
|
|
$$(Q) $$(MAKE) $$(build)=$(1) all
|
|
.PHONY: $(3)
|
|
$(1)/built-in.o: $(3)
|
|
else
|
|
$(1): $(2)
|
|
$$(Q) $$(MAKE) $$(build)=$(1) all
|
|
.PHONY: $(1)
|
|
$(1)/built-in.o: $(1)
|
|
endif
|
|
endef
|
|
|
|
#
|
|
# Footer.
|
|
$(__nmk_dir)scripts/macro.mk:
|
|
@true
|
|
____nmk_defined__macro = y
|
|
endif
|