j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: Sun Jan 2 10:56:19 2011 New Revision: 1013 URL: http://tracker.coreboot.org/trac/openbios/changeset/1013
Log: Generate Makefile dependencies also from Forth files
Dependencies between Forth files were not detected, so dictionaries were not regenerated automatically in some cases.
Introduce '-M' flag to forthstrap to dump dependency information in Makefile compatible format, based on the Forth 'include' directives.
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/Makefile.target trunk/openbios-devel/config/xml/dictionary.xsl trunk/openbios-devel/kernel/bootstrap.c
Modified: trunk/openbios-devel/Makefile.target ============================================================================== --- trunk/openbios-devel/Makefile.target Sun Jan 2 02:32:17 2011 (r1012) +++ trunk/openbios-devel/Makefile.target Sun Jan 2 10:56:19 2011 (r1013) @@ -77,4 +77,4 @@ include rules.mak
# Include automatically generated dependency files --include $(wildcard $(ODIR)/host/kernel/*.d $(ODIR)/target/*/*.d $(ODIR)/target/*/*/*.d $(ODIR)/target/*/*/*/*.d) +-include $(wildcard $(ODIR)/*.d $(ODIR)/host/kernel/*.d $(ODIR)/target/*/*.d $(ODIR)/target/*/*/*.d $(ODIR)/target/*/*/*/*.d)
Modified: trunk/openbios-devel/config/xml/dictionary.xsl ============================================================================== --- trunk/openbios-devel/config/xml/dictionary.xsl Sun Jan 2 02:32:17 2011 (r1012) +++ trunk/openbios-devel/config/xml/dictionary.xsl Sun Jan 2 10:56:19 2011 (r1013) @@ -126,6 +126,7 @@ xsl:text -I$(ODIR)/forth</xsl:text>
xsl:text -D $@</xsl:text> + xsl:text -M $@.d</xsl:text> <xsl:if test="$init!=''"> xsl:text -d $(ODIR)/</xsl:text><xsl:value-of select="$init"/>xsl:text.dict</xsl:text> </xsl:if>
Modified: trunk/openbios-devel/kernel/bootstrap.c ============================================================================== --- trunk/openbios-devel/kernel/bootstrap.c Sun Jan 2 02:32:17 2011 (r1012) +++ trunk/openbios-devel/kernel/bootstrap.c Sun Jan 2 10:56:19 2011 (r1013) @@ -69,6 +69,7 @@ };
static include includes = { ".", NULL }; +static FILE *depfile;
static ucell * relocation_address=NULL; static int relocation_length=0; @@ -465,6 +466,10 @@ srclines [ cursrc ] = 1; srcfiles [ cursrc++ ] = ret;
+ if (depfile) { + fprintf(depfile, " %s", fullpath); + } + return ret; }
@@ -1025,7 +1030,9 @@ " write to output.dict\n" \ " -c|--console output.log\n" \ " write kernel console output to log file\n" \ - " -s|--segfault install segfault handler\n\n" + " -s|--segfault install segfault handler\n" \ + " -M|--dependency-dump file\n" \ + " dump dependencies in Makefile format\n\n" #else #define USAGE "Usage: %s [options] [dictionary file|source file]\n\n" \ " -h show this help\n" \ @@ -1039,7 +1046,7 @@ " -c output.log\n" \ " write kernel console output to log file\n" \ " -s install segfault handler\n\n" - + " -M file dump dependencies in Makefile format\n\n" #endif
int main(int argc, char *argv[]) @@ -1050,11 +1057,12 @@ char *dictname = NULL; char *basedict = NULL; char *consolefile = NULL; + char *depfilename = NULL;
unsigned char *bootstrapdict[2]; int c, cnt;
- const char *optstring = "VvhsI:d:D:c:?"; + const char *optstring = "VvhsI:d:D:c:M:?";
while (1) { #ifdef __GLIBC__ @@ -1068,6 +1076,7 @@ {"source-dictionary", 1, NULL, 'd'}, {"target-dictionary", 1, NULL, 'D'}, {"console", 1, NULL, 'c'}, + {"dependency-dump", 1, NULL, 'M'}, };
/* @@ -1118,6 +1127,11 @@ consolefile = optarg; } break; + case 'M': + if (!depfilename) { + depfilename = optarg; + } + break; default: return 1; } @@ -1127,6 +1141,7 @@ printk(BANNER); printk("Using source dictionary '%s'\n", basedict); printk("Dumping final dictionary to '%s'\n", dictname); + printk("Dumping dependencies to '%s'\n", depfilename); }
if (argc < optind + 1) { @@ -1134,6 +1149,15 @@ return 1; }
+ if (depfilename) { + depfile = fopen(depfilename, "w"); + if (!depfile) { + printk("panic: can't write to dependency file '%s'.\n", + depfilename); + exit(1); + } + fprintf(depfile, "%s:", dictname); + }
/* * Get all required resources @@ -1203,6 +1227,11 @@
run_dictionary(basedict, consolefile); } + if (depfile) { + fprintf(depfile, "\n"); + fclose(depfile); + depfile = NULL; + } if(errors) break; }