]> git.ipfire.org Git - thirdparty/gcc.git/blame - libcpp/include/mkdeps.h
Update copyright years.
[thirdparty/gcc.git] / libcpp / include / mkdeps.h
CommitLineData
49e6c08e 1/* Dependency generator for Makefile fragments.
99dee823 2 Copyright (C) 2000-2021 Free Software Foundation, Inc.
49e6c08e
ZW
3 Contributed by Zack Weinberg, Mar 2000
4
5This program is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
748086b7 7Free Software Foundation; either version 3, or (at your option) any
49e6c08e
ZW
8later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
748086b7
JJ
16along with this program; see the file COPYING3. If not see
17<http://www.gnu.org/licenses/>.
49e6c08e
ZW
18
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding! */
22
4f4e53dd
PB
23#ifndef LIBCPP_MKDEPS_H
24#define LIBCPP_MKDEPS_H
49e6c08e 25
918e8b10
NS
26#include "cpplib.h"
27
49e6c08e
ZW
28/* This is the data structure used by all the functions in mkdeps.c.
29 It's quite straightforward, but should be treated as opaque. */
30
99b1c316 31class mkdeps;
49e6c08e
ZW
32
33/* Create a deps buffer. */
99b1c316 34extern class mkdeps *deps_init (void);
49e6c08e
ZW
35
36/* Destroy a deps buffer. */
99b1c316 37extern void deps_free (class mkdeps *);
49e6c08e 38
c6e83800
ZW
39/* Add a set of "vpath" directories. The second argument is a colon-
40 separated list of pathnames, like you would set Make's VPATH
41 variable to. If a dependency or target name begins with any of
42 these pathnames (and the next path element is not "..") that
43 pathname is stripped off. */
99b1c316 44extern void deps_add_vpath (class mkdeps *, const char *);
c6e83800 45
a5a4ce3c
NB
46/* Add a target (appears on left side of the colon) to the deps list. Takes
47 a boolean indicating whether to quote the target for MAKE. */
99b1c316 48extern void deps_add_target (class mkdeps *, const char *, int);
49e6c08e 49
03b9ab42 50/* Sets the default target if none has been given already. An empty
48c4721e 51 string as the default target is interpreted as stdin. */
99b1c316 52extern void deps_add_default_target (class mkdeps *, const char *);
49e6c08e 53
db87f19a
NS
54/* Adds a module target. The module name and cmi name are copied. */
55extern void deps_add_module_target (struct mkdeps *, const char *module,
56 const char *cmi, bool is_header);
57
58/* Adds a module dependency. The module name is copied. */
59extern void deps_add_module_dep (struct mkdeps *, const char *module);
60
49e6c08e
ZW
61/* Add a dependency (appears on the right side of the colon) to the
62 deps list. Dependencies will be printed in the order that they
63 were entered with this function. By convention, the first
64 dependency entered should be the primary source file. */
99b1c316 65extern void deps_add_dep (class mkdeps *, const char *);
49e6c08e 66
918e8b10 67/* Write out a deps buffer to a specified file. The last argument
49e6c08e 68 is the number of columns to word-wrap at (0 means don't wrap). */
918e8b10 69extern void deps_write (const cpp_reader *, FILE *, unsigned int);
49e6c08e 70
17211ab5
GK
71/* Write out a deps buffer to a file, in a form that can be read back
72 with deps_restore. Returns nonzero on error, in which case the
73 error number will be in errno. */
99b1c316 74extern int deps_save (class mkdeps *, FILE *);
17211ab5
GK
75
76/* Read back dependency information written with deps_save into
77 the deps buffer. The third argument may be NULL, in which case
78 the dependency information is just skipped, or it may be a filename,
79 in which case that filename is skipped. */
99b1c316 80extern int deps_restore (class mkdeps *, FILE *, const char *);
17211ab5 81
4f4e53dd 82#endif /* ! LIBCPP_MKDEPS_H */