summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 14 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 805b51d..90b42c1 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,7 @@
# USA.
#
+SHELL = /bin/bash
DESTDIR =
ETCDIR = /etc
BINDIR = /usr/bin
@@ -26,15 +27,20 @@ MANDIR = /usr/share/man
VERSION = 1.1
-all: backup backup.1 lastBackups lastBackups.1 backupStatistics backupStatistics.1
+all: man.commons backup backup.1 lastBackups lastBackups.1 backupStatistics backupStatistics.1
%: %.in
- sed "s/#VERSION#/$(VERSION)/; s@#BINDIR#@$(BINDIR)@; s@#ETCDIR#@$(ETCDIR)@; s@#NUMSTAGES#@5@" $< > $@
-
-%.common: man.commons
- grep -v "^$(@:.common=)(" $< > $@
-
-%.1: % %.common
+ sed " \
+ s/#VERSION#/$(VERSION)/; \
+ s@#BINDIR#@$(BINDIR)@; \
+ s@#ETCDIR#@$(ETCDIR)@; \
+ s@#NUMSTAGES#@5@; \
+ s@#HELPTEXT#\(\s\+\)#@ --help \1display this help and exit\n --version\1display version and exit@; \
+ " $< > $@ && \
+ ( [[ "$@" = *.* ]] || chmod +x "$@" )
+
+%.1: % man.commons
+ grep -v "^$<(" man.commons | sed '/^\[SEE ALSO]$$/{n;:a;N;/\[/b;s/\n/, /;ta;}' > "$<.common" && \
help2man -o "$@" -N --include $<.common --no-discard-stderr "./$<"
.PHONY: install dist clean
@@ -45,7 +51,7 @@ install: all
install -D -m0644 -t $(DESTDIR)$(ETCDIR) backup.conf
clean:
- cat .gitignore | xargs rm -f
+ git clean -x -d -f
dist: clean
git status --porcelain 2> /dev/null | grep -q "\S" && (git add .; git commit -m"neue Version: $(VERSION)") || true