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.

47 lines
1.4 KiB

6 years ago
6 years ago
  1. PREFIX = /usr/local
  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: $(EXE_FILES) $(MAN_NAME)
  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. install:
  28. install -D --mode=0755 $(TARGET_DIR)/acmed $(DESTDIR)$(BINDIR)/acmed
  29. install -D --mode=0755 $(TARGET_DIR)/tacd $(DESTDIR)$(BINDIR)/tacd
  30. install -D --mode=0644 $(TARGET_DIR)/man/acmed.8.gz $(DESTDIR)$(DATADIR)/man/man8/acmed.8.gz
  31. install -D --mode=0644 $(TARGET_DIR)/man/acmed.toml.5.gz $(DESTDIR)$(DATADIR)/man/man5/acmed.toml.5.gz
  32. install -D --mode=0644 $(TARGET_DIR)/man/tacd.8.gz $(DESTDIR)$(DATADIR)/man/man8/tacd.8.gz
  33. install -D --mode=0644 acmed/acmed_example.toml $(DESTDIR)$(SYSCONFDIR)/acmed/acmed.toml
  34. install -d --mode=0700 $(DESTDIR)$(SYSCONFDIR)/acmed/accounts
  35. install -d --mode=0755 $(DESTDIR)$(SYSCONFDIR)/etc/acmed/certs
  36. clean:
  37. cargo clean
  38. .PHONY: $(EXE_NAMES) all clean install man