diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 43 |
1 files changed, 28 insertions, 15 deletions
@@ -4,6 +4,7 @@ architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu app_name := map deploy_host := deploy@build.r.bdr.sh deploy_path := /srv/http/build.r.bdr.sh/$(app_name) +install_path := /usr/local/bin/$(app_name) define sign_and_deploy @./scripts/sign.sh "$(1)" "$(channel)" "$(architecture)" @@ -17,11 +18,18 @@ set_rust: rustup default stable prepare: +ifneq ($(skip_prepare),1) rustup target add $(target) +endif + +# Build ######################################################################## build: prepare + @$(eval target_dir := ./target/$(target)/$(profile)/map) cargo build --profile $(profile) --target $(target) +# Code Quality ################################################################# + test: cargo test @@ -34,15 +42,15 @@ format: lint: cargo fmt -- --check && cargo clippy +# Packaging #################################################################### + +package: $(architectures) + release: rpm tar deb @$(eval filename := $(app_name)-$(target)-$(channel)) -$(architectures): -ifneq ($(channel),) - $(MAKE) -e channel=$(channel) -e target=$@ release -else - $(MAKE) -e target=$@ build -endif +flatpak: + @flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo --install builddir ./build-aux/systems.tranquil.Map.yml deb: build ifeq ($(findstring linux,$(target)),linux) @@ -65,15 +73,12 @@ tar: build tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name) @$(call sign_and_deploy,$(filename).tar.gz) -package: $(architectures) +# Distribution ################################################################# -mac: - @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin) -ifeq ($(tag),) - $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package -else - $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package -endif +install: build + @cp target/$(target)/$(profile)/ $(install_path) + +# CI ########################################################################### ci: lint coverage ifeq ($(GIT_REF),refs/heads/main) @@ -82,4 +87,12 @@ else ifneq (,$(findstring refs/tags/,$(GIT_REF))) $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package endif -.PHONY: default build $(architectures) rpm package prepare set_rust ci release test coverage format +$(architectures): +ifneq ($(channel),) + $(MAKE) -e channel=$(channel) -e target=$@ release +else + $(MAKE) -e target=$@ build +endif + + +.PHONY: default build $(architectures) rpm package prepare set_rust ci release test coverage format flatpak |