<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#943634;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'>You may want to take a look at &#8220;meta/conf/distro/include/security_flags.inc&#8221;. I think it does what you are looking for<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'>//Peter<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> bitbake-devel-bounces@lists.openembedded.org [mailto:bitbake-devel-bounces@lists.openembedded.org] <b>On Behalf Of </b>Udayan Bapat<br><b>Sent:</b> den 8 november 2013 14:53<br><b>To:</b> bitbake-devel@lists.openembedded.org<br><b>Subject:</b> [bitbake-devel] How to strip CFLAGS in the recipe file?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hi all,<br><br>I have a Yocto build environment where I intend to build all recipes with -fPIE flag. So I have added CFLAGS_append += '-fPIE' in the local.conf. However since shared libraries can not be built using -fPIE flag, I would like to remove it from some recipes.<br><br>So far I have tried this in .bb files - <br><br>CFLAGS_noPIE = &quot;<a href="mailto:$%7b@'$%7bCFLAGS%7d'.replace('-fPIE','')%7d">${@'${CFLAGS}'.replace('-fPIE','')}</a>&quot;<br><br>do_compile_prepend () {<br>&nbsp;&nbsp;&nbsp; CFLAGS = &quot;${CFLAGS_noPIE}&quot;<br>}<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>This throws an error - <br><br>*/zlib-native/1.2.8-r0/temp/run.do_compile.23159: line 82: CFLAGS: command not found<o:p></o:p></p></div><p class=MsoNormal>I also have tried - <br><br>CFLAGS = &quot;${@'${CFLAGS}'.replace('-<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>fPIE','')}&quot;<o:p></o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>This doesn't work because same variable can not be referenced twice.<o:p></o:p></p></div><div><p class=MsoNormal>Then I tried this - <br><br>CFLAGS_noPIE = &quot;<a href="mailto:$%7b@'$%7bCFLAGS%7d'.replace('-fPIE','')%7d">${@'${CFLAGS}'.replace('-fPIE','')}</a>&quot;<o:p></o:p></p></div><div><p class=MsoNormal>CFLAGS = &quot;${CFLAGS_noPIE}&quot; <o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>This fails with an error &quot;maximum recursion depth exceeded for variable 'CFLAGS'&quot;<o:p></o:p></p></div><div><p class=MsoNormal>What is the correct way to doing this?<br><br>Thanks<o:p></o:p></p></div></div></div></div></div></div></body></html>