[CRIU] [PATCH 2/2] piegen: Allow to compile piegen tool in cross environment
Cyrill Gorcunov
gorcunov at openvz.org
Tue Sep 29 12:26:21 PDT 2015
To build piegen tool with different compiler/linker than
gcc/ld -- simply run make as
HOSTCC="host-compiler" HOSTLD="host-ld" make
where host-compiler/ld is appropriate program needed.
https://github.com/xemul/criu/issues/63
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
Makefile | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 0f0447962bdc..c9011a8635eb 100644
--- a/Makefile
+++ b/Makefile
@@ -32,8 +32,15 @@ NM := $(CROSS_COMPILE)nm
SH := bash
MAKE := make
OBJCOPY := $(CROSS_COMPILE)objcopy
+HOSTCC ?= gcc
+HOSTLD ?= ld
CFLAGS += $(USERCFLAGS)
+HOSTCFLAGS ?= $(CFLAGS)
+
+export HOSTCC
+export HOSTLD
+export HOSTCFLAGS
#
# Fetch ARCH from the uname if not yet set
@@ -209,12 +216,12 @@ $(ARCH_DIR): protobuf config
ifeq ($(piegen-y),y)
pie/piegen/%: config
- $(Q) $(MAKE) $(build)=pie/piegen $@
+ $(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build)=pie/piegen $@
pie/piegen: config
- $(Q) $(MAKE) $(build)=pie/piegen all
+ $(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build)=pie/piegen all
$(piegen): pie/piegen/built-in.o
$(E) " LINK " $@
- $(Q) $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
+ $(Q) $(HOSTCC) $(HOSTCFLAGS) $^ $(LDFLAGS) -o $@
.PHONY: pie/piegen
endif
--
2.4.3
More information about the CRIU
mailing list