My main development machine for the last several years, runs 4.4BSD (NetBSD to be precise), and the BSD source tree is an excellent example of managing a large software project. In following NetBSD's -current delevlopment, I learned to use the new BSD Makefiles and make(1), I'll refer to it as bmake from here on. Since then all my new projects and many of my old ones use bmake. Since bmake.tar.gz uses GNU's autoconf and is quite portable, I've skipped the effort of making the rest of my distribution support GNU make.
It may be insteresting to note that much of my tree uses the same simple Makefile, it is:
# a totally generic makefile suits 90% of projects PROG= ${.CURDIR:T} SRCS= $(PROG).c .include "prog.mk"
.include "prog.mk";Makefiles for libraries inlcude lib.mk btw. Anyway, apart from reading a bunch of rules from the system macros (/usr/share/mk/* by default) it reads "../Makefile.inc" thus provinding a hook for much magic. My Makefile.inc files typically look for Makefile.${MACHINE}.inc as well. Note that I used to use the bsd.*.mk macros (intended for building /usr/src), but attempts to get simple portability improvments committed into these, usually failed, so the only viable solution is to maintain a parallel set.
/usr/src/bin/cat/obj -> /usr/obj/bin/catthen suddenly building for multiple architectures is very easy. Since I typically export my tree via NFS and want to gather the binaries into my
/usr/local/obj -> src/obj.${MACHINE}and then I set:
BSDSRCDIR=`cd /usr/local/src; /bin/pwd` BSDOBJDIR=/usr/local/objNote: You must set BSDSRCDIR with the same value that /bin/pwd produces as otherwise obj.mk will do the wrong thing.
$ mkdir /tmp/bmake $ cd /tmp/bmake $ /usr/local/src/sjg/bmake/configure $ make -f makefile.boot # make -f makefile.boot installNote that bmake/mk contains copies of bsd.*.mk too which should only be installed on non-4.4BSD systems. The install step above will only install them if bsd.own.mk does not exists in the target directory.
$ `pwd`/configure $ make -f makefile.boot # make -f makefile.boot install
Bootstraping bmake in /usr/local/src/sjg/bmake should not present any difficulties though I've not tried it. In anycase the following does work (the need for the sed(1) command suggests a bug in make(1)).
$ mkdir /tmp/bmake $ cd /tmp/bmake $ /usr/local/src/sjg/bmake/configure $ make -f makefile.boot depend MKDEP_OPTS=-N $ sed 's,/usr/local/src.*/\([^/]*\.c\),\1,' .depend >> makefile.boot $ cd lst.lib $ sed 's,/usr/local/src.*/\([^/]*\.c\),\1,' .depend >> makefile.boot $ make -f makefile.boot # make -f makefile.boot installNote: AIX.sys.mk is still probably full of errors, updates appreciated.