This commit was generated by cvs2svn to compensate for changes in r1365,
[chise/xemacs-chise.git.1] / lib-src / process-depends.sh
1 ## Process the output of makedepend.
2 ## Copyright (c) 1994 Amdahl Corporation.
3 ## Written by Ben Wing, December 1994.
4
5 ## This file is used as part of 'make depend', to produce the
6 ## dependency list for src/Makefile.in.in.
7
8 ## Unfortunately, makedepend (at least the one that comes as part
9 ## of Open Windows under Solaris) is stupid and doesn't follow the
10 ## documented behavior.  So we have to force the definitions of
11 ## certain options through -D flags (even though it's supposed to
12 ## pick this up), and post-process the output to get rid of stuff
13 ## we don't want.
14
15 ## The sed stage gets rid of include files in other directories,
16 ## except for lwlib.h (makedepend puts system include files in,
17 ## which is pretty stupid).  We also get rid of some standard
18 ## include files that are in every or pretty much every file
19 ## and where changes in those files don't usually merit
20 ## recompilation of everything.  Finally, we eliminate entirely
21 ## the dependencies for some files (such as unex*.c) that get
22 ## screwed up by makedepend.  We just put those in by hand at
23 ## the top of the dependency list.
24
25 ## For Mule, we need to do some additional processing: conversion
26 ## to MULESRCDIR (at least so that the include files don't get
27 ## wiped out by the next stage) and removing the mule/ prefix
28 ## from the object file names.
29
30 ## The awk stage puts one dependency per line.  Then we pass
31 ## the result through sort and uniq (makedepend is supposed
32 ## to not put in duplicate dependencies, but it does so
33 ## occasionally).
34
35 ## After running 'make depend', verify that the output (in
36 ## depend.out) is reasonable and then replace the stuff in
37 ## Makefile.in.in marked "generated by 'make depend'".
38
39 sed -e '
40 1d
41 s/ \/[^ ]*\/lwlib\// $(LWLIBSRCDIR)\//g
42 s/\.\.\/etc\//${srcdir}\/${etcdir}/g
43 s/^mule\///g
44 s/ mule\// $(MULESRCDIR)\/mule\//g
45 s/ \/[^ ]*\.h//g
46 s/ \/[^ ]*gray//g
47 s/ [a-z][^ ]*\/[^ ]*\.h//g
48 s/ lisp\.h//g
49 s/ lisp-union\.h//g
50 s/ lisp-disunion\.h//g
51 s/ lrecord\.h//g
52 s/ emacsfns\.h//g
53 s/ symeval\.h//g
54 s/ symsinit\.h//g
55 s/ syssignal\.h//g
56 s/ intl\.h//g
57 s/ tt_c\.h//g
58 s/ descrip\.h//g
59 /^unex/d
60 /^sgiplay/d
61 /^Extern/d
62 /^extw/d
63 /^[^ ]*\.o:$/d
64 ' | awk '
65 { for (i = 2; i <= NF; i++)
66   printf ("%s %s\n", $1, $i)
67 }
68 ' | sort | uniq