1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Creates build.ninja. Crawls dynamic dependencies.
|
4 | #
|
5 | # Usage:
|
6 | # ./NINJA-config.sh
|
7 |
|
8 | set -o nounset
|
9 | set -o pipefail
|
10 | set -o errexit
|
11 |
|
12 | source build/dev-shell.sh # python2 in $PATH
|
13 | source build/dynamic-deps.sh # py-tool, etc
|
14 |
|
15 | PY_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 |
|
28 | # Translated
|
29 | TRANSLATED=(
|
30 | # These only have one file, so we don't need deps
|
31 | #bin.hello
|
32 | #bin.hello_mylib
|
33 |
|
34 | bin.oils_for_unix
|
35 | mycpp.examples.parse
|
36 | )
|
37 |
|
38 | # These special cases should go away
|
39 | TRANSLATED_2=(
|
40 | yaks.yaks_main # Experimental IR to C++ translator
|
41 | bin.osh_parse
|
42 | bin.osh_eval
|
43 | )
|
44 |
|
45 | # A binary looks like this:
|
46 | #
|
47 | # bin/
|
48 | # hello.py # no preamble
|
49 | # # uses build/default.{typecheck,translate}-filter.txt
|
50 | # oils_for_unix.py
|
51 | # oils_for_unix_preamble.h
|
52 | # oils_for_unix.typecheck-filter.txt
|
53 | # oils_for_unix.translate-filter.txt
|
54 | # mycpp/
|
55 | # examples/
|
56 | # parse.py
|
57 | # parse_preamble.h
|
58 | # # TODO: {translate,typecheck}-filter
|
59 |
|
60 | # Supporting files:
|
61 | #
|
62 | # _build/NINJA/ # Part of the Ninja graph
|
63 | # asdl.asdl_main/
|
64 | # all-pairs.txt
|
65 | # deps.txt
|
66 | # bin.hello/
|
67 | # all-pairs.txt
|
68 | # typecheck.txt
|
69 | # translate.txt
|
70 | # bin.oils_for_unix/
|
71 | # all-pairs.txt
|
72 | # typecheck.txt
|
73 | # translate.txt
|
74 | #
|
75 | # Related:
|
76 | # prebuilt/
|
77 | # ninja/
|
78 | # mycpp.mycpp_main/
|
79 | # pea.pea_main/
|
80 |
|
81 | main() {
|
82 | mkdir -p _build/NINJA
|
83 |
|
84 | # Implicit dependencies for tools
|
85 | for mod in "${PY_TOOL[@]}"; do
|
86 | py-tool $mod
|
87 | done
|
88 |
|
89 | # Use filters next to the binary, or the defaults
|
90 | for mod in "${TRANSLATED[@]}"; do
|
91 | typecheck-translate $mod
|
92 | done
|
93 |
|
94 | # Legacy: use Oils
|
95 | for mod in "${TRANSLATED_2[@]}"; do
|
96 | typecheck-translate $mod \
|
97 | bin/oils_for_unix.typecheck-filter.txt \
|
98 | bin/oils_for_unix.translate-filter.txt
|
99 | done
|
100 |
|
101 | echo DEPS prebuilt/ninja/*/deps.txt
|
102 | echo
|
103 |
|
104 | # Reads the deps.txt files above
|
105 | PYTHONPATH=. build/ninja_main.py
|
106 | }
|
107 |
|
108 | main "$@"
|