[PATCH 3/3] cr: simplify cross-compilation

Alexander Kartashov alekskartashov at parallels.com
Thu Apr 10 08:41:54 PDT 2014


---
 Makefile               |   10 +++++++++-
 config.mk              |    7 +++++++
 scripts/Makefile.build |    2 +-
 3 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 config.mk

diff --git a/Makefile b/Makefile
index 7e192ad..46cb6da 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+-include config.mk
+
 VERSION_MAJOR		:= 1
 VERSION_MINOR		:= 2
 VERSION_SUBLEVEL	:=
@@ -119,7 +121,7 @@ CRIU-LIB	:= lib/$(CRIU-SO).so
 CRIU-INC	:= lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
 
 export CC MAKE CFLAGS LIBS SRCARCH DEFINES MAKEFLAGS CRIU-SO
-export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
+export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD LDFLAGS
 export cflags-y
 export VDSO_O
 
@@ -299,3 +301,9 @@ gcov:
 .PHONY: gcov
 
 .DEFAULT_GOAL	:= all
+
+criu-test.tar.gz: .FORCE
+	ARCH=$(ARCH) test/zdtm.sh -g
+	tar -czf $@ criu test
+
+.FORCE:
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..2aec178
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,7 @@
+#ARCH=armv7
+#CROSS_COMPILE:=arm-linux-gnueabi-
+#ARCH:=aarch64
+#CROSS_COMPILE:=aarch64-linux-gnu-
+#CROSS_COMPILE:=aarch64-oe-linux-
+CFLAGS=$(shell pkg-config --cflags libprotobuf-c)
+LDFLAGS=$(shell pkg-config --libs libprotobuf-c)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 2e18c3b..9f7232b 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -204,7 +204,7 @@ endif
 ifneq ($(lib-so),)
 $(obj)/$(lib-so).so: $(all-objs) $(libs-e)
 	$(E) "  LINK    " $@
-	$(Q) $(CC) -shared $(cflags-so) -o $@ $^ $(ldflags-so)
+	$(Q) $(CC) -shared $(cflags-so) -o $@ $^ $(ldflags-so) $(LDFLAGS)
 
 _all += $(obj)/$(lib-so).so
 cleanup-y += $(obj)/$(lib-so).so
-- 
1.7.9.5


--------------000909060806020601080604--


More information about the CRIU mailing list