forked from oils-for-unix/oils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NINJA-config.sh
executable file
·137 lines (105 loc) · 2.97 KB
/
NINJA-config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
#
# Creates build.ninja. Crawls dynamic dependencies.
#
# Usage:
# ./NINJA-config.sh
set -o nounset
set -o pipefail
set -o errexit
source build/dev-shell.sh # python2 in $PATH
source build/dynamic-deps.sh # py-tool, etc
asdl-main() { py-tool asdl.asdl_main; }
optview-gen() { py-tool core.optview_gen; }
consts-gen() { py-tool frontend.consts_gen; }
flag-gen() { py-tool frontend.flag_gen; }
lexer-gen() { py-tool frontend.lexer_gen; }
option-gen() { py-tool frontend.option_gen; }
grammar-gen() { py-tool ysh.grammar_gen; }
arith-parse-gen() { py-tool osh.arith_parse_gen; }
signal-gen() { py-tool frontend.signal_gen; }
embedded-file-gen() { py-tool cpp.embedded_file_gen; }
osh-eval() {
### Old binary
local dir=$DIR/bin.osh_eval
mkdir -p $dir
PYTHONPATH=$PY_PATH /usr/bin/env python2 \
build/dynamic_deps.py py-manifest bin.osh_eval \
> $dir/all.txt
set +o errexit
cat $dir/all.txt | repo-filter | exclude-filter typecheck | mysort \
> $dir/typecheck.txt
cat $dir/typecheck.txt | exclude-filter translate | mysort \
> $dir/translate.txt
echo DEPS $dir/*
}
oils-for-unix() {
### The main binary
local dir=$DIR/bin.oils_for_unix
mkdir -p $dir
PYTHONPATH=$PY_PATH /usr/bin/env python2 \
build/dynamic_deps.py py-manifest bin.oils_for_unix \
> $dir/all.txt
set +o errexit
cat $dir/all.txt | repo-filter | exclude-filter typecheck | mysort \
> $dir/typecheck.txt
cat $dir/typecheck.txt | exclude-filter translate | mysort \
> $dir/translate.txt
echo DEPS $dir/*
}
# TODO: Prune deps
# j8.py depends on vm.HeapValueId() for cycle detection
# But that's in the JSON8 PRINTER, which yaks doesn't need
# vm.py depends on cmd_eval.py and a whole bunch of other stuff
#
# Well I guess you can create a cycle in nil8, especially if we have <- and so
# forth.
#
# So that function should go in another file.
yaks() {
### Experimental IR to C++ translator
local dir=$DIR/yaks.yaks_main
mkdir -p $dir
PYTHONPATH=$PY_PATH /usr/bin/env python2 \
build/dynamic_deps.py py-manifest yaks.yaks_main \
> $dir/all.txt
set +o errexit
cat $dir/all.txt | repo-filter | exclude-filter typecheck | mysort \
> $dir/typecheck.txt
cat $dir/typecheck.txt | exclude-filter translate | mysort \
> $dir/translate.txt
echo DEPS $dir/*
}
main() {
# _build/NINJA/ # Part of the Ninja graph
# asdl.asdl_main/
# all-pairs.txt
# deps.txt
# osh_eval/
# typecheck.txt
# translate.txt
mkdir -p _build/NINJA
# Implicit dependencies for tools
asdl-main
optview-gen
consts-gen
flag-gen
lexer-gen
option-gen
grammar-gen
arith-parse-gen
signal-gen
embedded-file-gen
# Explicit dependencies for translating and type checking
# Baked into mycpp/NINJA.
osh-eval
oils-for-unix
yaks
echo DEPS prebuilt/ninja/*/deps.txt
echo
# Special _OIL_DEV for -D GC_TIMING
_OIL_DEV=1 ./configure
# Reads the deps.txt files above
PYTHONPATH=. build/ninja_main.py
}
main "$@"