]>
Commit | Line | Data |
---|---|---|
a04ba49c 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 | |
43780806 | 4 | app_name := blog |
d620665f RBR |
5 | |
6 | default: build | |
7 | ||
5c7a9258 RBR |
8 | set_rust: |
9 | rustup default stable | |
10 | ||
a04ba49c RBR |
11 | prepare: |
12 | rustup target add $(target) | |
d620665f | 13 | |
a04ba49c RBR |
14 | build: prepare |
15 | cargo build --profile $(profile) --target $(target) | |
16 | ||
94b6e2ec | 17 | release: rpm tar dab |
4dfd8d3d | 18 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
c4b892b1 | 19 | |
a04ba49c | 20 | $(architectures): |
c4b892b1 RBR |
21 | ifneq ($(channel),) |
22 | $(MAKE) -e channel=$(channel) -e target=$@ release | |
43780806 RBR |
23 | else |
24 | $(MAKE) -e target=$@ build | |
c4b892b1 | 25 | endif |
a04ba49c | 26 | |
94b6e2ec RBR |
27 | deb: build |
28 | @$(eval filename := $(app_name)-$(target)-$(channel)) | |
29 | cargo deb --profile $(profile) --target $(target) | |
30 | mv target/$(target)/deb/*.deb $(filename).deb | |
31 | sha256sum $(filename).deb > $(filename).deb.sha256 | |
32 | rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
33 | rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
34 | ||
a04ba49c | 35 | rpm: build |
6b85c7c4 RBR |
36 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
37 | cargo generate-rpm --profile $(profile) --target $(target) | |
38 | mv target/$(target)/generate-rpm/*.rpm $(filename).rpm | |
39 | sha256sum $(filename).rpm > $(filename).rpm.sha256 | |
40 | rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
41 | rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
a04ba49c | 42 | |
43780806 | 43 | tar: build |
4dfd8d3d RBR |
44 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
45 | tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name) | |
6b85c7c4 | 46 | sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256 |
27c166eb | 47 | rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) |
6b85c7c4 | 48 | rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) |
43780806 | 49 | |
a04ba49c RBR |
50 | package: $(architectures) |
51 | ||
c4b892b1 RBR |
52 | ci: |
53 | ifeq ($(GIT_REF),refs/heads/main) | |
b12f5ad8 | 54 | $(MAKE) -e profile=release -e channel=unstable package |
c4b892b1 | 55 | else ifneq (,$(findstring refs/tags/,$(GIT_REF))) |
b12f5ad8 | 56 | $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package |
c4b892b1 RBR |
57 | endif |
58 | ||
59 | .PHONY: default build $(architectures) rpm package prepare set_rust ci release |