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.

41 lines
1.2 KiB

6 years ago
  1. TARGET_DIR = ./target/release
  2. EXE_NAMES = acmed \
  3. tacd
  4. EXE_FILES = $(foreach name,$(EXE_NAMES),$(TARGET_DIR)/$(name))
  5. MAN_SRC_DIR = ./man/en
  6. MAN_DST_DIR = $(TARGET_DIR)/man
  7. MAN_SRC = acmed.8 \
  8. acmed.toml.5 \
  9. tacd.8
  10. MAN_FILES = $(foreach name,$(MAN_SRC),$(MAN_DST_DIR)/$(name).gz)
  11. all: $(EXE_FILES) $(MAN_NAME)
  12. man: $(MAN_DST_DIR) $(MAN_FILES)
  13. $(EXE_NAMES): %: $(TARGET_DIR)/%
  14. $(EXE_FILES): $(TARGET_DIR)/%: %/Cargo.toml
  15. cargo build --release --bin $(subst /Cargo.toml,,$<)
  16. strip $@
  17. $(MAN_DST_DIR):
  18. @mkdir -p $(MAN_DST_DIR)
  19. $(MAN_DST_DIR)/%.gz: $(MAN_SRC_DIR)/%
  20. gzip <$< >$@
  21. install:
  22. install -D --mode=0755 $(TARGET_DIR)/acmed $(DESTDIR)/usr/bin/acmed
  23. install -D --mode=0755 $(TARGET_DIR)/tacd $(DESTDIR)/usr/bin/tacd
  24. install -D --mode=0644 $(TARGET_DIR)/man/acmed.8.gz $(DESTDIR)/usr/share/man/man8/acmed.8.gz
  25. install -D --mode=0644 $(TARGET_DIR)/man/acmed.toml.5.gz $(DESTDIR)/usr/share/man/man5/acmed.toml.5.gz
  26. install -D --mode=0644 $(TARGET_DIR)/man/tacd.8.gz $(DESTDIR)/usr/share/man/man8/tacd.8.gz
  27. install -D --mode=0644 acmed/acmed_example.toml $(DESTDIR)/etc/acmed/acmed.toml
  28. install -d --mode=0700 $(DESTDIR)/etc/acmed/accounts
  29. install -d --mode=0755 $(DESTDIR)/etc/acmed/certs
  30. clean:
  31. cargo clean
  32. .PHONY: $(EXE_NAMES) all clean install man