Add to git. master
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 25 Apr 2014 10:39:41 +0000 (11:39 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 25 Apr 2014 10:39:41 +0000 (11:39 +0100)
34 files changed:
.cvsignore [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile+ [new file with mode: 0644]
README [new file with mode: 0644]
README.Solaris [new file with mode: 0644]
README.make+_for_bundles [new file with mode: 0644]
c.mk [new file with mode: 0644]
check_funcs.sh [new file with mode: 0755]
check_gnu_tar.sh [new file with mode: 0755]
check_headers.sh [new file with mode: 0755]
check_lib.sh [new file with mode: 0755]
check_progs.sh [new file with mode: 0755]
configure [new file with mode: 0755]
configure.mk [new file with mode: 0644]
configure_end.sh [new file with mode: 0755]
configure_start.sh [new file with mode: 0755]
default_goal.mk [new file with mode: 0644]
dist.mk [new file with mode: 0644]
doc/make+-book.xml [new file with mode: 0644]
doc/make+-man.xml [new file with mode: 0644]
install_dynamic_lib.sh [new file with mode: 0755]
install_static_lib.sh [new file with mode: 0755]
link_dynamic.sh [new file with mode: 0755]
link_static.sh [new file with mode: 0755]
main.mk [new file with mode: 0644]
make+ [new file with mode: 0755]
make+-skeleton [new file with mode: 0755]
make_rpm_spec.sh [new file with mode: 0755]
make_website.sh [new file with mode: 0755]
release.sh [new file with mode: 0755]
rpm.mk [new file with mode: 0644]
run_tests.sh [new file with mode: 0644]
test.mk [new file with mode: 0644]
website.mk [new file with mode: 0644]

diff --git a/.cvsignore b/.cvsignore
new file mode 100644 (file)
index 0000000..1964f99
--- /dev/null
@@ -0,0 +1 @@
+build-*
\ No newline at end of file
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..7a8b097
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,80 @@
+Installing make+
+----------------
+
+Make+ is entirely self-hosting! But don't worry, it's easy to build and
+install make+ even if you don't already have make+ installed. Follow the
+steps below to build, install or make a package.
+
+1. Quick installation for the impatient:
+
+       MAKEPLUS_HOME=`pwd`; export MAKEPLUS_HOME
+       PATH=$MAKEPLUS_HOME:$PATH
+       ./configure [--prefix=/usr --sysconfdir=/etc]
+       make+
+       su
+       make+ install
+       exit
+       unset MAKEPLUS_HOME
+
+Step by step instructions follow:
+
+2. Set the MAKEPLUS_HOME environment variable to point to the make+
+   source files.
+
+   Make sure you are in the unpacked make+ source directory and type:
+
+       MAKEPLUS_HOME=`pwd`
+       export MAKEPLUS_HOME
+
+   If you are using CSH, type:
+
+       setenv MAKEPLUS_HOME `pwd`
+
+   Note that those are backquotes (`) around the pwd.
+
+   To check this, type:
+
+       echo $MAKEPLUS_HOME
+
+   which should show the full path to the unpacked source directory.
+
+   Similarly you also need to update your PATH so that the 'make+'
+   program can be found:
+
+       PATH=$MAKEPLUS_HOME:$PATH
+
+3. Configure the paths used by make+. Normally you would do:
+
+       ./configure
+
+   This will install make+ entirely under the /usr/local directory. To
+   install under /usr and with the configuration file in /etc, do:
+
+       ./configure --prefix=/usr --sysconfdir=/etc
+
+4. Run make+ to have it build itself:
+
+       make+
+
+5. To perform a straightforward install, you'll need to be root (but
+   you don't need to be root yet if all you want to do is build an RPM).
+   To become root, type:
+
+       su
+
+   you will probably be asked for the root password.
+
+6. Type:
+
+       make+ install
+       exit
+
+7. If you prefer, you can build an RPM of make+:
+
+       make+ rpm
+
+   The RPM will end up under build-*/makeplus-*.rpm
+
+8. Remove the MAKEPLUS_HOME environment variable.
+
+       unset MAKEPLUS_HOME
diff --git a/Makefile+ b/Makefile+
new file mode 100644 (file)
index 0000000..3ebe693
--- /dev/null
+++ b/Makefile+
@@ -0,0 +1,229 @@
+# -*- Makefile -*-
+#
+# This is a make+ file. Make+ is a set of scripts which enhance GNU
+# make and let you build RPMs, and other package types with just one
+# control file.  To build this package you will need to download make+
+# from this site: http://www.annexia.org/freeware/makeplus/
+
+PACKAGE                := makeplus
+VERSION_MAJOR  := 0
+VERSION_MINOR  := 2.3
+VERSION                := $(VERSION_MAJOR).$(VERSION_MINOR)
+
+SUMMARY                := Advanced build system for GNU make
+COPYRIGHT      := Public Domain
+AUTHOR         := Richard W.M. Jones <rich@annexia.org>
+
+define DESCRIPTION
+Make+ is a set of scripts which enhance GNU make. The scripts replace
+the functionality of autoconf, automake, rpm, dpkg and more, allowing
+you to build, install, make RPMs, make Debian packages and more, all
+from a single maintainable 'Makefile+' script.
+
+Read more at http://www.annexia.org/freeware/makeplus/
+
+The original author is Richard W.M. Jones <rich@annexia.org>
+
+This software has been explicitly placed in the PUBLIC DOMAIN.  You
+do not need any sort of license or agreement to use or copy this
+software. You may also copyright this software yourself, and/or
+relicense it under any terms you want, at any time and at no cost.
+This allows you (among other things) to include this software with
+other packages so that the user does not need to download and
+install make+ separately.
+endef
+
+RPM_REQUIRES   := make >= 3.76, bash
+RPM_GROUP      := Development/Building
+
+CFLAGS         += -Wall -Werror -g -O2
+
+EXTRA_DIST     := doc/*.html doc/*.1
+
+all:   build
+
+configure:
+       $(MP_CONFIGURE_START)
+       $(MP_CHECK_GNU_TAR)
+       $(MP_CONFIGURE_END)
+
+build: docs
+
+docs:  doc/index.html doc/make+.1 # doc/makeplus.pdf
+
+doc/index.html: doc/make+-book.xml
+       rm -f doc/*.html
+       -xmlto html -o doc $^
+
+doc/make+.1: doc/make+-man.xml
+       -rm -f doc/*.1 ; xmlto man -o doc $^
+
+doc/makeplus.pdf: doc/make+-book.xml
+       rm -f $@
+       -xmlto pdf -o doc $^
+
+test:
+
+# Avoid recursively distributing self.
+MP_BUNDLE := 0
+
+install: dist_for_bundles
+       install -d $(DESTDIR)$(bindir)
+       install -d $(DESTDIR)$(sysconfdir)
+       install -d $(DESTDIR)$(pkgdatadir)
+       install -d $(DESTDIR)$(docdir)
+       install -d $(DESTDIR)$(man1dir)
+
+       install -m 0755 $(srcdir)/make+ $(srcdir)/make+-skeleton \
+               $(DESTDIR)$(bindir)
+       echo "MAKEPLUS_HOME=$(pkgdatadir); export MAKEPLUS_HOME" \
+               > $(DESTDIR)$(sysconfdir)/make+.conf
+       install -m 0755 $(srcdir)/configure $(DESTDIR)$(pkgdatadir)
+       install -m 0644 $(srcdir)/*.mk $(DESTDIR)$(pkgdatadir)
+       install -m 0755 $(srcdir)/*.sh $(DESTDIR)$(pkgdatadir)
+       install -m 0644 $(srcdir)/README $(DESTDIR)$(docdir) ||:
+#      # Built docs might be in $(srcdir) or build directory.
+       install -m 0644 doc/*.html $(DESTDIR)$(docdir) ||:
+       install -m 0644 doc/*.1 $(DESTDIR)$(man1dir)   ||:
+       install -m 0644 $(srcdir)/doc/*.html $(DESTDIR)$(docdir) ||:
+       install -m 0644 $(srcdir)/doc/*.1 $(DESTDIR)$(man1dir)   ||:
+ifdef HAVE_GNU_TAR
+#      # We do this so that the MP_BUNDLE option works (see dist.mk).
+       install -m 0644 mp-dist_for_bundles.tar.gz \
+               $(DESTDIR)$(pkgdatadir)/$(PACKAGE).tar.gz
+       install -m 0644 $(srcdir)/README.make+_for_bundles \
+               $(DESTDIR)$(pkgdatadir)
+       rm mp-dist_for_bundles.tar.gz
+endif
+
+# make+ installs a copy of its own distribution so that the MP_BUNDLE
+# option works (see dist.mk).
+ifdef HAVE_GNU_TAR
+dist_for_bundles:
+       $(MAKE) -f $(srcdir)/$(_mp_makefile) \
+         MP_SRC_DIST=mp-dist_for_bundles.tar.gz dist
+else
+dist_for_bundles:
+
+endif
+
+define WEBSITE
+<% include page_header.msp %>
+
+<h1>makeplus - $(SUMMARY)</h1>
+
+<p>
+Make+ is a set of scripts which enhance GNU make. The scripts replace
+the functionality of autoconf, automake, rpm, dpkg and more, allowing
+you to build, install, make RPMs, make Debian packages and more, all
+from a single maintainable 'Makefile+' script.
+</p>
+
+<h1>Download</h1>
+
+<h2>Source code</h2>
+
+<ul>
+<li> Latest source release is $(VERSION):
+     <a href="$(PACKAGE)-$(VERSION).tar.gz">$(PACKAGE)-$(VERSION).tar.gz</a>
+<li> Red Hat 7.x Source RPM package:
+     <a href="$(PACKAGE)-$(VERSION)-1.src.rpm">$(PACKAGE)-$(VERSION)-1.src.rpm</a>
+</ul>
+
+<h2>Binary packages</h2>
+
+<ul>
+<li> Red Hat 7.x RPM package:
+     <a href="$(PACKAGE)-$(VERSION)-1.i386.rpm">$(PACKAGE)-$(VERSION)-1.i386.rpm</a>
+<li> Binary tarball:
+     <a href="$(PACKAGE)-$(VERSION).bin.tar.gz">$(PACKAGE)-$(VERSION).bin.tar.gz</a>
+</ul>
+
+<h1>News</h1>
+
+<p>
+<b>Fri Mar 28 14:25:31 GMT 2003:</b>
+Fixed case where 'uname -m' has spaces, which would cause
+the build directory name to contain spaces. Fixed the RPM spec
+file (autogenerated) so that when building make+, make+ builds
+itself using itself (thanks to ksonney at redhat.com for
+identifying this problem).
+</p>
+
+<p>
+<b>Sat Mar  1 14:28:35 GMT 2003:</b>
+Make+ now supports a separate <code>./configure</code>
+scripts, to make it look very much more like autoconf.
+Added the ability to check that programs exist on the system.
+Libraries, etc., can now be required (the configure step will
+fail if they are not present). Make+ can now bundle itself
+with your distribution so people don't need to download
+make+ separately. More extensive testing on FreeBSD and
+Solaris. Manpages install on the right place on FreeBSD
+(thanks alane at geeksrus.net).
+</p>
+
+<p>
+<b>Mon Feb 10 09:00:12 GMT 2003:</b>
+Added missing newline at the end of configure_start.sh, which
+broke FreeBSD's shell. (Thanks alane at geeksrus.net).
+</p>
+
+<p>
+<b>Sat Feb  8 17:00:47 GMT 2003:</b>
+Ported to Solaris, OpenBSD and FreeBSD (thanks to
+<a href="http://www.azazel.net/">Jeremy Sowden</a>
+and <a href="http://www.mondaymorning.org/">Richard Baker</a>
+for help and equipment). Configuration information logged
+to <code>config.log</code> file. Separate <code>config.mk</code>
+file for Makefile-specific configuration.
+</p>
+
+<p>
+<b>Fri Dec 27 10:40:50 GMT 2002:</b>
+Multiple patches from Alan E at geekrus dot net which fix compatibility
+issues with FreeBSD (manual page location can now be chosen, <code>CC</code>
+and <code>CFLAGS</code> variables can be read on the command line).
+This is an intermediate release which contains incomplete DocBook
+documentation (to be completed properly later).
+</p>
+
+<p>
+<b>Fri Dec 20 12:28:09 GMT 2002:</b> A patch which corrects the
+build directory name on FreeBSD (thanks to Alan E at geeksrus dot
+net for this).
+</p>
+
+<p>
+<b>Mon Dec 16 22:03:32 GMT 2002:</b> Various improvements to building
+tar files, binary distributions. This version should work better with
+*BSD.
+</p>
+
+<p>
+<b>Sun Dec  8 12:46:46 GMT 2002:</b> Extra colon in skeleton removed.
+'/' in headers no longer breaks the $$(MP_CHECK_HEADERS) rule.
+Fixed building of dynamic libraries in subdirectories. Various
+extra fixes for <code>pthrlib</code>.
+</p>
+
+<p>
+<b>Sun Dec  8 11:28:28 GMT 2002:</b> <code>make+</code> on its own now
+correctly runs the <code>all</code> target.
+</p>
+
+<p>
+<b>Sun Dec  8 10:50:11 GMT 2002:</b> Fixed
+several bugs in <code>make+-skeleton</code>.
+</p>
+
+<% include page_footer.msp %>
+endef
+
+upload_website:
+       scp $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)-1.*.rpm \
+       $(PACKAGE)-$(VERSION).bin.tar.gz \
+       rich@10.0.0.248:annexia.org/freeware/makeplus/
+       scp index.html rich@10.0.0.248:annexia.org/freeware/makeplus/index.msp
+
+.PHONY:        build configure docs test upload_website
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..8921868
--- /dev/null
+++ b/README
@@ -0,0 +1,7 @@
+Make+ is a set of scripts which enhance GNU make. The scripts replace
+the functionality of autoconf, automake, rpm, dpkg and more, allowing
+you to build, install, make RPMs, make Debian packages and more, all
+from a single maintainable 'Makefile+' script.
+
+To find out how to install make+, please read the accompanying INSTALL
+file.
\ No newline at end of file
diff --git a/README.Solaris b/README.Solaris
new file mode 100644 (file)
index 0000000..2de2244
--- /dev/null
@@ -0,0 +1,16 @@
+It is possible to install and use make+ on Solaris. Make sure, however,
+that you have installed the GNU software from http://www.sunfreeware.com/,
+in particular these packages:
+
+make
+fileutils
+gzip
+bash
+grep
+
+You may also need to ensure that the GNU versions of the tools are first
+in the PATH, for example by doing:
+
+export PATH=/usr/local/bin:$PATH
+
+Rich, 2003/01/14
diff --git a/README.make+_for_bundles b/README.make+_for_bundles
new file mode 100644 (file)
index 0000000..7d837d4
--- /dev/null
@@ -0,0 +1,38 @@
+README for make+
+----------------
+
+This package uses 'make+' - the sane replacement for autoconf/automake.
+
+Bundled along with this package you should find a makeplus-NNN/
+subdirectory.  This contains the version of makeplus which was used
+when this package was created. You now have three choices:
+
+1. If you already have a recent version of make+ installed on your
+computer, then just ignore this subdirectory. You should be able to
+build this package just by doing:
+
+       ./configure
+       make+
+       make+ test
+       make+ install           # As root
+
+2. If you do not have make+ installed or you want to use the bundled
+version of make+ because it is newer, then you can do:
+
+       MAKEPLUS_HOME=`pwd`/makeplus-* ; export MAKEPLUS_HOME
+
+       oldpath=$PATH
+       PATH=$MAKEPLUS_HOME:$PATH ; export PATH
+
+       ./configure
+       make+
+       make+ test
+       make+ install           # As root
+
+       PATH=$oldpath
+
+3. Or you can go to the website to download the latest version of
+make+, install it and then proceed with the instructions in (1)
+above. The website is:
+
+       http://www.annexia.org/freeware/makeplus/
diff --git a/c.mk b/c.mk
new file mode 100644 (file)
index 0000000..856bdff
--- /dev/null
+++ b/c.mk
@@ -0,0 +1,32 @@
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# General C compilation variables.
+CC             ?= gcc
+CFLAGS         += -I. -I..
+LIBS           +=
+SETENV         ?= /usr/bin/env
+CONF_ENV       = CC="$(CC)" CFLAGS="$(CFLAGS)"
+
+# Link scripts.
+MP_LINK_STATIC = $(MAKEPLUS_HOME)/link_static.sh
+MP_LINK_DYNAMIC        = $(MAKEPLUS_HOME)/link_dynamic.sh
+MP_INSTALL_STATIC_LIB = $(MAKEPLUS_HOME)/install_static_lib.sh
+MP_INSTALL_DYNAMIC_LIB = $(MAKEPLUS_HOME)/install_dynamic_lib.sh
+
+# Compile object files for dynamic linking.
+.c.lo:
+       $(CC) $(CFLAGS) -fPIC -c $< -o $@
+
+.SUFFIXES: .lo
\ No newline at end of file
diff --git a/check_funcs.sh b/check_funcs.sh
new file mode 100755 (executable)
index 0000000..3fd351d
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+require=$1
+shift
+
+for func in "$@"; do
+    sym=`echo $func | tr -- '-.[a-z]' '__[A-Z]'`
+    have=
+
+    # Try to compile and link a short program which references this
+    # symbol. If the symbol exists in the library then this ought to
+    # succeed.
+    rm -f mp-check_func
+    echo "char $func(); char (*f) ();int main(){f = $func;return 0;}" \
+       > mp-check_func.c
+    echo "mp-check_func.c:" >>config.log
+    cat mp-check_func.c >>config.log
+    echo $CC $CFLAGS mp-check_func.c -o mp-check_func $LIBS >>config.log
+    $CC $CFLAGS mp-check_func.c -o mp-check_func $LIBS >>config.log 2>&1
+    if [ $? -eq 0 ]; then
+       if [ -f mp-check_func ]; then
+           have=y
+       fi
+    fi
+    rm -f mp-check_func*
+
+    if [ "x$have" = "xy" ]; then
+       echo "#define HAVE_$sym 1" >> config.h
+       echo "HAVE_$sym := 1" >> config.mk
+    else
+       if [ "x$require" = "xy" ]; then
+           echo "configure: function $func is required; not found"
+           exit 1
+       fi
+       echo "/* #define HAVE_$sym 1 */" >> config.h
+       echo "# HAVE_$sym := 1" >> config.mk
+    fi
+done
diff --git a/check_gnu_tar.sh b/check_gnu_tar.sh
new file mode 100755 (executable)
index 0000000..ff167b5
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# XXX More thought required here. Much of dist.mk makes assumptions
+# that we have a non-losing tar. This is why you can't build distributions
+# on Solaris yet.
+
+tar --help > mp-check_gnu_tar 2>&1
+if head -1 mp-check_gnu_tar | grep -q GNU >/dev/null 2>&1; then
+    echo 'HAVE_GNU_TAR := 1' >> config.mk
+    echo '#define HAVE_GNU_TAR 1' >> config.h
+else
+    echo '# HAVE_GNU_TAR := 1' >> config.mk
+    echo '/* #define HAVE_GNU_TAR 1 */' >> config.h
+fi
+rm -f mp-check_gnu_tar
diff --git a/check_headers.sh b/check_headers.sh
new file mode 100755 (executable)
index 0000000..1c363d2
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+require=$1
+shift
+
+for hdr in "$@"; do
+    sym=`echo $hdr | tr -- '-./[a-z]' '___[A-Z]'`
+    have=
+
+    # Try to compile a short program which includes this file.
+    rm -f mp-check_header.o
+    echo "#include <$hdr>" > mp-check_header.c
+    echo "mp-check_header.c:" >>config.log
+    cat mp-check_header.c >>config.log
+    echo $CC $CFLAGS -E mp-check_header.c >>config.log
+    $CC $CFLAGS -E mp-check_header.c >>config.log 2>&1
+    if [ $? -eq 0 ]; then
+        have='y'
+    fi
+    rm -f mp-check_header*
+
+    if [ "x$have" = "xy" ]; then
+       echo "#define HAVE_$sym 1" >> config.h
+       echo "HAVE_$sym := 1" >> config.mk
+    else
+       if [ "x$require" = "xy" ]; then
+           echo "configure: header file <$hdr> is required; not found"
+           echo "configure: You may need to do:"
+           echo "configure:   CFLAGS=-I/path/to/header; export CFLAGS"
+           exit 1
+       fi
+       echo "/* #define HAVE_$sym 1 */" >> config.h
+       echo "# HAVE_$sym := 1" >> config.mk
+    fi
+done
diff --git a/check_lib.sh b/check_lib.sh
new file mode 100755 (executable)
index 0000000..f51a43e
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+require=$1
+func=$2
+lib=$3
+
+sym=`echo $lib | tr -- '-.[a-z]' '__[A-Z]'`
+have=
+
+# Try to compile and link a short program which references this
+# symbol. If the symbol exists in the library then this ought to
+# succeed.
+rm -f mp-check_lib
+echo "char $func();int main(){(void)&$func;return 0;}" > mp-check_lib.c
+echo "mp-check_lib.c:" >>config.log
+cat mp-check_lib.c >>config.log
+echo $CC $CFLAGS mp-check_lib.c -o mp-check_lib -l$lib $LIBS >>config.log
+$CC $CFLAGS mp-check_lib.c -o mp-check_lib -l$lib $LIBS >>config.log 2>&1
+if [ $? -eq 0 ]; then
+    if [ -f mp-check_lib ]; then
+       have=y
+    fi
+fi
+rm -f mp-check_lib*
+
+if [ "x$have" = "xy" ]; then
+    echo "#define HAVE_LIB$sym 1" >> config.h
+    echo "LIBS := \$(LIBS) -l$lib" >> config.mk
+else
+    if [ "x$require" = "xy" ]; then
+       echo "configure: library $lib containing function $func is required"
+       exit 1
+    fi
+    echo "/* #define HAVE_LIB$sym 1 */" >> config.h
+    echo "# LIBS := \$(LIBS) -l$lib" >> config.mk
+fi
diff --git a/check_progs.sh b/check_progs.sh
new file mode 100755 (executable)
index 0000000..34589a0
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+require=$1
+shift
+
+for prog in "$@"; do
+    sym=`echo $prog | tr -- '-./[a-z]' '___[A-Z]'`
+    have=
+
+    # Find out if the program exists. The trick here is not to actually
+    # run the program.
+    if which $prog >> config.log 2>&1; then
+       have=y
+    fi
+
+    if [ "x$have" = "xy" ]; then
+       echo "#define HAVE_$sym 1" >> config.h
+       echo "HAVE_$sym := 1" >> config.mk
+    else
+       if [ "x$require" = "xy" ]; then
+           echo "configure: program $prog is required; not found"
+           echo "configure: You may need to do:"
+           echo "configure:   PATH=/path/to/program:\$PATH; export PATH"
+           exit 1
+       fi
+       echo "/* #define HAVE_$sym 1 */" >> config.h
+       echo "# HAVE_$sym := 1" >> config.h
+    fi
+done
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..04d9db0
--- /dev/null
+++ b/configure
@@ -0,0 +1,66 @@
+#!/bin/sh -
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let you build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+mp_options=""
+
+usage ()
+{
+    cat <<EOF
+./configure [--options]
+
+Installation directory options:
+  --prefix=PREFIX       Installation prefix [default: /usr/local]
+  --sysconfdir=SYSCONF  Installation prefix for configuration files
+                         [default: PREFIX/etc]
+  --localstatedir=STATE Installation prefix for writable files
+                         [default: PREFIX/var]
+
+Help options:
+  --help                Display this help and exit.
+  --print-mp-cmd        Display the make+ command and exit (use as final arg)
+EOF
+    exit 1
+}
+
+while [ $# -gt 0 ]; do
+    opt=$1 ; shift
+
+    case "$opt" in
+       --help)
+           usage
+           ;;
+       --print-mp-cmd)
+           echo "rm -f build-\*/config.mk"
+           echo "make+ $mp_options configure"
+           exit 0
+           ;;
+       --*prefix|--*dir)
+           opt=`echo $opt | sed 's/^--//'`
+           arg=$1 ; shift
+           mp_options="$mp_options $opt=$arg"
+           ;;
+       --*prefix=*|--*dir=*)
+           opt=`echo $opt | sed 's/^--//'`
+           mp_options="$mp_options $opt"
+           ;;
+       *)
+           mp_options="$mp_options $opt"
+           ;;
+    esac
+done
+
+rm -f build-*/config.mk
+make+ $mp_options configure
diff --git a/configure.mk b/configure.mk
new file mode 100644 (file)
index 0000000..6b4e6f0
--- /dev/null
@@ -0,0 +1,32 @@
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# Configuration scripts.
+MP_CONFIGURE_START = $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/configure_start.sh
+MP_CONFIGURE_END = $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/configure_end.sh
+
+MP_CHECK_HEADERS = $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_headers.sh n
+MP_CHECK_HEADER = $(MP_CHECK_HEADERS)
+MP_CHECK_FUNCS =  $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_funcs.sh n
+MP_CHECK_LIB   =  $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_lib.sh n
+MP_CHECK_PROGS =  $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_progs.sh n
+MP_CHECK_PROG  =  $(MP_CHECK_PROGS)
+MP_REQUIRE_HEADERS = $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_headers.sh y
+MP_REQUIRE_HEADER = $(MP_REQUIRE_HEADERS)
+MP_REQUIRE_FUNCS = $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_funcs.sh y
+MP_REQUIRE_LIB = $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_lib.sh y
+MP_REQUIRE_PROGS = $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_progs.sh y
+MP_REQUIRE_PROG = $(MP_REQUIRE_PROGS)
+
+MP_CHECK_GNU_TAR = $(SETENV) $(CONF_ENV) $(MAKEPLUS_HOME)/check_gnu_tar.sh
diff --git a/configure_end.sh b/configure_end.sh
new file mode 100755 (executable)
index 0000000..21abbe0
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+echo >> config.h
+echo "#endif /* MP_CONFIG_H */" >> config.h
diff --git a/configure_start.sh b/configure_start.sh
new file mode 100755 (executable)
index 0000000..0a0c1ab
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+# Check the 'config.mk' file doesn't exist. If it does exist then this
+# is a serious problem because it will override command line arguments
+# (which, when doing a configure, we want). The user really ought to be
+# running the ./configure shell script which removes this file.
+if [ -f config.mk ]; then
+    echo "configure: config.mk: file found (which is an error)"
+    echo "configure: Before running 'make+ configure', you must remove this"
+    echo "configure: file, or the build directory. You could also do:"
+    echo "configure:   ./configure [--help]"
+    exit 1
+fi
+
+rm -f config.h config.log
+
+cat > config.h <<EOF
+/* Generated automatically by make+. */
+
+#ifndef MP_CONFIG_H
+#define MP_CONFIG_H
+
+#define PACKAGE "$PACKAGE"
+#define VERSION "$VERSION"
+EOF
+
+cat > config.mk <<EOF
+prefix         = $prefix
+bindir         = $bindir
+sbindir                = $sbindir
+libexecdir     = $libexecdir
+datadir                = $datadir
+sysconfdir     = $sysconfdir
+sharedstatedir = $sharedstatedir
+localstatedir  = $localstatedir
+libdir         = $libdir
+infodir                = $infodir
+includedir     = $includedir
+pkgdatadir     = $pkgdatadir
+docdir         = $docdir
+pkgetcdir      = $pkgetcdir
+pkglibdir      = $pkglibdir
+pkgincludedir  = $pkgincludedir
+manprefix      = $manprefix
+mandir         = $mandir
+man1dir                = $man1dir
+man2dir                = $man2dir
+man3dir                = $man3dir
+man4dir                = $man4dir
+man5dir                = $man5dir
+man6dir                = $man6dir
+man7dir                = $man7dir
+man8dir                = $man8dir
+manndir                = $manndir
+manldir                = $manldir
+EOF
diff --git a/default_goal.mk b/default_goal.mk
new file mode 100644 (file)
index 0000000..0d3f97c
--- /dev/null
@@ -0,0 +1,17 @@
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+_mp_all: all
+
+.PHONY: _mp_all
\ No newline at end of file
diff --git a/dist.mk b/dist.mk
new file mode 100644 (file)
index 0000000..d37173f
--- /dev/null
+++ b/dist.mk
@@ -0,0 +1,72 @@
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# The user can add more exclude patterns by adding to or overriding
+# this variable. Each pattern is a wildcard passed to the -X option
+# of tar.
+MP_DIST_EXCLUDE        = build-* makeplus-* CVS .\#* *~ *.old core
+
+# Default name for the source distribution.
+MP_SRC_DIST    = $(PACKAGE)-$(VERSION).tar.gz
+
+# Default name for the binary distribution.
+MP_BIN_DIST    = $(PACKAGE)-$(VERSION).bin.tar.gz
+
+# Default name for the binary manifest.
+MP_BIN_MANIFEST        = MANIFEST.bin
+
+# If set then bundle a copy of make+ with source distributions.
+# (Note: Doesn't work on platforms with losing non-GNU 'tar').
+MP_BUNDLE      = 1
+
+# Build a source distribution.
+dist: mp-dist.ex
+       rm -rf $(PACKAGE)-$(VERSION)
+       rm -f $(MP_SRC_DIST)
+       mkdir $(PACKAGE)-$(VERSION)
+       tar -cf - -X mp-dist.ex $(EXTRA_DIST) -C .. . | \
+         tar -xf - -C $(PACKAGE)-$(VERSION)
+       if [ -n "$(MP_BUNDLE)" -a -r "$(MAKEPLUS_HOME)/makeplus.tar.gz" ]; \
+       then \
+         gzip -d -c $(MAKEPLUS_HOME)/makeplus.tar.gz | \
+         tar -xf - -C $(PACKAGE)-$(VERSION); \
+         cp $(MAKEPLUS_HOME)/README.make+_for_bundles \
+           $(PACKAGE)-$(VERSION)/README.make+; \
+       fi
+       tar -cf - $(PACKAGE)-$(VERSION) | gzip --best > $(MP_SRC_DIST)
+       rm -rf $(PACKAGE)-$(VERSION)
+       rm mp-dist.ex
+
+mp-dist.ex:
+       @for ex in $(MP_DIST_EXCLUDE); do echo $$ex; done > mp-dist.ex
+
+# Build a binary distribution.
+# XXX What's the standard name for this target?
+bindist:
+       rm -rf mp-bindist
+       rm -f $(MP_BIN_DIST)
+       mkdir mp-bindist
+       $(MAKE) -f $(srcdir)/$(_mp_makefile) DESTDIR=mp-bindist install
+       tar -cf - -C mp-bindist . | gzip --best > $(MP_BIN_DIST)
+       rm -rf mp-bindist
+
+# Build a manifest for the binary distribution.
+mp_manifest_bin:
+       rm -rf mp-bindist
+       mkdir mp-bindist
+       $(MAKE) -f $(srcdir)/$(_mp_makefile) DESTDIR=mp-bindist install
+       find mp-bindist \! -type d | sed 's|^mp-bindist||' > $(MP_BIN_MANIFEST)
+       rm -rf mp-bindist
+
+.PHONY: dist bindist mp_manifest_bin
diff --git a/doc/make+-book.xml b/doc/make+-book.xml
new file mode 100644 (file)
index 0000000..27ed5e2
--- /dev/null
@@ -0,0 +1,541 @@
+<book>
+  <bookinfo>
+    <title><application>make+</application> users manual</title>
+    <authorgroup>
+      <author>
+       <firstname>Richard</firstname>
+       <othername>W.M.</othername>
+       <surname>Jones</surname>
+      </author>
+    </authorgroup>
+
+    <date>21st December 2002</date>
+    <releaseinfo>1.0</releaseinfo>
+
+    <abstract>
+      <para>
+       <application>make+</application> is an advanced build system
+       designed to replace the functionality of
+       <application>autoconf</application>,
+       <application>automake</application>, and packaging systems
+       such as <application>rpm</application>. Using a single control
+       file, maintainers and end users can build and install the
+       program, build RPMs, Debian packagages and other package
+       formats, and maintain a website.
+       <application>make+</application> is just a set of GNU
+       <application>make</application> snippets and shell scripts,
+       making it simple to maintain and extend.
+      </para>
+    </abstract>
+
+    <keywordset>
+      <keyword>make+</keyword>
+      <keyword>make</keyword>
+      <keyword>automake</keyword>
+      <keyword>autoconf</keyword>
+      <keyword>rpm</keyword>
+      <keyword>deb</keyword>
+      <keyword>dpkg</keyword>
+      <keyword>package</keyword>
+    </keywordset>
+  </bookinfo>
+
+  <chapter>
+    <title>Introduction</title>
+
+    <para>
+      <application>make+</application> is an advanced build system
+      designed to replace the functionality of
+      <application>autoconf</application>,
+      <application>automake</application>, and packaging systems such
+      as <application>rpm</application>. Using a single control file,
+      maintainers and end users can build and install the program,
+      build RPMs, Debian packagages and other package formats, and
+      maintain a website.
+    </para>
+
+    <para>
+      At the same time, <application>make+</application> is just a set
+      of GNU <application>make</application> snippets and shell
+      scripts, making it simple to maintain and extend.
+    </para>
+
+    <para>
+      This manual explains how to convert your own package to use
+      <application>make+</application>. If you have been presented
+      with a package which contains a <filename>Makefile+</filename>
+      file and you want to know how to use <command>make+</command> to
+      build and install this package, then please read the
+      <command>make+(1)</command> manual page.
+    </para>
+
+  </chapter>
+
+  <chapter id="theory-of-operation">
+    <title><application>make+</application> theory of operation</title>
+
+    <para>
+      A <application>make+</application>-enabled package
+      contains a single file called <filename>Makefile+</filename>
+      located in the top-level source directory.
+      <application>make+</application> should never
+      be used recursively, so you will not need more than
+      one <filename>Makefile+</filename> file even if your
+      package source contains subdirectories.
+    </para>
+
+    <para>
+      <application>make+</application> has the notion of a "pristine"
+      source directory. This means that
+      <application>make+</application> should never create
+      intermediate files (object files, Java class files and the like)
+      directly in the source directory. Instead,
+      <application>make+</application> creates a build directory
+      before it starts to store intermediate build files. Normally
+      this directory is called something like
+      <filename>build-i686-unknown-linux</filename> but it may, of
+      course, be something different on your particular machine and
+      operating system.
+    </para>
+
+    <para>
+      The <command>make+</command> command is a shell script
+      which performs the following steps:
+    </para>
+
+    <itemizedlist>
+      <listitem>
+       <para> Creates the build directory if it doesn't exist already. </para>
+      </listitem>
+      <listitem>
+       <para> Change into the build directory, ie.
+         <command>cd build-foo-bar</command> </para>
+      </listitem>
+      <listitem>
+       <para> Set the GNU <application>make</application> environment
+         variable <envar>MAKEFILES</envar>. This causes GNU
+         <application>make</application> to load the
+         <application>make+</application> library first. </para>
+      </listitem>
+      <listitem>
+       <para> Run <command>gmake -f ../Makefile+</command>. Because
+         <envar>MAKEFILES</envar> has been set, GNU make will
+         first load the <application>make+</application> library,
+         and second load <filename>Makefile+</filename> from the
+         top level of the source directory. </para>
+      </listitem>
+    </itemizedlist>
+
+    <para>
+      Because <application>make+</application> runs in the
+      build subdirectory, intermediate files shouldn't
+      pollute the source directory. For this reason,
+      <application>make+</application> can use a very
+      simple scheme when it builds a source tarball of
+      the package: it just treats every file in the source
+      directory as a source file, ignoring only the
+      build subdirectory itself and files with names
+      like <filename>foo~</filename> and <filename>CVS</filename>.
+    </para>
+
+  </chapter>
+
+  <chapter>
+    <title>Compiling a package which has been converted to use
+      <application>make+</application></title>
+
+    <para>
+      If you have been given an application which has been
+      converted to use <application>make+</application> already
+      and you just want to compile it, then you're likely to
+      read the generic <filename>INSTALL</filename> file and
+      follow those instructions. This chapter explains the
+      steps needed to compile an application, but also covers
+      what's happening "behind the scenes" at each step.
+    </para>
+
+    <para>
+      The basic steps for compiling a <application>make+</application>-enabled
+      application are:
+    </para>
+
+    <itemizedlist>
+      <listitem>
+       <para> Configure the application using
+         <command>./configure</command> </para>
+      </listitem>
+      <listitem>
+       <para> Compile the application by typing
+         <command>make+</command> </para>
+      </listitem>
+      <listitem>
+       <para> Run any supplied tests by typing
+         <command>make+ test</command> </para>
+      </listitem>
+      <listitem>
+       <para> Install the application (as root) with
+         <command>make+ install</command> </para>
+      </listitem>
+    </itemizedlist>
+
+    <para>
+      But what is actually happening at each step?
+    </para>
+
+    <sect1>
+      <title>Configuration</title>
+
+      <para>
+       The configuration step sets up the installation paths and then
+       examines the system looking for required and optional programs
+       and libraries.
+      </para>
+
+      <para>
+       We can imagine a fictional C debugging library. This requires
+       the GNU <application>bfd</application> library to read
+       executables. In addition, if the Linux-specific
+       <function>backtrace</function> function is present in
+       <application>libc</application>, then our fictional library
+       can present more readable stack traces when a program
+       crashes. The configure step for this library would first
+       examine the system looking for the GNU
+       <application>bfd</application> library. If not found, it would
+       stop with an error, telling the user that they must install
+       this library. It would then look for the
+       <function>backtrace</function> function, but if this function
+       was not present, it would not be a fatal error.
+      </para>
+
+      <para>
+       During the configuration step is also the point where we
+       specify where we want to install the program. Normally
+       users will be interested in setting the <envar>prefix</envar>
+       variable which controls the overall location of the
+       installation. It defaults to <filename>/usr/local</filename>
+       which causes most files to be installed in subdirectories
+       of this directory, but some users will want to change
+       the prefix, commonly to <filename>/usr</filename>.
+      </para>
+
+      <para>
+       The result of the configuration step is three files in the
+       build directory:
+      </para>
+
+      <variablelist>
+       <varlistentry>
+         <term><filename>config.h</filename></term>
+         <listitem>
+           <para> A C/C++ header file describing the capabilities
+             of the system. For our imaginary debugging library
+             the C header file might look like this:
+           </para>
+
+<programlisting>
+/* Generated automatically by make+. */
+
+#ifndef MP_CONFIG_H
+#define MP_CONFIG_H
+
+#define PACKAGE "foo"
+#define VERSION "0.0.1"
+#define HAVE_LIBBFD 1
+#define HAVE_BACKTRACE 1
+
+#endif /* MP_CONFIG_H */
+</programlisting>
+
+           <para>
+             Happily we can see that this platform has both the
+             required GNU bfd and the optional <function>backtrace</function>
+             function.
+           </para>
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
+         <term><filename>config.mk</filename></term>
+         <listitem>
+           <para> This file is a <filename>Makefile</filename>
+             fragment which is included directly the next time
+             that <application>make+</application> runs (ie. it
+             is included when we do the compile, test and
+             install steps).
+           </para>
+
+           <para>
+             The purpose of this file is threefold. Firstly to
+             define the <envar>LIBS</envar> variable, which
+             is built on the fly as a result of detecting
+             required and optional libraries. Secondly to
+             save the installation paths (the <envar>prefix</envar>
+             and related paths). Thirdly to save the results
+             of the configuration tests in a way which is accessible
+             to the <filename>Makefile+</filename>.
+           </para>
+
+           <para>
+             An extract from the <filename>config.mk</filename>
+             file for our fictional debugging library:
+           </para>
+
+<programlisting>
+prefix     = /usr
+bindir     = /usr/bin
+sbindir    = /usr/sbin
+libexecdir = /usr/libexec
+  #
+  # many lines omitted
+  #
+LIBS       = -lbfd
+
+HAVE_LIBBFD = 1
+HAVE_BACKTRACE = 1
+</programlisting>
+
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
+         <term><filename>config.log</filename></term>
+         <listitem>
+           <para>
+             This file logs every command issued during the
+             configuration step, and is very useful for
+             debugging problems.
+           </para>
+         </listitem>
+       </varlistentry>
+      </variablelist>
+
+      <para>
+       <application>make+</application>-enabled applications come
+       with a simple <command>configure</command> script. This is not
+       just a convenience (users are used to typing
+       <command>./configure --prefix=/usr</command>). It also removes
+       the old <filename>config.mk</filename> file before running
+       <command>make+ configure</command>, which is essential to
+       ensure that any previous installation paths do not
+       accidentally take precedence.
+      </para>
+
+    </sect1>
+
+    <sect1>
+      <title>Compiling and testing</title>
+
+      <para>
+       The application's <filename>Makefile+</filename> file
+       contains <filename>all</filename> and <filename>test</filename>
+       targets, and, just like an ordinary
+       <filename>Makefile</filename>, running
+       <command>make+ all</command> or <command>make+ test</command>
+       just executes these targets. However, recall from
+       the <link linkend="theory-of-operation">theory of
+         operation chapter</link>, before the application's
+       <filename>Makefile+</filename> runs, the
+       <application>make+</application> library is loaded
+       first. Thus the application's <filename>all</filename> and
+       <filename>test</filename> targets may - if they want -
+       use macros and scripts from <application>make+</application>.
+      </para>
+
+      <para>
+       As an example, here is a typical <filename>test</filename>
+       target, which makes use of the <application>make+</application>
+       library's <envar>MP_RUN_TESTS</envar> macro:
+      </para>
+
+<programlisting>
+test: test_hash test_matvec test_pool
+        $(MP_RUN_TESTS) $^
+
+test_hash: test_hash.o
+        $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
+test_matvec: test_matvec.o
+        $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
+test_pool: test_pool.o
+        $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
+</programlisting>
+
+    </sect1>
+
+    <sect1>
+      <title>Installing</title>
+
+      <para>
+       The application's <filename>Makefile+</filename> file contains
+       an ordinary <filename>install</filename> target which is run
+       directly when the user does <command>make+ install</command>.
+       The purpose of the <filename>install</filename> target is
+       to do whatever is necessary to install the program, but
+       in practice this means doing two things:
+      </para>
+
+      <itemizedlist>
+       <listitem>
+       <para> Making the installation directories. </para>
+       </listitem>
+       <listitem>
+         <para> Copying the program into the installation directories. </para>
+       </listitem>
+      </itemizedlist>
+
+      <para>
+       Here is an example <filename>install</filename> target.
+       The first four commands are concerned with creating the
+       installation directories. The last five commands are concerned
+       with copying the built program (in this case, a library) to
+       the installation directories. Notice the use of several
+       <application>make+</application> macros.
+      </para>
+
+<programlisting>
+install:
+        install -d $(DESTDIR)$(libdir)
+        install -d $(DESTDIR)$(pkgincludedir)
+        install -d $(DESTDIR)$(man3dir)
+        install -d $(DESTDIR)$(datadir)/rws/symtabs/
+
+        $(MP_INSTALL_STATIC_LIB) libc2lib.a
+        $(MP_INSTALL_DYNAMIC_LIB) libc2lib.so
+        install -m 0644 $(HEADERS) $(DESTDIR)$(pkgincludedir)
+        install -m 0644 *.3        $(DESTDIR)$(man3dir)
+        install -m 0644 *.syms     $(DESTDIR)$(datadir)/rws/symtabs/
+</programlisting>
+
+      <para>
+       <filename>$(DESTDIR)</filename> must be prefixed onto every
+       install path. Normally it is empty, and so has no
+       effect. However when doing packaged builds (building RPMs for
+       example) it can be used to create a "fake root".
+      </para>
+
+      <para>
+       <filename>$(libdir)</filename>, etc., are standard paths
+       for particular directories. For example if the prefix
+       is <filename>/usr/local</filename> and we are building
+       on Linux, then
+       <filename>$(libdir)</filename> will expand to
+       <filename>/usr/local/lib</filename> and
+       <filename>$(man3dir)</filename> to
+       <filename>/usr/local/share/man/man3</filename>.
+      </para>
+
+    </sect1>
+
+  </chapter>
+
+  <chapter>
+    <title>Converting a package to use <application>make+</application></title>
+
+    <para>
+      Converting a package to use <application>make+</application>
+      is simple in principle. Step one is to create a file
+      called <filename>Makefile+</filename> and place it in
+      the top level directory of your package. Step two is
+      to remove whatever existing build system you were
+      using before - <filename>Makefile</filename>,
+      <filename>configure.in</filename>, <filename>config.*</filename>,
+      <filename>Makefile.am</filename> and so on. Of course
+      step two is optional!
+    </para>
+
+    <para>
+      <application>make+</application> comes with a handy
+      shell script called <command>make+-skeleton</command>
+      which can help you to create your <filename>Makefile+</filename>
+      file. You should run this in the top-level directory
+      of your package. A typical interaction will go like this:
+    </para>
+
+    <screen>
+<prompt>$</prompt> <command>make+-skeleton</command>
+<computeroutput>
+What is the name of your package? <userinput>foo</userinput>
+
+Now I'm going to ask you for the initial version number for this
+package. Version numbers have two parts: the MAJOR part and the
+MINOR part.
+
+The MAJOR part is a single number (eg 3). It is used (for example)
+for versioning libraries.
+
+The MINOR part is two numbers separated by a single DOT (eg 1.0)
+This is the incremental release of the library.
+
+If you library is version 3.1.0 then the MAJOR part would be
+  3
+and the MINOR part would be
+  1.0
+
+What is the MAJOR part of the version? <userinput>0</userinput>
+What is the MINOR part of the version? <userinput>0.1</userinput>
+
+I've written a Makefile+ file for you. You'll need to edit this file.
+Start by searching for all the 'XXX's and replacing them as necessary.
+</computeroutput>
+    </screen>
+
+    <para>
+      This creates the initial <filename>Makefile+</filename>
+      for a package called <filename>foo</filename> at
+      version 0.0.1. The <filename>Makefile+</filename> file
+      will start like this:
+    </para>
+
+    <example>
+      <title><filename>Makefile+</filename> skeleton file</title>
+<programlisting>
+# -*- Makefile -*-
+#
+# This is a make+ file. Make+ is a set of scripts which enhance GNU
+# make and let you build RPMs, and other package types with just one
+# control file.  To build this package you will need to download make+
+# from this site: http://www.annexia.org/freeware/makeplus/
+
+PACKAGE         := foo
+VERSION_MAJOR   := 0
+VERSION_MINOR   := 0.1
+VERSION         := $(VERSION_MAJOR).$(VERSION_MINOR)
+
+SUMMARY         := XXX A ONE LINE SUMMARY OF YOUR PACKAGE
+COPYRIGHT       := XXX ONE LINE COPYRIGHT OR LICENSE
+AUTHOR          := XXX YOUR NAME AND EMAIL ADDRESS
+</programlisting>
+    </example>
+
+    <para>
+      Your first step should be to edit this file, search through for
+      <literal>XXX</literal> and replace these as desired. (The
+      following sections will help you to write each part of the
+      file).
+    </para>
+
+    <para>
+      You should familiarise yourself with the
+      <link linkend="theory-of-operation">theory
+       of operation of <application>make+</application></link>
+      too, particularly remembering that the
+      <filename>Makefile+</filename> rules are run
+      in the build subdirectory, not in the source
+      directory.
+    </para>
+
+    <sect1>
+      <title>Configuration</title>
+
+
+    </sect1>
+
+
+
+
+
+
+
+  </chapter>
+
+
+</book>
diff --git a/doc/make+-man.xml b/doc/make+-man.xml
new file mode 100644 (file)
index 0000000..ef7ab4f
--- /dev/null
@@ -0,0 +1,30 @@
+<refentry id="make+">
+  <refmeta>
+    <refentrytitle>make+</refentrytitle>
+    <manvolnum>1</manvolnum>
+  </refmeta>
+
+  <refnamediv>
+    <refname>make+</refname>
+    <refpurpose>build system</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>make+</command>
+      <!--<arg choice="opt">
+       <option>abc</option>
+      </arg>-->
+      <arg choice="opt" rep="repeat">target</arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+
+  <refsect1><title>Description</title>
+    <para>
+      For each file that is a directory, <command>ls</command> lists
+      the contents of the directory; for each file that is an ordinary
+      file, <command>ls</command> repeats its name and any other
+      information requested.
+    </para>
+  </refsect1>
+</refentry>
diff --git a/install_dynamic_lib.sh b/install_dynamic_lib.sh
new file mode 100755 (executable)
index 0000000..d5642c2
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+library="$1"
+soname="$1.$VERSION_MAJOR"
+filename="$1.$VERSION_MAJOR.$VERSION_MINOR"
+
+base_library=`basename "$library"`
+base_soname=`basename "$soname"`
+base_filename=`basename "$filename"`
+
+install -m 0755 "$filename" "$DESTDIR$libdir"
+cd "$DESTDIR$libdir"
+rm -f "$base_soname" "$base_library"
+ln -s "$base_filename" "$base_soname"
+ln -s "$base_soname" "$base_library"
diff --git a/install_static_lib.sh b/install_static_lib.sh
new file mode 100755 (executable)
index 0000000..d61891c
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+install -m 0644 "$1" $DESTDIR$libdir
diff --git a/link_dynamic.sh b/link_dynamic.sh
new file mode 100755 (executable)
index 0000000..306e8e2
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+# Find the name of the linker -soname option.
+# XXX This is wrong: during the configure stage we should work out
+# which Solaris linker we are using (gcc has it as a hard-coded path)
+# and choose the appropriate option.
+soname_opt=-soname
+if [ `uname` = "SunOS" ]; then
+    soname_opt=-h
+fi
+
+library="$1"; shift
+
+soname="$library.$VERSION_MAJOR"
+filename="$library.$VERSION_MAJOR.$VERSION_MINOR"
+
+base_soname=`basename "$soname"`
+base_filename=`basename "$filename"`
+
+gcc -shared -Wl,$soname_opt,"$base_soname" -o "$filename" "$@"
+rm -f "$soname" "$library"
+ln -s "$base_filename" "$soname"
+ln -s "$base_soname" "$library"
diff --git a/link_static.sh b/link_static.sh
new file mode 100755 (executable)
index 0000000..7125e2e
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+library="$1"; shift
+
+ar rc $library "$@"
+ranlib $library
diff --git a/main.mk b/main.mk
new file mode 100644 (file)
index 0000000..ba5bc12
--- /dev/null
+++ b/main.mk
@@ -0,0 +1,86 @@
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# This is a hack to make GNU make recognise '_mp_all (all)' as the
+# default goal.
+include $(MAKEPLUS_HOME)/default_goal.mk
+
+# Set the VPATH because builds always happen in a subdirectory.
+VPATH          := ..
+srcdir         := $(shell cd .. && pwd)
+
+# Directories.
+prefix         ?= /usr/local
+bindir         = $(prefix)/bin
+sbindir                = $(prefix)/sbin
+libexecdir     = $(prefix)/libexec
+datadir                = $(prefix)/share
+sysconfdir     = $(prefix)/etc
+sharedstatedir = $(prefix)/com
+localstatedir  = $(prefix)/var
+libdir         = $(prefix)/lib
+infodir                = $(prefix)/info
+includedir     = $(prefix)/include
+pkgdatadir     = $(datadir)/$(PACKAGE)
+docdir         = $(datadir)/doc/$(PACKAGE)-$(VERSION)
+pkgetcdir      = $(sysconfdir)/$(PACKAGE)
+pkglibdir      = $(libdir)/$(PACKAGE)
+pkgincludedir  = $(includedir)/$(PACKAGE)
+ifneq ($(shell uname), FreeBSD)
+manprefix      = $(datadir)
+else
+manprefix      = $(prefix)
+endif
+mandir         = $(manprefix)/man
+man1dir                = $(mandir)/man1
+man2dir                = $(mandir)/man2
+man3dir                = $(mandir)/man3
+man4dir                = $(mandir)/man4
+man5dir                = $(mandir)/man5
+man6dir                = $(mandir)/man6
+man7dir                = $(mandir)/man7
+man8dir                = $(mandir)/man8
+manndir                = $(mandir)/mann
+manldir                = $(mandir)/manl
+
+# If the configuration file exists, include it (from the build directory).
+-include config.mk
+
+# Include the other parts of this makefile.
+include $(MAKEPLUS_HOME)/configure.mk
+include $(MAKEPLUS_HOME)/c.mk
+include $(MAKEPLUS_HOME)/dist.mk
+include $(MAKEPLUS_HOME)/rpm.mk
+include $(MAKEPLUS_HOME)/test.mk
+include $(MAKEPLUS_HOME)/website.mk
+
+# Clean rule (removes files and links in the build directory and removes
+# editor backup files from the source directory).
+clean:
+       [ -f $(srcdir)/$(_mp_makefile) ]
+       find . \( -type f -o -type l \) -print | xargs rm -f
+       find .. -name '*~' -print | xargs rm -f
+
+# Distclean rule (does a clean and additionally removes the build directory).
+distclean: clean
+       cd .. && rm -rf $(_mp_builddir)
+
+# Force target.
+_mp_force:
+
+# Export everything.
+.EXPORT_ALL_VARIABLES:
+
+# Phony targets.
+.PHONY: clean configure distclean
diff --git a/make+ b/make+
new file mode 100755 (executable)
index 0000000..ae8c280
--- /dev/null
+++ b/make+
@@ -0,0 +1,95 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let you build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# The control file. XXX Parse and remove the -f option.
+_mp_makefile="Makefile+"; export _mp_makefile
+
+# Check the control file exists in the current directory. You can only
+# run make+ from the top level source directory, the one which contains
+# Makefile+. You should not be doing anything recursive with make+.
+if [ ! -r "$_mp_makefile" ]; then
+    echo "make+: $_mp_makefile: file not found or not readable"
+    echo "You should always run make+ from the top-level source"
+    echo "directory, the one which contains the Makefile+ file."
+    exit 1
+fi
+
+# Find a suitable copy of GNU make. You can override this test
+# by setting the $MAKE option.
+if [ "x$MAKE" = "x" ]; then
+    if sh -c 'gmake --version' 2>/dev/null | grep -q 'GNU Make'; then
+       MAKE=gmake
+    elif sh -c 'make --version' 2>/dev/null | grep -q 'GNU Make'; then
+       MAKE=make
+    else
+       echo "make+: I cannot find a copy of GNU make. Please set the \$MAKE"
+       echo "environment variable to point to the GNU make binary."
+    fi
+fi
+
+# Check for a sufficiently recent version of GNU make.
+if $MAKE --version | grep -q '^GNU Make .*3\.'; then
+    # make is up-to-date
+    :
+else
+    echo "make+: Your 'make' is not GNU make (or not a recent version)"
+    echo "Please install a recent version of GNU make."
+    exit 1
+fi
+
+# Check that either MAKEPLUS_HOME or /etc/make+.conf exists, and run it.
+if [ "x$MAKEPLUS_HOME" = "x" ]; then
+    for d in /etc /usr/etc /usr/local/etc; do
+       if [ -f $d/make+.conf ]; then
+           . $d/make+.conf
+           break
+       fi
+    done
+fi
+
+# Check MAKEPLUS_HOME looks reasonable.
+if [ ! -f "$MAKEPLUS_HOME/main.mk" ]; then
+    echo "make+: MAKEPLUS_HOME environment variable not set correctly."
+    echo "This environment variable should point to the installation"
+    echo "directory for make+ (eg. /usr/share/makeplus). You would normally"
+    echo "do this by creating a file called /etc/make+.conf containing"
+    echo "  export MAKEPLUS_HOME=/usr/share/makeplus"
+    echo "or you can set it as an environment variable each time you run"
+    echo "make+."
+    exit 1
+fi
+
+# Set MAKEFILES.
+MAKEFILES=$MAKEPLUS_HOME/main.mk; export MAKEFILES
+
+# Construct a suitable target architecture.
+# XXX Cross compiling.
+arch=`uname -m`
+os=`uname -s | tr 'A-Z' 'a-z'`
+hw=`( uname -i 2>/dev/null || echo "unknown" ) | tr -cd 'A-Za-z0-9'`
+_mp_builddir=build-$arch-$hw-$os; export _mp_builddir
+
+# Create the build directory.
+# XXX
+mkdir -p $_mp_builddir
+cd $_mp_builddir
+
+# Create the directories under the build directory.
+(cd .. && find . -type d -a \! -name CVS) | grep -v $_mp_builddir |
+    xargs mkdir -p
+
+# Run GNU make from the build directory.
+$MAKE -f ../$_mp_makefile "$@"
diff --git a/make+-skeleton b/make+-skeleton
new file mode 100755 (executable)
index 0000000..2c99287
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+# Check that either MAKEPLUS_HOME or /etc/make+.conf exists, and run it.
+if [ "x$MAKEPLUS_HOME" = "x" ]; then
+    for d in /etc /usr/etc /usr/local/etc; do
+       if [ -f $d/make+.conf ]; then
+           . $d/make+.conf
+           break
+       fi
+    done
+fi
+
+# Overwrite 'configure' with the latest version. This file is never
+# important, even in autoconf-based installations.
+cp $MAKEPLUS_HOME/configure .
+chmod 0755 configure
+
+# Check 'Makefile+' does not exist in the current directory.
+if [ -f "Makefile+" ]; then
+    echo "There is already a file 'Makefile+' in the current directory."
+    echo "I won't overwrite this file. Remove this file and rerun me."
+    exit 1
+fi
+
+# Get the name of the package.
+echo -n "What is the name of your package? "
+read PACKAGE
+
+# Get the version number.
+echo
+echo "Now I'm going to ask you for the initial version number for this"
+echo "package. Version numbers have two parts: the MAJOR part and the"
+echo "MINOR part."
+echo
+echo "The MAJOR part is a single number (eg 3). It is used (for example)"
+echo "for versioning libraries."
+echo
+echo "The MINOR part is two numbers separated by a single DOT (eg 1.0)"
+echo "This is the incremental release of the library."
+echo
+echo "If you library is version 3.1.0 then the MAJOR part would be"
+echo "  3"
+echo "and the MINOR part would be"
+echo "  1.0"
+echo
+
+echo -n "What is the MAJOR part of the version? "
+read VERSION_MAJOR
+
+echo -n "What is the MINOR part of the version? "
+read VERSION_MINOR
+
+# Create the Makefile+ file.
+
+cat > Makefile+ <<EOF
+# -*- Makefile -*-
+#
+# This is a make+ file. Make+ is a set of scripts which enhance GNU
+# make and let you build RPMs, and other package types with just one
+# control file.  To build this package you will need to download make+
+# from this site: http://www.annexia.org/freeware/makeplus/
+
+PACKAGE                := $PACKAGE
+VERSION_MAJOR  := $VERSION_MAJOR
+VERSION_MINOR  := $VERSION_MINOR
+VERSION                := \$(VERSION_MAJOR).\$(VERSION_MINOR)
+
+SUMMARY                := XXX A ONE LINE SUMMARY OF YOUR PACKAGE
+COPYRIGHT      := XXX ONE LINE COPYRIGHT OR LICENSE
+AUTHOR         := XXX YOUR NAME AND EMAIL ADDRESS
+
+define DESCRIPTION
+XXX A FEW PARAGRAPHS ABOUT WHAT YOUR PACKAGE DOES
+endef
+
+#RPM_REQUIRES  :=
+RPM_GROUP      := Development/Libraries
+
+CFLAGS         += -Wall -Werror -g -O2
+
+all:   build
+
+# XXX MODIFY THE FOLLOWING TO CONFIGURE YOUR PACKAGE
+configure:
+       \$(MP_CONFIGURE_START)
+       \$(MP_CHECK_HEADERS) string.h unistd.h
+       \$(MP_CONFIGURE_END)
+
+build:
+# XXX ADD CODE HERE TO BUILD YOUR PACKAGE
+
+test: XXX LIST OF TEST PROGRAMS
+       \$(MP_RUN_TESTS) $^
+
+# XXX MODIFY THE FOLLOWING CODE TO INSTALL YOUR PACKAGE
+# XXX ALWAYS REMEMBER TO PREFIX INSTALLATION PATHS WITH \$(DESTDIR)
+install:
+       install -d \$(DESTDIR)\$(bindir)
+       install -m 0755 my_program \$(DESTDIR)\$(bindir)
+
+define WEBSITE
+<html>
+XXX PUT YOUR WEBSITE HERE. IF YOU DON\'T WANT TO MANAGE A WEBSITE WITH
+XXX MAKE+ THEN JUST DELETE THIS SECTION AND THE upload_website RULE.
+</html>
+endef
+
+upload_website:
+       scp \$(PACKAGE)-\$(VERSION).tar.gz \$(PACKAGE)-\$(VERSION)-1.*.rpm \\
+       \$(PACKAGE)-\$(VERSION).bin.tar.gz \\
+       you@yourmachine.example.com:/var/www/html/\$(PACKAGE)/files
+       scp index.html you@yourmachine.example.com:/var/www/html/\$(PACKAGE)/
+
+.PHONY:        build configure test upload_website
+EOF
+
+echo
+echo "I've written a Makefile+ file for you. You'll need to edit this file."
+echo "Start by searching for all the 'XXX's and replacing them as necessary."
diff --git a/make_rpm_spec.sh b/make_rpm_spec.sh
new file mode 100755 (executable)
index 0000000..458ec6f
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# This RPM builder is not very smart at the moment. It should know more
+# about libraries and building separate -devel and -doc packages at least.
+
+set -e
+
+manifest=$1; shift
+
+cat <<EOF
+Summary: $SUMMARY
+Name: $PACKAGE
+Version: $VERSION
+Release: 1
+Copyright: $COPYRIGHT
+Group: $RPM_GROUP
+Source: %{name}-%{version}.tar.gz
+BuildRoot: /var/tmp/%{name}-%{version}-root
+#BuildRequires: makeplus XXX uncomment before release!!!
+EOF
+
+if [ "x$RPM_BUILD_REQUIRES" != "x" ]; then
+    echo "BuildRequires: $RPM_BUILD_REQUIRES"
+fi
+
+if [ "x$RPM_REQUIRES" != "x" ]; then
+    echo "Requires: $RPM_REQUIRES"
+fi
+
+cat <<EOF
+%description
+$DESCRIPTION
+
+%prep
+%setup -q
+
+%build
+./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+make+ all
+
+%install
+rm -rf \$RPM_BUILD_ROOT
+mkdir -p \$RPM_BUILD_ROOT
+make+ DESTDIR=\$RPM_BUILD_ROOT install
+
+%post
+# XXX Don't always run ldconfig, only if there is a library.
+/sbin/ldconfig
+
+%clean
+rm -rf \$RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+EOF
+
+sed 's|\(/man/.*\.[1-9ln]\)$|\1*|' < $manifest
diff --git a/make_website.sh b/make_website.sh
new file mode 100755 (executable)
index 0000000..3114f8e
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+cat <<EOF
+$WEBSITE
+EOF
\ No newline at end of file
diff --git a/release.sh b/release.sh
new file mode 100755 (executable)
index 0000000..8ec0b40
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+make+ clean ||:
+./configure --prefix=/usr --sysconfdir=/etc
+make+ all dist bindist rpm mp_website upload_website
diff --git a/rpm.mk b/rpm.mk
new file mode 100644 (file)
index 0000000..fba356d
--- /dev/null
+++ b/rpm.mk
@@ -0,0 +1,36 @@
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# Build an RPM
+rpm:   mp-rpm.spec
+       @rm -rf mp-rpm
+       @mkdir mp-rpm
+       @mkdir mp-rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+       @mkdir mp-rpm/RPMS/{i386,i486,i586,i686,noarch}
+       $(MAKE) -f $(srcdir)/$(_mp_makefile) \
+         MP_SRC_DIST=mp-rpm/SOURCES/$(PACKAGE)-$(VERSION).tar.gz dist
+       @cp mp-rpm.spec mp-rpm/SPECS/$(PACKAGE)-$(VERSION).spec
+       rpmbuild -ba --define _topdir\ `pwd`/mp-rpm --clean \
+       mp-rpm/SPECS/$(PACKAGE)-$(VERSION).spec
+       @mv mp-rpm/RPMS/*/*.rpm mp-rpm/SRPMS/*.rpm .
+       @rm -rf mp-rpm mp-rpm.spec
+
+# Build the spec file.
+mp-rpm.spec: $(srcdir)/$(_mp_makefile)
+       $(MAKE) -f $< prefix=/usr sysconfdir=/etc localstatedir=/var \
+         MP_BIN_MANIFEST=mp-MANIFEST.bin mp_manifest_bin
+       $(MAKEPLUS_HOME)/make_rpm_spec.sh mp-MANIFEST.bin > $@
+       @rm mp-MANIFEST.bin
+
+.PHONY: rpm
\ No newline at end of file
diff --git a/run_tests.sh b/run_tests.sh
new file mode 100644 (file)
index 0000000..e62f2d5
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+set -e
+
+total=0
+failed=0
+
+for f in "$@"; do
+    total=`expr $total + 1`
+    echo "$f:"
+    ./"$f" || failed=`expr $failed + 1`
+done
+
+if [ $failed -gt 0 ]; then
+    echo "Failed tests: $failed/$total"
+    exit 1
+else
+    echo "All tests completed successfully."
+fi
diff --git a/test.mk b/test.mk
new file mode 100644 (file)
index 0000000..7a64af8
--- /dev/null
+++ b/test.mk
@@ -0,0 +1,15 @@
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+MP_RUN_TESTS   = $(MAKEPLUS_HOME)/run_tests.sh
diff --git a/website.mk b/website.mk
new file mode 100644 (file)
index 0000000..0bf0c21
--- /dev/null
@@ -0,0 +1,30 @@
+# This is make+. Make+ is a set of scripts which enhance GNU make and
+# let ou build RPMs, and other packages types with just one control
+# file. Read more at http://www.annexia.org/freeware/makeplus/
+#
+# The original author is Richard W.M. Jones <rich@annexia.org>.
+#
+# This software has been explicitly placed in the PUBLIC DOMAIN.  You
+# do not need any sort of license or agreement to use or copy this
+# software. You may also copyright this software yourself, and/or
+# relicense it under any terms you want, at any time and at no cost.
+# This allows you (among other things) to include this software with
+# other packages so that the user does not need to download and
+# install make+ separately.
+
+# This module contains code for building a website and uploading
+# a whole release (source, binary, RPMs, website, etc.) to your server.
+
+# mp_release is the main target. It builds everything and uploads it.
+# The only thing you need to do is change the version number before
+# running it.
+mp_release:
+       cd $(srcdir) && $(MAKEPLUS_HOME)/release.sh
+
+# This target just rebuilds the website (index.html).
+mp_website: index.html
+
+index.html: $(srcdir)/$(_mp_makefile)
+       $(MAKEPLUS_HOME)/make_website.sh > $@
+
+.PHONY: mp_release mp_website