builds of agedu. Building the man page from the .but file is included
in the Automake makefile, but omitted if configure can't find halibut,
in which case 'make clean' also won't destroy the now-non-rebuildable
agedu.1.
git-svn-id: svn://svn.tartarus.org/sgt/agedu@9245
cda61777-01e9-0310-a592-
d414129be87e
module agedu
-# Build the man page.
-in agedu do make doc
-
in agedu do sed '/AC_INIT/s/6.66/r$(revision)/' configure.ac > tmp.ac
in agedu do mv tmp.ac configure.ac
-in agedu do aclocal
-in agedu do autoconf
-in agedu do autoheader
-in agedu do automake -a --foreign
+in agedu do ./mkauto.sh
in agedu do rm -rf autom4te.cache
+# Build the man page. This also tests the automake setup to ensure
+# configure actually works; but we use a self-delegation (i.e. do all
+# of this in a throwaway copy of the build directory) to avoid
+# accidentally shipping any outputs of configure. Instead we return
+# only the actual man page from the delegation environment.
+delegate -
+ in agedu do ./configure
+ in agedu do make doc
+ return agedu/*.1
+enddelegate
+
in . do cp -R agedu agedu-r$(revision)
-in . do rm agedu-r$(revision)/GNUmakefile
in . do tar chzvf agedu-r$(revision).tar.gz agedu-r$(revision)
in agedu do halibut --html=manpage.html agedu.but
+++ /dev/null
-# Makefile for agedu.
-
-prefix = /usr/local
-bindir = $(prefix)/bin
-mandir = $(prefix)/man
-man1dir = $(mandir)/man1
-
-INSTALL = install
-
-CFLAGS = -Wall --std=c99 -pedantic $(XFLAGS)
-
--include Makefile.local
-
-AGEDU_MODULES := agedu du alloc trie index html httpd fgetline licence
-AGEDU_OBJS := $(patsubst %,%.o,$(AGEDU_MODULES))
-
-ALLMODULES := $(sort $(AGEDU_MODULES))
-ALLOBJS := $(patsubst %,%.o,$(ALLMODULES))
-ALLDEPS := $(patsubst %,%.d,$(ALLMODULES))
-
-BINARIES = agedu
-
-binaries: $(BINARIES)
-
-agedu: config.h $(AGEDU_OBJS)
- gcc $(LFLAGS) -o agedu $(AGEDU_OBJS)
-
-config.h: configure
- ./configure -q && touch config.h
- rm -f Makefile # we keep using _this_ Makefile
-
-configure: configure.ac
- aclocal
- autoconf
- autoheader
- automake -a --foreign
-
-INTERNALFLAGS=#
-
-$(ALLOBJS): %.o: %.c
- gcc $(CFLAGS) -MM $*.c > $*.d
- gcc $(CFLAGS) $(INTERNALFLAGS) -c $*.c
-
-MANPAGES = agedu.1
-
-doc: $(MANPAGES)
-$(MANPAGES): %.1: %.but
- halibut --man=$*.1 $*.but
-
-clean:
- rm -f $(ALLOBJS) $(ALLDEPS) $(MANPAGES) $(BINARIES)
-
-spotless: clean
- rm -f config.h config.h.in config.log config.status configure
- rm -f depcomp install-sh missing stamp-h1
- rm -f Makefile.in aclocal.m4
- rm -rf autom4te.cache .deps
-
--include $(ALLDEPS)
fgetline.c licence.c
agedu_LDADD = $(LIBOBJS)
man1_MANS = agedu.1
+
+# If Halibut is available to rebuild the man pages from their .but
+# source, then man pages are treated as derived files in the obvious
+# way, and deleted by 'make clean'. If Halibut is not available (the
+# typical case if someone has downloaded the source archive and rerun
+# mkauto.sh), the man pages are treated as source files by this
+# makefile.
+if HAVE_HALIBUT
+BUILT_MANS = $(man1_MANS)
+CLEANFILES = $(BUILT_MANS)
+.SUFFIXES = .but .1
+.but.1:
+ halibut --man=$@ $<
+doc: $(BUILT_MANS)
+endif
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_INSTALL
+AC_CHECK_PROG([HALIBUT],[halibut],[yes],[no])
+AM_CONDITIONAL([HAVE_HALIBUT],[test "x$HALIBUT" = "xyes"])
# Checks for libraries.
--- /dev/null
+#!/bin/sh
+aclocal && autoconf && autoheader && automake -a --foreign