Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_edr_adapter / SConscript
index 4e2fa34..d7da75a 100644 (file)
@@ -1,44 +1,41 @@
 #######################################################
-#      Building BT adapter
+#      Build BT EDR adapter
 #######################################################
 
 Import('env')
+import os.path
 
-print"Reading bt adapter script"
+print "Reading BT EDR adapter script"
 
 target_os = env.get('TARGET_OS')
 
-if target_os == 'tizen':
-    env.ParseConfig("pkg-config --cflags --libs capi-network-bluetooth")
+src_dir = os.path.join(os.curdir, 'bt_edr_adapter')
 
-src_dir = './bt_edr_adapter/'
-
-#Source files to build common for all platforms
+# Source files to build common for all platforms
+common_files = []
 if target_os != 'arduino':
-       env.AppendUnique(CA_SRC=[src_dir+'caedradapter.c'])
-
-#Source files to build in Linux platform
-if target_os == 'linux':
-       env.AppendUnique(CA_SRC=[src_dir+'linux/caedradapter.c',
-                       ])
-
-#Source files to build in Tizen platform
-if target_os == 'tizen':
-       env.PrependUnique(CPPPATH = [src_dir + 'tizen'])
-       env.AppendUnique(CA_SRC=[src_dir+'tizen/caedrclient.c',
-                       src_dir+'tizen/caedrdevicelist.c',
-                       src_dir+'tizen/caedrendpoint.c',
-                       src_dir+'tizen/caedrnwmonitor.c',
-                       src_dir+'tizen/caedrserver.c',
-                       src_dir+'tizen/caedrutils.c',
-                       ])
-
-#Source files to build in Android platform
-if target_os == 'android':
-       env.AppendUnique(CA_SRC=[src_dir+'caedradapter.c',
-                       src_dir+'android/caedrclient.c',
-                       src_dir+'android/caedrutils.c',
-                       src_dir+'android/caedrnwmonitor.c',
-                       src_dir+'android/caedrserver.c',
-                       ])
-
+       common_files = [ os.path.join(src_dir, 'caedradapter.c') ]
+
+# Get list of target-specific source file base names, i.e. no parent
+# directories prepended to the path.
+#
+# Target-specific SConscript files are expected to return that list.
+target_files = []
+target_sconscript = os.path.join(target_os, 'SConscript')
+
+# Check for the existence of the platform-specific SConscript file
+# relative to the top-level source directory, not the build (variant)
+# directory, before calling that SConscript file to prevent a missing
+# file warning platforms that don't provide one.
+target_sconscript_abspath = str(File(target_sconscript).srcnode().abspath)
+if os.path.exists(target_sconscript_abspath):
+        target_files = env.SConscript(target_sconscript, exports='src_dir')
+
+# Now prepend the appropriate parent directories
+# (e.g. ./bt_edr_adapter/linux) to each of the target source files in
+# the list.
+target_files = [ os.path.join(src_dir, target_os, f) for f in target_files ]
+
+# The list of BLE adapter source files is a combination of both the
+# common and target-specific source file lists.
+env.AppendUnique(CA_SRC = common_files + target_files)