Improve build and deployment
[gpl/argeo-freed.git] / local.mk
index b2af1350ae93149c275b19ed65826d4f0467129b..7284143be85264e4b23cef32918f22c3c2c9ce92 100644 (file)
--- a/local.mk
+++ b/local.mk
@@ -18,11 +18,23 @@ clean:
        $(MAKE) -C sjbin clean
 
 install:
-       $(COPY) -r --no-clobber etc/* $(DESTDIR)$(sysconfdir)
-       $(COPY) -r usr/bin/* $(DESTDIR)$(bindir)
-       $(COPY) -r usr/share/* $(DESTDIR)$(datarootdir)
-       $(COPY) -r usr/lib/* $(DESTDIR)$(libdir)
-       $(COPY) -r usr/libexec/* $(DESTDIR)$(libexecdir)
-       $(MAKE) -C sjbin install
+# TODO use install and wildcard ?
+       $(COPY) -v -r --no-clobber etc/* $(DESTDIR)$(sysconfdir)
+       $(COPY) -v -r usr/bin/* $(DESTDIR)$(bindir)
+#      $(COPY) -v -r usr/share/* $(DESTDIR)$(datarootdir)
+       $(COPY) -v -r usr/lib/* $(DESTDIR)$(libdir)
+       sed -i 's|/usr/local|$(prefix)|' $(DESTDIR)$(libdir)/systemd/system/argeo*.service
+       sed -i 's|/usr/local|$(prefix)|' $(DESTDIR)$(libdir)/systemd/user/argeo*.service
+       sed -i 's|/usr/local|$(prefix)|' $(DESTDIR)$(libdir)/argeo/*.args
+       $(COPY) -v -r usr/libexec/* $(DESTDIR)$(libexecdir)
+#      $(MAKE) -C sjbin install
        systemctl daemon-reload
-       
\ No newline at end of file
+
+uninstall:
+       $(foreach f, $(shell cd usr/bin/ && find . -type f), $(RM) $(DESTDIR)$(bindir)/$(f);)
+#      $(foreach f, $(shell find usr/share/ -type f), $(RM) $(DESTDIR)$(datarootdir)/$(f);)
+       $(foreach f, $(shell cd usr/lib/ && find . -type f), $(RM) $(DESTDIR)$(libdir)/$(f);)
+       $(foreach f, $(shell cd usr/libexec/ && find . -type f), $(RM) $(DESTDIR)$(libexecdir)/$(f);)
+
+purge: uninstall       
+       $(foreach f, $(shell cd etc/ && find . -type f), $(RM) $(DESTDIR)$(sysconfdir)/$(f);)