diff --git a/Makefile.config.in b/Makefile.config.in index f14fa04d..8c245ace 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -42,6 +42,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ +UNINSTALL = rm -f host = @host@ diff --git a/Makefile.lib b/Makefile.lib index 09fa3c9e..446c1e62 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -8,6 +8,7 @@ ifdef MAKE_COLOR PO_COLOR = $(shell tput setaf 6) LINK_COLOR = $(shell tput bold;tput setaf 4) INSTALL_COLOR = $(shell tput setaf 3) + UNINSTALL_COLOR = $(shell tput setaf 1) END_COLOR = $(shell tput sgr0) endif @@ -65,6 +66,8 @@ quiet_cmd_installdata = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH) quiet_cmd_installprog = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH)$(2) -> $(3)" cmd_installprog = $(INSTALL_PROGRAM) $(2) $(3) +quiet_cmd_uninstall = " [$(UNINSTALL_COLOR)UNINSTALL$(END_COLOR)] $(3)/$(2)" + cmd_uninstall = $(UNINSTALL) $(3)/$(2) ############################################################################# # Special handling of conditional variables @@ -166,6 +169,19 @@ ifdef MAN5 $(call ncmd,installdata,$(file),$(DESTDIR)$(mandir)/man5);) endif +uninstall-default: +ifdef PROGS + @$(foreach file,$(PROGS), \ + $(call ncmd,uninstall,$(file),$(DESTDIR)$(bindir));) +endif +ifdef MAN1 + @$(foreach file,$(MAN1), \ + $(call ncmd,uninstall,$(file),$(DESTDIR)$(mandir)/man1);) +endif +ifdef MAN5 + @$(foreach file,$(MAN5), \ + $(call ncmd,uninstall,$(file),$(DESTDIR)$(mandir)/man5);) +endif ############################################################################## # Auto-testing infrastructure @@ -205,7 +221,7 @@ endif ############################################################################# # Basic recursion and dependencies setup -RULES = all install clean cleanall init check test +RULES = all install clean cleanall init check test uninstall RULES_LOCAL = $(addsuffix -local,$(RULES)) RULES_REC = $(addsuffix -recursive,$(RULES)) @@ -238,6 +254,7 @@ cleanall: $(call rule_deps,cleanall) init: $(call rule_deps,init) check: $(call rule_deps,check) test: $(call rule_deps,test) +uninstall: $(call rule_deps,uninstall) ############################################################################# # Misc diff --git a/po/Makefile b/po/Makefile index 5cf25b13..4d76c8d8 100644 --- a/po/Makefile +++ b/po/Makefile @@ -108,6 +108,11 @@ install-local: all-local $(call ncmd,installdata,$(lang).gmo,$(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES/$(PACKAGE).mo); \ ) +uninstall-local: + @$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(CATALOGS))), \ + $(call ncmd,uninstall,$(PACKAGE).mo,$(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES); \ + ) + clean-local: @rm -f $(PACKAGE).po *.new.po $(srcdir)$(POTFILES_ABS_LIST)