mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 18:07:57 +00:00
Makefiles: protect from % rules, don't rebuild
GNU make tries to rebuild any makefiles it uses. While in general it's a good idea (and it is used e.g. in autoconf-based builds), in our case it is not necessary, as all the makefiles are static. More to say, as we have a few "match anything" rules for subdirectories, Makefiles in these subdirs are also matching these rules, which leads to excessive (re)building while a particular makefile is needed. Protect such Makefiles with explicit (or pattern) rules, so make knows it should do nothing to rebuild those. Signed-off-by: Kir Kolyshkin <kir@openvz.org> Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
15a757f6be
commit
ab90777ca1
16
Makefile
16
Makefile
@ -1,8 +1,15 @@
|
|||||||
#
|
|
||||||
# Import the build engine first
|
|
||||||
__nmk_dir=$(CURDIR)/scripts/nmk/scripts/
|
__nmk_dir=$(CURDIR)/scripts/nmk/scripts/
|
||||||
export __nmk_dir
|
export __nmk_dir
|
||||||
|
|
||||||
|
#
|
||||||
|
# No need to try to remake our Makefiles
|
||||||
|
Makefile: ;
|
||||||
|
Makefile.%: ;
|
||||||
|
scripts/%.mak: ;
|
||||||
|
$(__nmk_dir)%.mk: ;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Import the build engine
|
||||||
include $(__nmk_dir)include.mk
|
include $(__nmk_dir)include.mk
|
||||||
include $(__nmk_dir)macro.mk
|
include $(__nmk_dir)macro.mk
|
||||||
|
|
||||||
@ -213,6 +220,7 @@ SOCCR_A := soccr/libsoccr.a
|
|||||||
SOCCR_CONFIG := soccr/config.h
|
SOCCR_CONFIG := soccr/config.h
|
||||||
$(SOCCR_CONFIG): $(CONFIG_HEADER)
|
$(SOCCR_CONFIG): $(CONFIG_HEADER)
|
||||||
$(Q) test -f $@ || ln -s ../$(CONFIG_HEADER) $@
|
$(Q) test -f $@ || ln -s ../$(CONFIG_HEADER) $@
|
||||||
|
soccr/Makefile: ;
|
||||||
soccr/%: $(SOCCR_CONFIG) .FORCE
|
soccr/%: $(SOCCR_CONFIG) .FORCE
|
||||||
$(Q) $(MAKE) $(build)=soccr $@
|
$(Q) $(MAKE) $(build)=soccr $@
|
||||||
soccr/built-in.o: $(SOCCR_CONFIG) .FORCE
|
soccr/built-in.o: $(SOCCR_CONFIG) .FORCE
|
||||||
@ -228,6 +236,9 @@ criu-deps += $(SOCCR_A)
|
|||||||
#
|
#
|
||||||
# But note that we're already included
|
# But note that we're already included
|
||||||
# the nmk so we can reuse it there.
|
# the nmk so we can reuse it there.
|
||||||
|
criu/Makefile: ;
|
||||||
|
criu/Makefile.packages: ;
|
||||||
|
criu/Makefile.crtools: ;
|
||||||
criu/%: $(criu-deps) .FORCE
|
criu/%: $(criu-deps) .FORCE
|
||||||
$(Q) $(MAKE) $(build)=criu $@
|
$(Q) $(MAKE) $(build)=criu $@
|
||||||
criu: $(criu-deps)
|
criu: $(criu-deps)
|
||||||
@ -238,6 +249,7 @@ criu: $(criu-deps)
|
|||||||
# Libraries next once criu it ready
|
# Libraries next once criu it ready
|
||||||
# (we might generate headers and such
|
# (we might generate headers and such
|
||||||
# when building criu itself).
|
# when building criu itself).
|
||||||
|
lib/Makefile: ;
|
||||||
lib/%: criu .FORCE
|
lib/%: criu .FORCE
|
||||||
$(Q) $(MAKE) $(build)=lib $@
|
$(Q) $(MAKE) $(build)=lib $@
|
||||||
lib: criu
|
lib: criu
|
||||||
|
@ -31,6 +31,7 @@ criu-deps += compel/$(LIBCOMPEL_A)
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Compel itself.
|
# Compel itself.
|
||||||
|
compel/Makefile: ;
|
||||||
compel/%: $(compel-deps) $(compel-plugins) .FORCE
|
compel/%: $(compel-deps) $(compel-plugins) .FORCE
|
||||||
$(Q) $(MAKE) $(build)=compel $@
|
$(Q) $(MAKE) $(build)=compel $@
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ criu-deps += compel/compel-host-bin
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Plugins
|
# Plugins
|
||||||
|
compel/plugins/Makefile: ;
|
||||||
compel/plugins/%: $(compel-deps) .FORCE
|
compel/plugins/%: $(compel-deps) .FORCE
|
||||||
$(Q) $(MAKE) $(build)=compel/plugins $@
|
$(Q) $(MAKE) $(build)=compel/plugins $@
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ pie: criu/pie/pie.lib.a
|
|||||||
$(Q) $(MAKE) $(build)=criu/pie all
|
$(Q) $(MAKE) $(build)=criu/pie all
|
||||||
.PHONY: pie
|
.PHONY: pie
|
||||||
|
|
||||||
|
criu/pie/Makefile: ;
|
||||||
|
criu/pie/Makefile.library: ;
|
||||||
criu/pie/%: pie ;
|
criu/pie/%: pie ;
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -71,8 +73,10 @@ PROGRAM-BUILTINS += $(COMPEL_LIBS)
|
|||||||
$(obj)/built-in.o: pie
|
$(obj)/built-in.o: pie
|
||||||
$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) all
|
$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) all
|
||||||
|
|
||||||
$(obj)/Makefile:
|
|
||||||
@true
|
$(obj)/Makefile: ;
|
||||||
|
$(obj)/Makefile.crtools: ;
|
||||||
|
$(obj)/Makefile.packages: ;
|
||||||
|
|
||||||
$(obj)/%: pie
|
$(obj)/%: pie
|
||||||
$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) $@
|
$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) $@
|
||||||
|
@ -12,8 +12,8 @@ all-y += lib-c lib-py
|
|||||||
|
|
||||||
#
|
#
|
||||||
# C language bindings.
|
# C language bindings.
|
||||||
|
lib/c/Makefile: ;
|
||||||
lib/c/%: .FORCE
|
lib/c/%: .FORCE
|
||||||
$(call msg-gen, $@)
|
|
||||||
$(Q) $(MAKE) $(build)=lib/c $@
|
$(Q) $(MAKE) $(build)=lib/c $@
|
||||||
|
|
||||||
cflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR)
|
cflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR)
|
||||||
@ -27,6 +27,7 @@ lib-c: lib/c/$(CRIU_SO)
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Python bindings.
|
# Python bindings.
|
||||||
|
lib/py/Makefile: ;
|
||||||
lib/py/%: .FORCE
|
lib/py/%: .FORCE
|
||||||
$(call msg-gen, $@)
|
$(call msg-gen, $@)
|
||||||
$(Q) $(MAKE) $(build)=lib/py $@
|
$(Q) $(MAKE) $(build)=lib/py $@
|
||||||
|
@ -2,6 +2,7 @@ all-y += libpy-images rpc_pb2.py
|
|||||||
|
|
||||||
.PHONY: .FORCE
|
.PHONY: .FORCE
|
||||||
|
|
||||||
|
$(obj)/images/Makefile: ;
|
||||||
$(obj)/images/%: .FORCE
|
$(obj)/images/%: .FORCE
|
||||||
$(Q) $(MAKE) $(build)=$(obj)/images $@
|
$(Q) $(MAKE) $(build)=$(obj)/images $@
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user