]> git.r.bdr.sh - rbdr/lyricli/blame - Makefile
Include dbus to use vendored
[rbdr/lyricli] / Makefile
CommitLineData
738ec06d
RBR
1profile := dev
2target = $(shell rustc -vV | grep host | awk '{print $$2}')
3architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
44e7b4de 4app_name := lrc
8d584ce7 5long_app_name := lyricli
169297c8
BB
6
7default: build
8
738ec06d
RBR
9set_rust:
10 rustup default stable
11
12prepare:
13 rustup target add $(target)
14
15build: prepare
16 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo build --profile $(profile) --target $(target)
17
aece0e58 18test:
d33e6d4d 19 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo test
aece0e58
RBR
20
21coverage:
d33e6d4d 22 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo tarpaulin
aece0e58
RBR
23
24format:
d33e6d4d 25 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo fmt && cargo clippy --fix
aece0e58
RBR
26
27lint:
d33e6d4d 28 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo fmt -- --check && cargo clippy
aece0e58 29
738ec06d
RBR
30release: rpm tar deb
31 @$(eval filename := $(app_name)-$(target)-$(channel))
32
33$(architectures):
34ifneq ($(channel),)
35 $(MAKE) -e channel=$(channel) -e target=$@ release
36else
37 $(MAKE) -e target=$@ build
38endif
39
40deb: build
8d584ce7 41ifeq ($(findstring linux,$(target)),linux)
738ec06d 42 @$(eval filename := $(app_name)-$(target)-$(channel))
f5a040da 43 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo deb --profile $(profile) --target $(target)
738ec06d
RBR
44 mv target/$(target)/debian/*.deb $(filename).deb
45 sha256sum $(filename).deb > $(filename).deb.sha256
8d584ce7
RBR
46 rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
47 rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
48endif
738ec06d
RBR
49
50rpm: build
8d584ce7 51ifeq ($(findstring linux,$(target)),linux)
738ec06d 52 @$(eval filename := $(app_name)-$(target)-$(channel))
f5a040da 53 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo generate-rpm --profile $(profile) --target $(target)
738ec06d
RBR
54 mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
55 sha256sum $(filename).rpm > $(filename).rpm.sha256
8d584ce7
RBR
56 rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
57 rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
58endif
738ec06d
RBR
59
60tar: build
61 @$(eval filename := $(app_name)-$(target)-$(channel))
62 tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name)
63 sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256
8d584ce7
RBR
64 rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
65 rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
738ec06d
RBR
66
67package: $(architectures)
68
8d584ce7 69mac:
534287c3 70 @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin)
8d584ce7 71ifeq ($(tag),)
534287c3 72 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package
8d584ce7 73else
534287c3 74 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package
8d584ce7
RBR
75endif
76
aece0e58 77ci: lint coverage
738ec06d 78ifeq ($(GIT_REF),refs/heads/main)
aece0e58 79 $(MAKE) -e profile=release -e channel=unstable package
738ec06d 80else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
aece0e58 81 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
738ec06d
RBR
82endif
83
84.PHONY: default build $(architectures) rpm package prepare set_rust ci release