]>
Commit | Line | Data |
---|---|---|
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 := blog | |
5 | ||
6 | default: build | |
7 | ||
8 | set_rust: | |
9 | rustup default stable | |
10 | ||
11 | prepare: | |
12 | rustup target add $(target) | |
13 | ||
14 | build: prepare | |
15 | cargo build --profile $(profile) --target $(target) | |
16 | ||
17 | release: rpm tar | |
18 | @$(eval filename := $(app_name)-$(target)-$(channel)) | |
19 | rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
20 | ||
21 | $(architectures): | |
22 | ifneq ($(channel),) | |
23 | $(MAKE) -e channel=$(channel) -e target=$@ release | |
24 | else | |
25 | $(MAKE) -e target=$@ build | |
26 | endif | |
27 | ||
28 | rpm: build | |
29 | cargo generate-rpm --profile $(profile) --target $(target) | |
30 | ||
31 | tar: build | |
32 | @$(eval filename := $(app_name)-$(target)-$(channel)) | |
33 | tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name) | |
34 | ||
35 | package: $(architectures) | |
36 | ||
37 | ci: | |
38 | ifeq ($(GIT_REF),refs/heads/main) | |
39 | $(MAKE) -e profile=release -e channel=unstable package | |
40 | else ifneq (,$(findstring refs/tags/,$(GIT_REF))) | |
41 | $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package | |
42 | endif | |
43 | ||
44 | .PHONY: default build $(architectures) rpm package prepare set_rust ci release |