From c9cfc9bc4451a6219f71407b9a6e00b51defc713 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 May 2016 18:49:42 -0400 Subject: Use automake.mk --- .gitignore | 1 + Makefile | 32 +++++++++++++++++++++----------- common.each.head.mk | 0 common.each.tail.mk | 0 common.once.head.mk | 0 common.once.tail.mk | 0 write-ifchanged | 11 +++++++++++ 7 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 common.each.head.mk create mode 100644 common.each.tail.mk create mode 100644 common.once.head.mk create mode 100644 common.once.tail.mk create mode 100755 write-ifchanged 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 diff --git a/common.each.tail.mk b/common.each.tail.mk new file mode 100644 index 0000000..e69de29 diff --git a/common.once.head.mk b/common.once.head.mk new file mode 100644 index 0000000..e69de29 diff --git a/common.once.tail.mk b/common.once.tail.mk new file mode 100644 index 0000000..e69de29 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 -- cgit v1.2.3