Why BSD's pmake is the best

08 Jan 2008 • 2 min read

Simplicity :)Consider these Makefiles, as used by dhcpcd over the years.dhcpcd-1 Makefile.amdhcpcd 2 Makefile.amdhcpcd 3 MakefileNow, the first two are automake files. I strongly dislike autotools after dealing with it for a few years now. I shan't go into the reasons why here though. But suffice to say that the whole build system required autotools. dhcpcd-3 supported BSD based systems, so it was only fair that we strive to support their base install. This means no autotools. So I set about discovering what I could do that worked on pmake and gmake.Sadly, the answer is that only simple things work, hence the dhcpcd-3 Makefile being quite long. Especially as it does a little bit of auto config for needed libraries, which used to be in the configure. Well, it sufficed for a long time, and when I started OpenRC I used a similar Makefile as it had to work their out of the box. Eventually my occasional partner in crime, vapier, came across my Makefile and complained about a few things, namely it's too complicated and good be a lot better. He even went and patched it so that it almost worked on pmake. But still, it needed to fully work.The end result is that I've made some .mk stubs that work with both pmake and gmake, using the same variables that the mk stubs pmake ships with. It's nowhere near as flexable, and we do make many assumptions.new dhcpcd MakefileAs you can see, we now look more like the old dhcpcd-1 and dhcpcd-2 Makefiles, but without the need for autotools or any pre-processing of Makefiles. OpenRC currently uses a similar system and has an mk stub for building static and shared binaries. Obviously, this is not suitable for everyone, but it suits me very well. And as it's all BSD licensed, feel free to use it as you wish - just respect my copyright.