summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2017-05-20 08:42:45 +0100
committerSimon Tatham <anakin@pobox.com>2017-05-20 08:48:11 +0100
commit41394e187f6fad8dfb44baefe7603b77c0bff57b (patch)
tree6fb71966e4473fa2169047112dcd2abc52724240
parent80d18da9a127d1d7d111625133742691b9aeedfe (diff)
downloadhalibut-41394e187f6fad8dfb44baefe7603b77c0bff57b.zip
halibut-41394e187f6fad8dfb44baefe7603b77c0bff57b.tar.gz
halibut-41394e187f6fad8dfb44baefe7603b77c0bff57b.tar.bz2
halibut-41394e187f6fad8dfb44baefe7603b77c0bff57b.tar.xz
Replace Halibut's makefiles with autotools.
This commit updates the libcharset submodule to incorporate the autotools-ification that I just pushed to that subproject, and builds on it by replacing Halibut's own makefile system similarly with an autotools setup. The new Makefile.am incorporates both of the old Makefile and doc/Makefile, so a single run of 'make' should now build Halibut itself and all the formats of its own documentation, which also means that the automake-generated 'make install' target can do the right thing in terms of putting an appropriate subset of those documentation formats in the assorted installation directories. The old Makefiles are gone, as is release.sh (which is now obsolete because autotools's 'make dist' doesn't do anything obviously wrong). The bob build script is comprehensively rewritten, but should still work - even the clang-based Windows build can use the autotools-generated makefile system, provided I do the libcharset build with a manual override of bin_PROGRAMS to prevent it trying to build the libcharset supporting utilities (which are not completely Windows-portable).
-rw-r--r--.gitignore13
-rw-r--r--Buildscr48
-rw-r--r--Makefile130
-rw-r--r--Makefile.am65
-rwxr-xr-xautogen.sh2
m---------charset0
-rw-r--r--configure.ac18
-rw-r--r--doc/Makefile24
-rwxr-xr-xrelease.sh29
9 files changed, 121 insertions, 208 deletions
diff --git a/.gitignore b/.gitignore
index 98ae31c..21a2f53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
/build.log
/build.out
-/build
/halibut
/doc/*.html
/doc/halibut.1
@@ -9,3 +8,15 @@
/doc/halibut.ps
/doc/halibut.txt
/doc/halibut.chm
+*.o
+.deps
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache/
+/compile
+/configure
+/depcomp
+/install-sh
+/missing
+/stamp-h1
diff --git a/Buildscr b/Buildscr
index a1f1e63..2272f8d 100644
--- a/Buildscr
+++ b/Buildscr
@@ -15,39 +15,39 @@ in halibut do perl -e 'print "\n\\versionid Halibut version $$ARGV[0]\n"' $(Vers
in halibut do echo '/* Generated by automated build script */' > version.h
in halibut do echo '$#define VERSION "version $(Version)"' >> version.h
-set Rel
-ifneq "$(RELEASE)" "" set Rel RELEASE=$(RELEASE)
+# Substitute the version into configure.ac.
+in halibut do perl -i -pe 's!NOVERSION!$(Version)!' configure.ac
-set Basename halibut-$(Version)
+# Run autotools.
+in halibut do ./autogen.sh
# Make the source archive.
-in halibut do ./release.sh $(Basename) $(Version)
+in . do mkdir builddist
+in builddist do ../halibut/configure && make dist
# Build a Windows binary of Halibut using clang-cl.
-in halibut with clangcl64 do make CC='clang --target=x86_64-pc-windows-msvc18.0.0 -D_CRT_SECURE_NO_WARNINGS' CC_LINK='lld-link -defaultlib:libcmt -out:$$@' EXE=.exe
-in halibut do mv build/halibut.exe .
-in halibut do rm -rf build
+in . do mkdir buildwin
+in buildwin do mkdir lld-link-bodge
+in buildwin/lld-link-bodge do { echo '$#!/bin/sh'; echo 'exec lld-link "$$@"'; } > lld-link.exe && chmod +x lld-link.exe
+in buildwin do ../halibut/configure
+in buildwin/charset with clangcl64 do PATH="$$PWD/lld-link-bodge:$$PATH" make CC='clang --target=x86_64-pc-windows-msvc18.0.0 -D_CRT_SECURE_NO_WARNINGS -fuse-ld=lld' bin_PROGRAMS=
+in buildwin with clangcl64 do PATH="$$PWD/lld-link-bodge:$$PATH" make CC='clang --target=x86_64-pc-windows-msvc18.0.0 -D_CRT_SECURE_NO_WARNINGS -fuse-ld=lld' EXEEXT=.exe halibut.exe
+
delegate windows
# Code-sign the Windows binary, if the local bob config provides
# a script to do so. We assume here that the script accepts an -i
# option to provide a 'more info' URL, and that it signs the file
# in place.
- ifneq "$(winsigncode)" "" in halibut do $(winsigncode) -i http://www.chiark.greenend.org.uk/~sgtatham/halibut/ halibut.exe
- return halibut/halibut.exe
+ ifneq "$(winsigncode)" "" in buildwin do $(winsigncode) -i http://www.chiark.greenend.org.uk/~sgtatham/halibut/ halibut.exe
+ return buildwin/halibut.exe
enddelegate
-# Build a local binary of Halibut in order to build the docs. Make
-# sure to tag it with the supplied version number, so that the
-# release docs announce themselves as having been built with the
-# release Halibut (e.g. PDF's Producer property).
-in halibut do make $(Rel)
-
-# And now build the docs.
-in halibut/doc do make
-
-deliver halibut/*.tar.gz $@
-deliver halibut/halibut.exe $@
-deliver halibut/doc/halibut.pdf $@
-deliver halibut/doc/halibut.txt $@
-deliver halibut/doc/halibut.chm $@
-deliver halibut/doc/*.html $@
+# Do a full local build of Halibut, which will also build the docs.
+in builddist do make
+
+deliver builddist/*.tar.gz $@
+deliver buildwin/halibut.exe $@
+deliver builddist/halibut.pdf $@
+deliver builddist/halibut.txt $@
+deliver builddist/halibut.chm $@
+deliver builddist/*.html $@
diff --git a/Makefile b/Makefile
deleted file mode 100644
index ba5676f..0000000
--- a/Makefile
+++ /dev/null
@@ -1,130 +0,0 @@
-# Halibut master makefile
-
-# Currently depends on gcc, because:
-# - the dependency tracking uses -MD in order to avoid needing an
-# explicit `make depend' step
-# - the definition of CFLAGS includes the gcc-specific flag
-# `-Wall'
-#
-# Currently depends on GNU make, because:
-# - the Makefile uses GNU ifdef / ifndef commands and GNU make `%'
-# pattern rules
-# - we use .PHONY
-
-prefix=/usr/local
-exec_prefix=$(prefix)
-bindir=$(exec_prefix)/bin
-INSTALL=install -c
-
-.PHONY: all install clean spotless topclean release
-
-ifdef RELEASE
-ifndef VERSION
-VERSION := $(RELEASE)
-endif
-else
-CFLAGS += -g
-endif
-
-ifeq (x$(VERSION)y,xy)
-RELDIR := halibut
-else
-RELDIR := halibut-$(VERSION)
-endif
-
-# `make' from top level will build in directory `build'
-# `make BUILDDIR=foo' from top level will build in directory foo
-ifndef REALBUILD
-ifndef BUILDDIR
-ifdef TEST
-BUILDDIR := test
-else
-BUILDDIR := build
-endif
-endif
-
-all install:
- @test -d $(BUILDDIR) || mkdir $(BUILDDIR)
- @$(MAKE) -C $(BUILDDIR) -f ../Makefile $@ REALBUILD=yes
-
-spotless: topclean
- @test -d $(BUILDDIR) || mkdir $(BUILDDIR)
- @$(MAKE) -C $(BUILDDIR) -f ../Makefile spotless REALBUILD=yes
-
-clean: topclean
- @test -d $(BUILDDIR) || mkdir $(BUILDDIR)
- @$(MAKE) -C $(BUILDDIR) -f ../Makefile clean REALBUILD=yes
-
-# Remove Halibut output files in the source directory (may
-# have been created by running, for example, `build/halibut
-# inputs/test.but').
-topclean:
- rm -f *.html output.* *.tar.gz
-
-# Makef a release archive.
-release: release.sh
- ./release.sh $(RELDIR) $(VERSION)
-
-else
-
-# The `real' makefile part.
-
-CFLAGS += -Wall -W -ansi -pedantic
-
-ifdef TEST
-CFLAGS += -DLOGALLOC
-LIBS += -lefence
-endif
-
-EXE =#
-
-all: halibut$(EXE)
-
-SRC := ../
-
-ifeq ($(shell test -d $(SRC)charset && echo yes),yes)
-LIBCHARSET_SRCDIR = $(SRC)charset/
-else
-LIBCHARSET_SRCDIR = $(SRC)../charset/
-endif
-LIBCHARSET_OBJDIR = ./#
-LIBCHARSET_OBJPFX = cs-#
-LIBCHARSET_GENPFX = charset-#
-MD = -MD
-CFLAGS += -I$(LIBCHARSET_SRCDIR) -I$(LIBCHARSET_OBJDIR)
-include $(LIBCHARSET_SRCDIR)Makefile
-CC_LINK = $(CC) -o $@
-
-MODULES := main malloc ustring error help licence version misc tree234
-MODULES += input in_afm in_pf in_sfnt keywords contents index biblio
-MODULES += bk_text bk_html bk_whlp bk_man bk_info bk_paper bk_ps bk_pdf
-MODULES += winhelp winchm deflate lzx lz77 huffman psdata wcwidth
-
-OBJECTS := $(addsuffix .o,$(MODULES)) $(LIBCHARSET_OBJS)
-DEPS := $(addsuffix .d,$(MODULES))
-
-halibut$(EXE): $(OBJECTS)
- $(CC_LINK) $(LFLAGS) $(OBJECTS) $(LIBS)
-
-%.o: $(SRC)%.c
- $(CC) $(CFLAGS) -MD -c $<
-
-version.o: FORCE
- $(CC) $(CFLAGS) $(VDEF) -MD -c $(SRC)version.c
-
-spotless:: clean
- rm -f *.d
-
-clean::
- rm -f *.o halibut core
-
-install:
- mkdir -p $(prefix) $(bindir)
- $(INSTALL) -m 755 halibut $(bindir)/halibut
- $(MAKE) -C ../doc install prefix="$(prefix)" INSTALL="$(INSTALL)"
-
-FORCE: # phony target to force version.o to be rebuilt every time
-
--include $(DEPS)
-
-endif
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..5220861
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,65 @@
+SUBDIRS = charset
+
+AM_CPPFLAGS = -I$(srcdir)/charset
+
+bin_PROGRAMS = halibut
+
+halibut_SOURCES = main.c halibut.h version.h malloc.c ustring.c \
+error.c help.c licence.c version.c misc.c tree234.c tree234.h input.c \
+in_afm.c in_pf.c in_sfnt.c keywords.c contents.c index.c biblio.c \
+bk_text.c bk_html.c bk_whlp.c bk_man.c bk_info.c bk_paper.c paper.h \
+bk_ps.c bk_pdf.c winhelp.c winhelp.h winchm.c winchm.h deflate.c \
+deflate.h lzx.c lzx.h lz77.c lz77.h huffman.c huffman.h psdata.c \
+wcwidth.c
+
+halibut_LDADD = charset/libcharset.a
+
+# Prevent 'make install' from recursing into $(SUBDIRS) and hence also
+# installing libcharset's supporting binary utilities.
+install:
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+
+man1_MANS = halibut.1
+noinst_DATA = halibut.info halibut.txt halibut.ps halibut.pdf halibut.chm
+doc_DATA = index.html halibut.pdf
+
+MANPAGE_SRC = $(srcdir)/doc/manpage.but
+halibut.1: halibut $(MANPAGE_SRC)
+ ./halibut --man=$@ $(MANPAGE_SRC)
+
+MANUAL_SRC := $(srcdir)/doc/blurb.but $(srcdir)/doc/intro.but \
+$(srcdir)/doc/running.but $(srcdir)/doc/input.but \
+$(srcdir)/doc/output.but $(srcdir)/doc/licence.but \
+$(srcdir)/doc/manpage.but $(srcdir)/doc/index.but
+
+index.html: halibut $(MANUAL_SRC)
+ ./halibut --html $(MANUAL_SRC)
+
+halibut.info: halibut $(MANUAL_SRC)
+ ./halibut --info=halibut.info $(MANUAL_SRC)
+
+halibut.txt: halibut $(MANUAL_SRC)
+ ./halibut --text=$@ $(MANUAL_SRC)
+
+halibut.ps: halibut $(MANUAL_SRC)
+ ./halibut --ps=$@ $(MANUAL_SRC)
+
+halibut.pdf: halibut $(MANUAL_SRC)
+ ./halibut --pdf=$@ $(MANUAL_SRC)
+
+halibut.chm: halibut $(MANUAL_SRC)
+ ./halibut --chm=$@ $(MANUAL_SRC)
+
+# Install all the other parts of the HTML, and the Info documentation.
+# I can't just add those file lists to the usual Automake
+# dir_FILETYPES variables, because both are variable lists of
+# filenames, and in addition, Automake doesn't even let me write an
+# info_DATA variable at all because it expects that the only things
+# you might ever install in $(infodir) are generated from Texinfo
+# source.
+install-data-hook: halibut.info
+ $(INSTALL_DATA) *.html $(docdir)
+ $(MKDIR_P) $(infodir)
+ $(INSTALL_DATA) *.info* $(infodir)
+
+EXTRA_DIST = $(MANUAL_SRC) $(MANPAGE_SRC)
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..52251d0
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+autoreconf -i && rm -rf autom4te.cache
diff --git a/charset b/charset
-Subproject a7353cf60d896b33f103a26bc73cce535990d5c
+Subproject 102311655988317c71e42bbb3d454414d9179e6
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..6aeaa0e
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,18 @@
+# autoconf input for halibut.
+
+AC_INIT([halibut], [NOVERSION], [anakin@pobox.com])
+AC_CONFIG_SRCDIR([halibut.h])
+
+AM_INIT_AUTOMAKE(foreign)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MKDIR_P
+
+AC_LANG([C])
+
+AC_CONFIG_FILES([Makefile])
+
+AC_CONFIG_SUBDIRS([charset])
+
+AC_OUTPUT
diff --git a/doc/Makefile b/doc/Makefile
deleted file mode 100644
index e0cc27a..0000000
--- a/doc/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-mandir=$(prefix)/man
-man1dir=$(mandir)/man1
-
-CHAPTERS := $(SITE) blurb intro running input output licence manpage index
-
-INPUTS = $(patsubst %,%.but,$(CHAPTERS))
-
-HALIBUT = ../build/halibut
-
-all: index.html halibut.1
-
-index.html: $(INPUTS) $(HALIBUT)
- $(HALIBUT) --text=halibut.txt --html --info=halibut.info \
- --ps=halibut.ps --pdf=halibut.pdf --chm=halibut.chm $(INPUTS)
-
-halibut.1: manpage.but
- $(HALIBUT) --man=halibut.1 manpage.but
-
-install:
- mkdir -p $(man1dir)
- $(INSTALL) -m 644 halibut.1 $(man1dir)/halibut.1
-
-clean:
- rm -f *.html *.txt *.hlp *.cnt *.1 *.info* *.ps *.pdf *.chm
diff --git a/release.sh b/release.sh
deleted file mode 100755
index af047b4..0000000
--- a/release.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# Make a Halibut release archive.
-
-RELDIR="$1"
-VERSION="$2"
-
-linkmirror() {
- (cd "$1"; find . -name CVS -prune -o -name .svn -prune -o \
- -name build -prune -o -name reltmp -prune -o -type d -print) | \
- while read dir; do mkdir -p "$2"/"$dir"; done
- (cd "$1"; find . -name CVS -prune -o -name .svn -prune -o \
- -name build -prune -o -name reltmp -prune -o \
- -name '*.orig' -prune -o -name '*.rej' -prune -o \
- -name '*.txt' -prune -o -name '*.html' -prune -o \
- -name '*.1' -prune -o -name '.cvsignore' -prune -o \
- -name '*.gz' -prune -o -name '.[^.]*' -prune -o \
- -type f -print) | \
- while read file; do ln -s "$1"/"$file" "$2"/"$file"; done
-}
-
-linkmirror $PWD reltmp/$RELDIR
-if ! test -d charset; then
- linkmirror $PWD/../charset reltmp/$RELDIR/charset
-fi
-
-tar chzvoCf reltmp $RELDIR.tar.gz $RELDIR
-
-rm -rf reltmp