<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Editing MakeFile</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111266/editing-makefile</link><description>Hello everyone, 
 I&amp;#39;m looking for some advice on a slightly offbeat topic related to the Nordic SDK. 
 I&amp;#39;d like to modify the Makefile of one of the SDK examples so that it displays a custom message at the end of the compilation process, similar to how</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 May 2024 12:52:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111266/editing-makefile" /><item><title>RE: Editing MakeFile</title><link>https://devzone.nordicsemi.com/thread/485127?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 12:52:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6028d74a-b53e-41f2-9410-60faee633821</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There is no way to do this directly in the Makefile, but you can create a script for it. &lt;br /&gt;The easiest way to get a list of warnings and errors is to store the build log into a file, for example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;west build -b nrf52840dk_nrf52840 &amp;gt; build_output.log&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then you can use grep to find how many times &amp;quot;warning&amp;quot; and &amp;quot;error&amp;quot; shows up in the build log, for example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;echo &amp;quot;Warnings: $(grep -i &amp;quot;: warning&amp;quot; build_output.log | wc -l)&amp;quot;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;echo &amp;quot;Errors: $(grep -i &amp;quot;: error&amp;quot; build_output.log | wc -l)&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To get the time, you can use the time command when building:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;time west build -b nrf52840dk_nrf52840&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you create a script for building, you can get the time before and after building and output this. &lt;br /&gt;Here is an example script that prints out warnings, errors, and time:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#!/bin/bash

start=$(date +%s)
west build -b $1 &amp;gt; build_output.log
end=$(date +%s)

duration=$((end - start))

warnings=$(grep -i &amp;quot;: warning&amp;quot; build_output.log | wc -l)
errors=$(grep -i &amp;quot;: error&amp;quot; build_output.log | wc -l)

echo &amp;quot;Warnings: $warnings&amp;quot;
echo &amp;quot;Errors: $errors&amp;quot;
echo &amp;quot;Build time: $duration seconds&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This takes the board as an argument when running the file, so if the file is called count_build_issues.sh you can run it to build for nRF52840 DK as follows:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;./count_build_issues.sh nrf52840dk_nrf52840&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>