|
|
1.1 root 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> # # dictionary rules # </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 := </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: <xsl:value-of select="$dictname"/><xsl:text>-DICTIONARY:=$(</xsl:text>
57: <xsl:value-of select="$dictname"/><xsl:text>-DICTIONARY) </xsl:text>
58:
59: <xsl:text>$(SRCDIR)/</xsl:text>
60: <xsl:value-of select="$path"/>
61: <xsl:value-of select="@source"/>
62: <xsl:text> </xsl:text>
63: </xsl:if>
64: </xsl:for-each>
65:
66: <xsl:text> </xsl:text>
67:
68: <!-- Create targets for all dictionaries -->
69: <xsl:for-each select="//dictionary">
70: <xsl:sort select="@name"/>
71:
72: <xsl:variable name="outer-conditions">
73: <xsl:text>0</xsl:text>
74: <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
75: <xsl:call-template name="resolve-condition">
76: <xsl:with-param select="@condition" name="expression"/>
77: </xsl:call-template>
78: </xsl:for-each>
79: </xsl:variable>
80:
81: <xsl:if test="$outer-conditions = 0">
82:
83: <xsl:if test="not(preceding::dictionary/@name = @name)">
84: <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
85: <xsl:variable name="init">
86: <xsl:value-of select="(//dictionary[@name=$name]/attribute::init)[last()]"/>
87: </xsl:variable>
88: <!-- dictionary name and dependencies -->
89: <xsl:text>$(ODIR)/</xsl:text>
90: <xsl:value-of select="@name"/><xsl:text>.dict: $(</xsl:text>
91: <xsl:value-of select="@name"/>
92: <xsl:text>-DICTIONARY) $(ODIR)/forthstrap</xsl:text>
93: <xsl:if test="$init!=''">
94: <xsl:text> $(ODIR)/</xsl:text><xsl:value-of select="$init"/><xsl:text>.dict</xsl:text>
95: </xsl:if>
96: <xsl:text> </xsl:text>
97: <!-- rule -->
98: <xsl:text>	$(call quiet-command,$(ODIR)/forthstrap</xsl:text>
99: <xsl:for-each select="//dictionary[@name = @name]">
100:
101: <xsl:variable name="conditions">
102: <xsl:text>0</xsl:text>
103: <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
104: <xsl:call-template name="resolve-condition">
105: <xsl:with-param select="@condition" name="expression"/>
106: </xsl:call-template>
107: </xsl:for-each>
108: </xsl:variable>
109:
110: <xsl:variable name="path">
111: <xsl:for-each select="ancestor::build">
112: <xsl:call-template name="get-dirname">
113: <xsl:with-param select="@base" name="path"/>
114: </xsl:call-template>
115: </xsl:for-each>
116: </xsl:variable>
117:
118: <xsl:if test="$conditions = 0">
119: <xsl:text> -I</xsl:text>
120: <xsl:text>$(SRCDIR)/</xsl:text>
121: <xsl:value-of select="$path"/>
122: </xsl:if>
123: </xsl:for-each>
124:
125: <!-- needed to include config and build date -->
126: <xsl:text> -I$(ODIR)/forth</xsl:text>
127:
128: <xsl:text> -D $@</xsl:text>
129: <xsl:text> -M [email protected]</xsl:text>
130: <xsl:if test="$init!=''">
131: <xsl:text> -d $(ODIR)/</xsl:text><xsl:value-of select="$init"/><xsl:text>.dict</xsl:text>
132: </xsl:if>
133: <xsl:text> -c [email protected]</xsl:text>
134: <xsl:text> $(</xsl:text>
135: <xsl:value-of select="@name"/>
136: <xsl:text>-DICTIONARY)," GEN $(TARGET_DIR)$@") </xsl:text>
137: </xsl:if>
138: </xsl:if>
139: </xsl:for-each>
140:
141: <!-- Create dictionaries target containing all dictionaries -->
142: <xsl:text>dictionaries: </xsl:text>
143: <xsl:for-each select="//dictionary">
144: <xsl:sort select="@name"/>
145:
146: <xsl:variable name="conditions">
147: <xsl:text>0</xsl:text>
148: <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
149: <xsl:call-template name="resolve-condition">
150: <xsl:with-param select="@condition" name="expression"/>
151: </xsl:call-template>
152: </xsl:for-each>
153: </xsl:variable>
154:
155: <xsl:if test="$conditions = 0">
156:
157: <xsl:if test="not(preceding::dictionary/@name = @name)">
158: <xsl:text>$(ODIR)/</xsl:text>
159: <xsl:value-of select="@name"/><xsl:text>.dict </xsl:text>
160: </xsl:if>
161: </xsl:if>
162: </xsl:for-each>
163: <xsl:text> </xsl:text>
164: </xsl:template>
165:
166: </xsl:stylesheet>
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.