diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-04 19:42:04 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-04 19:42:04 +0000 |
commit | 62adb1fe3bb6c8175d557d5e74e1b63cb03d3623 (patch) | |
tree | b5fe0ea6f7acb88432c113e0e8949eba769d06b3 /gcc/mkdeps.h | |
parent | 85b5244c3c06d63def55f498b9de8f76f938f390 (diff) | |
download | gcc-62adb1fe3bb6c8175d557d5e74e1b63cb03d3623.tar.gz |
* mkdeps.c, mkdeps.h: New files.
* po/POTFILES.in: Add them.
* Makefile.in (LIBCPP_OBJS): Add mkdeps.o.
(cpplib.o, cppinit.o): Depend on mkdeps.h.
(mkdeps.o): New target.
* cppfiles.c: Delete deps_output.
* cppinit.c: Include mkdeps.h. Delete known_suffixes,
OBJECT_SUFFIX, and base_name.
(cpp_cleanup): Use deps_free. Free ihash->name when clearing
the include hash.
(initialize_dependency_output): Use deps_init,
deps_add_target, deps_calc_target, and deps_add_dep. Remove
all the unnecessary string bashing.
(cpp_finish): Use deps_write. Remove an unnecessary nesting
level.
* cpplib.c (do_include): Use deps_add_dep.
* cpplib.h (struct cpp_reader): Replace deps_buffer,
deps_allocated_size, deps_size, deps_column members with
single pointer to a struct deps. Delete prototype of
deps_output.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32329 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/mkdeps.h')
-rw-r--r-- | gcc/mkdeps.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/gcc/mkdeps.h b/gcc/mkdeps.h new file mode 100644 index 00000000000..7a2c130af8a --- /dev/null +++ b/gcc/mkdeps.h @@ -0,0 +1,72 @@ +/* Dependency generator for Makefile fragments. + Copyright (C) 2000 Free Software Foundation, Inc. + Contributed by Zack Weinberg, Mar 2000 + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + +#ifndef __GCC_MKDEPS__ +#define __GCC_MKDEPS__ + +/* This is the data structure used by all the functions in mkdeps.c. + It's quite straightforward, but should be treated as opaque. */ + +struct deps +{ + const char **targetv; + unsigned int ntargets; /* number of slots actually occupied */ + unsigned int targets_size; /* amt of allocated space - in words */ + + const char **depv; + unsigned int ndeps; + unsigned int deps_size; +}; + +/* Create a deps buffer. */ +extern struct deps *deps_init PARAMS ((void)); + +/* Destroy a deps buffer. */ +extern void deps_free PARAMS ((struct deps *)); + +/* Add a target (appears on left side of the colon) to the deps list. */ +extern void deps_add_target PARAMS ((struct deps *, const char *)); + +/* Given the name of the primary source file, calculate and add the + name of the target. This is done by locating and stripping the + file extension (if any) and adding .o (OBJECT_SUFFIX). In addition, + any directory components of the path are discarded. */ +extern void deps_calc_target PARAMS ((struct deps *, const char *)); + +/* Add a dependency (appears on the right side of the colon) to the + deps list. Dependencies will be printed in the order that they + were entered with this function. By convention, the first + dependency entered should be the primary source file. */ +extern void deps_add_dep PARAMS ((struct deps *, const char *)); + +/* Write out a deps buffer to a specified file. The third argument + is the number of columns to word-wrap at (0 means don't wrap). */ +extern void deps_write PARAMS ((const struct deps *, FILE *, + unsigned int)); + +/* For each dependency *except the first*, emit a dummy rule for that + file, causing it to depend on nothing. This is used to work around + the intermediate-file deletion misfeature in Make, in some + automatic dependency schemes. */ +extern void deps_dummy_targets PARAMS ((const struct deps *, FILE *)); + +#endif |