]>
Commit | Line | Data |
---|---|---|
26be549a | 1 | /* genmddeps.c - creates a makefile dependency fragment for the md file. |
7adcbafe | 2 | Copyright (C) 2004-2022 Free Software Foundation, Inc. |
26be549a | 3 | |
9dcd6f09 NC |
4 | This program is free software; you can redistribute it and/or modify it |
5 | under the terms of the GNU General Public License as published by the | |
6 | Free Software Foundation; either version 3, or (at your option) any | |
7 | later version. | |
26be549a | 8 | |
9dcd6f09 NC |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
26be549a | 13 | |
9dcd6f09 NC |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program; see the file COPYING3. If not see | |
16 | <http://www.gnu.org/licenses/>. */ | |
26be549a RH |
17 | |
18 | #include "bconfig.h" | |
19 | #include "system.h" | |
20 | #include "coretypes.h" | |
26be549a | 21 | #include "errors.h" |
b78027d1 DM |
22 | #include "statistics.h" |
23 | #include "vec.h" | |
600ab3fc | 24 | #include "read-md.h" |
26be549a RH |
25 | |
26 | ||
27 | struct filedep | |
28 | { | |
29 | struct filedep *next; | |
30 | const char *pathname; | |
31 | }; | |
32 | ||
33 | static struct filedep *deps, **last = &deps; | |
34 | ||
35 | static void | |
36 | add_filedep (const char *pathname) | |
37 | { | |
38 | struct filedep *n = XNEW (struct filedep); | |
39 | n->pathname = pathname; | |
40 | *last = n; | |
41 | last = &n->next; | |
42 | } | |
43 | ||
44 | int | |
66b0fe8f | 45 | main (int argc, const char **argv) |
26be549a RH |
46 | { |
47 | struct filedep *d; | |
48 | ||
49 | progname = "genmddeps"; | |
50 | include_callback = add_filedep; | |
b8698a0f | 51 | |
812b1403 DM |
52 | noop_reader reader; |
53 | if (!reader.read_md_files (argc, argv, NULL)) | |
9b68b6ea | 54 | return FATAL_EXIT_CODE; |
26be549a RH |
55 | |
56 | *last = NULL; | |
57 | ||
58 | /* Output a variable containing all of the include files. */ | |
59 | fputs ("MD_INCLUDES =", stdout); | |
60 | for (d = deps; d ; d = d->next) | |
61 | printf (" \\\n\t%s", d->pathname); | |
62 | putchar ('\n'); | |
63 | ||
64 | /* Output make targets for these includes with empty actions. This | |
65 | will guard against make errors when includes are removed. */ | |
66 | for (d = deps; d ; d = d->next) | |
67 | printf ("\n%s:\n", d->pathname); | |
68 | ||
69 | fflush (stdout); | |
70 | return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); | |
71 | } |