00001 /* genmddeps.c - creates a makefile dependency fragment for the md file. 00002 Copyright (C) 2004 Free Software Foundation, Inc. 00003 00004 This program is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU General Public License as published by the 00006 Free Software Foundation; either version 2, or (at your option) any 00007 later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 00017 00018 #include "bconfig.h" 00019 #include "system.h" 00020 #include "coretypes.h" 00021 #include "tm.h" 00022 #include "rtl.h" 00023 #include "gensupport.h" 00024 #include "errors.h" 00025 00026 00027 struct filedep 00028 { 00029 struct filedep *next; 00030 const char *pathname; 00031 }; 00032 00033 static struct filedep *deps, **last = &deps; 00034 00035 static void 00036 add_filedep (const char *pathname) 00037 { 00038 struct filedep *n = XNEW (struct filedep); 00039 n->pathname = pathname; 00040 *last = n; 00041 last = &n->next; 00042 } 00043 00044 int 00045 main (int argc, char **argv) 00046 { 00047 struct filedep *d; 00048 00049 progname = "genmddeps"; 00050 include_callback = add_filedep; 00051 00052 if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE) 00053 return (FATAL_EXIT_CODE); 00054 00055 *last = NULL; 00056 00057 /* Output a variable containing all of the include files. */ 00058 fputs ("MD_INCLUDES =", stdout); 00059 for (d = deps; d ; d = d->next) 00060 printf (" \\\n\t%s", d->pathname); 00061 putchar ('\n'); 00062 00063 /* Output make targets for these includes with empty actions. This 00064 will guard against make errors when includes are removed. */ 00065 for (d = deps; d ; d = d->next) 00066 printf ("\n%s:\n", d->pathname); 00067 00068 fflush (stdout); 00069 return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); 00070 }
1.5.6