2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

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/63

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2015-09-29 22:26:21 +03:00 committed by Pavel Emelyanov
parent a755ece2f0
commit 3ffad59e2e

View File

@ -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