COPYRIGHT = $(top_srcdir)/COPYRIGHT.txt
dist-hook:
test -z "$(AWK)" && exit 0 ;\
TMPFILE="$(distdir)/tmp"; \
for f in $(DISTFILES) ; do \
distfile=$(distdir)/$$f ; \
if grep '__copyright__ *$$' $$distfile >/dev/null ; then \
mv $$distfile $$TMPFILE; \
$(AWK) 'BEGIN {nr=0;while(getline < "$(COPYRIGHT)" ==1) copyright[nr++]=$$0;} /__copyright__ *$$/{sub("__copyright__.*","");for(i=0;i<nr;i++) print $$0 copyright[i];} //' \
$$TMPFILE >$$distfile; \
touch -m -a -r $$TMPFILE $$distfile; \
fi; \
done ; \
rm -f $$TMPFILE