Commit ab115f7e authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

build: generate config.h in the top-make

So, we need CONFIG_HAS_* feature-defines in compel, libsoccr
tools. Let's move this tests upper.

It also reverts commit 411cde8815a4 ("make, soccr: let CRIU depend on
libsoccr"), as we don't need -lsoccr to build feature tests now.
To eliminate any races here, I added $(LIB_FEATURES).

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 20231a39
...@@ -177,6 +177,23 @@ endif ...@@ -177,6 +177,23 @@ endif
$(Q) echo "#define CRIU_GITID \"$(GITID)\"" >> $@ $(Q) echo "#define CRIU_GITID \"$(GITID)\"" >> $@
$(Q) echo "#endif /* __CR_VERSION_H__ */" >> $@ $(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 # Protobuf images first, they are not depending
# on anything else. # on anything else.
...@@ -224,6 +241,7 @@ clean: subclean ...@@ -224,6 +241,7 @@ clean: subclean
mrproper: subclean mrproper: subclean
$(Q) $(MAKE) $(build)=images $@ $(Q) $(MAKE) $(build)=images $@
$(Q) $(MAKE) $(build)=criu $@ $(Q) $(MAKE) $(build)=criu $@
$(Q) $(RM) $(CONFIG_HEADER)
$(Q) $(RM) $(VERSION_HEADER) $(Q) $(RM) $(VERSION_HEADER)
$(Q) $(RM) cscope.* $(Q) $(RM) cscope.*
$(Q) $(RM) tags TAGS $(Q) $(RM) tags TAGS
......
...@@ -3,15 +3,17 @@ include $(__nmk_dir)msg.mk ...@@ -3,15 +3,17 @@ include $(__nmk_dir)msg.mk
include $(SRC_DIR)/scripts/feature-tests.mak include $(SRC_DIR)/scripts/feature-tests.mak
ifeq ($(call try-cc,$(FEATURE_TEST_LIBBSD_DEV),-lbsd),true) ifeq ($(call try-cc,$(FEATURE_TEST_LIBBSD_DEV),-lbsd),true)
LIBS += -lbsd LIBS_FEATURES += -lbsd
FEATURE_DEFINES += -DCONFIG_HAS_LIBBSD FEATURE_DEFINES += -DCONFIG_HAS_LIBBSD
endif endif
ifeq ($(call pkg-config-check,libselinux),y) ifeq ($(call pkg-config-check,libselinux),y)
LIBS += -lselinux LIBS_FEATURES += -lselinux
FEATURE_DEFINES += -DCONFIG_HAS_SELINUX FEATURE_DEFINES += -DCONFIG_HAS_SELINUX
endif endif
export LIBS += $(LIBS_FEATURES)
export DEFINES += $(FEATURE_DEFINES) export DEFINES += $(FEATURE_DEFINES)
export CFLAGS += $(FEATURE_DEFINES) export CFLAGS += $(FEATURE_DEFINES)
...@@ -20,17 +22,19 @@ FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ ...@@ -20,17 +22,19 @@ FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \
# $1 - config name # $1 - config name
define gen-feature-test 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 '#define CONFIG_HAS_$(1)' >> $$@
$(Q) @echo '' >> $$@ $(Q) @echo '' >> $$@
endif endif
endef endef
$(obj)/include/config-base.h: CONFIG_BASE := $(SRC_DIR)/criu/include/config-base.h
$(CONFIG_BASE):
@true @true
define config-header-rule define config-header-rule
$(CONFIG_HEADER): $(obj)/include/config-base.h $(CONFIG_HEADER): $(CONFIG_BASE)
$$(call msg-gen, $$@) $$(call msg-gen, $$@)
$(Q) @echo '#ifndef __CR_CONFIG_H__' > $$@ $(Q) @echo '#ifndef __CR_CONFIG_H__' > $$@
$(Q) @echo '#define __CR_CONFIG_H__' >> $$@ $(Q) @echo '#define __CR_CONFIG_H__' >> $$@
......
...@@ -25,16 +25,6 @@ ifeq ($(GMON),1) ...@@ -25,16 +25,6 @@ ifeq ($(GMON),1)
GMONLDOPT := -pg GMONLDOPT := -pg
endif 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 # msg-* printing
include $(__nmk_dir)msg.mk include $(__nmk_dir)msg.mk
...@@ -42,17 +32,10 @@ include $(__nmk_dir)msg.mk ...@@ -42,17 +32,10 @@ include $(__nmk_dir)msg.mk
# Needed libraries checks # Needed libraries checks
include $(SRC_DIR)/criu/Makefile.packages 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. # System calls library.
SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o SYSCALL-LIB := $(ARCH_DIR)/syscalls.built-in.o
syscalls_lib: $(CONFIG_HEADER) syscalls_lib:
$(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) all $(Q) $(MAKE) $(call build-as,Makefile.syscalls,$(ARCH_DIR)) all
.PHONY: syscalls_lib .PHONY: syscalls_lib
...@@ -136,7 +119,6 @@ subproper: ...@@ -136,7 +119,6 @@ subproper:
$(Q) $(MAKE) $(build)=$(PIE_DIR) mrproper $(Q) $(MAKE) $(build)=$(PIE_DIR) mrproper
$(Q) $(MAKE) $(build)=$(PIE_DIR)/piegen mrproper $(Q) $(MAKE) $(build)=$(PIE_DIR)/piegen mrproper
.PHONY: subproper .PHONY: subproper
mrproper-y += $(CONFIG_HEADER)
mrproper: subproper mrproper: subproper
UAPI_HEADERS := $(SRC_DIR)/criu/include/criu-plugin.h UAPI_HEADERS := $(SRC_DIR)/criu/include/criu-plugin.h
......
...@@ -19,7 +19,7 @@ REQ-DEB-PKG-NAMES += libcap-dev ...@@ -19,7 +19,7 @@ REQ-DEB-PKG-NAMES += libcap-dev
REQ-DEB-PKG-TEST-NAMES += libaio-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: check-packages-failed:
$(warning Can not find some of the required libraries) $(warning Can not find some of the required libraries)
......
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