1. 10

    One should note that you’re not talking about just any Makefiles here, but specifically GNU Makefiles, since you’re using % patterns in rules. If you look at what BSD Makefiles support, you’ll find that many features are lacking, while new ones were added. And that’s kind of the difficulty, at least for me, when trying to use make for non-standard projects, that limiting oneself to the POSIX specification, to ensure portability, leaves you with a rather restricted set of possibilities.

    1. 3

      In reality, you can pretty much rely on GNU Make being available. It runs on most platforms. The biggest issue is that it may not be preinstalled.

      And yes, pure POSIX is quite limited.

      1. 3

        The biggest issue is that it may not be preinstalled.

        That’s exactly the point why I wanted to bring this up. I myself didn’t know about this until an OpenBSD user once remarked that it was a bit inconvenient to have to figure out what make implementation to use.

        And regarding POSIX’s limitedness, my main (but certainly not favourite) way around this is to “wrap” the makefile in a shell script, that does all the necessary configuration, eg. find all the files that have to be processed dynamicaly, and then pass these as variables to make.

        At the same time, one should keep in mind that “real” POSIX make doesn’t exist, and in practice most implementations share a common superset of features non specified by the standard. gmake‘s manual gives a nice overview, although I’m not sure how up-to-date it is.

      2. 2

        Thanks, zge! I will clarify in the post, and (if you don’t mind) credit you for the hint. Have a good day!