-->
Previous Table of Contents Next


As you compile Linux freeware, you’ll notice that there are a lot of conventions with make and Makefiles. For example, most Makefiles contain a target called all, which rebuilds the entire program when you execute:


     $ make all

For this command to work, the Makefile must have a target named all that tells make what to do to rebuild everything. In addition, most Makefiles contain a clean target that removes all .o files and other files created by the compiler, and an install target that copies the built executable file to an installation directory, such as /usr/local/bin.

Imake

In addition to make, there’s another tool called imake. Imake is used to generate Makefiles on a variety of systems. Imake uses an Imakefile for its rules. These rules then help generate a Makefile, which is used by make to build the program. Sound convoluted? It is. The main reason imake exists is because of radically different system configurations, especially where the X Window System is concerned.

You’ll find imake especially popular with programs for X Window. The problem with X is that there are so many options that every UNIX platform is configured slightly differently. There’s simply no way you could write a portable Makefile that could work on all such platforms. Imake uses an Imakefile and configuration files that are local to your system. Together, the Imakefile and the local configuration files generate a Makefile that should work on your system. (In addition to imake, there’s an even handier package called GNU configure. Unfortunately, imake is very common among X Window programs, and configure is not.)

If you need to compile programs for the X Window System and you see an Imakefile, here’s what you should do. First, run the xmkmf shell script. This script is merely a simple front end to imake:


     $ xmkmf

     mv Makefile Makefile.bak

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

These commands should make a backup of any Makefile you have (to Makefile.bak) and then create a new Makefile based on the commands in an Imakefile.

Imake isn’t easy to grasp, so if you have problems with imake, check with your system administrator or look up imake in a book on the X Window System (such as Using X, MIS:Press, 1992; see Appendix A for a list of books on using the X Window System).

Debuggers

Because Linux remains firmly in the GNU program-development world, it provides the gdb debugger, as well as the X Window front end, xxgdb, as shown in Figure 10.1.


Figure 10.1  The xxgdb debugger.

X Window Tools

If you’re developing X Window applications, a few extra utilities may help. The xman program (mentioned in Chapter 5) provides a graphical front end and nice formatting for UNIX online-manual pages.

For critical X programs, you’ll find xcmap very useful. This simple X application displays the current colormap. For color-intensive X applications, this can help you track down obscure X problems.

Similarly, the xev application helps you see what events the keyboard keys are really sending to the X server.

For selecting fonts, xfd and xfontsel both help you choose a good-looking font for your applications.

Parsers and Lexers

If you’re used to building your own parsers, you’ll like the GNU bison (a port of UNIX yacc—Yet Another Compiler Compiler) and flex (a fast lex). Linux even includes flex++ for developing C++ scanners.

Other Tools

We list some more useful tools for programmers in Table 10.5.

Table 10.5 More Useful Programming Tools
Tool Usage

ar Collects object files into libraries
diff Compares differences between files
gprof Gathers timing statistics about your programs for performance tuning
hexdump Displays ASCII, decimal, hexadecimal, or octal dump of a file
objdump Display information on object files
ranlib Generates an index in an ar-created archive (library)
rcs Source code Revision Control System
strace Displays system calls from your program

There’s even a tool called ansi2knr that converts ANSI C to old-style Kernighan and Ritchie-style C (without function prototypes). With Linux, you don’t really need this, as gcc fully supports ANSI C.

There are more tools than what we listed in Table 10.5. Chances are that just about every UNIX freeware tool is available on Linux.

Other Programming Languages

C is by and large the programming lingua franca on UNIX and Linux, with C++ (an object-oriented extension to C) fast gaining in popularity. In addition to these languages, Linux provides a host of other opportunities to program.

First, the GNU C compiler also supports the Objective-C extension to the C programming language. Objective-C is very popular under the Nextstep environment. The GNU C compiler also supports a Fortran 77 front end called g77.

For artificial intelligence fans, there’s Common Lisp (under the name clisp). Additional programming languages include Ada and Pascal.


NOTE:  None of the programming tools or languages get installed on a Slackware Linux system unless you specifically ask for them by running the setup program.

Java the Hut

One of the hottest new languages, especially for World Wide Web applications, is Sun’s Java. Java programs get compiled to a portable set of byte codes, which can execute on any system that supports the Java Virtual Machine. There’s a version of Java for Linux; on the second CD-ROM: the Java Development Kit, or JDK.. As of this writing, this software is in a very preliminary format, but it’s worth checking out.


Previous Table of Contents Next