Skip to content

Commit

Permalink
Fix cancelling any previous definition of name, either built in or pr…
Browse files Browse the repository at this point in the history
…ovided with a ``-D`` option // Resolve #191
  • Loading branch information
ivankravets committed May 7, 2015
1 parent 661ca2d commit 1a39781
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
6 changes: 3 additions & 3 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Release History
1.5.0 (2015-05-??)
------------------

* Created `PlatformIO gitter.im <https://gitter.im/platformio/platformio>`_
room
(`issue #174 <https://github.com/platformio/platformio/issues/174>`_)
* Added GDB as alternative uploader to `ststm32 <http://docs.platformio.org/en/latest/platforms/ststm32.html>`__ platform
(`issue #175 <https://github.com/platformio/platformio/issues/174>`_)
* Added `examples <https://github.com/platformio/platformio/tree/develop/examples>`__
with preconfigured IDE projects
(`issue #154 <https://github.com/platformio/platformio/issues/154>`_)
* Fixed parsing of includes for PlatformIO Library Dependency Finder
(`issue #189 <https://github.com/platformio/platformio/issues/189>`_)
* Fixed cancelling any previous definition of name, either built in or provided
with a ``-D`` option
(`issue #191 <https://github.com/platformio/platformio/issues/191>`_)

1.4.0 (2015-04-11)
------------------
Expand Down
26 changes: 19 additions & 7 deletions platformio/builder/tools/platformio.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@
def BuildFirmware(env):

# fix ASM handling under non-casitive OS
if not case_sensitive_suffixes('.s', '.S'):
if not case_sensitive_suffixes(".s", ".S"):
env.Replace(
AS="$CC",
ASCOM="$ASPPCOM"
)

if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}):
env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}"))

if "BUILD_FLAGS" in env:
env.MergeFlags(env['BUILD_FLAGS'])

env.ProcessFlags()
env.BuildFramework()

firmenv = env.Clone()
Expand Down Expand Up @@ -69,6 +64,22 @@ def BuildFirmware(env):
)


def ProcessFlags(env):
if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}):
env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}"))

if "BUILD_FLAGS" in env:
env.MergeFlags(env['BUILD_FLAGS'])

# Cancel any previous definition of name, either built in or
# provided with a -D option // Issue #191
undefines = [f for f in env.get("CCFLAGS", []) if f.startswith("-U")]
if undefines:
for undef in undefines:
env['CCFLAGS'].remove(undef)
env.Append(_CPPDEFFLAGS=" %s" % " ".join(undefines))


def GlobCXXFiles(env, path):
files = []
for suff in ["*.c", "*.cpp", "*.S"]:
Expand Down Expand Up @@ -373,6 +384,7 @@ def exists(_):

def generate(env):
env.AddMethod(BuildFirmware)
env.AddMethod(ProcessFlags)
env.AddMethod(GlobCXXFiles)
env.AddMethod(VariantDirRecursive)
env.AddMethod(BuildFramework)
Expand Down

0 comments on commit 1a39781

Please sign in to comment.