-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGNUmakefile
More file actions
47 lines (37 loc) · 849 Bytes
/
GNUmakefile
File metadata and controls
47 lines (37 loc) · 849 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
BIN = restartable
.PHONY: all
all: $(BIN)
DOCKER ?= podman
GO ?= go
# https://github.com/golang/go/issues/38810
CGO_ENABLED ?= 1
$(BIN): *.go
CGO_ENABLED=$(CGO_ENABLED) $(GO) build -trimpath -ldflags="-s -w -buildid=" -buildmode=pie
.PHONY: build
build:
image=$$( $(DOCKER) build -q . ) && \
container=$$( $(DOCKER) create $$image ) && \
$(DOCKER) cp $$container:/usr/local/bin/restartable . && \
$(DOCKER) rm -vf $$container && \
$(DOCKER) rmi $$image
.PHONY: test
test:
$(GO) test ./... -v
$(GO) vet
staticcheck
gofmt -s -l .
golangci-lint run -D errcheck
.PHONY: lint
lint:
golangci-lint run ./...
.PHONY: clean
clean:
$(GO) clean
.PHONY: gen
gen:
rm -f go.mod go.sum
$(GO) mod init github.com/ricardobranco777/$(BIN)
$(GO) mod tidy
.PHONY: install
install: $(BIN)
install -s -m 0755 $(BIN) /usr/local/bin/ 2>/dev/null