Imake (including the xmkmf tool) is a build configuration tool which generates Makefiles. It was developed back in the 80s by former TektronixInc engineer ToddBrunhoff as part of the X Windows System, and is (or was until recently) a key part of the development environment for X - at least the XFree86 distribution. ''The inheritors of XFree86 are working to replace imake with an AutoConf based make system, like many other large OpenSource projects. They are also breaking the X source tree into modules that can be compiled independently. Soon, imake will become a relic of history.'' I don't think it's used anywhere else. It is a classic example of DoTheSimplestThingThatCouldPossiblyWork going awry. Even its author repeatedly has disclaimed it as a "dirty hack" or some such. Essentially what Imake does, is that it serves as a preprocessor for Makefiles. You feed it a "makefile template" (an Imakefile) describing the software you want it to build, and "target description" files describing the target you want to build it for, and it outputs a set of Makefiles customized for your particular target. This was done in the days before Gnu make (to say nothing of other build configuration tools such as ApacheAnt) was widely available - and was designed to deal with numerous different Unices, each with their own crippled version of Make (and other insidious platform differences). However.... * Both the template and the generated makefile tend to begin at about 10,000 lines in the simple case and grow without bounds from there * Rather than invent a preprocessor, the author of Imake decided to use an existing one. Unfortunately, the CeePreprocessor was chosen - as a front-end to CeeLanguage, cpp is barely adequate. As a general-purpose macro processor, cpp is terrible. This makes Imakefiles ''way'' more complicated than they need to be; as you are constantly having to hack around the limitations of cpp. Plus, cpp and Make interact with each other in strange ways; e.g. ** Both treat backslash-newline as a "line continuation" indicator. To embed a backslash-newline in the resultant Makefile, you have to type @@\ in the Imakefile. Making sure, of course, you haven't left any whitespace ''after'' that backslash.... ** Many pathnames found in Unix makefiles contain a path separator (/) followed by the "select all files" wildcard (*). Of course, to cpp the string /* starts a comment. Some of the hardest-to-debug problems with imake are when this shows up in an Imakefile. * The imake distribution contains a set of sample templates for various platforms. Unfortunately, they contain reams of X-specific cruft; use of imake to build anything that isn't X is an interesting challenge. * Invoking imake directly is difficult--a typical imake command line is several lines long, with numerous difficult-to-remember options. As a result, a typical imake-generated makefile consists of rules to rebuild the makefile, so the user doesn't have to run imake directly--"make Makefiles" will do the trick. But what if ** You are bootstrapping the system for the first time? ** A change to the imakefile causes in invalid makefile to be generated, such that make fails? ** In the latter case, most Imakefiles arrange for a backup copy of the makefile to be made. In the former case, you're on your own--the usual solutions include a "bootstrap script", and/or a hand-written top-level Makefile. Constructing either is a RPITA. ---- CategorySoftwareTool