-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile
46 lines (32 loc) · 948 Bytes
/
Makefile
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
ifndef VERSION
VERSION := $(shell git describe --always --tags)
endif
DATE := $(shell date -u +%Y%m%d.%H%M%S)
LDFLAGS = -a -trimpath -ldflags "-X=main.version=$(VERSION)-$(DATE)"
targets = gozimhttpd gozimindex
.PHONY: all lint test clean
all: test $(targets)
test: testcgo testnocgo
testcgo: export CGO_ENABLED = 1
testcgo: export CGO_CFLAGS = $(shell pkg-config --cflags liblzma)
testcgo:
go test
testnocgo: export CGO_ENABLED = 0
testnocgo:
go test
testnolint:
go test -race ./...
lint: export CGO_ENABLED = 0
lint:
golangci-lint run
gozimhttpd: export CGO_ENABLED = 1
gozimhttpd: export CGO_CFLAGS = $(shell pkg-config --cflags liblzma)
gozimhttpd:
cd cmd/gozimhttpd && go build ${LDFLAGS}
gozimindex: export CGO_ENABLED = 1
gozimindex: export CGO_CFLAGS = $(shell pkg-config --cflags liblzma)
gozimindex:
cd cmd/gozimindex && go build ${LDFLAGS}
clean:
rm -f cmd/gozimhttpd/gozimhttpd
rm -f cmd/gozimindex/gozimindex