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@ srcdir := @srcdir@
VPATH := @srcdir@ VPATH := @srcdir@
cvs_controlled := @cvs_controlled@ revctrl := @revctrl@
EMPIREHOST := @EMPIREHOST@ EMPIREHOST := @EMPIREHOST@
EMPIREPORT := @EMPIREPORT@ 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: # Known contributors to this file:
# Markus Armbruster, 2005-2007 # Markus Armbruster, 2005-2007
@ -46,14 +46,18 @@ all:
.DELETE_ON_ERROR: .DELETE_ON_ERROR:
# Source files # 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))) dirs := $(sort $(dir $(src)))
csrc := $(filter %.c, $(src)) csrc := $(filter %.c, $(src))
tsrc := $(filter %.t, $(src)) tsrc := $(filter %.t, $(src))
man6 := $(filter man/%.6, $(src)) man6 := $(filter man/%.6, $(src))
builtins := $(filter src/lib/global/%.config, $(src)) builtins := $(filter src/lib/global/%.config, $(src))
# Info topics and subjects # Info subjects (automatically generated)
-include subjects.mk -include subjects.mk
# Abbreviations # Abbreviations
@ -281,12 +285,11 @@ $(libs) $(empth_lib):
# Info formatting # Info formatting
subjects.mk: $(tsrc) info/findsubj.pl sources.mk # FIXME Remaking subjects doesn't work correctly when info sources get
perl $(srcdir)/info/findsubj.pl # removed or subjects get dropped.
# 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 subjects.mk: info/findsubj.pl $(tsrc)
# missing files: perl $(srcdir)/info/findsubj.pl $(filter %.t, $^)
$(tsrc):
$(tsubj): info/mksubj.pl $(tsubj): info/mksubj.pl
perl $(srcdir)/info/mksubj.pl $@ $(filter %.t, $^) 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 # List of source files
ifeq ($(cvs_controlled),yes) # Note: $(srcdir)/sources.mk is only used when the source tree came
# Find files and directories under CVS control # from a tarball rather than git. The following rules create a
sources.mk: $(scripts)/cvsfiles.awk $(addprefix $(srcdir)/, $(addsuffix CVS/Entries, $(dirs))) # sources.mk to put into the tarball. It is not used in this build.
echo 'src := ' `cd $(srcdir) && $(AWK) -f src/scripts/cvsfiles.awk | LC_ALL=C sort` >$@
ifeq ($(revctrl),git)
sources.mk:
echo "src := $(src)" >sources.mk
else else
ifneq ($(srcdir),.) ifneq ($(srcdir),.)
sources.mk: $(srcdir)/sources.mk 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) AC_CHECK_PROG(NROFF, groff, [GROFF_NO_SGR= groff -Tascii -U], nroff)
# not really a check for a program, but close enough # not really a check for a program, but close enough
if test -d $srcdir/CVS; then cvs_controlled=yes; else cvs_controlled=no; fi if test -d $srcdir/.git; then revctrl=git
AC_SUBST(cvs_controlled,$cvs_controlled) else revctrl=
fi
AC_SUBST(revctrl,$revctrl)
### Checks for libraries ### Checks for libraries
@ -142,14 +144,16 @@ esac
AC_CONFIG_FILES([GNUmakefile]) AC_CONFIG_FILES([GNUmakefile])
AC_CONFIG_COMMANDS([stamp-h], AC_CONFIG_COMMANDS([stamp-h],
[if test $cvs_controlled = yes; then [case $revctrl in
mkdir -p `cd $srcdir && $AWK -f src/scripts/cvsfiles.awk \ git)
| sed -n '/\//s,/@<:@^/@:>@*$,,gp'| uniq` mkdir -p `cd $srcdir && git-ls-files \
else | sed -n 's,/@<:@^/@:>@*$,,gp' | uniq`
;;
*)
mkdir -p `sed s/.*=// <$srcdir/sources.mk | tr ' ' '\012' \ mkdir -p `sed s/.*=// <$srcdir/sources.mk | tr ' ' '\012' \
| sed -n '/\//s,/@<:@^/@:>@*$,,gp'| uniq` | sed -n '/\//s,/@<:@^/@:>@*$,,gp'| uniq`
fi esac
mkdir -p info.html info.nr lib mkdir -p info.html info.nr lib
touch stamp-h], touch stamp-h],
[cvs_controlled=$cvs_controlled; AWK=$AWK]) [revctrl=$revctrl])
AC_OUTPUT AC_OUTPUT

View file

@ -33,6 +33,7 @@
# Markus Armbruster, 2006 # Markus Armbruster, 2006
# #
# Usage: findsubj.pl INFO-FILE...
# Run it at the root of the build tree. This updates the make include # 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. # 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", "")); our @Subjects = split(' ', read_make_var("subjects", "subjects.mk", ""));
# Get source directory # Get source directory
my $srcdir = read_make_var("srcdir", "GNUmakefile"); 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 # Parse the .t files
for my $t (@tsrc) { for my $f (@ARGV) {
parse_file("$srcdir/$t"); parse_file("$f");
} }
# Create %subjfil from %see_also # 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";
}