]>
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 | ||
a411ac34 RBR |
23 | release: rpm tar deb |
24 | @$(eval filename := $(app_name)-$(target)-$(channel)) | |
102424ed RBR |
25 | |
26 | $(architectures): | |
27 | ifneq ($(channel),) | |
28 | $(MAKE) -e channel=$(channel) -e target=$@ release | |
29 | else | |
30 | $(MAKE) -e target=$@ build | |
31 | endif | |
32 | ||
a411ac34 | 33 | deb: build |
d843a0b2 | 34 | ifeq ($(findstring linux,$(target)),linux) |
a411ac34 RBR |
35 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
36 | cargo deb --profile $(profile) --target $(target) | |
37 | mv target/$(target)/debian/*.deb $(filename).deb | |
38 | sha256sum $(filename).deb > $(filename).deb.sha256 | |
39 | rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
40 | rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
d843a0b2 | 41 | endif |
a411ac34 | 42 | |
102424ed | 43 | rpm: build |
d843a0b2 | 44 | ifeq ($(findstring linux,$(target)),linux) |
a411ac34 RBR |
45 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
46 | cargo generate-rpm --profile $(profile) --target $(target) | |
47 | mv target/$(target)/generate-rpm/*.rpm $(filename).rpm | |
48 | sha256sum $(filename).rpm > $(filename).rpm.sha256 | |
49 | rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
50 | rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
d843a0b2 | 51 | endif |
102424ed RBR |
52 | |
53 | tar: build | |
a411ac34 RBR |
54 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
55 | tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name) | |
56 | sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256 | |
57 | rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
58 | rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
102424ed RBR |
59 | |
60 | package: $(architectures) | |
61 | ||
d843a0b2 RBR |
62 | mac: |
63 | @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin) | |
64 | ifeq ($(tag),) | |
65 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package | |
66 | else | |
67 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package | |
68 | endif | |
69 | ||
102424ed RBR |
70 | ci: |
71 | ifeq ($(GIT_REF),refs/heads/main) | |
72 | $(MAKE) -e profile=release -e channel=unstable package | |
73 | else ifneq (,$(findstring refs/tags/,$(GIT_REF))) | |
74 | $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package | |
75 | endif | |
76 | ||
260e8ec6 | 77 | .PHONY: default build $(architectures) rpm package prepare set_rust ci release test coverage |