Xref: utzoo alt.sources.d:1164 comp.unix.programmer:694 Path: utzoo!utgpu!cs.utexas.edu!uunet!mcsun!ukc!slxsys!ibmpcug!robobar!ronald From: ronald@robobar.co.uk (Ronald S H Khoo) Newsgroups: alt.sources.d,comp.unix.programmer Subject: Re: mkdep program for SysV (Xenix/Unix) Summary: you can use gcc -M Message-ID: <1990Dec14.023842.21164@robobar.co.uk> Date: 14 Dec 90 02:38:42 GMT References: <1990Dec13.010143@cs.yale.edu> Followup-To: comp.unix.programmer Organization: Robobar Ltd., Perivale, Middx., ENGLAND. Lines: 35 [ 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@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@robobar.co.uk +44 81 991 1142 (O) +44 71 229 7741 (H)