bjaspan@ATHENA.MIT.EDU (Barr3y Jaspan) (12/13/90)
Someone recently asked for info on how Imake works. I composed the following reply, which bounced when I mailed it to him (I didn't look very hard the address before sending it, so I'm not surprised. :-) Instead of thinking about how to make it not bounce, I decided it might be useful to other people on this group, so here it is. --- snip snip --- In article <11@ftms.UUCP> writes: |> I am searching for documentation explaining how the imake program works. |> I have the imake man page, but it doesn't explain the syntax of the |> Imakefile file. Imake is actually deceptively easy to use. Unfortunately, there is no good documentation for it AT ALL (as you noticed) and it looks confusing enough to throw off most people. The sheer scale of the X11 distribution doesn't help any, either. Here's how it works. imake itself only does one thing -- it reads in a template file called "Imake.tmpl" (you can give it another name if you want). Generally, you give imake a -I option so it knows which directory to find the template file in (it usually isn't in the current directory). imake runs the template file through cpp and spits the result out as a Makefile. *THAT'S IT*! "So how does it actually work?", I hear you cry. Well, it turns out that the template file contains one (or more) #include directives for cpp. Files that are usually included: Imake.config (or config.Imakefile, or site.defs, or Project.defaults, or whatever): this is where Imake is configured for different sites and for different platforms. It contains either (as distributed by X11) a bunch of #defines or (as I set it up) a bunch of Make macro assignments. So you can customize it by changing the values #defined or assigned to macros; also, since this is running through cpp, you can do things like #ifdef bsd ... #endif #ifdef ultrix ... #endif and so forth. Imake.rules: This is where all the magic lies. Imake.rules defines a bunch of cpp macros (just like in C: #define RandomMacro(arg1,arg2) ....). By a staggering coincedence :-), the macros are defined to turn into meaningful Makefile rules. For example, look at NormalProgramTarget in the X11 distribution. You give it objects and a program name and it spits out the "typical" make-rule for a simple program. (I'm a little fuzzy on the details, I haven't looked at it for a while.) The real trick comes in realizing that all the Imake rules are *just cpp macros*. Imakefile: Finally, the template (hopfully!) includes your Imakefile. In it, you use the macros defined in the Imake.rules file. You are also free to put in anything that normally can go in a Makefile, since remember all Imake does is run your Imakefile through cpp and spit out the result as Makefile. So, to sum up: the Makefile that Imake spits out contains first the exact contents of config.Imakefile (with ordinary #define replacements, if any), then your Imakefile with rules replaced by their #define'd equivalent from Imake.rules, and all that is interspersed with whatever happens to be in Imake.tmpl around the various #includes. Hope this helps. I'll probably be writing a short document on how to set up and use Imake in the near future, so let me know if there is anything missing or glaringly wrong. -- Barr3y Jaspan, bjaspan@mit.edu
paulsh@denali.wv.tek.COM (Paul Shearer) (12/14/90)
> In article <11@ftms.UUCP> writes: > |> I am searching for documentation explaining how the imake program works. > |> I have the imake man page, but it doesn't explain the syntax of the > |> Imakefile file. > > Imake is actually deceptively easy to use. Unfortunately, there is no > good documentation for it AT ALL (as you noticed) and it looks > confusing enough to throw off most people. The sheer scale of the X11 > distribution doesn't help any, either. Here's how it works. This is not quite true. There is a very good document "An Imake tutorial" found in contrib/doc/imake/* There may be an updated version on expo. The author is: moraes@csri.toronto.edu Paul Shearer M.S. 60-850 Tektronix, Inc. P.O. Box 1000 Wilsonville, OR 97070-1000 W (503) 685-2137 FAX (503) 682-1500 paulsh@orca.wv.tek.com
meo@Dixie.Com (Miles ONeal) (12/15/90)
bjaspan@ATHENA.MIT.EDU (Barr3y Jaspan) writes: |Imake is actually deceptively easy to use. Unfortunately, there is no |good documentation for it AT ALL (as you noticed) and it looks |confusing enough to throw off most people. ... Sorry, Barry, that's no longer true. Paul DuBois at U of Wisc (dubois@primate.wisc.edu) has done some nice doc on imake. I don't know the current state of it - what I have is several months old - but it explains quite a bit. You ought to check it out before you write anything. That way you could add to, instead of duplicate, his effort. Watch for further info on imake. -Miles O'Neal Miles O'Neal meo@dixie.com (S&SSi) {uunet | emory}!rsiatl!meo meo@sware.com (work) {uunet | emory}!sware!meo
bin@primate.wisc.edu (Brain in Neutral) (12/18/90)
From article <5293@rsiatl.Dixie.Com>, by meo@Dixie.Com (Miles ONeal): > bjaspan@ATHENA.MIT.EDU (Barr3y Jaspan) writes: > |Imake is actually deceptively easy to use. Unfortunately, there is no > |good documentation for it AT ALL (as you noticed) and it looks > |confusing enough to throw off most people. ... > > Sorry, Barry, that's no longer true. Paul DuBois at U of Wisc > (dubois@primate.wisc.edu) has done some nice doc on imake. I > don't know the current state of it - what I have is several > months old - but it explains quite a bit. You ought to check > it out before you write anything. That way you could add to, > instead of duplicate, his effort. I'll mention again that you can ftp this stuff from indri.primate.wisc.edu (128.104.230.11), in ~ftp/pub/imake-stuff. I'll also mention that although lots of people have grabbed the papers (there are two), very few have made any comments or suggestions. Since the paper on imake for X is by no means complete (sigh...) I'd still welcome anything people have to say about it. -- Paul DuBois dubois@primate.wisc.edu "The coach has to eat baloney and french fries" -- Ian D., age 3 1/2