home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3862 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  3.2 KB

  1. Xref: sparky comp.unix.programmer:3862 comp.unix.questions:9338 comp.lang.c:11517
  2. Newsgroups: comp.unix.programmer,comp.unix.questions,comp.lang.c
  3. Path: sparky!uunet!infonode!ingr!b11!davids!davids
  4. From: davids@davids.b11.ingr.com (David Reed Smith)
  5. Subject: Re: #include file dependancies
  6. In-Reply-To: ajg@controls.ccd.harris.com's message of Wed, 22 Jul 1992 16: 45:44 GMT
  7. Message-ID: <1992Jul23.144652.1785@b11.b11.ingr.com>
  8. Sender: usenet@b11.b11.ingr.com (Usenet Network)
  9. Reply-To: davids@davids.b11.ingr.com
  10. Organization: Intergraph Corp., Huntsville, AL
  11. References: <AJG.92Jul22114544@sp1.ccd.harris.com>
  12. Date: Thu, 23 Jul 1992 14:46:52 GMT
  13. Lines: 64
  14.  
  15. >>>>> On Wed, 22 Jul 1992 16:45:44 GMT, ajg@controls.ccd.harris.com
  16. >>>>> (Arnold Goldberg) said:
  17.  
  18.  
  19.     Arnold> We here have a very large source tree.
  20.  
  21.     Arnold> What I'm looking for is a script or utility that will
  22.     Arnold> somehow tell me which #include files are not actually
  23.     Arnold> needed for a source file.
  24.  
  25.     Arnold> any takers???
  26.  
  27.  
  28.     Arnold> arnold
  29.  
  30. Arnold, sometime back I wrote a perl script that does what you want.
  31. Besides perl, it makes use of 2 public domain packages: 'mkmf' and
  32. 'mkid'.
  33.  
  34. mkmf is a program that figures out makefile dependencies.
  35.  
  36. mkid is, according to the man page:
  37.  
  38.  Mkid builds a database that stores numbers and identifier
  39.           names, as well as the names of the files in which they
  40.           occur.  Mkid is particularly useful with large programs
  41.           spread out across multiple source files.  It serves as an
  42.           aid for program maintenance and as a guide for perusing a
  43.           program.
  44.  
  45. The process works like this:
  46.  
  47. (1) You run mkmf to figure out the dependencies.  'mkmf' inserts
  48.     the /usr/include .h files dependencies in your makefile.
  49.  
  50. (2) Run mkid on all the source files, all the local include files, and
  51.     all the system includes - even system includes included by other
  52.     system includes (which mkmf figures out for you).  It is easy to
  53.     set up a target in your makefile to do this.
  54.  
  55. (3) Run the perl script on a C file.  It uses the 'fid' program
  56.     (included in the mkid package) to query the database for all the
  57.     identifiers that occur both in a include file and the C file.
  58.     If no identifiers occur in the include file that are used by the C
  59.     file, it reports that the include file is unused.  This process is
  60.     continued for all the include files that the C file uses.
  61.  
  62. If that doesn't scare you off, and you would still be interested in
  63. what I've done, send me some mail.  I'll post the perl script if there
  64. is enough interest.
  65.  
  66. davids
  67.  
  68. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  69. David Smith                davids@davids.b11.ingr.com (Internet)
  70. Intergraph Corporation             uunet!ingr!b11!davids!davids (UUCP)
  71. Huntsville, AL 35807            (205) 730-5752
  72. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  73. --
  74. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  75. David Smith                davids@davids.b11.ingr.com (Internet)
  76. Intergraph Corporation             uunet!ingr!b11!davids!davids (UUCP)
  77. Huntsville, AL 35807            (205) 730-5752
  78. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  79.