]> git.r.bdr.sh - rbdr/lyricli/blob - Makefile
Add mac command
[rbdr/lyricli] / Makefile
1 profile := dev
2 target = $(shell rustc -vV | grep host | awk '{print $$2}')
3 architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
4 app_name := lrc
5 long_app_name := lyricli
6
7 default: build
8
9 set_rust:
10 rustup default stable
11
12 prepare:
13 rustup target add $(target)
14
15 build: prepare
16 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo build --profile $(profile) --target $(target)
17
18 release: rpm tar deb
19 @$(eval filename := $(app_name)-$(target)-$(channel))
20
21 $(architectures):
22 ifneq ($(channel),)
23 $(MAKE) -e channel=$(channel) -e target=$@ release
24 else
25 $(MAKE) -e target=$@ build
26 endif
27
28 deb: build
29 ifeq ($(findstring linux,$(target)),linux)
30 @$(eval filename := $(app_name)-$(target)-$(channel))
31 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo deb --profile $(profile) --target $(target)
32 mv target/$(target)/debian/*.deb $(filename).deb
33 sha256sum $(filename).deb > $(filename).deb.sha256
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)
36 endif
37
38 rpm: build
39 ifeq ($(findstring linux,$(target)),linux)
40 @$(eval filename := $(app_name)-$(target)-$(channel))
41 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo generate-rpm --profile $(profile) --target $(target)
42 mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
43 sha256sum $(filename).rpm > $(filename).rpm.sha256
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)
46 endif
47
48 tar: 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
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)
54
55 package: $(architectures)
56
57 mac:
58 override architectures := x86_64-apple-darwin aarch64-apple-darwin
59 ifeq ($(tag),)
60 $(MAKE) -e profile=release -e architectures='$(architectures)' -e channel=unstable package
61 else
62 $(MAKE) -e profile=release -e architectures='$(architectures)' -e channel=$(tag) package
63 endif
64
65
66 ci:
67 ifeq ($(GIT_REF),refs/heads/main)
68 $(MAKE) -e profile=release -e channel=unstable package
69 else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
70 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
71 endif
72
73 .PHONY: default build $(architectures) rpm package prepare set_rust ci release