OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import glob | 7 import glob |
8 import os | 8 import os |
9 | 9 |
10 env = Environment() | 10 env = Environment() |
11 | 11 |
12 lib_sources = env.Split("""env.cc | 12 lib_sources = env.Split("""env.cc |
13 interface.cc | 13 interface.cc |
14 minijail.cc | 14 minijail.cc |
15 options.cc""") | 15 options.cc""") |
16 bin_sources = env.Split("""minijail_main.cc""") | 16 bin_sources = env.Split("""minijail_main.cc""") |
17 test_sources = env.Split("""minijail_unittest.cc | 17 test_sources = env.Split("""minijail_unittest.cc |
18 minijail_testrunner.cc""") | 18 minijail_testrunner.cc""") |
19 benchmark_sources = glob.glob("*_microbenchmark.cc") | 19 benchmark_sources = glob.glob("*_microbenchmark.cc") |
20 | 20 |
21 env.Append( | 21 env.Append( |
22 CPPPATH=['..', '../../third_party/chrome/files', '../../common'], | 22 CPPPATH=['..', '../../third_party/chrome/files', '../../common'], |
23 CCFLAGS=['-g', '-fno-exceptions', '-Wall', '-Werror'], | 23 CCFLAGS=['-g', '-fno-exceptions', '-Wall', '-Werror'], |
24 LIBPATH=['../../third_party/chrome'], | 24 LIBPATH=['../../third_party/chrome'], |
25 LIBS=['cap', 'base', 'pthread', 'rt'], | 25 LIBS=['cap', 'base', 'pthread', 'rt'], |
26 ) | 26 ) |
| 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 |
27 | 31 |
28 env_lib = env.Clone() | 32 env_lib = env.Clone() |
29 env_lib.SharedLibrary('minijail', lib_sources) | 33 env_lib.SharedLibrary('minijail', lib_sources) |
30 | 34 |
31 env_bin = env.Clone() | 35 env_bin = env.Clone() |
32 env_bin.Program('minijail', lib_sources + bin_sources) | 36 env_bin.Program('minijail', lib_sources + bin_sources) |
33 | 37 |
34 env_test = env.Clone() | 38 env_test = env.Clone() |
35 env_test.Append(LIBS=['gtest']) | 39 env_test.Append(LIBS=['gtest']) |
36 env_test.Program('minijail_unittests', lib_sources + test_sources) | 40 env_test.Program('minijail_unittests', lib_sources + test_sources) |
37 | 41 |
38 env_benchmarks = env.Clone() | 42 env_benchmarks = env.Clone() |
39 # Note, LIBS needs to have: 'gtest', 'base', 'rt', 'pthread' | 43 # Note, LIBS needs to have: 'gtest', 'base', 'rt', 'pthread' |
40 env_benchmarks.Append(LIBS=['microbenchmark_main.a', | 44 env_benchmarks.Append(LIBS=['microbenchmark_main.a', |
41 # Since we want to run this on a prod image, | 45 # Since we want to run this on a prod image, |
42 # we just statically pull in gtest.a. | 46 # we just statically pull in gtest.a. |
43 File('/usr/lib/libgtest.a')], | 47 File('/usr/lib/libgtest.a')], |
44 LIBPATH=['../microbenchmark']) | 48 LIBPATH=['../microbenchmark']) |
45 env_benchmarks.Program('minijail_benchmarks', benchmark_sources) | 49 env_benchmarks.Program('minijail_benchmarks', benchmark_sources) |
OLD | NEW |