@@ -616,6 +616,17 @@ def MergeGroup(src_group, group):
616616 else :
617617 src_group ['LOCAL_ASFLAGS' ] = group ['LOCAL_ASFLAGS' ]
618618
619+ def _PretreatListParameters (target_list ):
620+ while '' in target_list : # remove null strings
621+ target_list .remove ('' )
622+ while ' ' in target_list : # remove ' '
623+ target_list .remove (' ' )
624+
625+ if (len (target_list ) == 0 ):
626+ return False # ignore this list, don't add this list to the parameter
627+
628+ return True # permit to add this list to the parameter
629+
619630def DefineGroup (name , src , depend , ** parameters ):
620631 global Env
621632 if not GetDepend (depend ):
@@ -640,19 +651,29 @@ def DefineGroup(name, src, depend, **parameters):
640651 group ['src' ] = src
641652
642653 if 'CCFLAGS' in group :
643- Env .AppendUnique (CCFLAGS = group ['CCFLAGS' ])
654+ target = group ['CCFLAGS' ]
655+ if len (target ) > 0 :
656+ Env .AppendUnique (CCFLAGS = target )
644657 if 'CPPPATH' in group :
645- paths = []
646- for item in group ['CPPPATH' ]:
647- paths .append (os .path .abspath (item ))
648- group ['CPPPATH' ] = paths
649- Env .AppendUnique (CPPPATH = group ['CPPPATH' ])
658+ target = group ['CPPPATH' ]
659+ if _PretreatListParameters (target ) == True :
660+ paths = []
661+ for item in target :
662+ paths .append (os .path .abspath (item ))
663+ target = paths
664+ Env .AppendUnique (CPPPATH = target )
650665 if 'CPPDEFINES' in group :
651- Env .AppendUnique (CPPDEFINES = group ['CPPDEFINES' ])
666+ target = group ['CPPDEFINES' ]
667+ if _PretreatListParameters (target ) == True :
668+ Env .AppendUnique (CPPDEFINES = target )
652669 if 'LINKFLAGS' in group :
653- Env .AppendUnique (LINKFLAGS = group ['LINKFLAGS' ])
670+ target = group ['LINKFLAGS' ]
671+ if len (target ) > 0 :
672+ Env .AppendUnique (LINKFLAGS = target )
654673 if 'ASFLAGS' in group :
655- Env .AppendUnique (ASFLAGS = group ['ASFLAGS' ])
674+ target = group ['ASFLAGS' ]
675+ if len (target ) > 0 :
676+ Env .AppendUnique (ASFLAGS = target )
656677 if 'LOCAL_CPPPATH' in group :
657678 paths = []
658679 for item in group ['LOCAL_CPPPATH' ]:
@@ -675,9 +696,13 @@ def DefineGroup(name, src, depend, **parameters):
675696 os .unlink (fn )
676697
677698 if 'LIBS' in group :
678- Env .AppendUnique (LIBS = group ['LIBS' ])
699+ target = group ['LIBS' ]
700+ if _PretreatListParameters (target ) == True :
701+ Env .AppendUnique (LIBS = target )
679702 if 'LIBPATH' in group :
680- Env .AppendUnique (LIBPATH = group ['LIBPATH' ])
703+ target = group ['LIBPATH' ]
704+ if _PretreatListParameters (target ) == True :
705+ Env .AppendUnique (LIBPATH = target )
681706
682707 # check whether to build group library
683708 if 'LIBRARY' in group :
0 commit comments