Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/libgfxinit/+/42365 )
Change subject: common/Makefile.inc: Factor out generation TLAs ......................................................................
common/Makefile.inc: Factor out generation TLAs
The Three Letter Acronyms that correspond to generation names appear four times inside complex sed-fu. Since they are the same, factor them out. Note the increased amount of backslashes, which are now required.
Sanity-checked by building gfxtest for Haswell, whose executable remains identical regardless of whether this commit is applied or not.
Change-Id: I63cb24d7334359d39aca4682632c3b9b6b698d43 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M common/Makefile.inc 1 file changed, 6 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/65/42365/1
diff --git a/common/Makefile.inc b/common/Makefile.inc index e01bdc2..3519723 100644 --- a/common/Makefile.inc +++ b/common/Makefile.inc @@ -57,6 +57,8 @@ CONFIG_GFX_GMA_ANALOG_I2C_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_ANALOG_I2C_PORT)) CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS := $(if $(filter y,$(CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS)),True,False)
+_GEN_TLA_SUBSTITUTIONS := '\(g45\|ilk\|hsw\|skl\)' + _GEN_NONCONST := $(strip \ $(if $(filter G45,$(CONFIG_GFX_GMA_GENERATION)),g45, \ $(if $(filter Ironlake,$(CONFIG_GFX_GMA_GENERATION)),ilk, \ @@ -86,9 +88,9 @@ sed $(GFX_GMA_COMMON_SUBSTITUTIONS) \ -e'/constant Gen_CPU(_Var)?/d' \ -e's/<genbool>/constant Boolean/' \ - -e's/<((g45|ilk|hsw|skl)(...)?)bool>/<\1var> Boolean/' \ + -e's/<($(_GEN_TLA_SUBSTITUTIONS)(...)?)bool>/<\1var> Boolean/' \ $(if $(_GEN_NONCONST),-e's/<(...)?$(_GEN_NONCONST)(...)?var>/<cpufunc>/') \ - -e's/<(g45|ilk|hsw|skl)(...)?var>/$(_GEN_CONST_TARGET)/' \ + -e's/<$(_GEN_TLA_SUBSTITUTIONS)(...)?var>/$(_GEN_CONST_TARGET)/' \ -e's/(.*: *<cpufunc>.*:=) *(.*);/\1\n (\2);/' \ -e's/([^ ]+) *: *<cpufunc> +([^ ]*) *:=/function \1 return \2 is/' \ -e's/<cpunull>//' \ @@ -101,8 +103,8 @@ -e's/<<CPU_VARIANT>>/$(CONFIG_GFX_GMA_CPU_VARIANT)/' \ -e":s$$(printf '\n ')/,$$/{N;s/,\n.*Dyn_CPU(_Var)?[^,)]*//;ts$$(printf '\n ')P;D;}" \ -e'/Dyn_CPU(_Var)?/d' \ - -e's/<(gen|(g45|ilk|hsw|skl)(...)?)bool>/constant Boolean/' \ - -e's/<((g45|ilk|hsw|skl)(...)?)var>/constant/' \ + -e's/<(gen|$(_GEN_TLA_SUBSTITUTIONS)(...)?)bool>/constant Boolean/' \ + -e's/<($(_GEN_TLA_SUBSTITUTIONS)(...)?)var>/constant/' \ -e's/<cpunull>/ is null/' \ $< >$@ endif
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/libgfxinit/+/42365 )
Change subject: common/Makefile.inc: Factor out generation TLAs ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/libgfxinit/+/42365/1/common/Makefile.inc File common/Makefile.inc:
https://review.coreboot.org/c/libgfxinit/+/42365/1/common/Makefile.inc@91 PS1, Line 91: -e's/<($(_GEN_TLA_SUBSTITUTIONS)(...)?)bool>/<\1var> Boolean/' \ The additional backslashes are only needed because you exit the quotation around them... it's literally
's/<('\(g45\|ilk\|... ^ exiting
Make is no shell, thus ignores quotes and backslashes where it can ;)
Hello Nico Huber, Patrick Georgi, Martin Roth, Matt DeVillier, Arthur Heymans,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/libgfxinit/+/42365
to look at the new patch set (#2).
Change subject: common/Makefile.inc: Factor out generation TLAs ......................................................................
common/Makefile.inc: Factor out generation TLAs
The Three Letter Acronyms that correspond to generation names appear four times inside complex sed-fu. As they are the same, factor them out.
Sanity-checked by building gfxtest for Haswell, whose executable remains identical regardless of whether this commit is applied or not.
Change-Id: I63cb24d7334359d39aca4682632c3b9b6b698d43 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M common/Makefile.inc 1 file changed, 6 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/65/42365/2
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/libgfxinit/+/42365 )
Change subject: common/Makefile.inc: Factor out generation TLAs ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/libgfxinit/+/42365/1/common/Makefile.inc File common/Makefile.inc:
https://review.coreboot.org/c/libgfxinit/+/42365/1/common/Makefile.inc@91 PS1, Line 91: -e's/<($(_GEN_TLA_SUBSTITUTIONS)(...)?)bool>/<\1var> Boolean/' \
The additional backslashes are only needed because you exit the quotation […]
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/libgfxinit/+/42365 )
Change subject: common/Makefile.inc: Factor out generation TLAs ......................................................................
Patch Set 2: Code-Review+1
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/libgfxinit/+/42365 )
Change subject: common/Makefile.inc: Factor out generation TLAs ......................................................................
Patch Set 3: Code-Review+2
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/libgfxinit/+/42365 )
Change subject: common/Makefile.inc: Factor out generation TLAs ......................................................................
Patch Set 3: Verified+1
Nico Huber has submitted this change. ( https://review.coreboot.org/c/libgfxinit/+/42365 )
Change subject: common/Makefile.inc: Factor out generation TLAs ......................................................................
common/Makefile.inc: Factor out generation TLAs
The Three Letter Acronyms that correspond to generation names appear four times inside complex sed-fu. As they are the same, factor them out.
Sanity-checked by building gfxtest for Haswell, whose executable remains identical regardless of whether this commit is applied or not.
Change-Id: I63cb24d7334359d39aca4682632c3b9b6b698d43 Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/42365 Reviewed-by: Nico Huber nico.h@gmx.de Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net Tested-by: Nico Huber nico.h@gmx.de --- M common/Makefile.inc 1 file changed, 6 insertions(+), 4 deletions(-)
Approvals: Nico Huber: Verified; Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve
diff --git a/common/Makefile.inc b/common/Makefile.inc index e01bdc2..f2a2fbb 100644 --- a/common/Makefile.inc +++ b/common/Makefile.inc @@ -57,6 +57,8 @@ CONFIG_GFX_GMA_ANALOG_I2C_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_ANALOG_I2C_PORT)) CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS := $(if $(filter y,$(CONFIG_GFX_GMA_IGNORE_PRESENCE_STRAPS)),True,False)
+_GEN_TLA_SUBSTITUTIONS := (g45|ilk|hsw|skl) + _GEN_NONCONST := $(strip \ $(if $(filter G45,$(CONFIG_GFX_GMA_GENERATION)),g45, \ $(if $(filter Ironlake,$(CONFIG_GFX_GMA_GENERATION)),ilk, \ @@ -86,9 +88,9 @@ sed $(GFX_GMA_COMMON_SUBSTITUTIONS) \ -e'/constant Gen_CPU(_Var)?/d' \ -e's/<genbool>/constant Boolean/' \ - -e's/<((g45|ilk|hsw|skl)(...)?)bool>/<\1var> Boolean/' \ + -e's/<($(_GEN_TLA_SUBSTITUTIONS)(...)?)bool>/<\1var> Boolean/' \ $(if $(_GEN_NONCONST),-e's/<(...)?$(_GEN_NONCONST)(...)?var>/<cpufunc>/') \ - -e's/<(g45|ilk|hsw|skl)(...)?var>/$(_GEN_CONST_TARGET)/' \ + -e's/<$(_GEN_TLA_SUBSTITUTIONS)(...)?var>/$(_GEN_CONST_TARGET)/' \ -e's/(.*: *<cpufunc>.*:=) *(.*);/\1\n (\2);/' \ -e's/([^ ]+) *: *<cpufunc> +([^ ]*) *:=/function \1 return \2 is/' \ -e's/<cpunull>//' \ @@ -101,8 +103,8 @@ -e's/<<CPU_VARIANT>>/$(CONFIG_GFX_GMA_CPU_VARIANT)/' \ -e":s$$(printf '\n ')/,$$/{N;s/,\n.*Dyn_CPU(_Var)?[^,)]*//;ts$$(printf '\n ')P;D;}" \ -e'/Dyn_CPU(_Var)?/d' \ - -e's/<(gen|(g45|ilk|hsw|skl)(...)?)bool>/constant Boolean/' \ - -e's/<((g45|ilk|hsw|skl)(...)?)var>/constant/' \ + -e's/<(gen|$(_GEN_TLA_SUBSTITUTIONS)(...)?)bool>/constant Boolean/' \ + -e's/<($(_GEN_TLA_SUBSTITUTIONS)(...)?)var>/constant/' \ -e's/<cpunull>/ is null/' \ $< >$@ endif