]> git.proxmox.com Git - grub2.git/blob - gentpl.py
* Update ntldr-img from grub-extras:
[grub2.git] / gentpl.py
1 #! /usr/bin/python
2
3 #
4 # This is the python script used to generate Makefile.tpl
5 #
6
7 GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
8 "i386_multiboot", "i386_ieee1275", "x86_64_efi",
9 "mips_yeeloong", "sparc64_ieee1275",
10 "powerpc_ieee1275" ]
11
12 GROUPS = {}
13
14 GROUPS["common"] = GRUB_PLATFORMS[:]
15
16 # Groups based on CPU
17 GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
18 GROUPS["x86_64"] = [ "x86_64_efi" ]
19 GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"]
20 GROUPS["mips"] = [ "mips_yeeloong" ]
21 GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
22 GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
23
24 # Groups based on firmware
25 GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ]
26 GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
27
28 # emu is a special case so many core functionality isn't needed on this platform
29 GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
30
31 # Groups based on hardware features
32 GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_yeeloong"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
33 GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"]
34 GROUPS["usb"] = GROUPS["pci"]
35
36 # If gfxterm is main output console integrate it into kernel
37 GROUPS["videoinkernel"] = ["mips_yeeloong"]
38 GROUPS["videomodules"] = GRUB_PLATFORMS[:];
39 for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
40
41 # Similar for terminfo
42 GROUPS["terminfoinkernel"] = ["mips_yeeloong"] + GROUPS["ieee1275"];
43 GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
44 for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
45
46 # Miscelaneous groups schedulded to disappear in future
47 GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275")
48 GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
49 GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc")
50
51 #
52 # Create platform => groups reverse map, where groups covering that
53 # platform are ordered by their sizes
54 #
55 RMAP = {}
56 for platform in GRUB_PLATFORMS:
57 # initialize with platform itself as a group
58 RMAP[platform] = [ platform ]
59
60 for k in GROUPS.keys():
61 v = GROUPS[k]
62 # skip groups that don't cover this platform
63 if platform not in v: continue
64
65 bigger = []
66 smaller = []
67 # partition currently known groups based on their size
68 for group in RMAP[platform]:
69 if group in GRUB_PLATFORMS: smaller.append(group)
70 elif len(GROUPS[group]) < len(v): smaller.append(group)
71 else: bigger.append(group)
72 # insert in the middle
73 RMAP[platform] = smaller + [ k ] + bigger
74
75 #
76 # Global variables
77 #
78 GVARS = set()
79
80 def gvar_add(var, value):
81 GVARS.add(var)
82 return var + " += " + value + "\n"
83
84 def global_variable_initializers():
85 r = ""
86 for var in sorted(GVARS):
87 r += var + " ?= \n"
88 return r
89
90 #
91 # Per PROGRAM/SCRIPT variables
92 #
93
94 def vars_init(*var_list):
95 r = "[+ IF (if (not (assoc-ref seen-vars (get \".name\"))) \"seen\") +]"
96 r += "[+ (out-suspend \"v\") +]"
97 for var in var_list:
98 r += var + " = \n"
99 r += "[+ (out-resume \"v\") +]"
100 r += "[+ (set! seen-vars (assoc-set! seen-vars (get \".name\") 0)) +]"
101 r += "[+ ENDIF +]"
102 return first_time(r)
103
104 def var_set(var, value):
105 return var + " = " + value + "\n"
106
107 def var_add(var, value):
108 return var + " += " + value + "\n"
109
110 #
111 # Autogen constructs
112 #
113
114 def set_canonical_name_suffix(suffix): return "[+ % name `export cname=$(echo %s" + suffix + " | sed -e 's/[^0-9A-Za-z@_]/_/g')` +]"
115 def cname(): return "[+ % name `echo $cname` +]"
116
117 def rule(target, source, cmd):
118 if cmd[0] == "\n":
119 return "\n" + target + ": " + source + cmd.replace("\n", "\n\t") + "\n"
120 else:
121 return "\n" + target + ": " + source + "\n\t" + cmd.replace("\n", "\n\t") + "\n"
122
123 #
124 # Template for keys with platform names as values, for example:
125 #
126 # kernel = {
127 # nostrip = emu;
128 # ...
129 # }
130 #
131 def if_platform_tagged(platform, tag, snippet_if, snippet_else=None):
132 r = ""
133 r += "[+ IF " + tag + " defined +]"
134 r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]"
135 for group in RMAP[platform]:
136 r += "[+ = \"" + group + "\" +]" + snippet_if
137
138 if snippet_else != None: r += "[+ * +]" + snippet_else
139 r += "[+ ESAC +][+ ENDFOR +]"
140
141 if snippet_else == None:
142 r += "[+ ENDIF +]"
143 return r
144
145 r += "[+ ELSE +]" + snippet_else + "[+ ENDIF +]"
146 return r
147
148 #
149 # Template for tagged values
150 #
151 # module = {
152 # extra_dist = ...
153 # extra_dist = ...
154 # ...
155 # };
156 #
157 def foreach_value(tag, closure):
158 return "[+ FOR " + tag + " +]" + closure("[+ ." + tag + " +]") + "[+ ENDFOR +]"
159
160 #
161 # Template for handling best matched values for a platform, for example:
162 #
163 # module = {
164 # cflags = '-Wall';
165 # emu_cflags = '-Wall -DGRUB_EMU=1';
166 # ...
167 # }
168 #
169 def foreach_platform_specific_value(platform, suffix, nonetag, closure):
170 r = ""
171 for group in RMAP[platform]:
172 gtag = group + suffix
173
174 if group == RMAP[platform][0]:
175 r += "[+ IF " + gtag + " +]"
176 else:
177 r += "[+ ELIF " + gtag + " +]"
178
179 r += "[+ FOR " + gtag + " +]" + closure("[+ ." + gtag + " +]") + "[+ ENDFOR +]"
180 r += "[+ ELSE +][+ FOR " + nonetag + " +]" + closure("[+ ." + nonetag + " +]") + "[+ ENDFOR +][+ ENDIF +]"
181 return r
182
183 #
184 # Template for handling values from sum of all groups for a platform,
185 # for example:
186 #
187 # module = {
188 # common = kern/misc.c;
189 # emu = kern/emu/misc.c;
190 # ...
191 # }
192 #
193 def foreach_platform_value (platform, suffix, closure):
194 r = ""
195 for group in RMAP[platform]:
196 gtag = group + suffix
197
198 r += "[+ IF " + gtag + " +]"
199 r += "[+ FOR " + gtag + " +]" + closure("[+ ." + gtag + " +]") + "[+ ENDFOR +]"
200 r += "[+ ENDIF +]"
201 return r
202
203 #
204 # Template for gaurding with platform specific "enable" keys, for example:
205 #
206 # module = {
207 # name = pci;
208 # noemu = bus/pci.c;
209 # emu = bus/emu/pci.c;
210 # emu = commands/lspci.c;
211 #
212 # enable = emu;
213 # enable = i386_pc;
214 # enable = x86_efi;
215 # enable = i386_ieee1275;
216 # enable = i386_coreboot;
217 # };
218 #
219 def foreach_enabled_platform(closure):
220 r = "[+ IF - enable undefined +]"
221 for platform in GRUB_PLATFORMS:
222 r += "\nif COND_" + platform + "\n" + closure(platform) + "endif\n"
223 r += "[+ ELSE +]"
224 for platform in GRUB_PLATFORMS:
225 x = "\nif COND_" + platform + "\n" + closure(platform) + "endif\n"
226 r += if_platform_tagged(platform, "enable", x)
227 r += "[+ ENDIF +]"
228 return r
229
230 #
231 # Template for gaurding with platform specific automake conditionals,
232 # for example:
233 #
234 # module = {
235 # name = usb;
236 # common = bus/usb/usb.c;
237 # noemu = bus/usb/usbtrans.c;
238 # noemu = bus/usb/usbhub.c;
239 # enable = emu;
240 # enable = i386;
241 # enable = mips_yeeloong;
242 # emu_condition = COND_GRUB_EMU_USB;
243 # };
244 #
245 def under_platform_specific_conditionals(platform, snippet):
246 r = foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n")
247 r += snippet
248 r += foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n")
249 return r
250
251 def platform_specific_values(platform, suffix, nonetag):
252 return foreach_platform_specific_value(platform, suffix, nonetag,
253 lambda value: value + " ")
254
255 def platform_values(platform, suffix):
256 return foreach_platform_value(platform, suffix, lambda value: value + " ")
257
258 def extra_dist():
259 return foreach_value("extra_dist", lambda value: value + " ")
260
261 def platform_sources(p): return platform_values(p, "")
262 def platform_nodist_sources(p): return platform_values(p, "_nodist")
263 def platform_dependencies(p): return platform_values(p, "dependencies", "_dependencies")
264
265 def platform_startup(p): return platform_specific_values(p, "_startup", "startup")
266 def platform_ldadd(p): return platform_specific_values(p, "_ldadd", "ldadd")
267 def platform_cflags(p): return platform_specific_values(p, "_cflags", "cflags")
268 def platform_ldflags(p): return platform_specific_values(p, "_ldflags", "ldflags")
269 def platform_cppflags(p): return platform_specific_values(p, "_cppflags", "cppflags")
270 def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "ccasflags")
271 def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags")
272 def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags")
273
274 #
275 # Emit snippet only the first time through for the current name.
276 #
277 def first_time(snippet):
278 r = "[+ IF (if (not (assoc-ref seen-target (get \".name\"))) \"seen\") +]"
279 r += snippet
280 r += "[+ ENDIF +]"
281 return r
282
283 def module(platform):
284 r = set_canonical_name_suffix(".module")
285
286 r += gvar_add("noinst_PROGRAMS", "[+ name +].module")
287 r += gvar_add("MODULE_FILES", "[+ name +].module$(EXEEXT)")
288
289 r += var_set(cname() + "_SOURCES", platform_sources(platform) + " ## platform sources")
290 r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources")
291 r += var_set(cname() + "_LDADD", platform_ldadd(platform))
292 r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(platform))
293 r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(platform))
294 r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(platform))
295 r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform))
296 # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
297
298 r += gvar_add("EXTRA_DIST", extra_dist())
299 r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
300 r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
301
302 r += gvar_add("MOD_FILES", "[+ name +].mod")
303 r += gvar_add("MARKER_FILES", "[+ name +].marker")
304 r += gvar_add("CLEANFILES", "[+ name +].marker")
305 r += """
306 [+ name +].marker: $(""" + cname() + """_SOURCES) $(nodist_""" + cname() + """_SOURCES)
307 $(TARGET_CPP) -DGRUB_LST_GENERATOR $(CPPFLAGS_MARKER) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@.new || (rm -f $@; exit 1)
308 grep 'MARKER' $@.new > $@; rm -f $@.new
309 """
310 return r
311
312 def kernel(platform):
313 r = set_canonical_name_suffix(".exec")
314 r += gvar_add("noinst_PROGRAMS", "[+ name +].exec")
315 r += var_set(cname() + "_SOURCES", platform_startup(platform))
316 r += var_add(cname() + "_SOURCES", platform_sources(platform))
317 r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources")
318 r += var_set(cname() + "_LDADD", platform_ldadd(platform))
319 r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_KERNEL) " + platform_cflags(platform))
320 r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_KERNEL) " + platform_ldflags(platform))
321 r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) " + platform_cppflags(platform))
322 r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_KERNEL) " + platform_ccasflags(platform))
323 r += var_set(cname() + "_STRIPFLAGS", "$(AM_STRIPFLAGS) $(STRIPFLAGS_KERNEL) " + platform_stripflags(platform))
324 # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
325
326 r += gvar_add("EXTRA_DIST", extra_dist())
327 r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
328 r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
329
330 r += gvar_add("platform_DATA", "[+ name +].img")
331 r += gvar_add("CLEANFILES", "[+ name +].img")
332 r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)",
333 if_platform_tagged(platform, "nostrip", "cp $< $@",
334 "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<"))
335 return r
336
337 def image(platform):
338 r = set_canonical_name_suffix(".image")
339 r += gvar_add("noinst_PROGRAMS", "[+ name +].image")
340 r += var_set(cname() + "_SOURCES", platform_sources(platform))
341 r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources")
342 r += var_set(cname() + "_LDADD", platform_ldadd(platform))
343 r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_IMAGE) " + platform_cflags(platform))
344 r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_IMAGE) " + platform_ldflags(platform))
345 r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform))
346 r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform))
347 r += var_set(cname() + "_OBJCOPYFLAGS", "$(OBJCOPYFLAGS_IMAGE) " + platform_objcopyflags(platform))
348 # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
349
350 r += gvar_add("EXTRA_DIST", extra_dist())
351 r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
352 r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
353
354 r += gvar_add("platform_DATA", "[+ name +].img")
355 r += gvar_add("CLEANFILES", "[+ name +].img")
356 r += rule("[+ name +].img", "[+ name +].image$(EXEEXT)", """
357 if test x$(USE_APPLE_CC_FIXES) = xyes; then \
358 $(MACHO2IMG) $< $@; \
359 else \
360 $(OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \
361 fi
362 """)
363 return r
364
365 def library(platform):
366 r = set_canonical_name_suffix("")
367
368 r += vars_init(cname() + "_SOURCES",
369 "nodist_" + cname() + "_SOURCES",
370 cname() + "_CFLAGS",
371 cname() + "_CPPFLAGS",
372 cname() + "_CCASFLAGS")
373 # cname() + "_DEPENDENCIES")
374
375 r += first_time(gvar_add("noinst_LIBRARIES", "[+ name +]"))
376 r += var_add(cname() + "_SOURCES", platform_sources(platform))
377 r += var_add("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform))
378 r += var_add(cname() + "_CFLAGS", first_time("$(AM_CFLAGS) $(CFLAGS_LIBRARY) ") + platform_cflags(platform))
379 r += var_add(cname() + "_CPPFLAGS", first_time("$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) ") + platform_cppflags(platform))
380 r += var_add(cname() + "_CCASFLAGS", first_time("$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) ") + platform_ccasflags(platform))
381 # r += var_add(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
382
383 r += gvar_add("EXTRA_DIST", extra_dist())
384 r += first_time(gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)"))
385 r += first_time(gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)"))
386 return r
387
388 def installdir(default="bin"):
389 return "[+ IF installdir +][+ installdir +][+ ELSE +]" + default + "[+ ENDIF +]"
390
391 def manpage():
392 r = "if COND_MAN_PAGES\n"
393 r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n")
394 r += rule("[+ name +].[+ mansection +]", "[+ name +]", """
395 chmod a+x [+ name +]
396 PATH=$(builddir):$$PATH $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/docs/man/[+ name +].h2m -o $@ [+ name +]
397 """)
398 r += gvar_add("CLEANFILES", "[+ name +].[+ mansection +]")
399 r += "endif\n"
400 return r
401
402 def program(platform, test=False):
403 r = set_canonical_name_suffix("")
404
405 r += "[+ IF testcase defined +]"
406 r += gvar_add("check_PROGRAMS", "[+ name +]")
407 r += gvar_add("TESTS", "[+ name +]")
408 r += "[+ ELSE +]"
409 r += var_add(installdir() + "_PROGRAMS", "[+ name +]")
410 r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
411 r += "[+ ENDIF +]"
412
413 r += var_set(cname() + "_SOURCES", platform_sources(platform))
414 r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform))
415 r += var_set(cname() + "_LDADD", platform_ldadd(platform))
416 r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_PROGRAM) " + platform_cflags(platform))
417 r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_PROGRAM) " + platform_ldflags(platform))
418 r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) " + platform_cppflags(platform))
419 r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform))
420 # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
421
422 r += gvar_add("EXTRA_DIST", extra_dist())
423 r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
424 r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
425 return r
426
427 def data(platform):
428 r = gvar_add("EXTRA_DIST", platform_sources(platform))
429 r += gvar_add("EXTRA_DIST", extra_dist())
430 r += var_add(installdir() + "_DATA", platform_sources(platform))
431 return r
432
433 def script(platform):
434 r = "[+ IF testcase defined +]"
435 r += gvar_add("check_SCRIPTS", "[+ name +]")
436 r += gvar_add ("TESTS", "[+ name +]")
437 r += "[+ ELSE +]"
438 r += var_add(installdir() + "_SCRIPTS", "[+ name +]")
439 r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
440 r += "[+ ENDIF +]"
441
442 r += rule("[+ name +]", platform_sources(platform) + " $(top_builddir)/config.status", """
443 $(top_builddir)/config.status --file=-:$< | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
444 chmod a+x [+ name +]
445 """)
446
447 r += gvar_add("CLEANFILES", "[+ name +]")
448 r += gvar_add("dist_noinst_DATA", platform_sources(platform))
449 return r
450
451 def rules(target, closure):
452 # Create association lists for the benefit of first_time and vars_init.
453 r = "[+ (define seen-target '()) +]"
454 r += "[+ (define seen-vars '()) +]"
455 # Most output goes to a diversion. This allows us to emit variable
456 # initializations before everything else.
457 r += "[+ (out-push-new) +]"
458
459 r += "[+ FOR " + target + " +]"
460 r += foreach_enabled_platform(
461 lambda p: under_platform_specific_conditionals(p, closure(p)))
462 # Remember that we've seen this target.
463 r += "[+ (set! seen-target (assoc-set! seen-target (get \".name\") 0)) +]"
464 r += "[+ ENDFOR +]"
465 r += "[+ (out-pop #t) +]"
466 return r
467
468 def module_rules():
469 return rules("module", module)
470
471 def kernel_rules():
472 return rules("kernel", kernel)
473
474 def image_rules():
475 return rules("image", image)
476
477 def library_rules():
478 return rules("library", library)
479
480 def program_rules():
481 return rules("program", program)
482
483 def script_rules():
484 return rules("script", script)
485
486 def data_rules():
487 return rules("data", data)
488
489 print "[+ AutoGen5 template +]\n"
490 a = module_rules()
491 b = kernel_rules()
492 c = image_rules()
493 d = library_rules()
494 e = program_rules()
495 f = script_rules()
496 g = data_rules()
497 z = global_variable_initializers()
498
499 # print z # initializer for all vars
500 print a
501 print b
502 print c
503 print d
504 print e
505 print f
506 print g