build: Rewrite the build system to be nicer.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 1 Apr 2008 20:00:17 +0000 (21:00 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 1 Apr 2008 21:23:55 +0000 (22:23 +0100)
Makefile.am
configure.ac [new file with mode: 0644]
configure.in [deleted file]
debian/rules

index e9d4aa4..7de67eb 100644 (file)
-## -*-makefile-*-
-##
-## Makefile for fw
-##
-## (c) 1999 Mark Wooding
-##
-
-##----- Licensing notice ----------------------------------------------------
-##
-## This file is part of the `fw' port forwarder.
-##
-## `fw' is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## `fw' is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with `fw'; if not, write to the Free Software Foundation,
-## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-AUTOMAKE_OPTIONS = foreign
-
-bin_PROGRAMS = fw
-man_MANS = fw.1
-
-EXTRA_DIST = \
-       fw.1.in GRAMMAR \
-       make-manpage \
-       debian/changelog debian/copyright debian/control debian/rules
-
-BUILT_SOURCES = mantext.c
+### -*-makefile-*-
+###
+### Makefile for fw
+###
+### (c) 1999 Mark Wooding
+###
 
-$(srcdir)/GRAMMAR: fw.1.in make-manpage
-       perl $(srcdir)/make-manpage text <$(srcdir)/fw.1.in >$@.new
-       mv $@.new $@
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the `fw' port forwarder.
+###
+### `fw' is free software; you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 2 of the License, or
+### (at your option) any later version.
+###
+### `fw' is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with `fw'; if not, write to the Free Software Foundation,
+### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+bin_PROGRAMS            =
+man_MANS                =
+
+EXTRA_DIST              =
+BUILT_SOURCES           =
+CLEANFILES              =
+MAINTAINERCLEANFILES    =
+
+AM_CFLAGS               = $(mLib_CFLAGS)
+
+###--------------------------------------------------------------------------
+### Documentation.
+
+make_manpage            = perl $(srcdir)/make-manpage <$(srcdir)/fw.1.in
+EXTRA_DIST             += fw.1.in make-manpage
+
+## The manual page.
+man_MANS               += fw.1
+CLEANFILES             += fw.1
 
 fw.1: fw.1.in make-manpage
-       perl $(srcdir)/make-manpage man <$(srcdir)/fw.1.in >$@.new
-       mv $@.new $@
+       $(make_manpage) man >$@.new && mv $@.new $@
+
+## The grammar summary.
+MAINTAINERCLEANFILES   += $(srcdir)/GRAMMAR
+EXTRA_DIST             += GRAMMAR
+
+$(srcdir)/GRAMMAR: fw.1.in make-manpage
+       $(make_manpage) text >$@.new && mv $@.new $@
+
+###--------------------------------------------------------------------------
+### The main port forwarder.
+
+bin_PROGRAMS           += fw
+fw_SOURCES              =
+fw_LDADD                = $(mLib_LIBS)
+
+## Main program.
+fw_SOURCES             += fw.c         fw.h
+
+fw_SOURCES             += chan.c       chan.h
+fw_SOURCES             += endpt.c      endpt.h
+fw_SOURCES             += source.c     source.h
+fw_SOURCES             +=              target.h
+
+fw_SOURCES             += conf.c       conf.h
+fw_SOURCES             += scan.c       scan.h
+fw_SOURCES             += fattr.c      fattr.h
+
+fw_SOURCES             += reffd.c      reffd.h
+
+## Sockets.
+fw_SOURCES             += socket.c     socket.h
+fw_SOURCES             +=              addr.h
+
+fw_SOURCES             += un.c         un.h
+
+fw_SOURCES             += inet.c       inet.h
+fw_SOURCES             += acl.c        acl.h
+fw_SOURCES             += identify.c   identify.h
+fw_SOURCES             += privconn.c   privconn.h
+
+## Files.
+fw_SOURCES             += file.c       file.h
+
+## Executables.
+fw_SOURCES             += exec.c       exec.h
+fw_SOURCES             +=              rlimits.h
+
+## Documentation.
+fw_SOURCES             += mantext.c mantext.h
+CLEANFILES             += mantext.c
+BUILT_SOURCES          += mantext.c
 
 mantext.c: fw.1.in make-manpage
-       perl $(srcdir)/make-manpage c <$(srcdir)/fw.1.in >$@.new
-       mv $@.new $@
-
-fw_SOURCES = \
-       chan.c conf.c endpt.c fw.c mantext.c reffd.c scan.c \
-       chan.h conf.h endpt.h fw.h mantext.h reffd.h scan.h \
-       \
-       source.c source.h target.h \
-         exec.c file.c socket.c \
-         exec.h file.h socket.h \
-       \
-       addr.h \
-         inet.c un.c \
-         inet.h un.h \
-       \
-       acl.c fattr.c identify.c privconn.c \
-       acl.h fattr.h identify.h privconn.h rlimits.h
-
-CLEANFILES = $(BUILT_SOURCES) fw.1
-MAINTAINERCLEANFILES = $(srcdir)/GRAMMAR
-
-##----- That's all, folks ---------------------------------------------------
+       $(make_manpage) c >$@.new && mv $@.new $@
+
+###--------------------------------------------------------------------------
+### Other infrastructure.
+
+## Set the release number.
+dist-hook:
+       echo "$(VERSION)" >$(distdir)/RELEASE
+
+###--------------------------------------------------------------------------
+### Debian.
+
+EXTRA_DIST             += debian/rules
+EXTRA_DIST             += debian/changelog
+EXTRA_DIST             += debian/control
+EXTRA_DIST             += debian/copyright
+
+###----- That's all, folks --------------------------------------------------
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..5da430b
--- /dev/null
@@ -0,0 +1,76 @@
+dnl -*-autoconf-*-
+dnl
+dnl Configuration script for fw
+dnl
+dnl (c) 2008 Straylight/Edgeware
+dnl
+
+dnl ----- Licensing notice --------------------------------------------------
+dnl
+dnl This file is part of the `fw' port forwarder.
+dnl
+dnl `fw' is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl `fw' is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with `fw'; if not, write to the Free Software Foundation,
+dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+dnl--------------------------------------------------------------------------
+dnl Initialization.
+
+mdw_AUTO_VERSION
+AC_INIT([fw], AUTO_VERSION, [mdw@distorted.org.uk])
+AC_CONFIG_SRCDIR([fw.c])
+AC_CONFIG_AUX_DIR([config])
+
+AM_INIT_AUTOMAKE([foreign])
+
+dnl--------------------------------------------------------------------------
+dnl C programming environment.
+
+dnl Compiler.
+AC_PROG_CC
+AX_CFLAGS_WARN_ALL
+
+dnl Headers.
+AC_CHECK_HEADERS([unistd.h])
+
+dnl Types.
+AC_TYPE_UID_T
+AC_TYPE_PID_T
+
+dnl Declarations.
+AC_CHECK_DECLS([environ])
+AC_CHECK_DECLS([_sys_siglist])
+
+dnl Libraries.
+AC_SEARCH_LIBS([socket], [socket])
+AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
+
+dnl Packages.
+PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4])
+
+dnl Functions.
+AC_CHECK_FUNCS([inet_aton])
+AC_CHECK_FUNCS([setrlimit])
+AC_CHECK_FUNCS([setgroups])
+AC_CHECK_FUNCS([getnetbyname])
+AC_CHECK_FUNCS([strsignal])
+
+dnl--------------------------------------------------------------------------
+dnl Output.
+
+AC_CONFIG_HEADER([config/config.h])
+AC_CONFIG_FILES([Makefile])
+
+AC_OUTPUT
+
+dnl ----- That's all, folks -------------------------------------------------
diff --git a/configure.in b/configure.in
deleted file mode 100644 (file)
index 0952eb7..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-dnl -*-m4-*-
-dnl
-dnl Configuration script for fw
-dnl
-dnl (c) 1999 Straylight/Edgeware
-dnl
-
-dnl ----- Licensing notice --------------------------------------------------
-dnl
-dnl This file is part of the `fw' port forwarder.
-dnl
-dnl `fw' is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl `fw' is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with `fw'; if not, write to the Free Software Foundation,
-dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-AC_INIT(fw.c)
-AM_INIT_AUTOMAKE(fw, 1.2.7)
-AM_CONFIG_HEADER(config.h)
-
-AC_PROG_CC
-mdw_GCC_FLAGS
-
-AC_CHECK_HEADERS(unistd.h)
-
-AC_TYPE_UID_T
-AC_TYPE_PID_T
-
-mdw_DECL_ENVIRON
-
-mdw_CHECK_MANYLIBS(socket, socket)
-mdw_CHECK_MANYLIBS(gethostbyname, nsl resolv)
-mdw_MLIB(2.0.3)
-
-AC_CHECK_FUNCS(inet_aton)
-AC_CHECK_FUNCS(setrlimit)
-AC_CHECK_FUNCS(setgroups)
-AC_CHECK_FUNCS(getnetbyname)
-AC_CHECK_FUNCS(strsignal _sys_siglist, break)
-
-AC_OUTPUT(Makefile)
-
-dnl ----- That's all, folks -------------------------------------------------
index b149ebf..39c2a7c 100755 (executable)
@@ -1,45 +1,18 @@
 #! /usr/bin/make -f
 
-export DH_COMPAT = 4
+CDBS = /usr/share/cdbs/1
 
-build:
-       rm -rf build deb-build
-       mkdir deb-build
-       cd deb-build; ../configure --prefix=/usr --mandir=/usr/share/man
-       make -C deb-build
-       touch build
+include $(CDBS)/class/autotools.mk
+include $(CDBS)/rules/debhelper.mk
 
-clean:
-       dh_clean
-       rm -rf deb-build build
+###--------------------------------------------------------------------------
+### General definitions.
 
-install: build
-       dh_clean
-       make -C deb-build install DESTDIR=`pwd`/debian/fw
+DEB_BUILDDIR = $(CURDIR)/build
 
-binary-indep:
+###--------------------------------------------------------------------------
+### Documentation.
 
-binary-arch: install
-       dh_testdir -a
-       dh_testroot -a
-       dh_compress -a
-       dh_installdocs -a GRAMMAR
-       dh_strip -a
-       dh_shlibdeps -a
-       dh_gencontrol -a
-       dh_fixperms -a
-       dh_installdeb -a
-       dh_md5sums -a
-       dh_builddeb -a
+DEB_INSTALL_DOCS_fw     = GRAMMAR
 
-binary: binary-indep binary-arch
-
-source:
-       rm -rf deb-build/*.tar.gz deb-build/=deb=
-       make -C deb-build dist
-       mkdir deb-build/=deb=
-       cd deb-build/=deb=; tar xvfz ../*.tar.gz
-       d=`pwd`; cd ..; dpkg-source -i -b $$d/deb-build/=deb=/*
-       rm -rf deb-build/=deb=
-
-.PHONY: binary binary-arch binary-indep clean install source
+###----- That's all, folks --------------------------------------------------
\ No newline at end of file