<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MCUXpresso IDE中的主题 Pass in variable defined in makefile.defs</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/Pass-in-variable-defined-in-makefile-defs/m-p/1755050#M9282</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given this makefile.defs (located in the project root directory)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$(info BEGIN makefile.defs)


GIT_HASH := $(shell git rev-parse HEAD)

# Determine the operating system
ifeq ($(OS),Windows_NT)
    # For Windows, use PowerShell's Get-Date cmdlet
    GIT_DATE := $(shell powershell Get-Date -Format 'yyyy-MM-dd')
    RAW_GIT_AUTH := $(shell echo $(USERNAME) | sed 's/.*\\//')
    GIT_TIME := $(shell powershell Get-Date -Format 'HH:mm:ss')
else
    # For Linux, use the date command and whoami
    GIT_DATE := $(shell date '+%Y-%m-%d')
    RAW_GIT_AUTH := $(shell whoami)
    GIT_TIME := $(shell date '+%H:%M:%S')
endif

# Check if the username is "jeff" and set GIT_AUTH accordingly
# this is because Jeff has a mac, something something 10 foot pole
ifeq ($(RAW_GIT_AUTH), jeff)
    GIT_AUTH := jefpot
else
    GIT_AUTH := $(RAW_GIT_AUTH)
endif

# Check if the length of GIT_AUTH is greater than 6
ifeq ($(shell echo -n $(GIT_AUTH) | wc -c | awk '{print $1}'), 7)
    $(error Username is too long! Aborting build.)
endif

GIT_FLAGS += -DBECK_SOFTWARE_REVISION_GIT="$(GIT_HASH)" \
             -DBECK_SOFTWARE_REVISION_DATE="$(GIT_DATE)" \
             -DBECK_SOFTWARE_REVISION_TIME="$(GIT_TIME)" \
             -DBECK_SOFTWARE_REVISION_AUTH="$(GIT_AUTH)"

$(info GIT_HASH: $(GIT_HASH))
$(info GIT_DATE: $(GIT_DATE))
$(info GIT_TIME: $(GIT_TIME))
$(info GIT_AUTH: $(GIT_AUTH))
$(info END makefile.defs)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the GIT_FLAGS variable to be passed into the build command, so that BECK_SOFTWARE_xxx is defined through the macros.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've followed the guide &lt;A href="https://stackoverflow.com/questions/65007843/eclipse-define-build-variable-in-pre-build" target="_blank" rel="noopener"&gt;on this stack overflow post&lt;/A&gt; and had no luck. What do I need to do to get those defines include in the build?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have verified that they are not passed in by looking at the console build output.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Nov 2023 15:34:09 GMT</pubDate>
    <dc:creator>GUnderdown</dc:creator>
    <dc:date>2023-11-09T15:34:09Z</dc:date>
    <item>
      <title>Pass in variable defined in makefile.defs</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Pass-in-variable-defined-in-makefile-defs/m-p/1755050#M9282</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given this makefile.defs (located in the project root directory)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$(info BEGIN makefile.defs)


GIT_HASH := $(shell git rev-parse HEAD)

# Determine the operating system
ifeq ($(OS),Windows_NT)
    # For Windows, use PowerShell's Get-Date cmdlet
    GIT_DATE := $(shell powershell Get-Date -Format 'yyyy-MM-dd')
    RAW_GIT_AUTH := $(shell echo $(USERNAME) | sed 's/.*\\//')
    GIT_TIME := $(shell powershell Get-Date -Format 'HH:mm:ss')
else
    # For Linux, use the date command and whoami
    GIT_DATE := $(shell date '+%Y-%m-%d')
    RAW_GIT_AUTH := $(shell whoami)
    GIT_TIME := $(shell date '+%H:%M:%S')
endif

# Check if the username is "jeff" and set GIT_AUTH accordingly
# this is because Jeff has a mac, something something 10 foot pole
ifeq ($(RAW_GIT_AUTH), jeff)
    GIT_AUTH := jefpot
else
    GIT_AUTH := $(RAW_GIT_AUTH)
endif

# Check if the length of GIT_AUTH is greater than 6
ifeq ($(shell echo -n $(GIT_AUTH) | wc -c | awk '{print $1}'), 7)
    $(error Username is too long! Aborting build.)
endif

GIT_FLAGS += -DBECK_SOFTWARE_REVISION_GIT="$(GIT_HASH)" \
             -DBECK_SOFTWARE_REVISION_DATE="$(GIT_DATE)" \
             -DBECK_SOFTWARE_REVISION_TIME="$(GIT_TIME)" \
             -DBECK_SOFTWARE_REVISION_AUTH="$(GIT_AUTH)"

$(info GIT_HASH: $(GIT_HASH))
$(info GIT_DATE: $(GIT_DATE))
$(info GIT_TIME: $(GIT_TIME))
$(info GIT_AUTH: $(GIT_AUTH))
$(info END makefile.defs)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the GIT_FLAGS variable to be passed into the build command, so that BECK_SOFTWARE_xxx is defined through the macros.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've followed the guide &lt;A href="https://stackoverflow.com/questions/65007843/eclipse-define-build-variable-in-pre-build" target="_blank" rel="noopener"&gt;on this stack overflow post&lt;/A&gt; and had no luck. What do I need to do to get those defines include in the build?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have verified that they are not passed in by looking at the console build output.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 15:34:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Pass-in-variable-defined-in-makefile-defs/m-p/1755050#M9282</guid>
      <dc:creator>GUnderdown</dc:creator>
      <dc:date>2023-11-09T15:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Pass in variable defined in makefile.defs</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Pass-in-variable-defined-in-makefile-defs/m-p/1757146#M9294</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/218583"&gt;@GUnderdown&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Please look into the following post by Erich Styger. I believe it will prove very insightful for your current inquiry:&amp;nbsp;&lt;A href="https://mcuoneclipse.com/2017/07/22/tutorial-makefile-projects-with-eclipse/" target="_blank"&gt;https://mcuoneclipse.com/2017/07/22/tutorial-makefile-projects-with-eclipse/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Let me know if it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR,&lt;BR /&gt;Edwin.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 20:38:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Pass-in-variable-defined-in-makefile-defs/m-p/1757146#M9294</guid>
      <dc:creator>EdwinHz</dc:creator>
      <dc:date>2023-11-14T20:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Pass in variable defined in makefile.defs</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Pass-in-variable-defined-in-makefile-defs/m-p/1757755#M9297</link>
      <description>&lt;P&gt;I managed to make this work by having a shell script that ran as a pre-build command, and generates the necessary defines in a .h file&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 16:24:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Pass-in-variable-defined-in-makefile-defs/m-p/1757755#M9297</guid>
      <dc:creator>GUnderdown</dc:creator>
      <dc:date>2023-11-15T16:24:18Z</dc:date>
    </item>
  </channel>
</rss>

