diff mbox

btrfs-progs: Add uninstall targets to Makefiles.

Message ID 1403293685-23536-2-git-send-email-git@n-st.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Nils Steinger June 20, 2014, 7:48 p.m. UTC
Signed-off-by: Nils Steinger <git@n-st.de>
---
 Documentation/Makefile | 4 ++++
 Makefile               | 9 +++++++++
 2 files changed, 13 insertions(+)

Comments

Satoru Takeuchi June 23, 2014, 1:57 a.m. UTC | #1
Hi Nils,

(2014/06/21 4:48), Nils Steinger wrote:
> Signed-off-by: Nils Steinger <git@n-st.de>
> ---
>   Documentation/Makefile | 4 ++++
>   Makefile               | 9 +++++++++
>   2 files changed, 13 insertions(+)
>
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 45299bb..5c9780b 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -76,6 +76,10 @@ install-man: man
>   	$(INSTALL) -m 644 $(GZ_MAN8) $(DESTDIR)$(man8dir)
>   	$(LNS) btrfs-check.8.gz $(DESTDIR)$(man8dir)
>   
> +uninstall:
> +	cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8.gz $(GZ_MAN8)
> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir)
> +

This code snippet looks good.

>   clean:
>   	$(RM) *.xml *.xml+ *.8 *.8.gz
>   
> diff --git a/Makefile b/Makefile
> index 76565e8..4cafa37 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -257,6 +257,15 @@ $(INSTALLDIRS):
>   	@echo "Making install in $(patsubst install-%,%,$@)"
>   	$(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst install-%,%,$@) install
>   
> +uninstall:
> +	$(Q)$(MAKE) $(MAKEOPTS) -C Documentation uninstall
> +	cd $(DESTDIR)$(incdir); rm -f $(headers)
> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(incdir)
> +	cd $(DESTDIR)$(libdir); rm -f $(lib_links)

You forgot to remove $(libs) here.

Thanks,
Satoru

> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(libdir)
> +	cd $(DESTDIR)$(bindir); rm -f btrfsck fsck.btrfs $(progs)
> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(bindir)
> +
>   ifneq ($(MAKECMDGOALS),clean)
>   -include $(objects:.o=.o.d) $(cmd-objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))
>   endif
>

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 45299bb..5c9780b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -76,6 +76,10 @@  install-man: man
 	$(INSTALL) -m 644 $(GZ_MAN8) $(DESTDIR)$(man8dir)
 	$(LNS) btrfs-check.8.gz $(DESTDIR)$(man8dir)
 
+uninstall:
+	cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8.gz $(GZ_MAN8)
+	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir)
+
 clean:
 	$(RM) *.xml *.xml+ *.8 *.8.gz
 
diff --git a/Makefile b/Makefile
index 76565e8..4cafa37 100644
--- a/Makefile
+++ b/Makefile
@@ -257,6 +257,15 @@  $(INSTALLDIRS):
 	@echo "Making install in $(patsubst install-%,%,$@)"
 	$(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst install-%,%,$@) install
 
+uninstall:
+	$(Q)$(MAKE) $(MAKEOPTS) -C Documentation uninstall
+	cd $(DESTDIR)$(incdir); rm -f $(headers)
+	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(incdir)
+	cd $(DESTDIR)$(libdir); rm -f $(lib_links)
+	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(libdir)
+	cd $(DESTDIR)$(bindir); rm -f btrfsck fsck.btrfs $(progs)
+	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(bindir)
+
 ifneq ($(MAKECMDGOALS),clean)
 -include $(objects:.o=.o.d) $(cmd-objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))
 endif