Skip to content

Commit

Permalink
Update build script to include examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Martinho Fernandes committed Jan 24, 2014
1 parent ab719a2 commit 85a6c32
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_files(root, pattern):
yield os.path.join(dir, f)

def object_file(fn):
return os.path.join('obj', re.sub(r'\.c\+\+', '.o', fn))
return os.path.join('obj', re.sub(r'\.c\+\+$', '.o', fn))

# --- arguments

Expand Down Expand Up @@ -114,6 +114,24 @@ def object_file(fn):
ninja.build('dist', 'phony',
inputs = tar)

# --- examples

example_files = list(get_files('examples', '*.c++'))
examples = []
for fn in example_files:
ninja.build(object_file(fn), 'cxx',
inputs = fn)
name = re.sub(r'\.c\+\+$', '', os.path.basename(fn))
example = os.path.join('bin', 'examples', name)
ninja.build(example, 'link',
inputs = [object_file(fn), libnonius])
ninja.build(name, 'phony',
inputs = example)
examples += [name]

ninja.build('examples', 'phony',
inputs = examples)

# --- default targets

ninja.default('lib')
Expand Down

0 comments on commit 85a6c32

Please sign in to comment.