-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (21 loc) · 740 Bytes
/
Makefile
File metadata and controls
26 lines (21 loc) · 740 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
.PHONY: build-app clean install-golint lint
APP_NAME=dynhost
DOCKER=docker
GO=go
GO_INPUT=./cmd/$(APP_NAME)/main.go
GO_OUTPUT=./bin/$(APP_NAME)
GOLINT=$(shell $(GO) list -f {{.Target}} golang.org/x/lint/golint)
VERSION?="$(shell echo $(shell git describe --abbrev=0 --tags) | sed 's/^v\(.*\)/\1/g')"
DATE?=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
COMMIT?="$(shell git rev-parse --short HEAD)"
build-app: clean
@echo "`date +'%d.%m.%Y %H:%M:%S'` Building $(GO_INPUT)"
$(GO) build \
-ldflags "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" \
-o $(GO_OUTPUT) $(GO_INPUT)
clean:
rm -f $(GO_OUTPUT)
install-golint:
$(GO) get -u golang.org/x/lint/golint
lint:
$(GOLINT) -set_exit_status ./...