Parent document is top of "Motif FAQ (Part 9 of 9)"
Previous document is "307) What order should the libraries be linked in?"
Next document is "309) How do I use imake with Motif 2.0?"

308) How do I use xmkmf for Motif clients?

[Last modified: July 96]

Answer:  This advice comes from dbrooks@osf.org. For another answer, see the
question immediately following this one ("How do I use imake with Motif
2.0?").

There are a number of intractable problems with using X configuration files
and xmkmf, while trying to make it easy to build Motif.  Not the least of
these, but one I've never heard mentioned yet, is that the rules for
contructing the names of shared library macros are machine-dependent, and in
the various xxxLib.tmpl files.  Do we edit all those files to add definitions
for XMLIB, DEPXMLIB, etc., or do we put a maze of #ifdefs into the Motif.tmpl
file?

Please note that, if you install Motif, it overwrites your installed
Imake.tmpl with one that includes Motif.tmpl and Motif.rules.

With those caveats, I think the following guidelines will help.

David Brooks OSF

Clients in the X11R5 release use the xmkmf command to build Makefiles.  In
general, the xmkmf command cannot be used for Motif clients, because of the
need to consider the UseInstalledMotif flag separately.  Since xmkmf is a
simple script that calls imake, it is easy to construct the proper call to
imake using the following rules.

In the following, replace {MTOP} by the toplevel directory with the Motif
source tree, and {XTOP} by the toplevel ("mit") directory with the X source.
It is assumed that the directory containing your installed imake is in your
PATH.

When needed, the imake variables XTop and MTop are normally set in your
site.def (to {XTOP} amd {MTOP} respectively); however they may also be set
with additional -D arguments to imake.

1. With both X and Motif in their source trees, ensure the imake variables
   XTop and MTop are set, and use:

        ${XTOP}/config/imake -I{MTOP}/config

2. With Motif in its source tree, and X installed, ensure MTop is set, and
   use:

        imake -I{MTOP}/config -DUseInstalled

3. With both Motif and X installed, and a nonstandard ProjectRoot (see
   site.def for an explanation of this), use:

        imake -DUseInstalled -DUseInstalledMotif -I{ProjectRoot}/lib/X11/config

   or, if the configuration files are in /usr/lib/X11/config:

        imake -DUseInstalled -DUseInstalledMotif  -I/usr/lib/X11/config

[Thanks to Paul DuBois (dubois@primate.wisc.edu) for correcting this.]

To build a simple Imakefile, remember to include lines like this:

        LOCAL_LIBRARIES = XmClientLibs
                DEPLIBS = XmClientDepLibs

Or, for a client that uses uil/mrm, replace these by MrmClientLibs and
MrmClientDepLibs, and also use:

        MSimpleUilTarget(program)

to build the client and uid file.  Look at the demos for more examples.


And Paul Howell <grue@engin.umich.edu> added:

i did this, calling the new script "xmmkmf".  It passes both -DUseInstalled
and -DUseInstalledMotif.

and i modified the stock R5 Imake.tmpl to do this:

#include <Project.tmpl>
#ifdef UseInstalledMotif
#include <Motif.tmpl>
#endif

#include <Imake.rules>
#ifdef UseInstalledMotif
#include <Motif.rules>
#endif

the result was something that does both athena and motif rules.  and it really
works, just that easy!

Parent document is top of "Motif FAQ (Part 9 of 9)"
Previous document is "307) What order should the libraries be linked in?"
Next document is "309) How do I use imake with Motif 2.0?"