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