]>
Commit | Line | Data |
---|---|---|
102424ed 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 | |
4 | app_name := page | |
48ea9080 RBR |
5 | |
6 | default: build | |
7 | ||
102424ed RBR |
8 | set_rust: |
9 | rustup default stable | |
48ea9080 | 10 | |
102424ed RBR |
11 | prepare: |
12 | rustup target add $(target) | |
13 | ||
14 | build: prepare | |
15 | cargo build --profile $(profile) --target $(target) | |
16 | ||
260e8ec6 RBR |
17 | test: |
18 | cargo test | |
19 | ||
20 | coverage: | |
21 | cargo tarpaulin | |
22 | ||
5732d284 RBR |
23 | format: |
24 | cargo fmt && cargo clippy --fix | |
25 | ||
26 | lint: | |
27 | cargo fmt -- --check && cargo clippy | |
28 | ||
a411ac34 RBR |
29 | release: rpm tar deb |
30 | @$(eval filename := $(app_name)-$(target)-$(channel)) | |
102424ed RBR |
31 | |
32 | $(architectures): | |
33 | ifneq ($(channel),) | |
34 | $(MAKE) -e channel=$(channel) -e target=$@ release | |
35 | else | |
36 | $(MAKE) -e target=$@ build | |
37 | endif | |
38 | ||
a411ac34 | 39 | deb: build |
d843a0b2 | 40 | ifeq ($(findstring linux,$(target)),linux) |
a411ac34 RBR |
41 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
42 | cargo deb --profile $(profile) --target $(target) | |
43 | mv target/$(target)/debian/*.deb $(filename).deb | |
44 | sha256sum $(filename).deb > $(filename).deb.sha256 | |
45 | rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
46 | rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
d843a0b2 | 47 | endif |
a411ac34 | 48 | |
102424ed | 49 | rpm: build |
d843a0b2 | 50 | ifeq ($(findstring linux,$(target)),linux) |
a411ac34 RBR |
51 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
52 | cargo generate-rpm --profile $(profile) --target $(target) | |
53 | mv target/$(target)/generate-rpm/*.rpm $(filename).rpm | |
54 | sha256sum $(filename).rpm > $(filename).rpm.sha256 | |
55 | rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
56 | rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
d843a0b2 | 57 | endif |
102424ed RBR |
58 | |
59 | tar: build | |
a411ac34 RBR |
60 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
61 | tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name) | |
62 | sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256 | |
63 | rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
64 | rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
102424ed RBR |
65 | |
66 | package: $(architectures) | |
67 | ||
d843a0b2 RBR |
68 | mac: |
69 | @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin) | |
70 | ifeq ($(tag),) | |
71 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package | |
72 | else | |
73 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package | |
74 | endif | |
75 | ||
5732d284 | 76 | ci: lint coverage |
102424ed RBR |
77 | ifeq ($(GIT_REF),refs/heads/main) |
78 | $(MAKE) -e profile=release -e channel=unstable package | |
79 | else ifneq (,$(findstring refs/tags/,$(GIT_REF))) | |
80 | $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package | |
81 | endif | |
82 | ||
5732d284 | 83 | .PHONY: default build $(architectures) rpm package prepare set_rust ci release test coverage format |