You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. PREFIX = /usr
  2. EXEC_PREFIX = $(PREFIX)
  3. BINDIR = $(EXEC_PREFIX)/bin
  4. DATAROOTDIR = $(PREFIX)/share
  5. DATADIR = $(DATAROOTDIR)
  6. SYSCONFDIR = /etc
  7. TARGET_DIR = ./target/release
  8. EXE_NAMES = acmed \
  9. tacd
  10. EXE_FILES = $(foreach name,$(EXE_NAMES),$(TARGET_DIR)/$(name))
  11. MAN_SRC_DIR = ./man/en
  12. MAN_DST_DIR = $(TARGET_DIR)/man
  13. MAN_SRC = acmed.8 \
  14. acmed.toml.5 \
  15. tacd.8
  16. MAN_FILES = $(foreach name,$(MAN_SRC),$(MAN_DST_DIR)/$(name).gz)
  17. all: update $(EXE_FILES) man
  18. man: $(MAN_DST_DIR) $(MAN_FILES)
  19. $(EXE_NAMES): %: $(TARGET_DIR)/%
  20. $(EXE_FILES): $(TARGET_DIR)/%: %/Cargo.toml
  21. cargo build --release --bin $(subst /Cargo.toml,,$<)
  22. strip $@
  23. $(MAN_DST_DIR):
  24. @mkdir -p $(MAN_DST_DIR)
  25. $(MAN_DST_DIR)/%.gz: $(MAN_SRC_DIR)/%
  26. gzip <"$<" >"$@"
  27. update:
  28. cargo update
  29. install:
  30. install -D -m 0755 $(TARGET_DIR)/acmed $(DESTDIR)$(BINDIR)/acmed
  31. install -D -m 0755 $(TARGET_DIR)/tacd $(DESTDIR)$(BINDIR)/tacd
  32. install -D -m 0644 $(TARGET_DIR)/man/acmed.8.gz $(DESTDIR)$(DATADIR)/man/man8/acmed.8.gz
  33. install -D -m 0644 $(TARGET_DIR)/man/acmed.toml.5.gz $(DESTDIR)$(DATADIR)/man/man5/acmed.toml.5.gz
  34. install -D -m 0644 $(TARGET_DIR)/man/tacd.8.gz $(DESTDIR)$(DATADIR)/man/man8/tacd.8.gz
  35. install -D -m 0644 acmed/config/acmed.toml $(DESTDIR)$(SYSCONFDIR)/acmed/acmed.toml
  36. install -D -m 0644 acmed/config/default_hooks.toml $(DESTDIR)$(SYSCONFDIR)/acmed/default_hooks.toml
  37. install -d -m 0700 $(DESTDIR)$(SYSCONFDIR)/acmed/accounts
  38. install -d -m 0755 $(DESTDIR)$(SYSCONFDIR)/acmed/certs
  39. clean:
  40. cargo clean
  41. .PHONY: $(EXE_NAMES) all clean install man update