From 33018704940e3d326689ca1a5f69ee73cd0f3ea4 Mon Sep 17 00:00:00 2001
From: namark <namark@disroot.org>
Date: Fri, 19 Apr 2019 19:13:46 +0400
Subject: [PATCH] No longer depending on /dev/null timestamps,

and finer grained uninstall targets.
---
 make_templates/header_only_lib |  9 +++++----
 make_templates/static_lib      | 24 ++++++++++++++++--------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/make_templates/header_only_lib b/make_templates/header_only_lib
index 7b9d872..02bc1ce 100644
--- a/make_templates/header_only_lib
+++ b/make_templates/header_only_lib
@@ -2,6 +2,7 @@ INSTALL_INCLUDE := include
 
 ifneq ($(shell cat COPYRIGHT 2> /dev/null),)
 COPYRIGHT ?= COPYRIGHT
+COPYRIGHT_DEP = COPYRIGHT
 else
 COPYRIGHT ?= /dev/null
 endif
@@ -20,14 +21,14 @@ default:
 install: $(INCLUDE)
 	@echo Install complete!
 
-$(INCDIR)/%.h: $(SRCDIR)/%.h $(COPYRIGHT)
+$(INCDIR)/%.h: $(SRCDIR)/%.h $(COPYRIGHT_DEP)
 	@mkdir -p $(@D)
-	cat $(COPYRIGHT) >> $@ 2> /dev/null || true
+	cat $(COPYRIGHT) >> $@ 
 	cat $< >> $@
 
-$(INCDIR)/%.hpp: $(SRCDIR)/%.hpp $(COPYRIGHT)
+$(INCDIR)/%.hpp: $(SRCDIR)/%.hpp $(COPYRIGHT_DEP)
 	@mkdir -p $(@D)
-	cat $(COPYRIGHT) >> $@ 2> /dev/null || true
+	cat $(COPYRIGHT) >> $@ 
 	cat $< >> $@
 
 uninstall:
diff --git a/make_templates/static_lib b/make_templates/static_lib
index 4ea3142..71fcafe 100644
--- a/make_templates/static_lib
+++ b/make_templates/static_lib
@@ -15,6 +15,7 @@ INSTALL_LIB	:= lib
 
 ifneq ($(shell cat COPYRIGHT 2> /dev/null),)
 COPYRIGHT ?= COPYRIGHT
+COPYRIGHT_DEP = COPYRIGHT
 else
 COPYRIGHT ?= /dev/null
 endif
@@ -96,21 +97,21 @@ $(LIBDIR)/$(TARGET): $(OUT) | $(LIBDIR)
 $(LIBDIR):
 	@mkdir -p $@
 
-$(INCDIR)/%.h: $(SRCDIR)/%.h $(COPYRIGHT)
+$(INCDIR)/%.h: $(SRCDIR)/%.h $(COPYRIGHT_DEP)
 	@mkdir -p $(@D)
-	cat $(COPYRIGHT) >> $@ 2> /dev/null || true
+	cat $(COPYRIGHT) >> $@
 	cat $< >> $@
 
-$(INCDIR)/%.hpp: $(SRCDIR)/%.hpp $(COPYRIGHT)
+$(INCDIR)/%.hpp: $(SRCDIR)/%.hpp $(COPYRIGHT_DEP)
 	@mkdir -p $(@D)
-	cat $(COPYRIGHT) >> $@ 2> /dev/null || true
+	cat $(COPYRIGHT) >> $@
 	cat $< >> $@
 
 install_source: $(INSTALL_SOURCES)
 
-$(INSTALL_SRCDIR)/%: $(SRCDIR)/% $(COPYRIGHT)
+$(INSTALL_SRCDIR)/%: $(SRCDIR)/% $(COPYRIGHT_DEP)
 	@mkdir -p $(@D)
-	cat $(COPYRIGHT) >> $@ 2> /dev/null || true
+	cat $(COPYRIGHT) >> $@
 	cat $< >> $@
 
 uninstall:
@@ -118,11 +119,18 @@ uninstall:
 	@rmdir -p $(INCDIRS) 2> /dev/null || true
 	-rm $(LIBDIR)/$(TARGET)
 	@rmdir -p $(LIBDIR) 2> /dev/null || true
+	@echo Archives/includes uninstalled!
+
+uninstall_source:
 	-rm $(INSTALL_SOURCES)
 	@rmdir -p $(INSTALL_SRCDIRS) 2> /dev/null || true
-	@echo Uninstall complete!
+	@echo Source code uninstalled!
+
+uninstall_all: uninstall uninstall_source
+	@echo Everything uninstalled!
+
 
 -include $(DEPENDS)
 
 .PRECIOUS : $(OBJECTS)
-.PHONY : clean distclean uninstall
+.PHONY : clean distclean uninstall uninstall_source uninstall_all
-- 
GitLab