Clean Arduino build intermediate files
authorCaiwen Zhang <caiwen.zhang@intel.com>
Wed, 25 Mar 2015 03:50:44 +0000 (11:50 +0800)
committerErich Keane <erich.keane@intel.com>
Mon, 30 Mar 2015 17:01:54 +0000 (17:01 +0000)
1) Remove .d files
2) Remove .map file

Change-Id: I866c5542b4bc51f48841588a3a1f880b18439a61
Signed-off-by: Caiwen Zhang<caiwen.zhang@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/569
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
build_common/arduino/SConscript
resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript

index f24da8b..d635a66 100644 (file)
@@ -221,7 +221,7 @@ else:
 # Get IDE version
 if os.path.exists(arduino_home + '/lib/version.txt'):
        vf = open(arduino_home + '/lib/version.txt', 'r')
-       version = vf.readline().replace('.', '')
+       version = vf.readline().replace('.', '').strip()
 else:
        print '''
 ************************************* Error ***********************************
@@ -391,6 +391,12 @@ else:
                env.AppendUnique(LIBS = 'm')
        env.Replace(ARCOM = '$AR ' + platform_info.get('compiler.ar.flags') + ' $TARGET $SOURCES')
 
+# Make sure the .d files are removed when clean the build
+if env.GetOption('clean'):
+       dfs = __search_files(env.get('BUILD_DIR'), '*.d')
+       for df in dfs:
+               Execute(Delete(df))
+
 env.AddMethod(__import_lib, "ImportLib") #import arduino library
 env.AddMethod(__build_core, "BuildCore") #build arduino core
 env.AddMethod(__create_bin, "CreateBin") #create binary files(.eep and .hex)
index 0d37077..613087e 100644 (file)
@@ -24,5 +24,8 @@ if env.get('NET') == 'Wifi':
 arduino_simplecs = arduino_simplecs_env.Program('SimpleClientServer', 'ocserver.cpp')
 env.CreateBin('SimpleClientServer')
 
+#The map file is intermediate file, make sure it's removed when clean build
+arduino_simplecs_env.Clean(arduino_simplecs, 'SimpleClientServer.map')
+
 Alias('arduino_simplecs', arduino_simplecs)
 env.AppendTarget('arduino_simplecs')