]> git.r.bdr.sh - rbdr/lyricli/blame_incremental - Makefile
Build openssl
[rbdr/lyricli] / Makefile
... / ...
CommitLineData
1profile := dev
2target = $(shell rustc -vV | grep host | awk '{print $$2}')
3architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
4app_name := lrc
5long_app_name := lyricli
6
7default: build
8
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
29ifeq ($(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)
36endif
37
38rpm: build
39ifeq ($(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)
46endif
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
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
55package: $(architectures)
56
57mac:
58 @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin)
59ifeq ($(tag),)
60 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package
61else
62 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package
63endif
64
65
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