From 5da0abd10199a154aeaccd6792e2dc1df8da3c23 Mon Sep 17 00:00:00 2001 From: nega Date: Mon, 10 Feb 2025 22:46:05 -0500 Subject: [PATCH 1/3] prefer to be explicit when constructing paths This makes things more clear when looking at `find`, "shell", and `make` syntax on one line (and removes double slashes in the output.) Signed-off-by: nega --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 687dc93f..cff7322d 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ CFG_DIR := $(PREFIX)/etc BIN_DIR := $(PREFIX)/bin LIB_DIR := $(PREFIX)/lib/lcov MAN_DIR := $(PREFIX)/share/man -SHARE_DIR := $(PREFIX)/share/lcov/ +SHARE_DIR := $(PREFIX)/share/lcov SCRIPT_DIR := $(SHARE_DIR)/support-scripts CFG_INST_DIR := $(DESTDIR)$(CFG_DIR) @@ -159,8 +159,8 @@ install: mkdir -p $(SHARE_INST_DIR) for d in example tests ; do \ ( cd $$d ; make clean ) ; \ - find $$d -type d -exec mkdir -p "$(SHARE_INST_DIR){}" \; ; \ - find $$d -type f -exec $(INSTALL) -Dm 644 "{}" "$(SHARE_INST_DIR){}" \; ; \ + find $$d -type d -exec mkdir -p "$(SHARE_INST_DIR)/{}" \; ; \ + find $$d -type f -exec $(INSTALL) -Dm 644 "{}" "$(SHARE_INST_DIR)/{}" \; ; \ done ; @chmod -R ugo+x $(SHARE_INST_DIR)/tests/bin @find $(SHARE_INST_DIR)/tests \( -name '*.sh' -o -name '*.pl' \) -exec chmod ugo+x {} \; From a4c90db5361db326b80de2b8e675a93793062cad Mon Sep 17 00:00:00 2001 From: nega Date: Mon, 10 Feb 2025 23:11:50 -0500 Subject: [PATCH 2/3] fix aggressive "rm -rf" with a less aggressive "rm -rf" `make uninstall` deletes `$(PREFIX)/share` instead of `$(PREFIX)/share/lcov` with `rm -rf`. This is surprising. This patch fixes that unconditional delete by deleting `$(PREFIX)/share/lcov`. This is still not optimal, and wouldn't be necessary if the tests were not installed. This patch also cleans up the installed manpages. Signed-off-by: nega --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cff7322d..65b40c85 100644 --- a/Makefile +++ b/Makefile @@ -180,14 +180,20 @@ uninstall: $(call echocmd," UNINST $(SCRIPT_INST_DIR)/$$s") \ $(RM) -f $(SCRIPT_INST_DIR)/$$s ; \ done - rmdir --ignore-fail-on-non-empty $(SCRIPT_INST_DIR) + rmdir --ignore-fail-on-non-empty $(SCRIPT_INST_DIR) || true for l in $(LIBS) ; do \ $(call echocmd," UNINST $(LIB_INST_DIR)/$$l") \ $(RM) -f $(LIB_INST_DIR)/$$l ; \ done rmdir --ignore-fail-on-non-empty $(LIB_INST_DIR) || true - rmdir `dirname $(LIB_INST_DIR)` || true - rm -rf `dirname $(SHARE_INST_DIR)` + for m in $(MANPAGES) ; do \ + $(call echocmd," UNINST $(MAN_INST_DIR)/$$m") \ + $(RM) -f $(MAN_INST_DIR)/$$m ; \ + done + rmdir --ignore-fail-on-non-empty $(MAN_INST_DIR)/man5 || true + rmdir --ignore-fail-on-non-empty $(MAN_INST_DIR)/man1 || true + rmdir --ignore-fail-on-non-empty $(MAN_INST_DIR) || true + $(RM) -rf $(SHARE_INST_DIR) $(call echocmd," UNINST $(CFG_INST_DIR)/lcovrc") $(RM) -f $(CFG_INST_DIR)/lcovrc rmdir --ignore-fail-on-non-empty $(CFG_INST_DIR) || true From e142ff3ce05bfa2d91a5fc4b502f8aad3b2e670b Mon Sep 17 00:00:00 2001 From: nega Date: Mon, 10 Feb 2025 23:54:47 -0500 Subject: [PATCH 3/3] remove examples and tests from the install target This eliminates the need for `rm -rf` in the uninstall target. Signed-off-by: nega --- Makefile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 65b40c85..0f799738 100644 --- a/Makefile +++ b/Makefile @@ -157,13 +157,6 @@ install: done ; \ done mkdir -p $(SHARE_INST_DIR) - for d in example tests ; do \ - ( cd $$d ; make clean ) ; \ - find $$d -type d -exec mkdir -p "$(SHARE_INST_DIR)/{}" \; ; \ - find $$d -type f -exec $(INSTALL) -Dm 644 "{}" "$(SHARE_INST_DIR)/{}" \; ; \ - done ; - @chmod -R ugo+x $(SHARE_INST_DIR)/tests/bin - @find $(SHARE_INST_DIR)/tests \( -name '*.sh' -o -name '*.pl' \) -exec chmod ugo+x {} \; $(INSTALL) -d -m 755 $(CFG_INST_DIR) $(call echocmd," INSTALL $(CFG_INST_DIR)/lcovrc") $(INSTALL) -m 644 lcovrc $(CFG_INST_DIR)/lcovrc @@ -193,7 +186,7 @@ uninstall: rmdir --ignore-fail-on-non-empty $(MAN_INST_DIR)/man5 || true rmdir --ignore-fail-on-non-empty $(MAN_INST_DIR)/man1 || true rmdir --ignore-fail-on-non-empty $(MAN_INST_DIR) || true - $(RM) -rf $(SHARE_INST_DIR) + rmdir --ignore-fail-on-non-empty $(SHARE_INST_DIR) || true $(call echocmd," UNINST $(CFG_INST_DIR)/lcovrc") $(RM) -f $(CFG_INST_DIR)/lcovrc rmdir --ignore-fail-on-non-empty $(CFG_INST_DIR) || true