forked from jeessy2/ddns-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (30 loc) · 899 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
32
33
34
35
36
37
38
39
40
.PHONY: build clean test test-race
VERSION=0.0.1
BIN=ddns-go
DIR_SRC=.
DOCKER_CMD=docker
GO_ENV=CGO_ENABLED=0
GO_FLAGS=-ldflags="-X main.version=$(VERSION) -X 'main.buildTime=`date`' -extldflags -static"
GO=$(GO_ENV) $(shell which go)
GOROOT=$(shell `which go` env GOROOT)
GOPATH=$(shell `which go` env GOPATH)
build: $(DIR_SRC)/main.go
@$(GO) build $(GO_FLAGS) -o $(BIN) $(DIR_SRC)
build_docker_image:
@$(DOCKER_CMD) build -f ./Dockerfile -t ddns-go:$(VERSION) .
init:
@go get -u github.com/go-bindata/go-bindata/...
test:
@$(GO) test ./...
test-race:
@$(GO) test -race ./...
bindata:
@go-bindata -pkg util -o util/staticPages.go static/pages/...
@go-bindata -pkg asserts -o asserts/html.go -fs -prefix "static/" static/
dev:
@go-bindata -debug -pkg util -o util/staticPages.go static/pages/...
# clean all build result
clean:
@$(GO) clean ./...
@rm -f $(BIN)
@rm -rf ./dist/*