mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
/* Dependency generator for Makefile fragments.
|
2009-04-09 17:00:19 +02:00
|
|
|
Copyright (C) 2000, 2001, 2003, 2009 Free Software Foundation, Inc.
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
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
|
2009-04-09 17:00:19 +02:00
|
|
|
Free Software Foundation; either version 3, or (at your option) any
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
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
|
2009-04-09 17:00:19 +02:00
|
|
|
along with this program; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>.
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
|
|
|
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! */
|
|
|
|
|
2004-05-24 12:50:45 +02:00
|
|
|
#ifndef LIBCPP_MKDEPS_H
|
|
|
|
#define LIBCPP_MKDEPS_H
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
|
|
|
/* This is the data structure used by all the functions in mkdeps.c.
|
|
|
|
It's quite straightforward, but should be treated as opaque. */
|
|
|
|
|
2001-01-04 11:25:55 +01:00
|
|
|
struct deps;
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
|
|
|
/* Create a deps buffer. */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern struct deps *deps_init (void);
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
|
|
|
/* Destroy a deps buffer. */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern void deps_free (struct deps *);
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
2004-06-05 22:58:06 +02:00
|
|
|
/* Add a set of "vpath" directories. The second argument is a colon-
|
|
|
|
separated list of pathnames, like you would set Make's VPATH
|
|
|
|
variable to. If a dependency or target name begins with any of
|
|
|
|
these pathnames (and the next path element is not "..") that
|
|
|
|
pathname is stripped off. */
|
|
|
|
extern void deps_add_vpath (struct deps *, const char *);
|
|
|
|
|
2001-01-05 08:50:24 +01:00
|
|
|
/* Add a target (appears on left side of the colon) to the deps list. Takes
|
|
|
|
a boolean indicating whether to quote the target for MAKE. */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern void deps_add_target (struct deps *, const char *, int);
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
2001-01-04 11:25:55 +01:00
|
|
|
/* Sets the default target if none has been given already. An empty
|
2003-06-25 23:01:10 +02:00
|
|
|
string as the default target is interpreted as stdin. */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern void deps_add_default_target (struct deps *, const char *);
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
|
|
|
/* 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. */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern void deps_add_dep (struct deps *, const char *);
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
|
|
|
/* 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). */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern void deps_write (const struct deps *, FILE *, unsigned int);
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
/* Write out a deps buffer to a file, in a form that can be read back
|
|
|
|
with deps_restore. Returns nonzero on error, in which case the
|
|
|
|
error number will be in errno. */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern int deps_save (struct deps *, FILE *);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
/* Read back dependency information written with deps_save into
|
|
|
|
the deps buffer. The third argument may be NULL, in which case
|
|
|
|
the dependency information is just skipped, or it may be a filename,
|
|
|
|
in which case that filename is skipped. */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern int deps_restore (struct deps *, FILE *, const char *);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
/* 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. */
|
2003-07-06 11:56:09 +02:00
|
|
|
extern void deps_phony_targets (const struct deps *, FILE *);
|
mkdeps.c, mkdeps.h: New files.
* 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.
From-SVN: r32329
2000-03-04 20:42:04 +01:00
|
|
|
|
2004-05-24 12:50:45 +02:00
|
|
|
#endif /* ! LIBCPP_MKDEPS_H */
|