Commit 8c3da46a authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

make: add Makefile.packages and simplify it

I think, we can simplify criu's makefile by moving packages
checks out to special makefile.
Now we only need to make criu's target depend on 'check-packages'.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 98b136f6
......@@ -18,47 +18,6 @@ ccflags-y += -I/usr/include/libnl3
export ccflags-y
LIBS := -lrt -lpthread -lprotobuf-c -ldl -lnl-3
REQ-RPM-PKG-NAMES += protobuf
REQ-RPM-PKG-NAMES += protobuf-c
REQ-RPM-PKG-NAMES += protobuf-c-devel
REQ-RPM-PKG-NAMES += protobuf-compiler
REQ-RPM-PKG-NAMES += protobuf-devel
REQ-RPM-PKG-NAMES += protobuf-python
REQ-RPM-PKG-NAMES += libnl3-devel
REQ-RPM-PKG-NAMES += libcap-devel
REQ-DEB-PKG-NAMES += libprotobuf-dev
REQ-DEB-PKG-NAMES += libprotobuf-c0-dev
REQ-DEB-PKG-NAMES += protobuf-c-compiler
REQ-DEB-PKG-NAMES += protobuf-compiler
REQ-DEB-PKG-NAMES += python-protobuf
REQ-DEB-PKG-NAMES += libnl-3-dev
REQ-DEB-PKG-NAMES += libcap-dev
REQ-RPM-PKG-TEST-NAMES += libaio-devel
REQ-DEB-PKG-TEST-NAMES += libaio-dev
#
# Make sure all required libs are installed
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),mrproper)
ifneq ($(shell sh -c \
'echo "int main(int argc, char *argv[]) { return 0; }" | \
"$(CC)" -x c - $(LIBS) -o /dev/null > /dev/null 2>&1 && echo y'),y)
$(warning "Couldn't find some of the required libraries")
$(warning "Make sure the following packages are installed")
$(warning "RPM based distros: $(REQ-RPM-PKG-NAMES)")
$(warning "DEB based distros: $(REQ-DEB-PKG-NAMES)")
$(warning "To run tests the following packages are needed")
$(warning "RPM based distros: $(REQ-RPM-PKG-TEST-NAMES)")
$(warning "DEB based distros: $(REQ-DEB-PKG-TEST-NAMES)")
$(error "Compilation aborted")
endif
endif
endif
ifeq ($(GMON),1)
CFLAGS += -pg
GMONLDOPT := -pg
......@@ -77,6 +36,10 @@ endif
# msg-* printing
include $(__nmk_dir)/msg.mk
#
# Needed libraries checks
include Makefile.packages
#
# Configure variables.
include Makefile.config
......@@ -186,6 +149,6 @@ uninstall:
#
# Final @all target.
all: criu
all: check-packages criu
@true
.PHONY: all
REQ-RPM-PKG-NAMES += protobuf
REQ-RPM-PKG-NAMES += protobuf-c
REQ-RPM-PKG-NAMES += protobuf-c-devel
REQ-RPM-PKG-NAMES += protobuf-compiler
REQ-RPM-PKG-NAMES += protobuf-devel
REQ-RPM-PKG-NAMES += protobuf-python
REQ-RPM-PKG-NAMES += libnl3-devel
REQ-RPM-PKG-NAMES += libcap-devel
REQ-RPM-PKG-TEST-NAMES += libaio-devel
REQ-DEB-PKG-NAMES += libprotobuf-dev
REQ-DEB-PKG-NAMES += libprotobuf-c0-dev
REQ-DEB-PKG-NAMES += protobuf-c-compiler
REQ-DEB-PKG-NAMES += protobuf-compiler
REQ-DEB-PKG-NAMES += python-protobuf
REQ-DEB-PKG-NAMES += libnl-3-dev
REQ-DEB-PKG-NAMES += libcap-dev
REQ-DEB-PKG-TEST-NAMES += libaio-dev
export LIBS := -lrt -lpthread -lprotobuf-c -ldl -lnl-3
#
# Make sure all required libs are installed
check-build-packages:
$(Q) echo "int main(int argc, char *argv[]) { return 0; }" | \
$(CC) -x c - $(LIBS) -o /dev/null > /dev/null 2>&1
check-packages-failed:
$(warning Can not find some of the required libraries)
$(warning Make sure the following packages are installed)
$(warning RPM based distros: $(REQ-RPM-PKG-NAMES))
$(warning DEB based distros: $(REQ-DEB-PKG-NAMES))
$(warning To run tests the following packages are needed)
$(warning RPM based distros: $(REQ-RPM-PKG-TEST-NAMES))
$(warning DEB based distros: $(REQ-DEB-PKG-TEST-NAMES))
$(error Compilation aborted)
check-packages:
$(Q) $(MAKE) check-build-packages || $(MAKE) check-packages-failed
.PHONY: check-build-packages check-packages-failed check-packages
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