Q: Problem with null suffix rules (make)

Tim Scott scott at spectra.com
Tue Jan 16 07:35:09 AEST 1990


This seems like it should be trivial to do. I hope I can 
explain it clearly enough. 

I have a directory full of C programs: (say: a.c, b.c, c.c, ...)
each one builds an executable (a, b, c, ...) using the same
commands. Due to a "feature" of the *ix I I use, I have to do a 
couple syncs after the load (if you really want to know why,
send me mail. It's too awful to describe on a public net that
children may be reading :-) Thus I can't use the default null
suffix rules.

The following makefile correctly builds a from a.c if the latter
is newer than the former:

LIBS = /usr/lib/mylib.o  /usr/lib/notherlib.a
CFLAGS = -lfm

.c: 	
	cc -o $@ $@.o $(LIBS) $(CFLAGS)
	sync; sync

Fine for that. HOWEVER, what I want to do is have the makefile 
just do the load ONLY if a.o already exists and is newer than either 
a or a.c. (Sometimes I manually compile a.c for various reasons...)
I have tried a bunch of things, and read the O'Reilly book backwards 
and forwards and can't get it to work.

The whole idea of null suffixes is good, since that way I don't
have to modify the makefile each time I add, remove or change the
name of a program.c in the directory. 

Please, can anyone shed any light on this? I'd be very grateful.

(Email if you can, but I'll check this group if you feel it's of
general interest or can't get mail to me.)

[P.S. Does it matter that I'm using AIX 2.2.1 on an IBM PC-RT?]

Disclaimer: So what's to disclaim already?!



More information about the Comp.unix.questions mailing list