1 /* Functions for handling dependency tracking when reading .class files.
3 Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNU CC; see the file COPYING. If not, write to
17 the Free Software Foundation, 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
20 Java and all Java-based marks are trademarks or registered trademarks
21 of Sun Microsystems, Inc. in the United States and other countries.
22 The Free Software Foundation is independent of Sun Microsystems, Inc. */
24 /* Written by Tom Tromey <tromey@cygnus.com>, October 1998. */
36 /* The dependency structure used for this invocation. */
37 struct deps *dependencies;
39 /* The output file, or NULL if we aren't doing dependency tracking. */
40 static FILE *dep_out = NULL;
42 /* Nonzero if system files should be added. */
43 static int system_files;
45 /* Nonzero if we are dumping out dummy dependencies. */
46 static int print_dummies;
50 /* Call this to reset the dependency module. This is required if
51 multiple dependency files are being generated from a single tool
52 invocation. FIXME: we should change our API or just completely use
53 the one in mkdeps.h. */
55 jcf_dependency_reset ()
59 if (dep_out != stdout)
64 if (dependencies != NULL)
66 deps_free (dependencies);
72 jcf_dependency_set_target (name)
75 /* We just handle this the same as an `add_target'. */
76 if (dependencies != NULL && name != NULL)
77 deps_add_target (dependencies, name);
81 jcf_dependency_add_target (name)
84 if (dependencies != NULL)
85 deps_add_target (dependencies, name);
89 jcf_dependency_set_dep_file (name)
92 assert (dep_out != stdout);
95 if (! strcmp (name, "-"))
98 dep_out = fopen (name, "w");
102 jcf_dependency_add_file (filename, system_p)
103 const char *filename;
109 /* Just omit system files. */
110 if (system_p && ! system_files)
113 deps_add_dep (dependencies, filename);
117 jcf_dependency_init (system_p)
120 assert (! dependencies);
121 system_files = system_p;
122 dependencies = deps_init ();
126 jcf_dependency_print_dummies ()
132 jcf_dependency_write ()
137 assert (dependencies);
139 deps_write (dependencies, dep_out, 72);
141 deps_dummy_targets (dependencies, dep_out);