mkdep program for SysV (Xenix/Unix)
Ronald S H Khoo
ronald at robobar.co.uk
Fri Dec 14 13:38:42 AEST 1990
[ OK guys, where *do* you ask about things like makefile makers ?
comp.unix.programmer ? alt.sport.toe.wrestling ? I'll try the former :-) ]
[ Now I'm going to *expect* a followup telling me what the current crop of
mkdeps do that cc -M doesn't. Or do people distribute makedepend
just because some people don't have cc -M ? Answers on a postcard to
Craig Shergold, please, or follow up :-) ]
fields-doug at cs.yale.edu (Doug Fields) writes:
> Hi. I have alot of Makefiles that call a "makedep" or "mkdep" program, which
> I assume adds to the end a zillion dependencies [ to the end of Makefiles ]
> Anyway, I could really use [ mkdep ], or one which does
> something similar, for those Makefiles and as a general utility.
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
to the end of your makefile. Then "make depend" would do just that.
This works especially well when your dependencies change a lot depending
on what -I and -D flags you change in CFLAGS, just run make depend again.
Just make sure you haven't got a file called "depend" in the current
directory :-)
--
ronald at robobar.co.uk +44 81 991 1142 (O) +44 71 229 7741 (H)
More information about the Comp.unix.programmer
mailing list