SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
APP := jdkman
DESTDIR ?=
PREFIX ?= /usr/local
CARGOFLAGS ?=
all: build
build: target/release/$(APP)
install: $(DESTDIR)$(PREFIX)/bin/$(APP)
uninstall:
> -rm -- "$(DESTDIR)$(PREFIX)/bin/$(APP)"
check: target/debug/$(APP)
test: .cargoinstalled
> cargo test --all --all-targets --all-features
clean: .cargoinstalled
> cargo clean
.PHONY: all build clean install uninstall check test
target/debug/$(APP): .cargoinstalled Cargo.toml Cargo.lock $(shell find . \( -path './src*' -or -path './crates*' \) -type f)
> cargo build --bin $(APP)
target/release/$(APP): .cargoinstalled Cargo.toml Cargo.lock $(shell find . \( -path './src*' -or -path './crates*' \) -type f)
> RUSTFLAGS="-C link-arg=-s -C opt-level=3 -C target-cpu=native --emit=asm" cargo build $(CARGOFLAGS) --package $(APP) --release
$(DESTDIR)$(PREFIX)/bin/$(APP): target/release/$(APP)
> install -m755 -- target/release/$(APP) "$(DESTDIR)$(PREFIX)/bin/"
.cargoinstalled:
> @if ! command -v cargo 2> /dev/null
> @then
> @echo "Cargo is not installed. Please visit 'https://rustup.rs/' and follow their instructions, or try to run 'curl --proto \"=https\" --tlsv1.2 -sSf https://sh.rustup.rs | sh'"
> @exit 1
> @fi
> touch .cargoinstalled