-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (30 loc) · 888 Bytes
/
Makefile
File metadata and controls
39 lines (30 loc) · 888 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
GO111MODULE ?= on
CGO_ENABLED = 0
LOCALS := $(shell find . -type f -name '*.go' 2> /dev/null)
all: deps fmt build
deps:
go get ./...
clean:
-rm -rf bin
-rm *.rpm *.tar.gz *.deb
fmt: gofmt
go mod tidy
go vet ./...
go generate ./...
gofmt: $(LOCALS)
$(LOCALS):
@gofmt -s -w $(@)
test:
go build -tags nocgo -o bin/procwatch-tester tests/tester.go
go test ./...
build:
go build -tags nocgo -o bin/procwatch cmd/procwatch/*.go
packages: fmt deps build test
-rm -rf pkg *.deb *.rpm *.tar.gz
mkdir -p pkg/usr/bin
cp bin/procwatch pkg/usr/bin/
-fpm -s dir -t deb -n procwatch -v "`./bin/procwatch -v | cut -d' ' -f3`" -C pkg usr
-fpm -s dir -t rpm -n procwatch -v "`./bin/procwatch -v | cut -d' ' -f3`" -C pkg usr
cd bin && tar czvf "../procwatch-`../bin/procwatch -v | cut -d' ' -f3`.tar.gz" procwatch
.PHONY: test deps $(LOCALS)
.EXPORT_ALL_VARIABLES: