Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / config / xml / dictionary.xsl
1 <?xml version="1.0" encoding="ISO-8859-15" ?>
2
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4  
5   <xsl:template match="/" mode="dictionaries">
6
7     <xsl:text>&#10;#&#10;# dictionary rules&#10;#&#10;&#10;</xsl:text>
8   
9     <!-- Set all dictionary source lists empty -->
10     <xsl:for-each select="//dictionary">
11      <xsl:sort select="@name"/>
12     
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"/>
18        </xsl:call-template>
19       </xsl:for-each>
20      </xsl:variable>
21      
22     <xsl:if test="$conditions = 0">
23      
24      <xsl:if test="not(preceding::dictionary/@name = @name)">
25       <xsl:value-of select="@name"/>
26       <xsl:text>-DICTIONARY :=&#10;</xsl:text>
27      </xsl:if>
28      </xsl:if>
29     </xsl:for-each>
30     
31     <!-- Add all forth source files to their dictionaries -->
32     <xsl:for-each select="//dictionary/object">
33     
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"/>
38        </xsl:call-template>
39       </xsl:for-each>
40      </xsl:variable>
41  
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"/>
47        </xsl:call-template>
48       </xsl:for-each>
49      </xsl:variable>
50  
51      <xsl:variable name="dictname">
52       <xsl:value-of select="parent::*/@name"/>
53      </xsl:variable>
54
55      <xsl:if test="$conditions=0">
56
57       <xsl:variable name="source"><xsl:value-of select="@source" /></xsl:variable>
58
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>
63
64        <xsl:value-of select="$path"/>
65        <xsl:value-of select="$source"/>
66        <xsl:text>&#10;</xsl:text>
67       </xsl:if>
68
69      </xsl:if>
70     </xsl:for-each>
71     
72     <xsl:text>&#10;&#10;</xsl:text>
73
74     <!-- Create targets for all dictionaries -->
75     <xsl:for-each select="//dictionary">
76     <xsl:sort select="@name"/>
77
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"/>
83        </xsl:call-template>
84       </xsl:for-each>
85      </xsl:variable>
86      
87     <xsl:if test="$outer-conditions = 0">
88     
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()]"/>
93      </xsl:variable>
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>
101      </xsl:if>
102
103      <!-- Check for Fcode dependency -->
104      <xsl:for-each select="object[@target = 'fcode']">
105
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"/>
111         </xsl:call-template>
112        </xsl:for-each>
113       </xsl:variable>
114
115       <xsl:if test="$conditions = 0">
116
117        <xsl:text> $(ODIR)/</xsl:text>
118        <xsl:value-of select="@source"/>
119
120       </xsl:if>
121      </xsl:for-each>
122
123      <xsl:text>&#10;</xsl:text>
124      <!-- rule -->
125      <xsl:text>&#9;$(call quiet-command,$(ODIR)/forthstrap</xsl:text>
126      <xsl:for-each select="//dictionary[@name = @name]">
127  
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"/>
133         </xsl:call-template>
134        </xsl:for-each>
135       </xsl:variable>
136      
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"/>
141         </xsl:call-template>
142        </xsl:for-each>
143       </xsl:variable>
144       
145       <xsl:if test="$conditions = 0">
146        <xsl:text> -I</xsl:text>
147        <xsl:text>$(SRCDIR)/</xsl:text>
148        <xsl:value-of select="$path"/>
149       </xsl:if>
150      </xsl:for-each>
151
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>
156      
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>
161      </xsl:if>
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)$@")&#10;&#10;</xsl:text>
166     </xsl:if>
167     </xsl:if>
168     </xsl:for-each>
169    
170     <!-- Create dictionaries target containing all dictionaries -->
171     <xsl:text>dictionaries: </xsl:text>
172     <xsl:for-each select="//dictionary">
173     <xsl:sort select="@name"/>
174     
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"/>
180        </xsl:call-template>
181       </xsl:for-each>
182      </xsl:variable>
183      
184     <xsl:if test="$conditions = 0">
185     
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>
189     </xsl:if>
190     </xsl:if>
191     </xsl:for-each>
192     <xsl:text>&#10;</xsl:text>
193   </xsl:template>
194   
195 </xsl:stylesheet>