<?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>Makefile syntax in SDK examples</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16226/makefile-syntax-in-sdk-examples</link><description>Hi ! 
 I&amp;#39;ve seen that the Makefile given with the examples changed a lot between SDK11 and SDK12, lots of improvements ! However there&amp;#39;s still something I don&amp;#39;t get. Why do you use this syntax : 
 SRC_FILES += \
$(SDK_ROOT)/components/libraries/log</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 07 Sep 2016 13:25:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16226/makefile-syntax-in-sdk-examples" /><item><title>RE: Makefile syntax in SDK examples</title><link>https://devzone.nordicsemi.com/thread/61974?ContentTypeID=1</link><pubDate>Wed, 07 Sep 2016 13:25:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db8239c0-3a5f-4acf-9dc7-ac467b67d4ae</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;I don&amp;#39;t think it&amp;#39;s necessary since the syntax used is totally valid. It&amp;#39;s probably arbitrary if I find the other one better. Since I write a lot of Makefiles I was curious if the SDK team had a good reason to prefer a syntax I personally dislike over the other one. Anyway as andxnor mentioned it&amp;#39;s also possible to combine both syntaxes, but then we end up with a mix of syntax which, IMHO, would be the worst.&lt;/p&gt;
&lt;p&gt;What kind of tools could they use ? At some point you have to specify which files to build, don&amp;#39;t you ? Aside of the standard Makefile template we find in all projects, this plus the compiler/linker flags are the main content of the Makefile. Maybe they are extracted from the Keil project ? Their workflow may be interesting for me since I also have to maintain both a Makefile and a Keil project file for the same project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Makefile syntax in SDK examples</title><link>https://devzone.nordicsemi.com/thread/61975?ContentTypeID=1</link><pubDate>Wed, 07 Sep 2016 13:16:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cccdbfc4-15ba-47bd-9d70-965f4ba5c45a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I think the SDK team have generated the SRC_FILES and INC_FOLDERS using a tool (i am guessing this). I agree to your point that now this wont allow conditional additions of file. Do you want to raise this as a bug?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Makefile syntax in SDK examples</title><link>https://devzone.nordicsemi.com/thread/61977?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 16:06:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f3373cc-6183-495b-a711-3ca1409c4361</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;That&amp;#39;s right but then you mix two syntaxes. For the point about forgetting some characters, I think whatever mistake you do, it will not end as expected. Anyway I&amp;#39;d typically copy-paste this kind of line which prevents the risk of failing the left part of the line since it&amp;#39;s always the same.&lt;/p&gt;
&lt;p&gt;Small precision but I just ask this by curiosity, I don&amp;#39;t think there is an absolute best practice here (even though I have a preference).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Makefile syntax in SDK examples</title><link>https://devzone.nordicsemi.com/thread/61976?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 15:24:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26fa63b9-c32e-4cca-847d-cd5b81370709</guid><dc:creator>andnxor</dc:creator><description>&lt;p&gt;The first syntax is a bit cleaner since each row only requires one variable. Also if, for example, you forget the &amp;quot;+&amp;quot; SRC_FILES will miss some of the .c files. The example below won&amp;#39;t compile nrf_log_frontend.c&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SRC_FILES += $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c 
SRC_FILES = $(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c 
SRC_FILES += $(SDK_ROOT)/components/libraries/button/app_button.c
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It does not preclude you from adding additional files later like in your example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ifeq($(SOME_MAKEFILE_VAR),1)
SRC_FILES += $(SDK_ROOT)/components/libraries/button/some_file.c 
endif
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>