From 3e5797a911c39a286fc85ce224131bccefe4a132 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Thu, 8 Jun 2017 13:28:30 +0100 Subject: [PATCH] build: Make sure the tools compile on Linux/macOS/Windows This patch adds cross compilation steps for Linux, macOS and, Windows to the CI targets to ensure that the all commands cross compile nicely. Although the CI runs on Linux we still explicitly compile for Linux in case developers use the CI targets locally on a non-Linux host. While at it, also fix the GOARCH override to enable cross compilation of ARM64 on Linux. The build support seems to work, but the compilation fails (hence it is not added to the test). Signed-off-by: Rolf Neugebauer --- Makefile | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 87f5cabd0..92b8707fe 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,10 @@ LINUXKIT?=bin/linuxkit GOOS?=$(shell uname -s | tr '[:upper:]' '[:lower:]') GOARCH?=amd64 ifneq ($(GOOS),linux) -CROSS=-e GOOS=$(GOOS) -e GOARCH=$(GOARCH) +CROSS+=-e GOOS=$(GOOS) +endif +ifneq ($(GOARCH),amd64) +CROSS+=-e GOARCH=$(GOARCH) endif PREFIX?=/usr/local/ @@ -55,6 +58,12 @@ collect-artifacts: artifacts/test.img.tar.gz artifacts/test-ltp.img.tar.gz .PHONY: ci ci-tag ci-pr ci: + $(MAKE) clean + $(MAKE) GOOS=darwin + $(MAKE) clean + $(MAKE) GOOS=linux + $(MAKE) clean + $(MAKE) GOOS=windows $(MAKE) clean $(MAKE) $(MAKE) install @@ -62,6 +71,12 @@ ci: $(MAKE) -C pkg tag ci-tag: + $(MAKE) clean + $(MAKE) GOOS=darwin + $(MAKE) clean + $(MAKE) GOOS=linux + $(MAKE) clean + $(MAKE) GOOS=windows $(MAKE) clean $(MAKE) $(MAKE) install @@ -69,6 +84,12 @@ ci-tag: $(MAKE) -C pkg tag ci-pr: + $(MAKE) clean + $(MAKE) GOOS=darwin + $(MAKE) clean + $(MAKE) GOOS=linux + $(MAKE) clean + $(MAKE) GOOS=windows $(MAKE) clean $(MAKE) $(MAKE) install