unix/fiss

adding install-commands to Makefile (13e8383aee5d80b4fefb3a334f26430f88899d5b)
Repositories | LICENSE

commit 13e8383aee5d80b4fefb3a334f26430f88899d5b
parent da2d66e0ebbd2b1dd413bece35776acaf82737ea
Author: Friedel Schön <[email protected]>
Date:   Thu,  8 Jun 2023 15:03:03 +0200

adding install-commands to Makefile

Diffstat:
MMakefile7+++----
Mdocs/index.txt2+-
Rman/vlogger.1.txt -> man/vlogger.8.txt0
Mmk/binary.mk2++
Mmk/config.mk7+++++++
Amk/install.mk38++++++++++++++++++++++++++++++++++++++
6 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -6,9 +6,7 @@ VERSION := 0.3.3 SOURCE_FILES := $(wildcard $(SRC_DIR)/*.c) EXEC_FILES := $(wildcard $(BIN_DIR)/*) OBJ_FILES := $(patsubst $(SRC_DIR)/%.c,$(TARGET_OBJECT_DIR)/%.o,$(SOURCE_FILES)) -BIN_FILES := $(patsubst $(BIN_DIR)/%.c,$(TARGET_BIN_DIR)/%,$(EXEC_FILES)) \ - $(patsubst $(BIN_DIR)/%.sh,$(TARGET_BIN_DIR)/%,$(EXEC_FILES)) \ - $(patsubst $(BIN_DIR)/%.lnk,$(TARGET_BIN_DIR)/%,$(EXEC_FILES)) +BIN_FILES := $(patsubst %,$(TARGET_BIN_DIR)/%,$(BINARIES)) INCLUDE_FILES := $(wildcard $(INCLUDE_DIR)/*.h) MAN_FILES := $(wildcard $(MAN_DIR)/*.txt) @@ -16,7 +14,7 @@ TEMPL_FILES := $(wildcard $(DOCS_DIR)/*.txt) ROFF_FILES := $(patsubst $(MAN_DIR)/%.txt,$(TARGET_MAN_DIR)/%,$(MAN_FILES)) DOCS_FILES := $(patsubst $(DOCS_DIR)/%.txt,$(TARGET_DOCS_DIR)/%.html,$(TEMPL_FILES)) \ - $(patsubst $(MAN_DIR)/%.txt,$(TARGET_DOCS_DIR)/%.html,$(MAN_FILES)) + $(patsubst $(MAN_DIR)/%.txt,$(TARGET_DOCS_DIR)/%.html,$(MAN_FILES)) ifeq ($(VERBOSE),) SILENT := @ @@ -43,3 +41,4 @@ manual: $(ROFF_FILES) documentation: $(DOCS_FILES) include mk/target.mk +include mk/install.mk diff --git a/docs/index.txt b/docs/index.txt @@ -27,7 +27,7 @@ other *daemontools*-based utilities. [*sigremap(8)*](sigremap.8.html) - catches signals and redirects mapped signal to executable -[*vlogger(1)*](vlogger.1.html) - log messages to syslog or an arbitrary executable +[*vlogger(8)*](vlogger.8.html) - log messages to syslog or an arbitrary executable [*zzz(8)*](zzz.8.html) - suspend or hibernate your system @endlist diff --git a/man/vlogger.1.txt b/man/vlogger.8.txt diff --git a/mk/binary.mk b/mk/binary.mk @@ -1,3 +1,5 @@ +BINARIES := chpst finit fsvc fsvs halt init modules-load poweroff reboot seedrng shutdown sigremap vlogger zzz + chpst_OBJECTS := parse.o util.o finit_OBJECTS := message.o util.o diff --git a/mk/config.mk b/mk/config.mk @@ -7,6 +7,13 @@ ASSETS_DIR := assets TOOLS_DIR := tools TARGET_DIR := target +INSTALL_PREFIX := / +INSTALL_SBIN := /sbin +INSTALL_SHARE := /usr/share +INSTALL_MAN8 := /usr/share/man/man8 +INSTALL_DOCS := /usr/share/doc/fiss +INSTALL_ETC := /etc + TARGET_OBJECT_DIR := $(TARGET_DIR)/obj TARGET_BIN_DIR := $(TARGET_DIR)/bin TARGET_MAN_DIR := $(TARGET_DIR)/man diff --git a/mk/install.mk b/mk/install.mk @@ -0,0 +1,38 @@ +.PHONY: install install-binary install-documentation install-binary install-share install-etc + +install: install-binary \ + install-documentation \ + install-manual \ + install-share \ + install-etc + +install-binary: $(BIN_FILES) + @install -vd $(INSTALL_PREFIX)/$(INSTALL_SBIN) + @for file in $(BIN_FILES); do \ + install -v -m 755 $$file $(INSTALL_PREFIX)/$(INSTALL_SBIN); \ + done + +install-documentation: $(DOCS_FILES) + @install -vd $(INSTALL_PREFIX)/$(INSTALL_DOCS) + @for file in $(DOCS_FILES); do \ + install -v -m 644 $$file $(INSTALL_PREFIX)/$(INSTALL_DOCS); \ + done + +install-manual: $(ROFF_FILES) + @install -vd $(INSTALL_PREFIX)/$(INSTALL_MAN8) + @for file in $(ROFF_FILES); do \ + install -v -m 644 $$file $(INSTALL_PREFIX)/$(INSTALL_MAN8); \ + done + +install-share: + @install -vd $(INSTALL_PREFIX)/$(INSTALL_SHARE)/fiss + @for file in share/fiss/*; do \ + install -v -m 644 $$file $(INSTALL_PREFIX)/$(INSTALL_SHARE)/fiss; \ + done + +install-etc: + @install -vd $(INSTALL_PREFIX)/$(INSTALL_ETC)/service.d + @install -vd $(INSTALL_PREFIX)/$(INSTALL_ETC)/start.d + @install -vd $(INSTALL_PREFIX)/$(INSTALL_ETC)/stop.d + @install -vd $(INSTALL_PREFIX)/$(INSTALL_ETC)/zzz.d/resume + @install -vd $(INSTALL_PREFIX)/$(INSTALL_ETC)/zzz.d/suspend