forked from tremor-rs/tremor-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
226 lines (187 loc) · 7.87 KB
/
Makefile
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
RELEASE_TARGETS := \
x86_64-unknown-linux-gnu \
# x86_64-unknown-linux-musl \
# x86_64-alpine-linux-musl \
# fails on snmalloc builds currently so disabled
# TODO if we fix this, we don't need the alpine specifc target above for musl builds
# Please keep the RELEASE_FORMATS_* vars here aligned with RELEASE_TARGETS.
#
# For x86_64, packaging built on top of glibc based binaries is our primary
# means of distribution right now. Using musl targets here would give us
# fully static binaries (for easier distribution), but we are seeing up to
# 25% slowdown for some of our benchmarks with musl builds. So we stick with
# gnu builds for now.
#
# The deb packaging is disabled here for now, since we currently make the binary
# for x86_64-unknown-linux-gnu target in a centos7 docker container and binary
# produced there does not easily port to debian (due to the dynamic ssl linking).
# TODO resolve how we want to handle debian package building: either statically
# link openssl from the centos7 image, or separate out binary building for debian
# packaging using debian image itself (might also need to have separate build for
# archive packaging too).
#RELEASE_FORMATS_x86_64-unknown-linux-gnu := archive,deb,rpm
RELEASE_FORMATS_x86_64-unknown-linux-gnu := archive,rpm,deb
RELEASE_FORMATS_x86_64-alpine-linux-musl := archive
RELEASE_FORMATS_x86_64-unknown-linux-musl := archive
help:
@echo "This makefile wraps the tasks:"
@echo " image - build the docker image"
@echo " demo - run a simple demo"
@echo " it - run integration tests"
@echo " bench - run benchmarks"
@echo " builder-image-TARGET - build the (builder) docker image used for building against the specified TARGET"
@echo " builder-images - build all the (builder) docker images used for building against the release targets"
@echo " build-TARGET - build for the specified TARGET"
@echo " builds - build for all the release targets"
@echo " archive-TARGET - package release archive for the specified TARGET"
@echo " archives - package release archive for all the release targets"
@echo " package-TARGET - package (across applicable formats) for the specified TARGET"
@echo " packages - package (across applicable formats) for all the release targets"
###############################################################################
image:
docker-compose build
demo: image
-docker-compose -f demo/demo.yaml rm -fsv
-docker-compose -f demo/demo.yaml up
-docker-compose -f demo/demo.yaml rm -fsv
it-clean:
-find tremor-cli/tests -name '*.log' | xargs rm
it: it-clean
cargo run -p tremor-cli -- test integration tremor-cli/tests
bench: force
cargo build --release -p tremor-cli
./bench/all.sh | tee bench-`date +%s`.txt
force:
true
###############################################################################
docs: library-doc lalrpop-doc
-cp tremor-script/docs/library/index.md docs/library
library-doc:
-rm -rf docs
-mkdir -p docs/library
-TREMOR_PATH=./tremor-script/lib cargo run -p tremor-cli -- doc tremor-script/lib docs/library
lalrpop-docgen:
-git clone https://github.com/licenser/lalrpop lalrpop-docgen
cd lalrpop-docgen && git checkout docgen
lalrpop-doc: lalrpop-docgen
-mkdir docs/language
cd lalrpop-docgen && cargo build --all
lalrpop-docgen/target/debug/lalrpop-docgen \
-rp "./" \
-mp static/language/prolog/ \
-me static/language/epilog/ \
-gc "ModuleFile,Deploy,Query,Script" \
--out-dir docs/language \
tremor-script/src/grammar.lalrpop
if test -f docs/language/grammar.md; then mv docs/language/grammar.md docs/language/EBNF.md; fi
if test -f docs/language/modulefile.md; then mv docs/language/modulefile.md docs/language/module_system.md; fi
lint-lalrpop-doc: lalrpop-docgen
-mkdir docs/language
cd lalrpop-docgen && cargo build --all
lalrpop-docgen/target/debug/lalrpop-docgen \
--lint \
-rp "./" \
-mp static/language/prolog \
-me static/language/epilog \
-gc "ModuleFile,Deploy,Query,Script" \
--out-dir docs/language \
tremor-script/src/grammar.lalrpop
if test -f docs/language/grammar.md; then mv docs/language/grammar.md docs/language/EBNF.md; fi
if test -f docs/language/modulefile.md; then mv docs/language/modulefile.md docs/language/module_system.md; fi
pdf-doc: lalrpop-doc
-mkdir docs/pdf
cd docs && \
echo pandoc --toc -f gfm --verbose \
-F /Users/dennis/.nvm/versions/node/v16.13.0/bin/mermaid-filter \
--pdf-engine /usr/local/texlive/2021/bin/universal-darwin/xelatex \
--variable mainfont="Helvetica" \
--variable sansfont="Courier New" \
--syntax-definition=../tremor.xml \
--syntax-definition=../trickle.xml \
--syntax-definition=../troy.xml \
--syntax-definition=../ebnf.xml \
-V papersize=a4 -V geometry=margin=2cm \
--columns 80 --wrap auto \
--highlight-style=tango --include-in-header ../chapter.tex \
language.md language/full.md language/EBNF.md \
-o pdf/tremor-langauge-reference.pdf
cd docs/library && \
pandoc --toc -f gfm \
--pdf-engine xelatex \
--variable mainfont="Helvetica" \
--variable sansfont="Courier New" \
--highlight-style=haddock \
overview.md \
std.md std/*.md std/time/*.md std/integer/*.md \
tremor.md tremor/*.md \
cncf.md cncf/otel.md \
cncf/otel/span_id.md cncf/otel/trace_id.md \
cncf/otel/logs.md cncf/otel/logs/*.md \
cncf/otel/metrics.md cncf/otel/metrics/*.md \
cncf/otel/trace.md cncf/otel/trace/status.md cncf/otel/trace/status/*.md cncf/otel/trace/spankind.md \
overview.md aggr.md aggr/stats.md aggr/win.md \
-o ../pdf/tremor-library-reference.pdf
chk_copyright:
@./.github/checks/copyright.sh
chk:
@./.github/checks/safety.sh -a
dep-list:
@cargo tree --all | sed -e 's/[^a-z]*\([a-z]\)/\1/' | sort -u
clippy:
touch */src/lib.rs && \
touch src/lib.rs && \
touch */src/main.rs && \
cargo clippy --all
###############################################################################
# eg: builder-image-x86_64-unknown-linux-gnu
builder-image-%:
@echo ""
./packaging/builder-images/build_image.sh $*
builder-images:
make $(foreach target,$(RELEASE_TARGETS),builder-image-$(target))
# eg: build-x86_64-unknown-linux-gnu
build-%:
@echo ""
./packaging/cross_build.sh $*
builds:
make $(foreach target,$(RELEASE_TARGETS),build-$(target))
# eg: archive-x86_64-unknown-linux-gnu
archive-%: build-%
@echo ""
./packaging/run.sh -f archive $*
archives:
make $(foreach target,$(RELEASE_TARGETS),archive-$(target))
# eg: package-x86_64-unknown-linux-gnu
package-%: build-%
@echo ""
@# ensure that we have RELEASE_FORMATS_* var defined here for the provided target
@echo "Packaging for target: $*"
@RELEASE_FORMATS=$(RELEASE_FORMATS_$*); \
if [ -z "$${RELEASE_FORMATS}" ]; then \
echo "Error: Variable RELEASE_FORMATS_$* not set in the Makefile"; \
exit 1; \
fi
@# package applicable formats for the given release target
./packaging/run.sh -f $(RELEASE_FORMATS_$*) $*
packages:
make $(foreach target,$(RELEASE_TARGETS),package-$(target))
###############################################################################
# eg: test-build-x86_64-unknown-linux-gnu
test-build-%:
@echo ""
TREMOR_MODE=debug ./packaging/cross_build.sh $*
# eg: test-package-x86_64-unknown-linux-gnu
test-package-%: test-build-%
@echo ""
@# ensure that we have RELEASE_FORMATS_* var defined here for the provided target
@echo "Packaging for target: $*"
@RELEASE_FORMATS=$(RELEASE_FORMATS_$*); \
if [ -z "$${RELEASE_FORMATS}" ]; then \
echo "Error: Variable RELEASE_FORMATS_$* not set in the Makefile"; \
exit 1; \
fi
@# package applicable formats for the given release target
./packaging/run.sh -d -f $(RELEASE_FORMATS_$*) $*
test-packages:
make $(foreach target,$(RELEASE_TARGETS),test-package-$(target))
###############################################################################