forked from autobrr/autobrr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (32 loc) · 949 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
.PHONY: test
.POSIX:
.SUFFIXES:
GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null)
GIT_TAG := $(shell git describe --abbrev=0 --tags)
SERVICE = autobrr
GO = go
RM = rm
GOFLAGS = "-X main.commit=$(GIT_COMMIT) -X main.version=$(GIT_TAG)"
PREFIX = /usr/local
BINDIR = bin
all: clean build
deps:
pnpm --dir web install --frozen-lockfile
go mod download
test:
go test $(go list ./... | grep -v test/integration)
build: deps build/web build/app
build/app:
go build -ldflags $(GOFLAGS) -o bin/$(SERVICE) cmd/$(SERVICE)/main.go
build/ctl:
go build -ldflags $(GOFLAGS) -o bin/autobrrctl cmd/autobrrctl/main.go
build/web:
pnpm --dir web run build
build/docker:
docker build -t autobrr:dev -f Dockerfile . --build-arg GIT_TAG=$(GIT_TAG) --build-arg GIT_COMMIT=$(GIT_COMMIT)
clean:
$(RM) -rf bin
install: all
echo $(DESTDIR)$(PREFIX)/$(BINDIR)
mkdir -p $(DESTDIR)$(PREFIX)/$(BINDIR)
cp -f bin/$(SERVICE) $(DESTDIR)$(PREFIX)/$(BINDIR)