-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (60 loc) · 1.47 KB
/
Copy pathMakefile
File metadata and controls
78 lines (60 loc) · 1.47 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
66
67
68
69
70
71
72
73
74
75
76
77
78
##
# a-lancxo
#
# @file
# @version 0.1
# Go Makefile
# Variables
APP=a-lancxo
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)"
# Active commands (deprecated stubs are excluded from default build).
ACTIVE_CMDS := cmd/a-lancxo cmd/ade-exe-cli
.PHONY: all
all: build
.PHONY: build
build:
$(foreach dir,$(ACTIVE_CMDS), echo "$(dir) building..."; go build $(FLAGS) -o $(BINDIR)/ ./$(dir);)
.PHONY: test
test:
go tool ginkgo ./...
.PHONY: test-integration
test-integration: build
python3 tests/integration_test.py
.PHONY: run
run: build
./$(BINDIR)/$(APP)
.PHONY: run-race
run-race: tidy
go run -race $(LDFLAGS) ./cmd/$(APP)
.PHONY: lint
lint:
go tool golangci-lint run ./...
.PHONY: fix-lint
fix-lint:
go tool golangci-lint run --fix ./...
.PHONY: tidy
tidy:
go mod tidy
# Build under regular user, only install under root!
.PHONY: install
install: build
@echo "Don't forget to set SUDO=sudo (or SUDO=doas) before this command!"
@echo "for example: SUDO=doas make install"
$(SUDO) install ./build/$(APP) $(PREFIX)
.PHONY: sloc
sloc:
cloc * >sloc.stats
.PHONY: clean
clean:
go clean
rm -rf $(BINDIR)
# end