-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathMakefile
71 lines (55 loc) · 1.82 KB
/
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
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
BIN=cardigann
PREFIX=github.com/cardigann/cardigann
GOVERSION=$(shell go version)
GOBIN=$(shell go env GOBIN)
VERSION=$(shell git describe --tags --candidates=1 --dirty)
FLAGS=-X main.Version=$(VERSION) -w
SRC=$(shell find ./indexer ./server ./config ./torznab)
WEBSRC=$(shell find web/src)
DEFINITIONS=$(shell find definitions)
test: statics
go test -v $(shell go list ./... | grep -v /vendor/)
build: $(SRC) server/static.go indexer/definitions.go
go build -o cardigann -ldflags="$(FLAGS)" *.go
statics: server/static.go indexer/definitions.go
$(BIN)-linux-amd64: statics $(SRC)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $@ -ldflags="$(FLAGS) -s" *.go
test-defs:
find definitions -name '*.yml' -print -exec go run *.go test {} \;
indexer/definitions.go: $(DEFINITIONS)
esc -o indexer/definitions.go -prefix templates -pkg indexer definitions/
server/static.go: $(WEBSRC)
cd web; npm run build
go generate -v ./server
setup:
go get -u github.com/mjibson/esc
go get -u github.com/c4milo/github-release
install:
go install -ldflags="$(FLAGS)" $(PREFIX)
clean-statics:
-rm -rf web/build
-rm server/static.go indexer/definitions.go
clean:
-rm -rf $(BIN)*
run-dev:
cd web/; npm start &
rerun $(PREFIX) server --debug --passphrase "llamasrock"
docker: $(BIN)-linux-amd64
docker-compose build
CHANNEL ?= edge
release:
equinox release \
--version=$(shell echo $(VERSION) | sed -e "s/^v//") \
--config=equinox.yml \
--channel=$(CHANNEL) \
-- -ldflags="-X main.Version=$(VERSION) -s -w" \
$(PREFIX)
publish:
equinox publish \
--release=$(shell echo $(VERSION) | sed -e "s/^v//") \
--config=equinox.yml \
--channel stable
github-release:
description=$$(git cat-file -p $(VERSION) | tail -n +6); \
commit=$$(git rev-list -n 1 $(VERSION)); \
github-release cardigann/cardigann $(VERSION) "$$commit" "$$description" ""