Commit 8994edeb authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

nmk: build.mk -- Make process depend on Makefile itself

If makefile is changed itself we've been not detecting it.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 10eaabd1
...@@ -21,7 +21,8 @@ ifndef obj ...@@ -21,7 +21,8 @@ ifndef obj
$(error obj is undefined) $(error obj is undefined)
endif endif
include $(call objectify,$(makefile)) src-makefile := $(call objectify,$(makefile))
include $(src-makefile)
ifneq ($(strip $(target)),) ifneq ($(strip $(target)),)
target := $(sort $(call uniq,$(target))) target := $(sort $(call uniq,$(target)))
...@@ -46,6 +47,16 @@ builtin-name := $(strip $(builtin-name)) ...@@ -46,6 +47,16 @@ builtin-name := $(strip $(builtin-name))
# Link flags. # Link flags.
ld_flags := $(strip $(LDFLAGS) $(ldflags-y)) ld_flags := $(strip $(LDFLAGS) $(ldflags-y))
#
# $(obj) related rules.
$(eval $(call gen-rule-o-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
$(eval $(call gen-rule-i-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
$(eval $(call gen-rule-s-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
$(eval $(call gen-rule-o-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
$(eval $(call gen-rule-d-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
$(eval $(call gen-rule-d-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
$(eval $(call gen-rule-i-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
# #
# Prepare targets. # Prepare targets.
ifneq ($(lib-y),) ifneq ($(lib-y),)
...@@ -92,14 +103,16 @@ ifdef builtin-target ...@@ -92,14 +103,16 @@ ifdef builtin-target
$(eval $(call gen-ld-target-rule, \ $(eval $(call gen-ld-target-rule, \
$(builtin-target), \ $(builtin-target), \
$(ld_flags), \ $(ld_flags), \
$(obj-y),$(obj-y) $(call objectify,$(obj-e)))) $(obj-y) $(src-makefile), \
$(obj-y) $(call objectify,$(obj-e))))
endif endif
ifdef lib-target ifdef lib-target
$(eval $(call gen-ar-target-rule, \ $(eval $(call gen-ar-target-rule, \
$(lib-target), \ $(lib-target), \
$(ARFLAGS) $(arflags-y), \ $(ARFLAGS) $(arflags-y), \
$(lib-y),$(lib-y) $(call objectify,$(lib-e)))) $(lib-y) $(src-makefile), \
$(lib-y) $(call objectify,$(lib-e))))
endif endif
# #
...@@ -109,7 +122,8 @@ define gen-custom-target-rule ...@@ -109,7 +122,8 @@ define gen-custom-target-rule
$(eval $(call gen-ld-target-rule, \ $(eval $(call gen-ld-target-rule, \
$(obj)/$(1).built-in.o, \ $(obj)/$(1).built-in.o, \
$(ld_flags) $(LDFLAGS_$(1)), \ $(ld_flags) $(LDFLAGS_$(1)), \
$(call objectify,$($(1)-obj-y)), \ $(call objectify,$($(1)-obj-y)) \
$(src-makefile), \
$(call objectify,$($(1)-obj-y)) \ $(call objectify,$($(1)-obj-y)) \
$(call objectify,$($(1)-obj-e)))) $(call objectify,$($(1)-obj-e))))
all-y += $(obj)/$(1).built-in.o all-y += $(obj)/$(1).built-in.o
...@@ -121,7 +135,8 @@ define gen-custom-target-rule ...@@ -121,7 +135,8 @@ define gen-custom-target-rule
$(obj)/$(1).lib.a, \ $(obj)/$(1).lib.a, \
$(ARFLAGS) $($(1)-arflags-y), \ $(ARFLAGS) $($(1)-arflags-y), \
$(call objectify,$($(1)-lib-y)) \ $(call objectify,$($(1)-lib-y)) \
$(call objectify,$($(1)-lib-e)), \ $(call objectify,$($(1)-lib-e)) \
$(src-makefile), \
$(call objectify,$($(1)-lib-y)))) $(call objectify,$($(1)-lib-y))))
all-y += $(obj)/$(1).lib.a all-y += $(obj)/$(1).lib.a
cleanup-y += $(call cleanify,$(call objectify,$($(1)-lib-y))) cleanup-y += $(call cleanify,$(call objectify,$($(1)-lib-y)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment