Convert the build process from CVS to git

Detect .git instead of CVS.  Use git-ls-files with git, else
$(srcdir)/sources.mk.  info/findsubj.pl now gets the info files as
arguments rather than from sources.mk.

Remaking info subjects doesn't quite work, but it was broken similarly
before.
This commit is contained in:
Markus Armbruster 2008-01-13 11:17:26 +01:00
parent 544612ed8c
commit 35db407da0
5 changed files with 35 additions and 50 deletions

View file

@ -83,7 +83,7 @@ sysconfdir := @sysconfdir@
srcdir := @srcdir@
VPATH := @srcdir@
cvs_controlled := @cvs_controlled@
revctrl := @revctrl@
EMPIREHOST := @EMPIREHOST@
EMPIREPORT := @EMPIREPORT@

32
Make.mk
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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";
}