OILS / NINJA-config.sh View on Github | oils.pub

101 lines, 37 significant
1#!/usr/bin/env bash
2#
3# Creates build.ninja. Crawls dynamic dependencies.
4#
5# Usage:
6# ./NINJA-config.sh
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12source build/dev-shell.sh # python2 in $PATH
13source build/dynamic-deps.sh # py-tool, etc
14
15PY_TOOL=(
16 asdl.asdl_main
17 core.optview_gen
18 frontend.consts_gen
19 frontend.flag_gen
20 frontend.lexer_gen
21 frontend.option_gen
22 ysh.grammar_gen
23 osh.arith_parse_gen
24 frontend.signal_gen
25 cpp.embedded_file_gen
26
27 # translated
28 bin.hello
29)
30
31BIN=(
32 yaks.yaks_main # Experimental IR to C++ translator
33 bin.osh_parse
34 bin.osh_eval
35 bin.oils_for_unix
36)
37
38# Create a dir structure htat looks like this:
39
40# _build/NINJA/ # Part of the Ninja graph
41# asdl.asdl_main/
42# all-pairs.txt
43# deps.txt
44# bin.hello/
45# all-pairs.txt
46# deps.txt
47# bin.oils_for_unix/
48# all-pairs.txt
49# typecheck.txt # special case
50# deps.txt
51#
52# Related:
53# prebuilt/
54# ninja/
55# mycpp.mycpp_main/
56# dynamic-deps/
57# filter-py-tool
58# mycpp/
59# examples/
60# parse.translate.txt
61# parse.typecheck.txt
62#
63# Should be parse.typecheck.txt and parse.deps.txt
64#
65# New structure
66# bin/
67# oils_for_unix.py
68# oils_for_unix_preamble.h
69# oils_for_unix.typecheck-filter.txt
70# oils_for_unix.deps-filter.txt
71# mycpp/
72# examples/
73# parse.py
74# parse_preamble.h
75# parse.deps-filter.txt
76#
77# All of these are optional, except deps-filter?
78# The default deps-filter can be in prebuilt/ perhaps
79
80main() {
81 mkdir -p _build/NINJA
82
83 # Implicit dependencies for tools
84 for mod in "${PY_TOOL[@]}"; do
85 py-tool $mod
86 done
87
88 # Explicit dependencies for translating and type checking
89 # Baked into mycpp/NINJA.
90 for mod in "${BIN[@]}"; do
91 typecheck-translate $mod
92 done
93
94 echo DEPS prebuilt/ninja/*/deps.txt
95 echo
96
97 # Reads the deps.txt files above
98 PYTHONPATH=. build/ninja_main.py
99}
100
101main "$@"