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.

66 lines
2.6 KiB

6 years ago
6 years ago
6 years ago
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. MAN5DIR = $(DATADIR)/man/man5
  7. MAN8DIR = $(DATADIR)/man/man8
  8. SYSCONFDIR = /etc
  9. VARLIBDIR = /var/lib
  10. RUNSTATEDIR = /var/run
  11. TARGET_DIR = ./target/$(TARGET)/release
  12. MAN_SRC_DIR = ./man/en
  13. MAN_DST_DIR = $(TARGET_DIR)/man
  14. FEATURES = openssl_dyn
  15. all: update acmed tacd
  16. update:
  17. cargo update
  18. acmed: man_dir
  19. if test -n "$(TARGET)"; then \
  20. VARLIBDIR="$(VARLIBDIR)" SYSCONFDIR="$(SYSCONFDIR)" RUNSTATEDIR="$(RUNSTATEDIR)" cargo build --release --manifest-path "acmed/Cargo.toml" --no-default-features --features "$(FEATURES)" --target "$(TARGET)"; \
  21. else \
  22. VARLIBDIR="$(VARLIBDIR)" SYSCONFDIR="$(SYSCONFDIR)" RUNSTATEDIR="$(RUNSTATEDIR)" cargo build --release --manifest-path "acmed/Cargo.toml" --no-default-features --features "$(FEATURES)"; \
  23. fi
  24. strip "$(TARGET_DIR)/acmed"
  25. gzip <"$(MAN_SRC_DIR)/acmed.8" >"$(MAN_DST_DIR)/acmed.8.gz"
  26. gzip <"$(MAN_SRC_DIR)/acmed.toml.5" >"$(MAN_DST_DIR)/acmed.toml.5.gz"
  27. tacd: man_dir
  28. if test -n "$(TARGET)"; then \
  29. VARLIBDIR="$(VARLIBDIR)" SYSCONFDIR="$(SYSCONFDIR)" RUNSTATEDIR="$(RUNSTATEDIR)" cargo build --release --manifest-path "tacd/Cargo.toml" --no-default-features --features "$(FEATURES)" --target "$(TARGET)"; \
  30. else \
  31. VARLIBDIR="$(VARLIBDIR)" SYSCONFDIR="$(SYSCONFDIR)" RUNSTATEDIR="$(RUNSTATEDIR)" cargo build --release --manifest-path "tacd/Cargo.toml" --no-default-features --features "$(FEATURES)"; \
  32. fi
  33. strip "$(TARGET_DIR)/tacd"
  34. gzip <"$(MAN_SRC_DIR)/tacd.8" >"$(MAN_DST_DIR)/tacd.8.gz"
  35. man_dir:
  36. @mkdir -p $(MAN_DST_DIR)
  37. install:
  38. install -d -m 0755 $(DESTDIR)$(BINDIR)
  39. install -d -m 0755 $(DESTDIR)$(MAN8DIR)
  40. if test -f "$(TARGET_DIR)/acmed"; then \
  41. install -d -m 0755 $(DESTDIR)$(MAN5DIR); \
  42. install -d -m 0755 $(DESTDIR)$(SYSCONFDIR)/acmed; \
  43. install -d -m 0755 $(DESTDIR)$(VARLIBDIR)/acmed/certs; \
  44. install -d -m 0700 $(DESTDIR)$(VARLIBDIR)/acmed/accounts; \
  45. install -m 0755 $(TARGET_DIR)/acmed $(DESTDIR)$(BINDIR)/acmed; \
  46. install -m 0644 $(TARGET_DIR)/man/acmed.8.gz $(DESTDIR)$(MAN8DIR)/acmed.8.gz; \
  47. install -m 0644 $(TARGET_DIR)/man/acmed.toml.5.gz $(DESTDIR)$(MAN5DIR)/acmed.toml.5.gz; \
  48. install -m 0644 acmed/config/acmed.toml $(DESTDIR)$(SYSCONFDIR)/acmed/acmed.toml; \
  49. install -m 0644 acmed/config/default_hooks.toml $(DESTDIR)$(SYSCONFDIR)/acmed/default_hooks.toml; \
  50. fi
  51. if test -f "$(TARGET_DIR)/tacd"; then \
  52. install -m 0755 $(TARGET_DIR)/tacd $(DESTDIR)$(BINDIR)/tacd; \
  53. install -m 0644 $(TARGET_DIR)/man/tacd.8.gz $(DESTDIR)$(MAN8DIR)/tacd.8.gz; \
  54. fi
  55. clean:
  56. cargo clean
  57. .PHONY: all update acmed tacd man_dir install clean