Skip to content

Commit

Permalink
feat: target arch
Browse files Browse the repository at this point in the history
  • Loading branch information
slntopp committed Dec 11, 2024
1 parent c17e048 commit 4a20008
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ ifndef TARGETOS
TARGETOS = $(shell go env GOOS)
endif

ifndef TARGETARCH
TARGETARCH = $(shell go env GOARCH)
endif

BIN_SUFFIX = ""
ifeq ($(TARGETOS),windows)
BIN_SUFFIX=".exe"
Expand Down Expand Up @@ -94,7 +98,7 @@ define buildProvider
echo "--> [${$@_NAME}] skipping compile"; \
else \
echo "--> [${$@_NAME}] creating ${$@_BIN}"; \
cd ${$@_HOME} && GOOS=${TARGETOS} go build -o ${$@_DIST_BIN}${BIN_SUFFIX} ./main.go; \
cd ${$@_HOME} && GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o ${$@_DIST_BIN}${BIN_SUFFIX} ./main.go; \
fi
endef

Expand All @@ -111,7 +115,7 @@ define buildProviderDist
echo "--> [${$@_NAME}] generate CLI json"
cd ${$@_HOME} && go run ./gen/main.go .
echo "--> [${$@_NAME}] creating ${$@_BIN}"
cd ${$@_HOME} && CGO_ENABLED=0 GOOS=${TARGETOS} go build ${LDFLAGSDIST} -o ${$@_DIST_BIN}${BIN_SUFFIX} ./main.go
cd ${$@_HOME} && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build ${LDFLAGSDIST} -o ${$@_DIST_BIN}${BIN_SUFFIX} ./main.go
endef

define installProvider
Expand Down Expand Up @@ -743,3 +747,7 @@ license/headers/check:

license/headers/apply:
copywrite headers

os:
@$(call buildProviderDist, providers/os)
@$(call bundleProvider, providers/os)

0 comments on commit 4a20008

Please sign in to comment.