Simon Josefsson wrote: > In build-aux/update-copyright it says: > > # You may wish to place a target like the following in your top-level > # makefile in your project: > # > # .PHONY: update-copyright > # update-copyright: > # if test -d .git; then \ > # git grep -l -w Copyright \ > # | grep -v -E '(^|/)(COPYING|ChangeLog)' \ > # | xargs $(srcdir)/build-aux/$@; \ > # fi > > I'd rather not have to manually add this snippet to 5+ projects, and > keep it synchronized in case of changes. > > How about adding the rule to maintainer-makefile? The rule above is > git-specific, but that can easily be solved by just renaming the rule > update-git-copyright if it is deemed a significant problem (see below).
I've added it there, but we don't need to change the name. Instead, I've used $(VC_LIST_EXCEPT) to make it VC-agnostic. Then, per-project exceptions can go in a file named .x-update-git-copyright. I debated whether to use GNU xargs' --no-run-if-empty option or to omit that, on the presumption that every project using this code has at least one version-controlled file containing the word Copyright. The risk of an empty file name list seems negligible, so I've omitted it. >From 9c34d44ff2f210d5347b430bb505f658098f539e Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Tue, 4 Aug 2009 09:53:04 +0200 Subject: [PATCH] maint.mk: add a copyright-updating rule * top/maint.mk (update-copyright): New rule. Derived from coreutils/Makefile.am. --- ChangeLog | 4 ++++ top/maint.mk | 7 +++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 435a4a7..1eacff5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-08-04 Jim Meyering <meyer...@redhat.com> + maint.mk: add a copyright-updating rule + * top/maint.mk (update-copyright): New rule. + Derived from coreutils/Makefile.am. + update-copyright: rename some variables * build-aux/update-copyright: Rename a few variables for clarity. Tweak syntax. List Joel E. Denny as coauthor. diff --git a/top/maint.mk b/top/maint.mk index c3e2f47..2db44ba 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -771,3 +771,10 @@ INDENT_SOURCES ?= $(C_SOURCES) .PHONY: indent indent: indent $(INDENT_SOURCES) + +# Run this rule once per year (usually early in January) +# to update all FSF copyright year lists in your project. +.PHONY: update-copyright +update-copyright: + grep -l -w Copyright $$($(VC_LIST_EXCEPT)) \ + | xargs $(build_aux)/$@ -- 1.6.4.212.g4719