summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-17 18:49:42 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-17 18:49:42 -0400
commitc9cfc9bc4451a6219f71407b9a6e00b51defc713 (patch)
treeeee260ac1b6ff37b5fba45b89204864d810dfe67
parent733636464ea990d96d38edefff9ca326e8195cf4 (diff)
Use automake.mk
-rw-r--r--.gitignore1
-rw-r--r--Makefile32
-rw-r--r--common.each.head.mk0
-rw-r--r--common.each.tail.mk0
-rw-r--r--common.once.head.mk0
-rw-r--r--common.once.tail.mk0
-rwxr-xr-xwrite-ifchanged11
7 files changed, 33 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 8d83e4a..fc8fb2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
depends.txt
+.srcfiles.mk
parabolaweb*
!parabolaweb*.in
diff --git a/Makefile b/Makefile
index 14c397f..58535a8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,10 @@
+topoutdir ?= .
+topsrcdir ?= .
+include $(topsrcdir)/automake.head.mk
+
+PACKAGE = parabolaweb-utils
+VERSION = 20160517
+
DESTDIR =
#prefix = /usr/local
@@ -20,6 +27,14 @@ pkgconffile = $(sysconfdir)/parabolaweb
CFLAGS += -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter
CPPFLAGS += -DSCRIPT_LOCATION='"$(pkglibexecdir)/parabolaweb-changepassword.real"'
+ifeq ($(wildcard .git),)
+include .srcfiles.mk
+else
+.srcfiles.mk: FORCE
+ @echo am_src_files = $(shell git ls-files) | ./write-ifchanged $@
+-include $(srcdir)/.srcfiles.mk
+endif
+
targets = \
$(sbindir)/parabolaweb-changepassword \
$(sbindir)/parabolaweb-reporead-inotify \
@@ -28,16 +43,9 @@ targets = \
$(systemddir)/parabolaweb-reporead-inotify.service \
$(uwsgidir)/parabolaweb.ini.example
-all: PHONY depends.txt $(notdir $(targets)) parabolaweb.conf
-
-install: PHONY $(addprefix $(DESTDIR),$(targets) $(pkgconffile))
-
-uninstall: PHONY
- $(RM) $(addprefix $(DESTDIR),$(targets) $(pkgconffile))
- rmdir -p -- $(wildcard $(sort $(dir $(addprefix $(DESTDIR),$(targets) $(pkgconffile))))) 2>/dev/null || true
-
-clean: PHONY
- $(RM) $(notdir $(targets)) depends.txt
+am_gen_files = .srcfiles.mk
+am_out_files = depends.txt $(notdir $(targets)) parabolaweb.conf
+am_sys_files = $(targets) $(pkgconffile)
# Pattern rules
@@ -65,4 +73,6 @@ $(DESTDIR)$(pkgconffile): parabolaweb.conf
install -Dm644 $< $@
.DELETE_ON_ERROR:
-.PHONY: PHONY
+.PHONY: FORCE
+
+include $(topsrcdir)/automake.tail.mk
diff --git a/common.each.head.mk b/common.each.head.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common.each.head.mk
diff --git a/common.each.tail.mk b/common.each.tail.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common.each.tail.mk
diff --git a/common.once.head.mk b/common.once.head.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common.once.head.mk
diff --git a/common.once.tail.mk b/common.once.tail.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common.once.tail.mk
diff --git a/write-ifchanged b/write-ifchanged
new file mode 100755
index 0000000..c65fa16
--- /dev/null
+++ b/write-ifchanged
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+outfile=$1
+tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}"
+
+cat > "$tmpfile" || exit $?
+if cmp -s "$tmpfile" "$outfile"; then
+ rm -f "$tmpfile" || :
+else
+ mv -f "$tmpfile" "$outfile"
+fi