mkdep program for SysV (Xenix/Unix)
Ned Nowotny
ned at pebbles.cad.mcc.com
Sat Dec 22 06:17:02 AEST 1990
In article <1990Dec14.023842.21164 at robobar.co.uk> ronald at robobar.co.uk (Ronald S H Khoo) writes:
>One fast and accurate way to make dependencies for makefiles is to use gcc -M.
>(Doug's asking about Xenix/Sys V, so he'd need gcc. BSD cc has -M doesn't it?)
>
>For example, you could add something like
>
> depend:
> sed "/^# DELETE ME/q" Makefile > Makefile.new
> gcc $(CFLAGS) -M $(OBJS:.o=.c) >> Makefile.new
> mv Makefile.new Makefile
>
> # DELETE ME
>
Or,
Makefile.depend: $(SRCS) $(HDRS)
for src in $(SRCS) ; \
do \
$(CC) $(CFLAGS) -E $${src} | \
grep '^# *1 ' | \
sed 's@[^"]*"\([^"]*\)".*@\1 \\@' | \
grep -v "$${src}" | \
sort -u >> $@ ; \
echo "$${src}" >> $@ ; \
done
if your compiler does not have -M but does have -E.
Ned Nowotny, MCC CAD Program, Box 200195, Austin, TX 78720 Ph: (512) 338-3715
ARPA: ned at mcc.com UUCP: ...!cs.utexas.edu!milano!cadillac!ned
-------------------------------------------------------------------------------
"We have ways to make you scream." - Intel advertisement in the June 1989 DDJ.
More information about the Comp.unix.programmer
mailing list