file include follower - "cpp" does nicely

Guy Harris guy at rlgvax.UUCP
Wed May 30 15:27:45 AEST 1984


A Makefile generator (the most common use of an include follower) was
posted to "net.sources" by somebody a while ago.  It used "cpp" to follow the
include files - this has the advantage that it even understands "ifdef"s and the
like.  An example of this advantage, which crops up here a fair bit, is
Makefiles for programs which provide a full-screen user interface.  Such
programs need an "#ifdef" for the V7/BSD tty driver vs. the USG tty driver;
depending on the define, it will include <sgtty.h> or <termio.h>.

That Makefile generator was one of the cleverer uses of "cpp" I've seen -
all you do is "cc -E" the source and grab "# <linenum> <filename>" lines
as they go by.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.unix mailing list