-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
31 lines (22 loc) · 803 Bytes
/
Makefile
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
29
30
31
GO ?= go
CONFIG_PATH ?= ./dev-config.yml
VERSION ?= $(shell git describe --always --tags)
LDFLAGS ?= -X "github.com/billy4479/server-tool/lib.Version=$(VERSION)"
RELEASE_LDFLAGS ?= -s -w $(LDFLAGS)
OUTPUT_DIR ?= ./build
ARGS ?=
all: build
.PHONY: all
build:
mkdir -p $(OUTPUT_DIR)
$(GO) build -ldflags '$(LDFLAGS)' -o $(OUTPUT_DIR)
.PHONY: build
run: build
CONFIG_PATH=$(CONFIG_PATH) $(OUTPUT_DIR)/server-tool $(ARGS)
.PHONY: run
build-release:
GOOS=linux GOARCH=amd64 $(GO) build -ldflags '$(RELEASE_LDFLAGS)' -o $(OUTPUT_DIR)/server-tool.linux
GOOS=windows GOARCH=amd64 $(GO) build -ldflags '$(RELEASE_LDFLAGS) -H=windowsgui' -o $(OUTPUT_DIR)/server-tool.windows.exe
install: build-release
install -Dm755 $(OUTPUT_DIR)/server-tool.linux $(GOPATH)/bin/server-tool
.PHONY: build-release