From 78335c9520138c0acb504df37489751b807d790c Mon Sep 17 00:00:00 2001 From: ArkaSaha30 Date: Tue, 28 May 2024 15:06:57 +0530 Subject: [PATCH] Add build subtargets based on arch This commit will group similar targets as per architecture into subtargets to build. It also adds `build-all` target to build all OS-Arch cominations. Allows subtargets without scripting by parameterizing and optimizing OS-ARCH builds Signed-off-by: ArkaSaha30 --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Makefile b/Makefile index ab673c690a1c..22ecab9810b1 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,18 @@ include tests/robustness/makefile.mk build: GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v -mod=readonly" ./scripts/build.sh +PLATFORMS=linux-amd64 linux-386 linux-arm linux-arm64 linux-ppc64le linux-s390x darwin-amd64 darwin-arm64 windows-amd64 windows-arm64 + +.PHONY: build-all +build-all: + @for platform in $(PLATFORMS); do \ + $(MAKE) build-$${platform}; \ + done + +.PHONY: build-% +build-%: + GOOS=$$(echo $* | cut -d- -f 1) GOARCH=$$(echo $* | cut -d- -f 2) GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v -mod=readonly" ./scripts/build.sh + .PHONY: tools tools: GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v -mod=readonly" ./scripts/build_tools.sh