1 /* Functions for handling dependency tracking when reading .class files.
3 Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
22 Java and all Java-based marks are trademarks or registered trademarks
23 of Sun Microsystems, Inc. in the United States and other countries.
24 The Free Software Foundation is independent of Sun Microsystems, Inc. */
26 /* Written by Tom Tromey <tromey@cygnus.com>, October 1998. */
30 #include "coretypes.h"
40 /* The dependency structure used for this invocation. */
41 struct deps
*dependencies
;
43 /* The output file, or NULL if we aren't doing dependency tracking. */
44 static FILE *dep_out
= NULL
;
46 /* Nonzero if system files should be added. */
47 static int system_files
;
49 /* Nonzero if we are dumping out dummy dependencies. */
50 static int print_dummies
;
54 /* Call this to reset the dependency module. This is required if
55 multiple dependency files are being generated from a single tool
56 invocation. FIXME: we should change our API or just completely use
57 the one in mkdeps.h. */
59 jcf_dependency_reset (void)
63 if (dep_out
!= stdout
)
68 if (dependencies
!= NULL
)
70 deps_free (dependencies
);
76 jcf_dependency_set_target (const char *name
)
78 /* We just handle this the same as an `add_target'. */
79 if (dependencies
!= NULL
&& name
!= NULL
)
80 deps_add_target (dependencies
, name
, 1);
84 jcf_dependency_add_target (const char *name
)
86 if (dependencies
!= NULL
)
87 deps_add_target (dependencies
, name
, 1);
91 jcf_dependency_set_dep_file (const char *name
)
93 assert (dep_out
!= stdout
);
96 if (! strcmp (name
, "-"))
99 dep_out
= fopen (name
, "w");
103 jcf_dependency_add_file (const char *filename
, int system_p
)
108 /* Just omit system files. */
109 if (system_p
&& ! system_files
)
112 deps_add_dep (dependencies
, filename
);
116 jcf_dependency_init (int system_p
)
118 assert (! dependencies
);
119 system_files
= system_p
;
120 dependencies
= deps_init ();
124 jcf_dependency_print_dummies (void)
130 jcf_dependency_write (void)
135 assert (dependencies
);
137 deps_write (dependencies
, dep_out
, 72);
139 deps_phony_targets (dependencies
, dep_out
);