]> git.r.bdr.sh - rbdr/blog/blame - Makefile
Add mac
[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
7c6c129b 17release: rpm tar deb
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 26
94b6e2ec 27deb: build
d26464d1 28ifeq ($(findstring linux,$(target)),linux)
94b6e2ec
RBR
29 @$(eval filename := $(app_name)-$(target)-$(channel))
30 cargo deb --profile $(profile) --target $(target)
7c6c129b 31 mv target/$(target)/debian/*.deb $(filename).deb
94b6e2ec
RBR
32 sha256sum $(filename).deb > $(filename).deb.sha256
33 rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
34 rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
d26464d1 35endif
94b6e2ec 36
a04ba49c 37rpm: build
d26464d1 38ifeq ($(findstring linux,$(target)),linux)
6b85c7c4
RBR
39 @$(eval filename := $(app_name)-$(target)-$(channel))
40 cargo generate-rpm --profile $(profile) --target $(target)
41 mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
42 sha256sum $(filename).rpm > $(filename).rpm.sha256
43 rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
44 rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
d26464d1 45endif
a04ba49c 46
43780806 47tar: build
4dfd8d3d
RBR
48 @$(eval filename := $(app_name)-$(target)-$(channel))
49 tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name)
6b85c7c4 50 sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256
27c166eb 51 rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
6b85c7c4 52 rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
43780806 53
a04ba49c
RBR
54package: $(architectures)
55
d26464d1
RBR
56mac:
57 @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin)
58ifeq ($(tag),)
59 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package
60else
61 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package
62endif
63
c4b892b1
RBR
64ci:
65ifeq ($(GIT_REF),refs/heads/main)
b12f5ad8 66 $(MAKE) -e profile=release -e channel=unstable package
c4b892b1 67else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
b12f5ad8 68 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
c4b892b1
RBR
69endif
70
71.PHONY: default build $(architectures) rpm package prepare set_rust ci release