-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (25 loc) · 994 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
41
42
.PHONY: all build clean run fmt lint test vet clean_deps install_deps jenkins all_linux deploy clear_deps_cache
BINARY_NAME := medium-rss-api
BUILD_DIR=build
VERSION := $(shell cat VERSION)
LDFLAGS := -ldflags "-X main.VERSION=${VERSION} -w"
default: build
all: clean build fmt lint test
build: vet
go build ${LDFLAGS} -o $(BUILD_DIR)/$(BINARY_NAME) -v ./cmd/$(BINARY_NAME)
all_linux: clean fmt lint test
CGO_ENABLED=0 GOOS=linux go build -a -tags netgo ${LDFLAGS} -o $(BUILD_DIR)/$(BINARY_NAME) -v ./cmd/$(BINARY_NAME)
linux: clean
CGO_ENABLED=0 GOOS=linux go build -a -tags netgo ${LDFLAGS} -o $(BUILD_DIR)/$(BINARY_NAME) -v ./cmd/$(BINARY_NAME)
clean:
go clean
run: build
./$(BUILD_DIR)/$(BINARY_NAME)
fmt:
gofmt -s -l . | grep -v vendor | tee /dev/stderr
lint:
golint ./... | grep -v vendor | tee /dev/stderr
test:
go test -short $(shell go list ./... | grep -v vendor)
vet:
go vet $(shell go list ./... | grep -v vendor)