Commit 3ffad59e authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

piegen: Allow to compile piegen tool in cross environment

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/63Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: 's avatarChristopher Covington <cov@codeaurora.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a755ece2
...@@ -32,8 +32,15 @@ NM := $(CROSS_COMPILE)nm ...@@ -32,8 +32,15 @@ NM := $(CROSS_COMPILE)nm
SH := bash SH := bash
MAKE := make MAKE := make
OBJCOPY := $(CROSS_COMPILE)objcopy OBJCOPY := $(CROSS_COMPILE)objcopy
HOSTCC ?= gcc
HOSTLD ?= ld
CFLAGS += $(USERCFLAGS) CFLAGS += $(USERCFLAGS)
HOSTCFLAGS ?= $(CFLAGS)
export HOSTCC
export HOSTLD
export HOSTCFLAGS
# #
# Fetch ARCH from the uname if not yet set # Fetch ARCH from the uname if not yet set
...@@ -209,12 +216,12 @@ $(ARCH_DIR): protobuf config ...@@ -209,12 +216,12 @@ $(ARCH_DIR): protobuf config
ifeq ($(piegen-y),y) ifeq ($(piegen-y),y)
pie/piegen/%: config pie/piegen/%: config
$(Q) $(MAKE) $(build)=pie/piegen $@ $(Q) CC=$(HOSTCC) LD=$(HOSTLD) CFLAGS="$(HOSTCFLAGS)" $(MAKE) $(build)=pie/piegen $@
pie/piegen: config 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 $(piegen): pie/piegen/built-in.o
$(E) " LINK " $@ $(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ $(Q) $(HOSTCC) $(HOSTCFLAGS) $^ $(LDFLAGS) -o $@
.PHONY: pie/piegen .PHONY: pie/piegen
endif endif
......
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