1 /* Functions for handling dependency tracking when reading .class files.
3 Copyright (C) 1998-2014 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 3, 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 COPYING3. If not see
19 <http://www.gnu.org/licenses/>.
21 Java and all Java-based marks are trademarks or registered trademarks
22 of Sun Microsystems, Inc. in the United States and other countries.
23 The Free Software Foundation is independent of Sun Microsystems, Inc. */
25 /* Written by Tom Tromey <tromey@cygnus.com>, October 1998. */
29 #include "coretypes.h"
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 (void)
59 if (dep_out
!= stdout
)
64 if (dependencies
!= NULL
)
66 deps_free (dependencies
);
72 jcf_dependency_set_target (const char *name
)
74 /* We just handle this the same as an `add_target'. */
75 if (dependencies
!= NULL
&& name
!= NULL
)
76 deps_add_target (dependencies
, name
, 1);
80 jcf_dependency_add_target (const char *name
)
82 if (dependencies
!= NULL
)
83 deps_add_target (dependencies
, name
, 1);
87 jcf_dependency_set_dep_file (const char *name
)
89 gcc_assert (dep_out
!= stdout
);
92 if (! strcmp (name
, "-"))
95 dep_out
= fopen (name
, "w");
99 jcf_dependency_add_file (const char *filename ATTRIBUTE_UNUSED
, int system_p
)
104 /* Just omit system files. */
105 if (system_p
&& ! system_files
)
109 /* FIXME: Don't emit any dependencies. In many cases we'll just see
110 temporary files emitted by ecj... */
111 /* deps_add_dep (dependencies, filename); */
115 jcf_dependency_init (int system_p
)
117 gcc_assert (! dependencies
);
118 system_files
= system_p
;
119 dependencies
= deps_init ();
123 jcf_dependency_print_dummies (void)
129 jcf_dependency_write (void)
134 gcc_assert (dependencies
);
136 deps_write (dependencies
, dep_out
, 72);
138 deps_phony_targets (dependencies
, dep_out
);