[comp.unix.questions] SUMMARY: Preprocessor dependencies in MAKE

perl@dwrsun2.UUCP (Robert Perlberg) (06/26/91)

Thanks to all who submitted replys.  The answer which best satisfies my
needs was submitted by Tun-Lian ("Tony") Chang (toncha@auto-trol.com).
This is the format that I am now using:

RUNME = runme.o

runme: $(RUNME)
	$(CC) $(CFLAGS) -o $@ $(RUNME) -lingres -lm

%.c: %.sc
	esqlc $<

%.o: %.c
	$(CC) $(CFLAGS) -c $<


The thing I like about this method is that it is strictly hierarchical,
i.e., the .o depends on the .c and the .c depends on the .sc, rather
than the usual short-circuit approach of making the .o depend on the
.sc.  It also provides for having to specify the commands only once no
matter how many modules are in the makefile.  It also gracefully
handles the intermixing of non-preprocessed C source files (make won't
complain if it can't find a .sc for a .c).

Robert Perlberg
Dean Witter Reynolds Inc., New York
murphy!dwrsun2!perl
	-- "I am not a language ... I am a free man!"