]> git.r.bdr.sh - rbdr/lyricli/blame - Makefile
Build openssl
[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
18release: rpm tar deb
19 @$(eval filename := $(app_name)-$(target)-$(channel))
20
21$(architectures):
22ifneq ($(channel),)
23 $(MAKE) -e channel=$(channel) -e target=$@ release
24else
25 $(MAKE) -e target=$@ build
26endif
27
28deb: build
8d584ce7 29ifeq ($(findstring linux,$(target)),linux)
738ec06d 30 @$(eval filename := $(app_name)-$(target)-$(channel))
f5a040da 31 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo deb --profile $(profile) --target $(target)
738ec06d
RBR
32 mv target/$(target)/debian/*.deb $(filename).deb
33 sha256sum $(filename).deb > $(filename).deb.sha256
8d584ce7
RBR
34 rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
35 rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
36endif
738ec06d
RBR
37
38rpm: build
8d584ce7 39ifeq ($(findstring linux,$(target)),linux)
738ec06d 40 @$(eval filename := $(app_name)-$(target)-$(channel))
f5a040da 41 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo generate-rpm --profile $(profile) --target $(target)
738ec06d
RBR
42 mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
43 sha256sum $(filename).rpm > $(filename).rpm.sha256
8d584ce7
RBR
44 rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
45 rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
46endif
738ec06d
RBR
47
48tar: build
49 @$(eval filename := $(app_name)-$(target)-$(channel))
50 tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name)
51 sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256
8d584ce7
RBR
52 rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
53 rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
738ec06d
RBR
54
55package: $(architectures)
56
8d584ce7 57mac:
534287c3 58 @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin)
8d584ce7 59ifeq ($(tag),)
534287c3 60 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package
8d584ce7 61else
534287c3 62 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package
8d584ce7
RBR
63endif
64
65
738ec06d
RBR
66ci:
67ifeq ($(GIT_REF),refs/heads/main)
68 $(MAKE) -e profile=release -e channel=unstable package
69else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
70 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
71endif
72
73.PHONY: default build $(architectures) rpm package prepare set_rust ci release