]>
Commit | Line | Data |
---|---|---|
738ec06d RBR |
1 | profile := dev |
2 | target = $(shell rustc -vV | grep host | awk '{print $$2}') | |
3 | architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu | |
44e7b4de | 4 | app_name := lrc |
8d584ce7 | 5 | long_app_name := lyricli |
169297c8 BB |
6 | |
7 | default: build | |
8 | ||
738ec06d RBR |
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 | |
8d584ce7 | 29 | ifeq ($(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) | |
36 | endif | |
738ec06d RBR |
37 | |
38 | rpm: build | |
8d584ce7 | 39 | ifeq ($(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) | |
46 | endif | |
738ec06d RBR |
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 | |
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 | |
55 | package: $(architectures) | |
56 | ||
8d584ce7 | 57 | mac: |
534287c3 | 58 | @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin) |
8d584ce7 | 59 | ifeq ($(tag),) |
534287c3 | 60 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package |
8d584ce7 | 61 | else |
534287c3 | 62 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package |
8d584ce7 RBR |
63 | endif |
64 | ||
65 | ||
738ec06d RBR |
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 |