]> git.pond.sub.org Git - empserver/commitdiff
Convert the build process from CVS to git
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 13 Jan 2008 10:17:26 +0000 (11:17 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 13 Jan 2008 10:17:26 +0000 (11:17 +0100)
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.

GNUmakefile.in
Make.mk
configure.ac
info/findsubj.pl
src/scripts/cvsfiles.awk [deleted file]

index 06ad0503d80ad42fae686e77640638d439fb2ef8..b31bef826275ce81f3b5112e34c655e91ce1334c 100644 (file)
@@ -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 cf3c75a94ccc38662b36ab087af1c6e141c866e2..6f6b03aeae4e1655f28f3afc5917607632f96453 100644 (file)
--- 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
index eee3731f089ac126a12f3aa37b4a0494914717e1..f75e250f6b1db43c34ea9f589ede3b1a3261451c 100644 (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
index e982b7674c8404741fef831056bce2a8199156bb..ceb33c82643e6ed093c7c8f2c43bcf6de0bbb38a 100644 (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
diff --git a/src/scripts/cvsfiles.awk b/src/scripts/cvsfiles.awk
deleted file mode 100755 (executable)
index 72e9615..0000000
+++ /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";
-}