#!/usr/bin/make -f # Copyright (C) 2021-2023 David Sugar . # Use of this source code is governed by a MIT-style license # that can be found in the included LICENSE.md file. # This is more a convenience since you can drive the project entirely from # cargo for most cases. It also provides a simple way to use existing # source build based packaging systems. # Project constants PROJECT := $(shell grep ^name Cargo.toml|sed -e s/\"\s*$$// -e s/^.*\"//) VERSION := $(shell grep ^version Cargo.toml|sed -e s/\"\s*$$// -e s/^.*\"//) BINS := paths fdsum # Override configs DESTDIR = RELEASE = target/release PREFIX = /usr/local BINDIR = $(PREFIX)/bin DATADIR = $(PREFIX)/share MANDIR = $(DATADIR)/man MAN1 = $(MANDIR)/man1 DESTDIR = all: build required: Cargo.lock # Define or override env sinclude custom.mk .PHONY: all config install install: release @install -d -m 755 $(DESTDIR)$(BINDIR) @install -d -m 755 $(DESTDIR)$(MAN1) @for name in $(BINS) ; do \ install -s -m 755 $(RELEASE)/$${name} $(DESTDIR)$(BINDIR) ;\ install -m 644 src/man/$${name}.1 $(DESTDIR)$(MAN1) ;\ done version: @echo $(PROJECT) $(VERSION) $(DESTDIR) # Can override existing targets sinclude .make/*.mk