]> arthur.barton.de Git - backup-script.git/commitdiff
Use ax-make
authorAlexander Barton <alex@barton.de>
Mon, 17 Nov 2014 16:31:56 +0000 (17:31 +0100)
committerAlexander Barton <alex@barton.de>
Mon, 17 Nov 2014 16:31:56 +0000 (17:31 +0100)
Makefile
Makefile.ax [new file with mode: 0644]

index c6766f9c0871e152e8a34c5100a64ddde0050d77..f7b3aa402dfcde322e50ecc91e9ee63fb9614b92 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,22 @@
 #
 # backup-script system for cloning systems using rsync
-# Copyright (c)2008-2013 Alexander Barton, alex@barton.de
+# Copyright (c)2008-2014 Alexander Barton, alex@barton.de
 #
 
-PREFIX = /usr/local
+include ./Makefile.ax
 
-all:
-
-clean:
-
-distclean: clean
-
-maintainer-clean: distclean
-
-check:
-
-install:
-       install -d -o root -g root -m 755 \
+install-local:
+       install -d -o $(USER) -g $(GROUP) -m 755 \
         $(DESTDIR)$(PREFIX)/sbin
-       install -o root -g root -m 755 bin/backup-script \
+       install -o $(USER) -g $(GROUP) -m 755 bin/backup-script \
         $(DESTDIR)$(PREFIX)/sbin/backup-script
-       install -o root -g root -m 755 bin/backup-script-wrapper \
+       install -o $(USER) -g $(GROUP) -m 755 bin/backup-script-wrapper \
         $(DESTDIR)$(PREFIX)/sbin/backup-script-wrapper
-       install -o root -g root -m 755 bin/backup-status \
+       install -o $(USER) -g $(GROUP) -m 755 bin/backup-status \
         $(DESTDIR)$(PREFIX)/sbin/backup-status
-       install -d -o root -g root -m 755 \
+       install -d -o $(USER) -g $(GROUP) -m 755 \
         $(DESTDIR)$(PREFIX)/etc/backup-script.d
-       install -d -o root -g root -m 755 $(DESTDIR)/etc
+       install -d -o $(USER) -g $(GROUP) -m 755 $(DESTDIR)/etc
        test -e $(DESTDIR)/etc/backup-script.d \
         || ln -s $(DESTDIR)$(PREFIX)/etc/backup-script.d \
              $(DESTDIR)/etc/backup-script.d
-
-.PHONY = all clean distclean maintainer-clean check install
diff --git a/Makefile.ax b/Makefile.ax
new file mode 100644 (file)
index 0000000..180ce3c
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# ax-make: Alex' Simple Makefile System
+# Copyright (c)2014 Alexander Barton (alex@barton.de)
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+
+AX_SILENT ?= @
+
+PREFIX ?= /usr/local
+
+USER ?= $(shell id -un)
+GROUP ?= $(shell stat --format=%G $(DESTDIR)$(PREFIX) 2>/dev/null || id -gn)
+
+all: all-ax all-local
+
+all-ax: $(ALL) $(SUBDIRS)
+
+clean: clean-ax clean-local
+
+distclean: clean-local distclean-ax distclean-local
+
+maintainer-clean: clean-local distclean-local maintainer-clean-ax maintainer-clean-local
+
+check: check-pre check-ax check-local check-post
+
+install: install-ax install-local
+
+all-ax clean-ax distclean-ax maintainer-clean-ax check-ax install-ax:
+       $(AX_SILENT)for subdir in $(SUBDIRS); do \
+         target=`echo "$@" | sed -e 's/-ax$$//'`; \
+         echo "Making \"$$target\" in \"$$subdir\" ..."; \
+         $(MAKE) -C $$subdir $$target || exit 1; \
+        done
+
+.PHONY: all clean distclean maintainer-clean check install
+.PHONY: all-ax clean-ax distclean-ax maintainer-clean-ax check-ax install-ax
+.PHONY: all-local clean-local distclean-local maintainer-clean-local check-local install-local
+.PHONY: check-pre check-post
+.PHONY: $(SUBDIRS)