1 <?xml version="1.0" encoding="ISO-8859-15" ?>
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
5 <xsl:template match="/" mode="dictionaries">
7 <xsl:text> # # dictionary rules # </xsl:text>
9 <!-- Set all dictionary source lists empty -->
10 <xsl:for-each select="//dictionary">
11 <xsl:sort select="@name"/>
13 <xsl:variable name="conditions">
14 <xsl:text>0</xsl:text>
15 <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
16 <xsl:call-template name="resolve-condition">
17 <xsl:with-param select="@condition" name="expression"/>
22 <xsl:if test="$conditions = 0">
24 <xsl:if test="not(preceding::dictionary/@name = @name)">
25 <xsl:value-of select="@name"/>
26 <xsl:text>-DICTIONARY := </xsl:text>
31 <!-- Add all forth source files to their dictionaries -->
32 <xsl:for-each select="//dictionary/object">
34 <xsl:variable name="path">
35 <xsl:for-each select="ancestor::build">
36 <xsl:call-template name="get-dirname">
37 <xsl:with-param select="@base" name="path"/>
42 <xsl:variable name="conditions">
43 <xsl:text>0</xsl:text>
44 <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
45 <xsl:call-template name="resolve-condition">
46 <xsl:with-param select="@condition" name="expression"/>
51 <xsl:variable name="dictname">
52 <xsl:value-of select="parent::*/@name"/>
55 <xsl:if test="$conditions=0">
57 <xsl:variable name="source"><xsl:value-of select="@source" /></xsl:variable>
59 <!-- Handle just Forth source, not FCode -->
60 <xsl:if test="not(@target = 'fcode')">
61 <xsl:value-of select="$dictname"/><xsl:text>-DICTIONARY:=$(</xsl:text>
62 <xsl:value-of select="$dictname"/><xsl:text>-DICTIONARY) </xsl:text>
64 <xsl:value-of select="$path"/>
65 <xsl:value-of select="$source"/>
66 <xsl:text> </xsl:text>
72 <xsl:text> </xsl:text>
74 <!-- Create targets for all dictionaries -->
75 <xsl:for-each select="//dictionary">
76 <xsl:sort select="@name"/>
78 <xsl:variable name="outer-conditions">
79 <xsl:text>0</xsl:text>
80 <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
81 <xsl:call-template name="resolve-condition">
82 <xsl:with-param select="@condition" name="expression"/>
87 <xsl:if test="$outer-conditions = 0">
89 <xsl:if test="not(preceding::dictionary/@name = @name)">
90 <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
91 <xsl:variable name="init">
92 <xsl:value-of select="(//dictionary[@name=$name]/attribute::init)[last()]"/>
94 <!-- dictionary name and dependencies -->
95 <xsl:text>$(ODIR)/</xsl:text>
96 <xsl:value-of select="@name"/><xsl:text>.dict: $(</xsl:text>
97 <xsl:value-of select="@name"/>
98 <xsl:text>-DICTIONARY) $(ODIR)/forthstrap</xsl:text>
99 <xsl:if test="$init!=''">
100 <xsl:text> $(ODIR)/</xsl:text><xsl:value-of select="$init"/><xsl:text>.dict</xsl:text>
103 <!-- Check for Fcode dependency -->
104 <xsl:for-each select="object[@target = 'fcode']">
106 <xsl:variable name="conditions">
107 <xsl:text>0</xsl:text>
108 <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
109 <xsl:call-template name="resolve-condition">
110 <xsl:with-param select="@condition" name="expression"/>
115 <xsl:if test="$conditions = 0">
117 <xsl:text> $(ODIR)/</xsl:text>
118 <xsl:value-of select="@source"/>
123 <xsl:text> </xsl:text>
125 <xsl:text>	$(call quiet-command,$(ODIR)/forthstrap</xsl:text>
126 <xsl:for-each select="//dictionary[@name = @name]">
128 <xsl:variable name="conditions">
129 <xsl:text>0</xsl:text>
130 <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
131 <xsl:call-template name="resolve-condition">
132 <xsl:with-param select="@condition" name="expression"/>
137 <xsl:variable name="path">
138 <xsl:for-each select="ancestor::build">
139 <xsl:call-template name="get-dirname">
140 <xsl:with-param select="@base" name="path"/>
145 <xsl:if test="$conditions = 0">
146 <xsl:text> -I</xsl:text>
147 <xsl:text>$(SRCDIR)/</xsl:text>
148 <xsl:value-of select="$path"/>
152 <!-- needed to locate files with full path -->
153 <xsl:text> -I$(SRCDIR)</xsl:text>
154 <!-- needed to include config and build date -->
155 <xsl:text> -I$(ODIR)/forth</xsl:text>
157 <xsl:text> -D $@</xsl:text>
158 <xsl:text> -M $@.d</xsl:text>
159 <xsl:if test="$init!=''">
160 <xsl:text> -d $(ODIR)/</xsl:text><xsl:value-of select="$init"/><xsl:text>.dict</xsl:text>
162 <xsl:text> -c $@-console.log</xsl:text>
163 <xsl:text> $(</xsl:text>
164 <xsl:value-of select="@name"/>
165 <xsl:text>-DICTIONARY)," GEN $(TARGET_DIR)$@") </xsl:text>
170 <!-- Create dictionaries target containing all dictionaries -->
171 <xsl:text>dictionaries: </xsl:text>
172 <xsl:for-each select="//dictionary">
173 <xsl:sort select="@name"/>
175 <xsl:variable name="conditions">
176 <xsl:text>0</xsl:text>
177 <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
178 <xsl:call-template name="resolve-condition">
179 <xsl:with-param select="@condition" name="expression"/>
184 <xsl:if test="$conditions = 0">
186 <xsl:if test="not(preceding::dictionary/@name = @name)">
187 <xsl:text>$(ODIR)/</xsl:text>
188 <xsl:value-of select="@name"/><xsl:text>.dict </xsl:text>
192 <xsl:text> </xsl:text>