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