-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Makefile
53 lines (43 loc) · 1.43 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
# Build variables
PACKAGE = github.com/l7mp/stunner
BUILD_DIR ?= bin/
VERSION ?= $(shell (git describe --tags --abbrev=8 --always --long) | tr "/" "-")
COMMIT_HASH ?= $(shell git rev-parse --short HEAD 2>/dev/null)
BUILD_DATE ?= $(shell date +%FT%T%z)
LDFLAGS += -s -w
LDFLAGS += -X main.version=${VERSION} -X main.commitHash=${COMMIT_HASH} -X main.buildDate=${BUILD_DATE}
GOARGS = -trimpath
ifeq (${VERBOSE}, 1)
ifeq ($(filter -v,${GOARGS}),)
GOARGS += -v
endif
endif
.PHONY: all
all: build
.PHONY: generate
generate: ## OpenAPI codegen
go generate ./pkg/config/...
.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...
.PHONY: vet
vet: ## Run go vet against code.
go vet ./...
.PHONY: test
test: generate fmt vet
go test ./... -v
##@ Build
.PHONY: build
build: generate fmt vet build-bin
.PHONY: build-bin
bin: build-bin
build-bin:
go build ${GOARGS} -ldflags "${LDFLAGS}" -o ${BUILD_DIR}/stunnerd cmd/stunnerd/main.go
go build ${GOARGS} -ldflags "${LDFLAGS}" -o ${BUILD_DIR}/turncat cmd/turncat/main.go
go build ${GOARGS} -ldflags "${LDFLAGS}" -o ${BUILD_DIR}/stunnerctl cmd/stunnerctl/*.go
go build ${GOARGS} -ldflags "${LDFLAGS}" -o ${BUILD_DIR}/icetester cmd/icetester/main.go
.PHONY: clean
clean:
# echo 'Use "make generate" to autogenerate server code' > pkg/server/server.go
# echo 'Use "make generate" to autogenerate client code' > pkg/client/client.go
# echo 'Use "make generate" to autogenerate client code' > pkg/types/types.go