aboutsummaryrefslogtreecommitdiffstats
path: root/mk/copy.mk
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-08 20:25:54 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-08 20:25:54 +0100
commitb9c23e3a7123452dcfefb2fee97ba1cdc18ee2ad (patch)
tree2761c44427abe1896b32bde30dd77c5bdd971516 /mk/copy.mk
parentPackaging moved to my collective repo for them (not needed now that it is documented in INSTALL.) (diff)
downloadscrotty-b9c23e3a7123452dcfefb2fee97ba1cdc18ee2ad.tar.gz
scrotty-b9c23e3a7123452dcfefb2fee97ba1cdc18ee2ad.tar.bz2
scrotty-b9c23e3a7123452dcfefb2fee97ba1cdc18ee2ad.tar.xz
a magical makefile, using a collection of submakefiles that are completely reusable without modifications
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'mk/copy.mk')
-rw-r--r--mk/copy.mk78
1 files changed, 78 insertions, 0 deletions
diff --git a/mk/copy.mk b/mk/copy.mk
new file mode 100644
index 0000000..c27604f
--- /dev/null
+++ b/mk/copy.mk
@@ -0,0 +1,78 @@
+# Copyright (C) 2015 Mattias Andrée <maandree@member.fsf.org>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+
+
+#=== These rules are used for legal files. ===#
+
+
+# Enables the rules:
+# install-copyright Install all files in _COPYING and _LICENSE
+# install-copying Install all files in _COPYING
+# install-license Install all files in _LICENSE
+
+
+# WHEN TO BUILD, INSTALL, AND UNINSTALL:
+
+install-base: install-copyright
+uninstall: uninstall-copyright
+
+
+# INSTALL RULES:
+
+.PHONY: install-copyright
+install-copyright:
+
+ifdef _COPYING
+.PHONY: install-copyright
+install-copyright: install-copying
+
+.PHONY: install-copying
+install-copying: $(_COPYING)
+ @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
+ $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ @$(ECHO_EMPTY)
+endif
+
+ifdef _COPYING
+.PHONY: install-copyright
+install-copyright: install-license
+
+.PHONY: install-license
+install-license: $(_LICENSE)
+ @$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
+ $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ @$(ECHO_EMPTY)
+endif
+
+
+# UNINSTALL RULES:
+
+.PHONY: uninstall-copyright
+uninstall-copyright:
+
+ifdef _COPYING
+.PHONY: uninstall-copyright
+uninstall-copyright: uninstall-copying
+
+.PHONY: uninstall-copying
+uninstall-copying:
+ -$(Q)$(RM) -- $(foreach F,$(_COPYING),"$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/$(F)")
+ -$(Q)$(RMDIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+endif
+
+ifdef _COPYING
+.PHONY: uninstall-copyright
+uninstall-copyright: uninstall-license
+
+.PHONY: uninstall-license
+uninstall-license:
+ -$(Q)$(RM) -- $(foreach F,$(_LICENSE),"$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/$(F)")
+ -$(Q)$(RMDIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+endif
+