From a5b59e7ba145de09d4066bbbe28a64c345574cad Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sun, 2 Aug 2020 13:14:24 +0200 Subject: [PATCH] Refactor the Makefile The previous version of the Makefile used features which are specific to GNU Make and therefore does not works on BSD systems. This new version, which is much more simpler, works both on GNU Make and BSD Make (tested on FreeBSD 12.1). --- CHANGELOG.md | 6 ++++++ Makefile | 35 ++++++++++++++--------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62bdefb..740c40a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed +- The Makefile now works on FreeBSD. It should also work on other BSD although it has not been tested. + + ## [0.9.0] - 2020-08-01 ### Added diff --git a/Makefile b/Makefile index dec4bef..c42dc94 100644 --- a/Makefile +++ b/Makefile @@ -5,34 +5,27 @@ DATAROOTDIR = $(PREFIX)/share DATADIR = $(DATAROOTDIR) SYSCONFDIR = /etc TARGET_DIR = ./target/release -EXE_NAMES = acmed \ - tacd -EXE_FILES = $(foreach name,$(EXE_NAMES),$(TARGET_DIR)/$(name)) MAN_SRC_DIR = ./man/en MAN_DST_DIR = $(TARGET_DIR)/man -MAN_SRC = acmed.8 \ - acmed.toml.5 \ - tacd.8 -MAN_FILES = $(foreach name,$(MAN_SRC),$(MAN_DST_DIR)/$(name).gz) -all: update $(EXE_FILES) man +all: update acmed tacd man -man: $(MAN_DST_DIR) $(MAN_FILES) +update: + cargo update -$(EXE_NAMES): %: $(TARGET_DIR)/% +acmed: + cargo build --release --bin acmed + strip "$(TARGET_DIR)/acmed" -$(EXE_FILES): $(TARGET_DIR)/%: %/Cargo.toml - cargo build --release --bin $(subst /Cargo.toml,,$<) - strip $@ +tacd: + cargo build --release --bin tacd + strip "$(TARGET_DIR)/tacd" -$(MAN_DST_DIR): +man: @mkdir -p $(MAN_DST_DIR) - -$(MAN_DST_DIR)/%.gz: $(MAN_SRC_DIR)/% - gzip <"$<" >"$@" - -update: - cargo update + gzip <"$(MAN_SRC_DIR)/acmed.8" >"$(MAN_DST_DIR)/acmed.8.gz" + gzip <"$(MAN_SRC_DIR)/acmed.toml.5" >"$(MAN_DST_DIR)/acmed.toml.5.gz" + gzip <"$(MAN_SRC_DIR)/tacd.8" >"$(MAN_DST_DIR)/tacd.8.gz" install: install -D -m 0755 $(TARGET_DIR)/acmed $(DESTDIR)$(BINDIR)/acmed @@ -48,4 +41,4 @@ install: clean: cargo clean -.PHONY: $(EXE_NAMES) all clean install man update +.PHONY: all update acmed tacd man install clean