drewry@google.com | bd940e9 | 2009-12-07 19:13:27 +0000 | [diff] [blame] | 1 | # -*- python -*- |
| 2 | |
| 3 | # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
Will Drewry | b551847 | 2009-12-10 12:31:47 -0800 | [diff] [blame] | 7 | import glob |
drewry@google.com | bd940e9 | 2009-12-07 19:13:27 +0000 | [diff] [blame] | 8 | import os |
| 9 | |
| 10 | env = Environment() |
| 11 | |
| 12 | lib_sources = env.Split("""env.cc |
| 13 | interface.cc |
| 14 | minijail.cc |
| 15 | options.cc""") |
| 16 | bin_sources = env.Split("""minijail_main.cc""") |
| 17 | test_sources = env.Split("""minijail_unittest.cc |
| 18 | minijail_testrunner.cc""") |
Will Drewry | b551847 | 2009-12-10 12:31:47 -0800 | [diff] [blame] | 19 | benchmark_sources = glob.glob("*_microbenchmark.cc") |
drewry@google.com | bd940e9 | 2009-12-07 19:13:27 +0000 | [diff] [blame] | 20 | |
| 21 | env.Append( |
| 22 | CPPPATH=['..', '../../third_party/chrome/files', '../../common'], |
| 23 | CCFLAGS=['-g', '-fno-exceptions', '-Wall', '-Werror'], |
| 24 | LIBPATH=['../../third_party/chrome'], |
| 25 | LIBS=['cap', 'base', 'pthread', 'rt'], |
| 26 | ) |
Colin Watson | 3daf602 | 2010-01-07 17:38:39 +0000 | [diff] [blame^] | 27 | for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'): |
| 28 | value = os.environ.get(key) |
| 29 | if value != None: |
| 30 | env[key] = value |
drewry@google.com | bd940e9 | 2009-12-07 19:13:27 +0000 | [diff] [blame] | 31 | |
| 32 | env_lib = env.Clone() |
| 33 | env_lib.SharedLibrary('minijail', lib_sources) |
| 34 | |
| 35 | env_bin = env.Clone() |
| 36 | env_bin.Program('minijail', lib_sources + bin_sources) |
| 37 | |
| 38 | env_test = env.Clone() |
Will Drewry | b551847 | 2009-12-10 12:31:47 -0800 | [diff] [blame] | 39 | env_test.Append(LIBS=['gtest']) |
drewry@google.com | bd940e9 | 2009-12-07 19:13:27 +0000 | [diff] [blame] | 40 | env_test.Program('minijail_unittests', lib_sources + test_sources) |
Will Drewry | b551847 | 2009-12-10 12:31:47 -0800 | [diff] [blame] | 41 | |
| 42 | env_benchmarks = env.Clone() |
| 43 | # Note, LIBS needs to have: 'gtest', 'base', 'rt', 'pthread' |
| 44 | env_benchmarks.Append(LIBS=['microbenchmark_main.a', |
| 45 | # Since we want to run this on a prod image, |
| 46 | # we just statically pull in gtest.a. |
| 47 | File('/usr/lib/libgtest.a')], |
| 48 | LIBPATH=['../microbenchmark']) |
| 49 | env_benchmarks.Program('minijail_benchmarks', benchmark_sources) |