Fix cancelling any previous definition of name, either built in or provided with a `-D` option // Resolve #191

This commit is contained in:
Ivan Kravets
2015-05-07 18:13:29 +01:00
parent 661ca2d27e
commit 1a39781cff
2 changed files with 22 additions and 10 deletions

View File

@ -4,9 +4,6 @@ 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>`__
@ -14,6 +11,9 @@ Release History
(`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)
------------------

View File

@ -15,18 +15,13 @@ from platformio.util import pioversion_to_intstr
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()
@ -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"]:
@ -373,6 +384,7 @@ def exists(_):
def generate(env):
env.AddMethod(BuildFirmware)
env.AddMethod(ProcessFlags)
env.AddMethod(GlobCXXFiles)
env.AddMethod(VariantDirRecursive)
env.AddMethod(BuildFramework)