It appears that I’ve given up one ancient codebase for another.
No more am I writing a framework that supports System 7 and is built using Classic-only legacy tools.
Instead, as part of TADS Workbench for Macintosh, I am now employing someone else’s codebase, a port of the text-based TADS utilities, that supports 15 often elderly variants of Unix, and is built by the even more ancient makefile system.
Good grief, it even supports the otherwise forgotten IBM RT workstation.
How does it support all these platforms? Well, since they’re all Unix, they share most of their APIs.
But the differences, and how the project deals with them, are the interesting part. Interesting enough to fill more than one weblog post.
I’ll start by talking about the makefile.
There’s only one for the whole project, but this one file has different sections in it for all the platforms. Script-specific variables are defined, but commented out, in each of those sections.
The particular values you uncomment are then used to build your desired platform’s version of the tools.
Not unusual for this sort of thing, but in one of the explanatory files, the maintainer mentions that it could be done better, more automatically.
Investigating this a little further quickly led me to the book GNU Autoconf, Automake, and Libtool, which I will be looking into.
Before I go to do that, though, I’d like to mention one detail. It turns out that, for TADS Workbench, I’m both building the whole TADS tools via the makefile and also building just a few TADS source files into my GUI IDE application via Xcode.
Xcode doesn’t use makefiles, so I can’t reuse the settings from that makefile, and instead have to specify them a second time in my Xcode project.
Wouldn’t it be nice if all the build flags could be assembled in just one place where they could be used by both the makefile and by the Xcode project?
It appears that it is possible, by using the
-include in your makefile. You specify e.g. the
defines.h file there, and then also use that same
defines.h file in, for example, your Xcode target’s Language panel as the prefix file. I just tested it with a sample project and makefile, and it works.
This doesn’t seem to be the usual strategy. (Nor does it handle linker flags.) I’m curious whether
autoconf and friends even accommodate it.