-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
228 lines (168 loc) · 7.12 KB
/
Copy pathMakefile
File metadata and controls
228 lines (168 loc) · 7.12 KB
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
227
228
# PON-BEAM — Makefile
#
# Comandos principais:
# make build-stock Compila OTP 30 stock (baseline) — worktree otp-stock
# make build-pon Compila OTP com PON-BEAM — otp/ (branch pon-beam)
# make build-all Compila ambos
# make emulator-stock Recompila só a VM stock (rápido, ~1-3 min)
# make emulator-pon Recompila só a VM PON (rápido, ~1-3 min)
# make benchmark Roda harness completo
# make benchmark-fase1 Roda só fase 1
# make benchmark-list Lista benchmarks
# make report Abre último diff report
# make status Mostra estado do repositório
# make clean Limpa artefatos de build
#
# Debug harness (instrumentação do ERTS):
# make debug-build-asan|ubsan|tsan Compila ERTS PON + sanitizer
# make debug-smoke Smoke suite sob sanitizer (halt-on-error)
# make debug-perf Profile perf + flamegraph
# make debug-probes / debug-wakeup uprobes pon_* / bpftrace
# make debug-rr / debug-replay Record/Replay determinístico (rr)
# make debug-core CORE=arquivo Backtrace gdb de core dump
# make debug-cppcheck / debug-scan-build / debug-static
# make debug-all Pipeline completo (build+smoke+static)
SHELL = /bin/bash
OTP_DIR = otp
OTP_STOCK_DIR = /home/sanonichan/projetos/otp-stock
HARNESS_DIR = harness
PREFIX_STOCK = /opt/erlang-30-stock
PREFIX_PON = $(HOME)/erlang-30-pon
BUILD_OPTS = --without-javac --without-odbc --without-wx
MAKE_OPTS = -j$$(nproc)
ERL_TOP_PON = $(shell pwd)/$(OTP_DIR)
.PHONY: all build-stock build-pon build-pon-clean build-pon-debug build-all benchmark benchmark-fair benchmark-list report status clean emulator-stock emulator-pon docker-build bench-docker bench-docker-run bench-docker-copy verify-tla verify-proper verify-c verify-all debug-build-asan debug-build-ubsan debug-build-tsan debug-build debug-smoke debug-perf debug-probes debug-wakeup debug-rr debug-replay debug-core debug-cppcheck debug-scan-build debug-static debug-all
all: build-stock build-pon
## === Build (primeira vez, ~30 min cada) ===
build-stock:
@echo "=== Compilando OTP 30 stock (baseline) em $(OTP_STOCK_DIR) ==="
cd $(OTP_STOCK_DIR) && ./configure $(BUILD_OPTS) --prefix=$(PREFIX_STOCK) && make $(MAKE_OPTS) && make install
build-pon:
@echo "=== Compilando OTP 30 com PON-BEAM em $(OTP_DIR) (incremental) ==="
cd $(OTP_DIR) && ./configure $(BUILD_OPTS) --prefix=$(PREFIX_PON) --enable-pon-beam CFLAGS="-O2 -g -DPON_BEAM" && make $(MAKE_OPTS) && make install
build-pon-clean:
@echo "=== Compilando OTP 30 com PON-BEAM em $(OTP_DIR) (clean + full rebuild) ==="
cd $(OTP_DIR) && make clean && ./configure $(BUILD_OPTS) --prefix=$(PREFIX_PON) --enable-pon-beam CFLAGS="-O2 -g -DPON_BEAM" && make $(MAKE_OPTS) && make install
build-pon-debug:
@echo "=== Compilando OTP 30 com PON-BEAM (debug) ==="
cd $(OTP_DIR) && ./configure $(BUILD_OPTS) --prefix=$(PREFIX_PON)-debug --enable-pon-beam CFLAGS="-DPON_BEAM_DEBUG -g -O0" && make $(MAKE_OPTS) && make install
build-all: build-stock build-pon
build:
@echo "Uso: make build-stock | make build-pon | make build-pon-debug | make build-all"
## === Iteração rápida (só o emulador C, precisa de build completo antes) ===
emulator-stock:
@echo "=== Recompilando só a VM stock em $(OTP_STOCK_DIR) ==="
cd $(OTP_STOCK_DIR)/otp/erts/emulator && make $(MAKE_OPTS)
cd $(OTP_STOCK_DIR)/otp && make install
emulator-pon:
@echo "=== Recompilando só a VM PON em $(OTP_DIR) ==="
cd $(OTP_DIR)/erts/emulator && \
ERL_TOP=$(ERL_TOP_PON) \
PATH=$(ERL_TOP_PON)/bootstrap/bin:$$PATH \
make $(MAKE_OPTS) opt
cd $(OTP_DIR) && \
ERL_TOP=$(ERL_TOP_PON) \
PATH=$(ERL_TOP_PON)/bootstrap/bin:$$PATH \
make install
## === Benchmarks ===
benchmark:
cd $(HARNESS_DIR) && ./run.sh
benchmark-fase%:
cd $(HARNESS_DIR) && ./run.sh --fase=$*
benchmark-only-%:
cd $(HARNESS_DIR) && ./run.sh --only=$*
benchmark-fair:
cd $(HARNESS_DIR) && ./run.sh --only=fair
benchmark-smp:
cd $(HARNESS_DIR) && ./run.sh --smp
benchmark-fair-smp:
cd $(HARNESS_DIR) && ./run.sh --only=fair --smp
benchmark-list:
cd $(HARNESS_DIR) && ./run.sh --list
report:
open harness/results/latest/diff/index.html 2>/dev/null || xdg-open harness/results/latest/diff/index.html 2>/dev/null || echo "Relatório: harness/results/latest/diff/index.html"
## === Debug Harness (harness/debug) ===
DEBUG_H = harness/debug
debug-build-asan:
$(DEBUG_H)/run.sh build-asan
debug-build-ubsan:
$(DEBUG_H)/run.sh build-ubsan
debug-build-tsan:
$(DEBUG_H)/run.sh build-tsan
debug-build: debug-build-asan debug-build-ubsan debug-build-tsan
@echo "=== Todos os ERTS instrumentados (asan/ubsan/tsan) prontos ==="
debug-smoke:
$(DEBUG_H)/run.sh smoke asan
debug-perf:
$(DEBUG_H)/run.sh perf
debug-probes:
$(DEBUG_H)/run.sh probes
debug-wakeup:
$(DEBUG_H)/run.sh wakeup
debug-rr:
$(DEBUG_H)/run.sh rr
debug-replay:
$(DEBUG_H)/run.sh replay
debug-core:
$(DEBUG_H)/run.sh core $(CORE)
debug-cppcheck:
$(DEBUG_H)/run.sh cppcheck
debug-scan-build:
$(DEBUG_H)/run.sh scan-build
debug-static: debug-cppcheck debug-scan-build
debug-all: debug-build debug-smoke debug-static
@echo "=== Debug harness: pipeline completo concluído ==="
## === Docker ===
DOCKER_IMAGE = pon-beam-bench
DOCKER_CONTAINER = pon-beam-results
RESULTS_DOCKER = harness/results/docker
docker-build:
@echo "=== Buildando imagem Docker (OTP30 stock + PON-BEAM, ~30 min) ==="
docker build --no-cache -f docker/Dockerfile -t $(DOCKER_IMAGE) .
bench-docker-run:
@echo "=== Rodando benchmarks dentro do container ==="
docker run --name $(DOCKER_CONTAINER) $(DOCKER_IMAGE)
bench-docker-copy:
@echo "=== Copiando resultados para $(RESULTS_DOCKER)/ ==="
rm -rf $(RESULTS_DOCKER)
docker cp $(DOCKER_CONTAINER):/pon-beam/harness/results/latest/. $(RESULTS_DOCKER)/
@echo "Relatório: $(RESULTS_DOCKER)/diff/index.html"
bench-docker: bench-docker-run bench-docker-copy
## === Livro PON-BEAM ===
BOOK_DIR = book
book-build:
@echo "=== Gerando site HTML do livro PON-BEAM ==="
python3 $(BOOK_DIR)/build.py
book-open:
@echo "=== Abrindo livro PON-BEAM ==="
open $(BOOK_DIR)/output/index.html 2>/dev/null || xdg-open $(BOOK_DIR)/output/index.html 2>/dev/null || echo "Índice: $(BOOK_DIR)/output/index.html"
book-clean:
rm -rf $(BOOK_DIR)/output
## === Utilitários ===
status:
@echo "=== Git status ==="
git status
@echo ""
@echo "=== Branch ==="
git branch
@echo ""
@echo "=== OTP version ==="
cat $(OTP_DIR)/OTP_VERSION
## === Verificação Formal ===
verify-tla:
@echo "=== [Pilar 1] Verificação de Modelos TLA+ ==="
./formal/tla/run_tlc.sh
verify-proper:
@echo "=== [Pilar 4] Property-Based Testing (PropEr) ==="
./formal/proper/run_proper.sh
verify-c:
@echo "=== [Pilar 3] Análise Estática de Código C (Frama-C / ACSL) ==="
./formal/framac/run_framac.sh
verify-all: verify-tla verify-proper verify-c
@echo "=== Toda a suíte de verificação formal concluída com sucesso! ==="
clean:
cd $(OTP_DIR) && git checkout . && git clean -fd
rm -rf $(HARNESS_DIR)/results
rm -f $(HARNESS_DIR)/benchmarks/*.beam
rm -f $(HARNESS_DIR)/benchmarks/lib/*.beam
rm -f $(HARNESS_DIR)/benchmarks/pon_experiments/*.beam