Building an application

When you are building an application, you must include the X11 header directory as part of the object compilation:

CFLAGS = -O -I/usr/X11R5/include

You must also include the libraries and place them after the object files:

XLIBS = -lXaw -lXmu -lXt -lXext -lX11

So the X11 versions of functions are linked, include general purpose libraries after the X11 libraries:

XLIBS = -lXaw -lXmu -lXt -lXext -lX11

You must include the -L directive (library location) before the object file:

XLIBDIR = -L/usr/X11R5/lib

Some applications, such as the source for the xtetris example, use the xrdb(1) utility to create the application defaults files. When you build these applications, you must set your display and start the X11 server before you start the build process.

Many X Window applications come with Imakefiles. You can create a Makefile from an Imakefile using either xmkmf(1) or imake(1).

If you use xmkmf to build an application from an Imakefile, you will see the following type of output:
mv Makefile Makefile.bak
imake -DUseInstalled -I/usr/X11R5/lib/X11/config

You can use imake directly, but you might need to pass appropriate -D and -I options. You can enter the previous command as an imake command by typing:

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

Once the Makefile has been built, you can build the application with make(1).

Some X Window applications use xrdb as part of the build process (for example, make install). For xrdb to run properly, you must set your display and have the X11 server running. This is true of the xtetris example source. Note, however, that Interix does not come with an X11 server.