-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (49 loc) · 1.04 KB
/
Makefile
File metadata and controls
65 lines (49 loc) · 1.04 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
##
# ade-ctld
#
# @file
# @version 0.1
# Go Makefile
# Variables
APP=xopen
BINDIR=build
PREFIX?=/usr/local/bin
# Replace it with "sudo", "doas" or somethat, that allows root privileges on your
# system.
# SUDO=sudo
SUDO?=
# Version information
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "v0.0.0-dev")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
FLAGS := -buildvcs=false -ldflags "-X main.version=$(VERSION) -X main.gitCommit=$(COMMIT)"
.PHONY: all
all: build
.PHONY: build
build:
$(foreach dir,$(wildcard cmd/*), echo "$(dir) building..."; go build $(FLAGS) -o $(BINDIR)/ ./$(dir);)
.PHONY: test
test:
go tool ginkgo ./...
.PHONY: run
run: build
./$(BINDIR)/$(APP)
.PHONY: run-log
run-log: tidy build
SLOG_LEVEL=debug ./$(BINDIR)/$(APP)
.PHONY: run-race
run-race: tidy
go run -race $(LDFLAGS) ./cmd/$(APP)
.PHONY: lint
lint:
go tool golangci-lint run ./...
.PHONY: tidy
tidy:
go mod tidy
.PHONY: sloc
sloc:
cloc * >sloc.stats
.PHONY: clean
clean:
go clean
rm -rf $(BINDIR)
# end