summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-04-29 19:09:16 +0200
committerAlejandro Colomar <alx@kernel.org>2023-04-29 19:17:49 +0200
commita4452bfcc74f2e56070c65b82f06392e58209c7f (patch)
treef97f869356fb5d0c827ef6943090d6f170ebfcc2
parent6a8196fb934118d1794c2673985a7469edb0f0a7 (diff)
*.mk: Don't rmdir
There's no need; we can leave empty dirs on 'make uninstall', and it allows some simplifications. We don't need the FORCE target anymore, and don't need some directory variables either. While at it, I found some unused variable that should have been removed a long time ago: $installdirs_manX Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--Makefile5
-rw-r--r--share/mk/cmd.mk1
-rw-r--r--share/mk/install/_.mk4
-rw-r--r--share/mk/install/html.mk5
-rw-r--r--share/mk/install/man.mk31
-rw-r--r--share/mk/src.mk2
6 files changed, 3 insertions, 45 deletions
diff --git a/Makefile b/Makefile
index 411aa5ad2..dd9d527bf 100644
--- a/Makefile
+++ b/Makefile
@@ -16,11 +16,7 @@
# is in a variable of the same name but without the '_'. The subdir is
# named after this project: <*/man>.
# - Variables ending in '_rm' refer to files that can be removed (exist).
-# - Variables ending in '_rmdir' refer to dirs that can be removed (exist).
# - Targets of the form '%-rm' remove their corresponding file '%'.
-# - Targets of the form '%-rmdir' remove their corresponding dir '%'.
-# - The 'FORCE' target is used to make phony some variables that can't be
-# .PHONY to avoid some optimizations.
#
########################################################################
@@ -242,4 +238,3 @@ help-variables:
.DELETE_ON_ERROR:
-FORCE:
diff --git a/share/mk/cmd.mk b/share/mk/cmd.mk
index dfeafcebc..aa7c07c1c 100644
--- a/share/mk/cmd.mk
+++ b/share/mk/cmd.mk
@@ -35,7 +35,6 @@ XZ := xz
INSTALL_DATA := $(INSTALL) -m 644
INSTALL_DIR := $(INSTALL) -m 755 -d
-RMDIR := rmdir --ignore-fail-on-non-empty
endif # include guard
diff --git a/share/mk/install/_.mk b/share/mk/install/_.mk
index 98f6f888f..751ab97e2 100644
--- a/share/mk/install/_.mk
+++ b/share/mk/install/_.mk
@@ -26,10 +26,6 @@ $(DESTDIR)%/:
$(info RM $*)
$(RM) $*
-%-rmdir:
- $(info RMDIR $(@D))
- $(RMDIR) $(@D)
-
.PHONY: install
install: install-man;
diff --git a/share/mk/install/html.mk b/share/mk/install/html.mk
index ae518d2c2..97e00ce17 100644
--- a/share/mk/install/html.mk
+++ b/share/mk/install/html.mk
@@ -18,10 +18,7 @@ _htmldir := $(DESTDIR)$(htmldir_)
_htmlpages := $(patsubst $(_HTMLDIR)/%,$(_htmldir)/%,$(_HTMLPAGES))
-_htmldirs := $(patsubst $(MANDIR)/%,$(_htmldir)/%,$(MANDIRS))
_htmlpages_rm := $(addsuffix -rm,$(wildcard $(_htmlpages)))
-_htmldirs_rmdir := $(addsuffix -rmdir,$(wildcard $(_htmldirs)))
-_htmldir_rmdir := $(addsuffix -rmdir,$(wildcard $(_htmldir)/))
$(_htmlpages): $(_htmldir)/%: $(_HTMLDIR)/% | $$(@D)/
@@ -33,7 +30,7 @@ $(_htmlpages): $(_htmldir)/%: $(_HTMLDIR)/% | $$(@D)/
install-html: $(_htmlpages);
.PHONY: uninstall-html
-uninstall-html: $(_htmldir_rmdir) $(_htmldirs_rmdir) $(_htmlpages_rm);
+uninstall-html: $(_htmlpages_rm);
endif # include guard
diff --git a/share/mk/install/man.mk b/share/mk/install/man.mk
index caafe5e09..a135788cd 100644
--- a/share/mk/install/man.mk
+++ b/share/mk/install/man.mk
@@ -63,14 +63,6 @@ _man5dir := $(DESTDIR)$(man5dir)
_man6dir := $(DESTDIR)$(man6dir)
_man7dir := $(DESTDIR)$(man7dir)
_man8dir := $(DESTDIR)$(man8dir)
-_mandirs := $(_man1dir)/ \
- $(_man2dir)/ $(_man2typedir)/ \
- $(_man3dir)/ $(_man3constdir)/ $(_man3headdir)/ $(_man3typedir)/ \
- $(_man4dir)/ \
- $(_man5dir)/ \
- $(_man6dir)/ \
- $(_man7dir)/ \
- $(_man8dir)/ \
_man1pages := $(patsubst $(MANDIR)/man1/%,$(_man1dir)/%$(Z),$(MAN1PAGES))
_man2pages := $(patsubst $(MANDIR)/man2/%,$(_man2dir)/%$(Z),$(MAN2PAGES))
@@ -106,24 +98,8 @@ _man6pages_rm := $(addsuffix -rm,$(wildcard $(_man6pages)))
_man7pages_rm := $(addsuffix -rm,$(wildcard $(_man7pages)))
_man8pages_rm := $(addsuffix -rm,$(wildcard $(_man8pages)))
-_mandirs_rmdir := $(addsuffix -rmdir,$(wildcard $(_mandirs)))
-_man1dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man1dir)))
-_man2dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man2dir)))
-_man2typedir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man2typedir)))
-_man3dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man3dir)))
-_man3constdir_rmdir:= $(addsuffix -rmdir,$(wildcard $(_man3constdir)))
-_man3headdir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man3headdir)))
-_man3typedir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man3typedir)))
-_man4dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man4dir)))
-_man5dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man5dir)))
-_man6dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man6dir)))
-_man7dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man7dir)))
-_man8dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man8dir)))
-_mandir_rmdir := $(addsuffix -rmdir,$(wildcard $(_mandir)/))
-
MAN_SECTIONS := 1 2 2type 3 3const 3head 3type 4 5 6 7 8
install_manX := $(foreach x,$(MAN_SECTIONS),install-man$(x))
-installdirs_manX := $(foreach x,$(MAN_SECTIONS),installdirs-man$(x))
uninstall_manX := $(foreach x,$(MAN_SECTIONS),uninstall-man$(x))
@@ -187,9 +163,6 @@ else ifeq ($(Z),.xz)
fi
endif
-$(_mandirs_rmdir): $(_mandir)/man%/-rmdir: $$(_man%pages_rm) FORCE
-$(_mandir_rmdir): $(uninstall_manX) FORCE
-
.PHONY: install-man1
install-man1: $(_man1pages);
@@ -220,10 +193,10 @@ install-man8: $(_man8pages);
install-man: $(install_manX);
.PHONY: $(uninstall_manX)
-$(uninstall_manX): uninstall-man%: $$(_man%pages_rm) $$(_man%dir_rmdir);
+$(uninstall_manX): uninstall-man%: $$(_man%pages_rm);
.PHONY: uninstall-man
-uninstall-man: $(_mandir_rmdir) $(uninstall_manX);
+uninstall-man: $(uninstall_manX);
endif # include guard
diff --git a/share/mk/src.mk b/share/mk/src.mk
index e753c4f7b..76deb8230 100644
--- a/share/mk/src.mk
+++ b/share/mk/src.mk
@@ -19,8 +19,6 @@ MANPAGES := $(shell $(FIND) $(MANDIR)/man*/ -type f \
| $(GREP) '$(MANEXT)' \
| $(SORT) \
| $(SED) 's,:,\\:,g')
-MANDIRS := $(shell $(FIND) $(MANDIR)/man* -type d \
- | $(SORT))
MAN1PAGES := $(filter %.1,$(MANPAGES))
MAN2PAGES := $(filter %.2,$(MANPAGES))