Previous: , Up: C   [Index]


GNU tools

Using GNU Tools with Ctalk

If you want to build Ctalk programs using the GNU configuration tools; i.e, the ‘./configure,’ ‘make,’ ‘make install’ sequence of commands, you need to tell the build tools about Ctalk.

Doing this mostly involves telling the utility automake, which helps write Makefiles for the make program, how to build a Ctalk source file into an executable.

The make program allows Makefiles to define rules to build different types of input files into programs, libraries, and other types of data files.

In order to distinguish a Ctalk file, we give it the file extension ‘.ca’. This lets the build tools know that the Ctalk program isn’t a standard C input file.

Then, in Makefile.am (consult the automake manual if you’re not certain what this is), you can define a rule to build a ‘.ca’ file into an ‘.o’ object file.


SUFFIXES=.ca .o

.ca.o:
	$(top_builddir)/src/ctalk -I $(top_builddir)/classes $< \
	  -o `basename $ .o`.i ; \
	$(CC) -c $(AM_CFLAGS) $(AM_CPPFLAGS) $(DEFS) -o $ `basename $< .ca`.i

Then, add another line to link the object file into a program.


methods$(EXEEXT) : methods.o
	$(CC) methods.o $(AM_LDFLAGS) $(LDFLAGS) $(LIBS) -o methods$(EXEEXT)

Note that this example comes from the methods program in the Ctalk distribution, where, “methods,” is the canonical name of the output file, as defined in the ‘bin_PROGRAMS’ macro. That allows make to install the program normally when you type, ‘make install.

If you’re using Ctalk for another package, you’ll almost certainly want to change the paths to something that uses an already-installed Ctalk. In that case, Makefile.am might contain lines like these.


SUFFIXES=.ca .o

.ca.o:
	/usr/local/bin/ctalk -I /usr/local/include/classes $< \
	  -o `basename $ .o`.i ; \
	$(CC) -c $(AM_CFLAGS) $(AM_CPPFLAGS) $(DEFS) -o $ `basename $< .ca`.i

Cleaning Up Extra Files

Note that the basename command in these examples handles the translation of the make targets into an intermediate Ctalk file.

This way make doesn’t need to worry about any intermediate files, except that the Makefile should clean them up.

So to define rules to clean up the extra files after the build, include make targets like these in Makefile.am.


clean-local:
	rm -f *.i

distclean-local:
	rm -f *.i


Running Ctalk Utilities in an Emacs Window

The doc/ subdirectory of the Ctalk source code distribution contains the Emacs Lisp programs classes.el, methods-brief.el, and methods-full.el. They define simple Emacs Lisp functions that let you capture the output of the Ctalk utilities in an Emacs window.

The documentation file, ctalktools.info contains descriptions of these functions, and the files also contain instructions to install and use them.


Previous: , Up: C   [Index]