Skip to content

Commit

Permalink
Add platform-specific builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 10, 2023
1 parent 83ca40f commit 0862dc8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion dev_tools/deploy_docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ GOOS=linux
# Good primer on Makefile variables...
# https://earthly.dev/blog/makefile-variables/
GO_SOURCE_FILE=src/deploy_docs.go
GO_BINARY_FILE=deploy_docs
# Find the platform (Linux or Darwin) from 'uname -a'...
PLATFORM := $(shell perl -e '`uname -a` =~ /^(\w+).*?$$/;print("$$1");')

.DEFAULT_GOAL := build

Expand All @@ -32,7 +35,22 @@ build:
make dep
-make lint
cd src && go vet .
go build -o bin/deploy_docs -ldflags="-s -w" $(GO_SOURCE_FILE)

############################################################################
#
# Replace this line with PLATFORM detection...
#
#go build -o bin/deploy_docs -ldflags="-s -w" $(GO_SOURCE_FILE)
#
############################################################################
if [ "$(PLATFORM)" = "Linux" ]; then \
GOARCH=amd64 GOOS=linux go build -ldflags "-s -w" -o ./$(GO_BINARY_FILE) $(GO_SOURCE_FILE); \
elif [ "$(PLATFORM)" = "Darwin" ]; then \
GOARCH=amd64 GOOS=darwin go build -ldflags "-s -w" -o ./$(GO_BINARY_FILE) $(GO_SOURCE_FILE); \
else \
echo "$(COL_RED)Unknown PLATFORM -> $(PLATFORM)$(COL_END)"; \
fi
make release
.PHONY: build

deploy:
Expand Down

0 comments on commit 0862dc8

Please sign in to comment.