mkdep program for SysV (Xenix/Unix)

Brandon S. Allbery KB8JRR allbery at NCoast.ORG
Sun Dec 16 13:04:14 AEST 1990


As quoted from <1990Dec14.023842.21164 at robobar.co.uk> by ronald at robobar.co.uk (Ronald S H Khoo):
+---------------
| 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?)
+---------------

If I remember correctly, BSD cc has -M but it has to be massaged to produce
dependencies.  gcc has -M and -E -M (I think that's correct); the latter
produces dependencies in Makefile format.

I have a Perl script that computes dependencies, which I use in preference to
gcc.  Part of the reason is that it doesn't feel as weird as running a C
compiler on random non-C source [ ;-) ] and part of the reason is some
misgivings about letting gcc anywhere near my Unify ACCELL 4GL scripts,
copyleft notwithstanding.  Neither is a hard-and-fast reason, and little would
change if I made my mkdep script call gcc -E -M, except that my mkdep does
a little cleanup on the resulting filenames.  In particular, I seem to
remember it keeping an eye on Makefile macro definitions and substituting them
in place of leading pathname components.  (It's been a while since I bothered
to look at the output; once you trust a tool, you don't worry it to death.)

++Brandon
-- 
Me: Brandon S. Allbery			    VHF/UHF: KB8JRR on 220, 2m, 440
Internet: allbery at NCoast.ORG		    Packet: KB8JRR @ WA8BXN
America OnLine: KB8JRR			    AMPR: KB8JRR.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery    Delphi: ALLBERY



More information about the Comp.unix.programmer mailing list