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
$(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
......
......@@ -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__' >> $$@
......
......@@ -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
......
......@@ -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)
......
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