]> git.r.bdr.sh - rbdr/blog/blame - Makefile
Set the release
[rbdr/blog] / Makefile
CommitLineData
a04ba49c
RBR
1profile := dev
2target = $(shell rustc -vV | grep host | awk '{print $$2}')
3architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
43780806 4app_name := blog
d620665f
RBR
5
6default: build
7
5c7a9258
RBR
8set_rust:
9 rustup default stable
10
a04ba49c
RBR
11prepare:
12 rustup target add $(target)
d620665f 13
a04ba49c
RBR
14build: prepare
15 cargo build --profile $(profile) --target $(target)
16
43780806 17release: rpm tar
4dfd8d3d 18 @$(eval filename := $(app_name)-$(target)-$(channel))
c4b892b1 19
a04ba49c 20$(architectures):
c4b892b1
RBR
21ifneq ($(channel),)
22 $(MAKE) -e channel=$(channel) -e target=$@ release
43780806
RBR
23else
24 $(MAKE) -e target=$@ build
c4b892b1 25endif
a04ba49c
RBR
26
27rpm: build
3b38f8e9 28 cargo generate-rpm --profile $(profile) --target $(target) -s'release = "$(channel)"'
27c166eb 29 rsync -avz target/$(target)/generate-rpm/*.rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
a04ba49c 30
43780806 31tar: build
4dfd8d3d
RBR
32 @$(eval filename := $(app_name)-$(target)-$(channel))
33 tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name)
3b38f8e9 34 sha256sum $(filename).tar.gz > $(filename).sha256
27c166eb 35 rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
3b38f8e9 36 rsync -avz $(filename).sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
43780806 37
a04ba49c
RBR
38package: $(architectures)
39
c4b892b1
RBR
40ci:
41ifeq ($(GIT_REF),refs/heads/main)
b12f5ad8 42 $(MAKE) -e profile=release -e channel=unstable package
c4b892b1 43else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
b12f5ad8 44 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
c4b892b1
RBR
45endif
46
47.PHONY: default build $(architectures) rpm package prepare set_rust ci release