After a few months of puzzling and testing it was time to push Makefile.pdlibbuilder onto a public repository (before rumours would become too embarrassing):
https://github.com/pure-data/pd-lib-builder
Makefile.pdlibbuilder is a one-size-fits-all helper makefile for Pd external libraries. A build system in this approach will typically have two makefiles:
1 - Makefile - defines input files and other library-dependent variables 2 - Makefile.pdlibbuilder - defines library-independent paths, flags and build rules for Pd lib building
You can think of this approach as a template split in two parts - specific and generic. Your Makefile is the specific part, to be updated when you make changes in your library. Makefile.pdlibbuilder is the generic part, to be updated in response to external conditions like OS and hardware developments. This partitioning makes it easy to (collectively) improve the generic part of the build system, and upgrade by simple file replacement.
Makefile.pdlibbuilder is conceived in the same spirit as Hans Christoph Steiner's Makefile Template, but differs from it in several aspects (apart from the partitioning). It does not assume the strict libdir layout as described in https://puredata.info/docs/developer/Libdir. Source files (multiple) and link flags may be defined per class. C and C++ are both supported. For exact info read Makefile.pdlibbuilder's internal documentation paragraphs.
The version number of this first public release is set at 0.0.0 to express that Makefile.pdlibbuilder's life as a community project starts here. It doesn't mean that this version is totally unstable. In the course of testing with ~60 libraries on 7 platforms, the 'API' was reconsidered a few times, but is now well defined. Discussions about flags, default paths and priorities thereof are to be expected however. Also, source packaging targets aren't implemented yet. And hopefully there's an interest to add platform definitions, for cross compiling in particular.
You may wonder why those ~60 library test makefiles (written by Fred Jan Kraan) won't be published as such. Briefly: while it takes a few minutes to write a library makefile for the Makefile.pdlibbuilder approach, it takes a few hours or days to build and test a single library on 7 platforms and make sure that the build result is identical to that of the original build system. In some cases it is hard to understand what the original build system means to build and install, and there is a huge variety of build methods among Pd-extended libs. Fred Jan's test makefiles mainly served to figure out the requirements for Makefile.pdlibbuilder. We concluded that most libraries could be accommodated, including the rather complex case of cyclone. Libraries which need to check dependencies before building are still better served by Autotools.
Katja