-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
28 lines (22 loc) · 981 Bytes
/
makefile
File metadata and controls
28 lines (22 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
APP_NAME := quickstart
GO_MODULE_PATH := $(shell go list -m)
CLI_LDFLAGS := -X '${GO_MODULE_PATH}/app.Version=$$(git describe --tags)' \
-X '${GO_MODULE_PATH}/app.Portable=false' \
-X '${GO_MODULE_PATH}/app.BuildDate=$$(date +%Y-%m-%d)' \
-X '${GO_MODULE_PATH}/app.CommitHash=$$(git rev-parse --short HEAD)'
GUI_LDFLAGS := -X '${GO_MODULE_PATH}/app.Version=$$(git describe --tags)' \
-X '${GO_MODULE_PATH}/app.Portable=true' \
-X '${GO_MODULE_PATH}/app.BuildDate=$$(date +%Y-%m-%d)' \
-X '${GO_MODULE_PATH}/app.CommitHash=$$(git rev-parse --short HEAD)'
build:
@echo "Building $(APP_NAME) with LDFLAGS: $(LDFLAGS)"
go build -ldflags="$(CLI_LDFLAGS)" -o $(APP_NAME)
go build -ldflags="$(GUI_LDFLAGS)" -o $(APP_NAME)-portable
release:
goreleaser release --clean
prerelease:
goreleaser release --skip=publish --clean --skip=validate
clean:
@echo "Cleaning..."
rm -f $(APP_NAME)-portable
rm -f $(APP_NAME)