From f2e048c15ce755d211283302915d79eb4cac09ef Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sun, 5 May 2019 20:44:10 +0200 Subject: [PATCH] Add a Makefile --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ README.md | 7 ++----- 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..46b5b48 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +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: $(EXE_FILES) $(MAN_NAME) + +man: $(MAN_DST_DIR) $(MAN_FILES) + +$(EXE_NAMES): %: $(TARGET_DIR)/% + +$(EXE_FILES): $(TARGET_DIR)/%: %/Cargo.toml + cargo build --release --bin $(subst /Cargo.toml,,$<) + strip $@ + +$(MAN_DST_DIR): + @mkdir -p $(MAN_DST_DIR) + +$(MAN_DST_DIR)/%.gz: $(MAN_SRC_DIR)/% + gzip <$< >$@ + +install: + install -D --mode=0755 $(TARGET_DIR)/acmed $(DESTDIR)/usr/bin/acmed + install -D --mode=0755 $(TARGET_DIR)/tacd $(DESTDIR)/usr/bin/tacd + install -D --mode=0644 $(TARGET_DIR)/man/acmed.8.gz $(DESTDIR)/usr/share/man/man8/acmed.8.gz + install -D --mode=0644 $(TARGET_DIR)/man/acmed.toml.5.gz $(DESTDIR)/usr/share/man/man5/acmed.toml.5.gz + install -D --mode=0644 $(TARGET_DIR)/man/tacd.8.gz $(DESTDIR)/usr/share/man/man8/tacd.8.gz + install -D --mode=0644 acmed/acmed_example.toml $(DESTDIR)/etc/acmed/acmed.toml + install -d --mode=0700 $(DESTDIR)/etc/acmed/accounts + install -d --mode=0755 $(DESTDIR)/etc/acmed/certs + +clean: + cargo clean + +.PHONY: $(EXE_NAMES) all clean install man diff --git a/README.md b/README.md index daa778b..67e41fe 100644 --- a/README.md +++ b/README.md @@ -54,13 +54,10 @@ ACMEd depends on the OpenSSL. The minimal supported versions are those from the On systems based on Debian/Ubuntu, you may need to install the `libssl-dev`, `build-essential` and `pkg-config` packages. ``` -cargo build --release -strip target/release/acmed -strip target/release/tacd +$ make +$ make install ``` -The executables are located in the `target/release` directory. - ## Frequently Asked Questions