diff --git a/Makefile b/Makefile index 707fd408b..c585cb598 100644 --- a/Makefile +++ b/Makefile @@ -177,6 +177,23 @@ endif $(Q) echo "#define CRIU_GITID \"$(GITID)\"" >> $@ $(Q) echo "#endif /* __CR_VERSION_H__ */" >> $@ +# +# piegen tool might be disabled by hands. Don't use it until +# you know what you're doing. +ifneq ($(filter ia32 x86 ppc64,$(ARCH)),) + ifneq ($(PIEGEN),no) + piegen-y := y + export piegen-y + endif +endif + +# +# Configure variables. +export CONFIG_HEADER := $(SRC_DIR)/criu/include/config.h +ifeq ($(filter clean mrproper,$(MAKECMDGOALS)),) +include $(SRC_DIR)/Makefile.config +endif + # # Protobuf images first, they are not depending # on anything else. @@ -224,6 +241,7 @@ clean: subclean mrproper: subclean $(Q) $(MAKE) $(build)=images $@ $(Q) $(MAKE) $(build)=criu $@ + $(Q) $(RM) $(CONFIG_HEADER) $(Q) $(RM) $(VERSION_HEADER) $(Q) $(RM) cscope.* $(Q) $(RM) tags TAGS diff --git a/criu/Makefile.config b/Makefile.config similarity index 81% rename from criu/Makefile.config rename to Makefile.config index cc6ec4350..d22c451be 100644 --- a/criu/Makefile.config +++ b/Makefile.config @@ -3,15 +3,17 @@ include $(__nmk_dir)msg.mk include $(SRC_DIR)/scripts/feature-tests.mak ifeq ($(call try-cc,$(FEATURE_TEST_LIBBSD_DEV),-lbsd),true) - LIBS += -lbsd + LIBS_FEATURES += -lbsd FEATURE_DEFINES += -DCONFIG_HAS_LIBBSD endif ifeq ($(call pkg-config-check,libselinux),y) - LIBS += -lselinux + LIBS_FEATURES += -lselinux FEATURE_DEFINES += -DCONFIG_HAS_SELINUX endif +export LIBS += $(LIBS_FEATURES) + export DEFINES += $(FEATURE_DEFINES) export CFLAGS += $(FEATURE_DEFINES) @@ -20,17 +22,19 @@ FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ # $1 - config name define gen-feature-test -ifeq ($$(call try-cc,$$(FEATURE_TEST_$(1)),$$(LIBS),$$(DEFINES)),true) +ifeq ($$(call try-cc,$$(FEATURE_TEST_$(1)),$$(LIBS_FEATURES),$$(DEFINES)),true) $(Q) @echo '#define CONFIG_HAS_$(1)' >> $$@ $(Q) @echo '' >> $$@ endif endef -$(obj)/include/config-base.h: +CONFIG_BASE := $(SRC_DIR)/criu/include/config-base.h + +$(CONFIG_BASE): @true define config-header-rule -$(CONFIG_HEADER): $(obj)/include/config-base.h +$(CONFIG_HEADER): $(CONFIG_BASE) $$(call msg-gen, $$@) $(Q) @echo '#ifndef __CR_CONFIG_H__' > $$@ $(Q) @echo '#define __CR_CONFIG_H__' >> $$@ diff --git a/criu/Makefile b/criu/Makefile index 1ab95a76d..fe87a3417 100644 --- a/criu/Makefile +++ b/criu/Makefile @@ -25,16 +25,6 @@ ifeq ($(GMON),1) GMONLDOPT := -pg endif -# -# piegen tool might be disabled by hands. Don't use it until -# you know what you're doing. -ifneq ($(filter ia32 x86 ppc64,$(ARCH)),) - ifneq ($(PIEGEN),no) - piegen-y := y - export piegen-y - endif -endif - # msg-* printing include $(__nmk_dir)msg.mk @@ -42,17 +32,10 @@ include $(__nmk_dir)msg.mk # Needed libraries checks include $(SRC_DIR)/criu/Makefile.packages -# -# Configure variables. -CONFIG_HEADER := $(obj)/include/config.h -ifneq ($(filter-out clean mrproper,$(MAKECMDGOALS)),) -include $(SRC_DIR)/criu/Makefile.config -endif - # # System calls library. SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o -syscalls_lib: $(CONFIG_HEADER) +syscalls_lib: $(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) all .PHONY: syscalls_lib @@ -136,7 +119,6 @@ subproper: $(Q) $(MAKE) $(build)=$(PIE_DIR) mrproper $(Q) $(MAKE) $(build)=$(PIE_DIR)/piegen mrproper .PHONY: subproper -mrproper-y += $(CONFIG_HEADER) mrproper: subproper UAPI_HEADERS := $(SRC_DIR)/criu/include/criu-plugin.h diff --git a/criu/Makefile.packages b/criu/Makefile.packages index 83a2fc45d..b998da46e 100644 --- a/criu/Makefile.packages +++ b/criu/Makefile.packages @@ -19,7 +19,7 @@ REQ-DEB-PKG-NAMES += libcap-dev REQ-DEB-PKG-TEST-NAMES += libaio-dev -export LIBS := -lrt -lpthread -lprotobuf-c -ldl -lnl-3 +export LIBS += -lrt -lpthread -lprotobuf-c -ldl -lnl-3 check-packages-failed: $(warning Can not find some of the required libraries)