diff --git a/GNUmakefile.in b/GNUmakefile.in index 06ad0503..b31bef82 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -83,7 +83,7 @@ sysconfdir := @sysconfdir@ srcdir := @srcdir@ VPATH := @srcdir@ -cvs_controlled := @cvs_controlled@ +revctrl := @revctrl@ EMPIREHOST := @EMPIREHOST@ EMPIREPORT := @EMPIREPORT@ diff --git a/Make.mk b/Make.mk index cf3c75a9..6f6b03ae 100644 --- a/Make.mk +++ b/Make.mk @@ -25,7 +25,7 @@ # # --- # -# Make.mk: +# Make.mk: The real Makefile, included by GNUmakefile # # Known contributors to this file: # Markus Armbruster, 2005-2007 @@ -46,14 +46,18 @@ all: .DELETE_ON_ERROR: # Source files --include sources.mk +ifeq ($(revctrl),git) +src := $(shell cd $(srcdir) && git-ls-files) +else +include $(srcdir)/sources.mk +endif dirs := $(sort $(dir $(src))) csrc := $(filter %.c, $(src)) tsrc := $(filter %.t, $(src)) man6 := $(filter man/%.6, $(src)) builtins := $(filter src/lib/global/%.config, $(src)) -# Info topics and subjects +# Info subjects (automatically generated) -include subjects.mk # Abbreviations @@ -281,12 +285,11 @@ $(libs) $(empth_lib): # Info formatting -subjects.mk: $(tsrc) info/findsubj.pl sources.mk - perl $(srcdir)/info/findsubj.pl -# If sources.mk is out of date, $(tsrc) is. If it contains files that -# went away, make can't remake subjects.mk. Tell it to ignore such -# missing files: -$(tsrc): +# FIXME Remaking subjects doesn't work correctly when info sources get +# removed or subjects get dropped. + +subjects.mk: info/findsubj.pl $(tsrc) + perl $(srcdir)/info/findsubj.pl $(filter %.t, $^) $(tsubj): info/mksubj.pl perl $(srcdir)/info/mksubj.pl $@ $(filter %.t, $^) @@ -311,10 +314,13 @@ info.ps: info/TROFF.MAC info/INFO.MAC $(ttop) $(tsubj) $(tsrc) # List of source files -ifeq ($(cvs_controlled),yes) -# Find files and directories under CVS control -sources.mk: $(scripts)/cvsfiles.awk $(addprefix $(srcdir)/, $(addsuffix CVS/Entries, $(dirs))) - echo 'src := ' `cd $(srcdir) && $(AWK) -f src/scripts/cvsfiles.awk | LC_ALL=C sort` >$@ +# Note: $(srcdir)/sources.mk is only used when the source tree came +# from a tarball rather than git. The following rules create a +# sources.mk to put into the tarball. It is not used in this build. + +ifeq ($(revctrl),git) +sources.mk: + echo "src := $(src)" >sources.mk else ifneq ($(srcdir),.) sources.mk: $(srcdir)/sources.mk diff --git a/configure.ac b/configure.ac index eee3731f..f75e250f 100644 --- a/configure.ac +++ b/configure.ac @@ -58,8 +58,10 @@ AC_ARG_VAR(NROFF, [nroff command]) AC_CHECK_PROG(NROFF, groff, [GROFF_NO_SGR= groff -Tascii -U], nroff) # not really a check for a program, but close enough -if test -d $srcdir/CVS; then cvs_controlled=yes; else cvs_controlled=no; fi -AC_SUBST(cvs_controlled,$cvs_controlled) +if test -d $srcdir/.git; then revctrl=git +else revctrl= +fi +AC_SUBST(revctrl,$revctrl) ### Checks for libraries @@ -142,14 +144,16 @@ esac AC_CONFIG_FILES([GNUmakefile]) AC_CONFIG_COMMANDS([stamp-h], - [if test $cvs_controlled = yes; then - mkdir -p `cd $srcdir && $AWK -f src/scripts/cvsfiles.awk \ - | sed -n '/\//s,/@<:@^/@:>@*$,,gp'| uniq` - else + [case $revctrl in + git) + mkdir -p `cd $srcdir && git-ls-files \ + | sed -n 's,/@<:@^/@:>@*$,,gp' | uniq` + ;; + *) mkdir -p `sed s/.*=// <$srcdir/sources.mk | tr ' ' '\012' \ | sed -n '/\//s,/@<:@^/@:>@*$,,gp'| uniq` - fi + esac mkdir -p info.html info.nr lib touch stamp-h], - [cvs_controlled=$cvs_controlled; AWK=$AWK]) + [revctrl=$revctrl]) AC_OUTPUT diff --git a/info/findsubj.pl b/info/findsubj.pl index e982b767..ceb33c82 100644 --- a/info/findsubj.pl +++ b/info/findsubj.pl @@ -33,6 +33,7 @@ # Markus Armbruster, 2006 # +# Usage: findsubj.pl INFO-FILE... # Run it at the root of the build tree. This updates the make include # file subjects.mk, which guides the remaking of info index files. # @@ -68,12 +69,10 @@ our ($filename, %subjfil); our @Subjects = split(' ', read_make_var("subjects", "subjects.mk", "")); # Get source directory my $srcdir = read_make_var("srcdir", "GNUmakefile"); -# Get info sources -my @tsrc = grep(/\.t$/, split(' ' , read_make_var("src", "sources.mk"))); # Parse the .t files -for my $t (@tsrc) { - parse_file("$srcdir/$t"); +for my $f (@ARGV) { + parse_file("$f"); } # Create %subjfil from %see_also diff --git a/src/scripts/cvsfiles.awk b/src/scripts/cvsfiles.awk deleted file mode 100755 index 72e96158..00000000 --- a/src/scripts/cvsfiles.awk +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/awk -f -# Find files under CVS control -# FIXME Ignores CVS/Entries.log - -BEGIN { - FS="/"; - if (ARGC == 1) - ARGV[ARGC++] = "CVS/Entries"; - else { - for (i = 1; i < ARGC; i++) - ARGV[i] = ARGV[i] "/CVS/Entries"; - } -} - -{ cwd = FILENAME; sub(/CVS\/Entries$/, "", cwd); } - -/^\// { - if ($3 !~ /^-/) - print cwd $2; -} - -/^D/ && NF > 1 { - ARGV[ARGC++] = cwd $2 "/CVS/Entries"; -}