-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Variables | ||
VERSION ?= $(shell git describe --tags --always --dirty) | ||
BINARY_NAME=noStrudel | ||
BUILD_DIR=bin | ||
|
||
# Build flags | ||
LDFLAGS=-ldflags="-X 'main.Version=${VERSION}'" | ||
|
||
# Ensure builds directory exists | ||
$(shell mkdir -p ${BUILD_DIR}) | ||
|
||
.PHONY: all clean windows linux darwin | ||
|
||
all: copy windows linux darwin | ||
|
||
# Build source | ||
copy: source | ||
cp -r ../dist/* web | ||
|
||
source: | ||
cd ../ && \ | ||
pnpm install && \ | ||
VITE_COMMIT_HASH=$(shell git rev-parse --short HEAD) \ | ||
VITE_APP_VERSION=$(shell jq -r .version ../package.json) \ | ||
pnpm build | ||
|
||
# Windows builds | ||
windows: windows-amd64 windows-arm64 | ||
|
||
windows-amd64: | ||
GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-windows-amd64.exe | ||
|
||
windows-arm64: | ||
GOOS=windows GOARCH=arm64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-windows-arm64.exe | ||
|
||
# Linux builds | ||
linux: linux-amd64 linux-arm64 | ||
|
||
linux-amd64: | ||
GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-linux-amd64 | ||
|
||
linux-arm64: | ||
GOOS=linux GOARCH=arm64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-linux-arm64 | ||
|
||
# macOS builds | ||
darwin: darwin-amd64 darwin-arm64 | ||
|
||
darwin-amd64: | ||
GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-darwin-amd64 | ||
|
||
darwin-arm64: | ||
GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o ${BUILD_DIR}/${BINARY_NAME}-darwin-arm64 | ||
|
||
# Clean build directory | ||
clean: | ||
rm -rf ${BUILD_DIR}/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters