Browse Source

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).
pull/35/head
Rodolphe Breard 4 years ago
parent
commit
a5b59e7ba1
  1. 6
      CHANGELOG.md
  2. 35
      Makefile

6
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

35
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
Loading…
Cancel
Save