~chrisppy/beagles

beagles/Makefile -rw-r--r-- 1.7 KiB
8e6595ccChris Palmer update to go-gemini 0.2.0 5 months ago
                                                                                
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
.POSIX:
.SUFFIXES:

GO = go
RM = rm
SCDOC = scdoc
GOFLAGS =
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man

gosrc = $(shell find . -name '*.go')
gosrc += go.mod go.sum
goflags = $(GOFLAGS) \
	-ldflags="-X 'main.Version=0.2.0'" \
	-o $@


all: beagles beagles.1 beagles-config.5

beagles: $(gosrc)
	$(GO) build $(goflags)
beagles.1:
	$(SCDOC) <doc/beagles.1.scd >beagles.1
beagles-config.5:
	$(SCDOC) <doc/beagles-config.5.scd >beagles-config.5

clean:
	$(GO) mod tidy
	$(RM) -f beagles beagles.1 beagles-config.5 *.tar.gz
	$(RM) -rf vendor

install: all
	mkdir -p $(DESTDIR)$(BINDIR)
	mkdir -p $(DESTDIR)$(MANDIR)/man1
	mkdir -p $(DESTDIR)$(MANDIR)/man5
	cp -f beagles $(DESTDIR)$(BINDIR)
	cp -f beagles.1 $(DESTDIR)$(MANDIR)/man1
	cp -f beagles-config.5 $(DESTDIR)$(MANDIR)/man5

format:
	$(GO) fmt -x ./...
	$(GO) vet ./...
lint:
	$(GO) get -u golang.org/x/lint/golint
	$(GO) get -u honnef.co/go/tools/cmd/staticcheck
	$(GO) get -u gitlab.com/opennota/check/cmd/aligncheck
	$(GO) get -u gitlab.com/opennota/check/cmd/structcheck
	$(GO) get -u gitlab.com/opennota/check/cmd/varcheck
	$(GO) get -u github.com/kisielk/errcheck
	golint -set_exit_status ./...
	staticcheck ./...
	aligncheck ./...
	structcheck ./...
	varcheck ./...
	errcheck ./...
security:
	$(GO) get -u github.com/securego/gosec/cmd/gosec
	gosec -exclude=G107,G204 ./... 
dependencies:
	$(GO) get -u github.com/psampaz/go-mod-outdated
	$(GO) list -u -m -json all | go-mod-outdated -direct -ci
check: clean format lint security dependencies 
	make clean

package: check
	$(GO) mod vendor
	tar --exclude='.git' \
		--exclude='*.tar.gz' \
		--exclude='script' \
		--exclude=".build.yml" \
		--exclude=".gitignore" \
		--exclude="*~" \
		-zcvf beagles-v0.2.0.tar.gz ../beagles