]> git.r.bdr.sh - rbdr/blog/blob - Makefile
0a4d393e8b44e261ef8b617dff425de8c02a2680
[rbdr/blog] / Makefile
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
5 default: build
6
7 set_rust:
8 rustup default stable
9
10 prepare:
11 rustup target add $(target)
12
13 build: prepare
14 cargo build --profile $(profile) --target $(target)
15
16 release:
17 @echo "Releasing target/$(target)/$(profile) to $(channel)"
18
19 $(architectures):
20 $(MAKE) -e target=$@ rpm
21 ifneq ($(channel),)
22 $(MAKE) -e channel=$(channel) -e target=$@ release
23 endif
24
25 rpm: build
26
27 package: $(architectures)
28
29 ci:
30 ifeq ($(GIT_REF),refs/heads/main)
31 $(MAKE) -e profile=release -e channel=unstable package
32 else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
33 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
34 endif
35
36 .PHONY: default build $(architectures) rpm package prepare set_rust ci release