* [PATCH] Use Autogen macros to reduce Makefile.tpl size
@ 2011-08-27 1:15 BVK Chaitanya
2011-09-29 8:44 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 3+ messages in thread
From: BVK Chaitanya @ 2011-08-27 1:15 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
Hi,
Attached patch removes lots of repeated Autogen code snippets from
Makefile.tpl with the help of Autogen macros. This reduces the
Makefile.tpl size from 9MB to less than 2MB.
thanks,
bvk.chaitanya
[-- Attachment #2: gentpl-improvements.patch --]
[-- Type: text/x-patch, Size: 9954 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: bvk.groups@gmail.com-20110826061359-sgqz04vgbytkw5dp
# target_branch: http://bzr.savannah.gnu.org/r/grub/trunk/grub/
# testament_sha1: 8aaa787c18d382a45a9a89268c49ec1599118bdc
# timestamp: 2011-08-25 23:14:04 -0700
# base_revision_id: phcoder@gmail.com-20110823092056-2o8vryiw9wa6i2yc
#
# Begin patch
=== modified file 'ChangeLog'
--- ChangeLog 2011-08-23 09:20:56 +0000
+++ ChangeLog 2011-08-26 06:13:59 +0000
@@ -1,3 +1,8 @@
+2011-08-25 BVK Chaitanya <bvk.groups@gmail.com>
+
+ * gentpl.py: Use Autogen macros so that the output file
+ (Makefile.tpl) size is reduced.
+
2011-08-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mips/loongson/init.c (grub_machine_init): Handle the
=== modified file 'gentpl.py'
--- gentpl.py 2011-07-05 19:00:01 +0000
+++ gentpl.py 2011-08-26 06:13:59 +0000
@@ -184,6 +184,17 @@
return r
#
+# Returns autogen code that defines an autogen macro using the
+# definition given in the 'snippet'.
+#
+def define_autogen_macro(name, snippet):
+ r = ""
+ r += "[+ DEFINE " + name + " +]"
+ r += snippet
+ r += "[+ ENDDEF +]\n"
+ return r
+
+#
# Template for handling values from sum of all groups for a platform,
# for example:
#
@@ -245,10 +256,18 @@
# emu_condition = COND_GRUB_EMU_USB;
# };
#
+def define_macro_for_platform_conditionals_if_statement(p):
+ return define_autogen_macro(
+ "if_" + p + "_conditionals",
+ foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n"))
+def define_macro_for_platform_conditionals_endif_statement(p):
+ return define_autogen_macro(
+ "endif_" + p + "_conditionals",
+ foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n"))
def under_platform_specific_conditionals(platform, snippet):
- r = foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n")
+ r = "[+ if_" + platform + "_conditionals +]"
r += snippet
- r += foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n")
+ r += "[+ endif_" + platform + "_conditionals +]"
return r
def platform_specific_values(platform, suffix, nonetag):
@@ -261,18 +280,69 @@
def extra_dist():
return foreach_value("extra_dist", lambda value: value + " ")
-def platform_sources(p): return platform_values(p, "")
-def platform_nodist_sources(p): return platform_values(p, "_nodist")
-def platform_dependencies(p): return platform_values(p, "dependencies", "_dependencies")
+def define_macro_for_platform_sources(p):
+ return define_autogen_macro(
+ "get_" + p + "_sources",
+ platform_values(p, ""))
+def define_macro_for_platform_nodist_sources(p):
+ return define_autogen_macro(
+ "get_" + p + "_nodist_sources",
+ platform_values(p, "_nodist"))
+def define_macro_for_platform_dependencies(p):
+ return define_autogen_macro(
+ "get_" + p + "_dependencies",
+ platform_values(p, "dependencies", "_dependencies"))
+def platform_sources(p): return "[+ get_" + p + "_sources +]"
+def platform_nodist_sources(p): return "[+ get_" + p + "_nodist_sources +]"
+def platform_dependencies(p): return "[+ get_" + p + "_dependencies +]"
-def platform_startup(p): return platform_specific_values(p, "_startup", "startup")
-def platform_ldadd(p): return platform_specific_values(p, "_ldadd", "ldadd")
-def platform_cflags(p): return platform_specific_values(p, "_cflags", "cflags")
-def platform_ldflags(p): return platform_specific_values(p, "_ldflags", "ldflags")
-def platform_cppflags(p): return platform_specific_values(p, "_cppflags", "cppflags")
-def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "ccasflags")
-def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags")
-def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags")
+#
+# Returns Autogen code which defines the autogen macros that collect
+# platform specific values for cflags, ldflags, etc. tags.
+#
+def define_macro_for_platform_startup(p):
+ return define_autogen_macro(
+ "get_" + p + "_startup",
+ platform_specific_values(p, "_startup", "startup"))
+def define_macro_for_platform_cflags(p):
+ return define_autogen_macro(
+ "get_" + p + "_cflags",
+ platform_specific_values(p, "_cflags", "cflags"))
+def define_macro_for_platform_ldadd(p):
+ return define_autogen_macro(
+ "get_" + p + "_ldadd",
+ platform_specific_values(p, "_ldadd", "ldadd"))
+def define_macro_for_platform_ldflags(p):
+ return define_autogen_macro(
+ "get_" + p + "_ldflags",
+ platform_specific_values(p, "_ldflags", "ldflags"))
+def define_macro_for_platform_cppflags(p):
+ return define_autogen_macro(
+ "get_" + p + "_cppflags",
+ platform_specific_values(p, "_cppflags", "cppflags"))
+def define_macro_for_platform_ccasflags(p):
+ return define_autogen_macro(
+ "get_" + p + "_ccasflags",
+ platform_specific_values(p, "_ccasflags", "ccasflags"))
+def define_macro_for_platform_stripflags(p):
+ return define_autogen_macro(
+ "get_" + p + "_stripflags",
+ platform_specific_values(p, "_stripflags", "stripflags"))
+def define_macro_for_platform_objcopyflags(p):
+ return define_autogen_macro(
+ "get_" + p + "_objcopyflags",
+ platform_specific_values(p, "_objcopyflags", "objcopyflags"))
+#
+# Autogen calls to invoke the above macros.
+#
+def platform_startup(p): return "[+ get_" + p + "_startup +]"
+def platform_ldadd(p): return "[+ get_" + p + "_ldadd +]"
+def platform_cflags(p): return "[+ get_" + p + "_cflags +]"
+def platform_ldflags(p): return "[+ get_" + p + "_ldflags +]"
+def platform_cppflags(p): return "[+ get_" + p + "_cppflags +]"
+def platform_ccasflags(p): return "[+ get_" + p + "_ccasflags +]"
+def platform_stripflags(p): return "[+ get_" + p + "_stripflags +]"
+def platform_objcopyflags(p): return "[+ get_" + p + "_objcopyflags +]"
#
# Emit snippet only the first time through for the current name.
@@ -489,7 +559,6 @@
def data_rules():
return rules("data", data)
-print "[+ AutoGen5 template +]\n"
a = module_rules()
b = kernel_rules()
c = image_rules()
@@ -499,6 +568,23 @@
g = data_rules()
z = global_variable_initializers()
+print "[+ AutoGen5 template +]\n"
+for p in GRUB_PLATFORMS:
+ print define_macro_for_platform_sources(p)
+ print define_macro_for_platform_nodist_sources(p)
+ # print define_macro_for_platform_dependencies(p)
+
+ print define_macro_for_platform_startup(p)
+ print define_macro_for_platform_cflags(p)
+ print define_macro_for_platform_ldadd(p)
+ print define_macro_for_platform_ldflags(p)
+ print define_macro_for_platform_cppflags(p)
+ print define_macro_for_platform_ccasflags(p)
+ print define_macro_for_platform_stripflags(p)
+ print define_macro_for_platform_objcopyflags(p)
+
+ print define_macro_for_platform_conditionals_if_statement(p)
+ print define_macro_for_platform_conditionals_endif_statement(p)
# print z # initializer for all vars
print a
print b
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWVWTPqIABIVfgEQwWP//93+v
3w6////wYAivffPp92vTgA75PeuxoPvOcUNsxtXhKESmniaR6gNPQnqeoAANGQZNBo0fpQAlEaCa
GgmhT0JiNGho0GgAABoAIqe9TUygAHqGgAAAAAAAAAk1RBCPVPQyNIxkmgDJoGgAA09QAEUkym0p
6p4TBR6NTyQ0ZPUaGgNAABoAIokCZGhJ6ZqYk8im0m1MEMQ0000AAaHogiPSjwG2Z5j4txRTRTAr
j31811aXXLASKhoMz5INKgsaUdSNtu3K5C7NftseLfux3oWQBdNpA22SxAiZwzk3ma3NN+quqKra
Ry3IClFF92V/wPm5923dpNcg2BYjEirFEQUFGTqjDf234nAGsQhohJlD8BRtSxDw32nz3kWRZl6Y
Tc6TFXBUKQIEuQHC0S1hpolJQgnUxROXTQUpLUyWwNzmZy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messages in thread
* Re: [PATCH] Use Autogen macros to reduce Makefile.tpl size
2011-08-27 1:15 [PATCH] Use Autogen macros to reduce Makefile.tpl size BVK Chaitanya
@ 2011-09-29 8:44 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-10-01 1:50 ` BVK Chaitanya
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-09-29 8:44 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 509 bytes --]
On 27.08.2011 03:15, BVK Chaitanya wrote:
> Hi,
>
>
> Attached patch removes lots of repeated Autogen code snippets from
> Makefile.tpl with the help of Autogen macros. This reduces the
> Makefile.tpl size from 9MB to less than 2MB.
>
>
>
Go ahead
> thanks,
> bvk.chaitanya
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use Autogen macros to reduce Makefile.tpl size
2011-09-29 8:44 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-10-01 1:50 ` BVK Chaitanya
0 siblings, 0 replies; 3+ messages in thread
From: BVK Chaitanya @ 2011-10-01 1:50 UTC (permalink / raw)
To: The development of GNU GRUB
Committed.
thanks,
bvk.chaitanya
2011/9/29 Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com>:
> On 27.08.2011 03:15, BVK Chaitanya wrote:
>> Hi,
>>
>>
>> Attached patch removes lots of repeated Autogen code snippets from
>> Makefile.tpl with the help of Autogen macros. This reduces the
>> Makefile.tpl size from 9MB to less than 2MB.
>>
>>
>>
> Go ahead
>> thanks,
>> bvk.chaitanya
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
> --
> Regards
> Vladimir 'φ-coder/phcoder' Serbinenko
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-01 1:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-27 1:15 [PATCH] Use Autogen macros to reduce Makefile.tpl size BVK Chaitanya
2011-09-29 8:44 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-10-01 1:50 ` BVK Chaitanya
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.