2 target = $(shell rustc -vV | grep host | awk '{print $$2}')
3 architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
5 long_app_name := lyricli
6 host_architecture := $(target)
14 rustup target add $(target)
17 # I need an actually configurable way to make this work. Right now i'm only
18 # cross compiling in the CI, and I know what I'm running, but
19 ifeq ($(host_architecture), x86_64-unknown-linux-gnu)
20 ifeq ($(target), aarch64-unknown-linux-gnu)
21 LD_LIBRARY_PATH=/usr/local/aarch64-linux-gnu/lib:${LD_LIBRARY_PATH}
24 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo build --profile $(profile) --target $(target)
27 @$(eval filename := $(app_name)-$(target)-$(channel))
31 $(MAKE) -e channel=$(channel) -e target=$@ release
33 $(MAKE) -e target=$@ build
37 ifeq ($(findstring linux,$(target)),linux)
38 @$(eval filename := $(app_name)-$(target)-$(channel))
39 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo deb --profile $(profile) --target $(target)
40 mv target/$(target)/debian/*.deb $(filename).deb
41 sha256sum $(filename).deb > $(filename).deb.sha256
42 rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
43 rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
47 ifeq ($(findstring linux,$(target)),linux)
48 @$(eval filename := $(app_name)-$(target)-$(channel))
49 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo generate-rpm --profile $(profile) --target $(target)
50 mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
51 sha256sum $(filename).rpm > $(filename).rpm.sha256
52 rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
53 rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
57 @$(eval filename := $(app_name)-$(target)-$(channel))
58 tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name)
59 sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256
60 rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
61 rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name)
63 package: $(architectures)
66 @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin)
68 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package
70 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package
75 ifeq ($(GIT_REF),refs/heads/main)
76 $(MAKE) -e profile=release -e channel=unstable package
77 else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
78 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
81 .PHONY: default build $(architectures) rpm package prepare set_rust ci release