aboutsummaryrefslogtreecommitdiff
path: root/drivers/base/ump/src/sconscript
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/ump/src/sconscript')
-rwxr-xr-xdrivers/base/ump/src/sconscript80
1 files changed, 80 insertions, 0 deletions
diff --git a/drivers/base/ump/src/sconscript b/drivers/base/ump/src/sconscript
new file mode 100755
index 00000000000..b493738ce63
--- /dev/null
+++ b/drivers/base/ump/src/sconscript
@@ -0,0 +1,80 @@
+#
+# (C) COPYRIGHT 2010-2012 ARM Limited. All rights reserved.
+#
+# This program is free software and is provided to you under the terms of the
+# GNU General Public License version 2 as published by the Free Software
+# Foundation, and any use by you of this program is subject to the terms
+# of such GNU licence.
+#
+# A copy of the licence is included with the program, and can also be obtained
+# from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+#
+
+
+import os
+import re
+Import('env')
+
+# Clone the environment so changes don't affect other build files
+env_ump = env.Clone()
+
+if env_ump['v'] != '1':
+ env_ump['MAKECOMSTR'] = '[MAKE] ${SOURCE.dir}'
+
+# Source files required for UMP.
+ump_src = [Glob('#kernel/drivers/base/ump/src/linux/*.c'), Glob('#kernel/drivers/base/ump/src/common/*.c'), Glob('#kernel/drivers/base/ump/src/imports/*/*.c')]
+
+env_ump.Append( CPPPATH='#kernel/drivers/base/ump/src/' )
+
+# Note: cleaning via the Linux kernel build system does not yet work
+if env_ump.GetOption('clean') :
+ makeAction=Action("cd ${SOURCE.dir}/.. && make clean", '$MAKECOMSTR')
+else:
+ if env['arch'] == 'x86_32' :
+ env_ump['arch_linux'] = 'x86'
+ elif 'arm' in env['arch']:
+ env_ump['arch_linux'] = 'arm'
+ else:
+ env_ump['arch_linux'] = env['arch']
+ if env['unit'] == '1':
+ makeAction=Action("cd ${SOURCE.dir}/.. && make ARCH=$arch_linux MALI_UNIT_TEST=${unit} PLATFORM=${platform} %s && cp ump.ko $STATIC_LIB_PATH/ump.ko" % env.kernel_get_config_defines(), '$MAKECOMSTR')
+ else:
+ makeAction=Action("cd ${SOURCE.dir}/.. && make ARCH=$arch_linux PLATFORM=${platform} %s && cp ump.ko $STATIC_LIB_PATH/ump.ko" % env.kernel_get_config_defines(), '$MAKECOMSTR')
+# The target is ump.ko, built from the source in ump_src, via the action makeAction
+# ump.ko will be copied to $STATIC_LIB_PATH after being built by the standard Linux
+# kernel build system, after which it can be installed to the directory specified if
+# "libs_install" is set; this is done by LibTarget.
+cmd = env_ump.Command('$STATIC_LIB_PATH/ump.ko', ump_src, [makeAction])
+
+if env['unit'] == '1':
+ env.Depends('$STATIC_LIB_PATH/ump.ko', '$STATIC_LIB_PATH/libosk.a')
+
+# Add a dependency on kds.ko.
+# Only necessary when KDS is not built into the kernel.
+#
+linux_config_file = os.path.normpath(os.environ['KDIR']) + '/.config'
+search_term = '^[\ ]*CONFIG_KDS[\ ]*=[\ ]*y'
+kds_in_kernel = 0
+for line in open(linux_config_file, 'r'):
+ if re.search(search_term, line):
+ # KDS in kernel.
+ kds_in_kernel = 1
+if not kds_in_kernel:
+ env.Depends('$STATIC_LIB_PATH/ump.ko', '$STATIC_LIB_PATH/kds.ko')
+
+# Until we fathom out how the invoke the Linux build system to clean, we can use Clean
+# to remove generated files.
+
+patterns = ['*.mod.c', '*.o', '*.ko', '*.a', '.*.cmd', 'modules.order', '.tmp_versions', 'Module.symvers']
+
+for p in patterns:
+ Clean(cmd, Glob('#kernel/drivers/base/ump/src/common/%s' % p))
+ Clean(cmd, Glob('#kernel/drivers/base/ump/src/linux/%s' % p))
+ Clean(cmd, Glob('#kernel/drivers/base/ump/src/%s' % p))
+
+env_ump.ProgTarget('ump', cmd)
+
+SConscript( 'imports/sconscript' )
+