-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
112 lines (95 loc) · 4.22 KB
/
Makefile
File metadata and controls
112 lines (95 loc) · 4.22 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
# Meshcore-Linux — Phase D build.
#
# make # build ./meshcore-linux
# make run # build and run against ./config/config.example.json
# make clean
#
# Compiles upstream MeshCore core (Mesh/Dispatcher/Identity/Packet/Utils)
# directly from ../MeshCore/src plus the rweather/Crypto and ed25519 libs
# from the MeshCore PlatformIO libdeps cache. No vendoring: meshcore-linux
# references the upstream tree in place.
CXX ?= g++
CXXFLAGS ?= -std=c++17 -O2 -Wall -Wextra
# MANDATORY flags must survive whatever CXXFLAGS the environment passes
# (dpkg-buildpackage overrides CXXFLAGS with hardening defaults and would
# otherwise strip our -include shims/Arduino.h, which the Arduino-API
# upstream sources cannot compile without). Always appended via `override`.
override CXXFLAGS += \
-Wno-unused-parameter -Wno-reorder-ctor -Wno-unused-result -Wno-sign-compare \
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 \
-DMAX_CLIENTS=32 -DMAX_NEIGHBOURS=32 \
-include cstddef -include cstdint -include cstring -include cstdio \
-include shims/Arduino.h -include shims/FS.h \
-Ishims \
-Ithird_party \
-I../MeshCore/src \
-I../MeshCore/lib/ed25519 \
-I../MeshCore/.pio/libdeps/Heltec_v3_repeater/Crypto
LDFLAGS ?= -pthread
# ── Our own source ───────────────────────────────────────────────────
LINUX_SRC := \
src/main.cpp \
src/LinuxTcpRadio.cpp \
src/LinuxRepeaterMesh.cpp \
src/ConfigServer.cpp \
shims/RNGStub.cpp
# ── MeshCore upstream core (compiled in-place, no vendoring) ─────────
MC := ../MeshCore/src
MESHCORE_SRC := \
$(MC)/Utils.cpp \
$(MC)/Mesh.cpp \
$(MC)/Dispatcher.cpp \
$(MC)/Identity.cpp \
$(MC)/Packet.cpp \
$(MC)/helpers/AdvertDataHelpers.cpp \
$(MC)/helpers/BaseChatMesh.cpp \
$(MC)/helpers/ClientACL.cpp \
$(MC)/helpers/CommonCLI.cpp \
$(MC)/helpers/IdentityStore.cpp \
$(MC)/helpers/RegionMap.cpp \
$(MC)/helpers/StaticPoolPacketManager.cpp \
$(MC)/helpers/TransportKeyStore.cpp \
$(MC)/helpers/TxtDataHelpers.cpp
# CayenneLPP — used by SensorManager (we stub it out but the compile path
# still pulls in the header from MeshCore code).
CLPP := ../MeshCore/.pio/libdeps/Heltec_v3_repeater/CayenneLPP/src
CLPP_SRC := $(CLPP)/CayenneLPP.cpp $(CLPP)/CayenneLPPPolyline.cpp
# ── rweather/Crypto — vendored via PlatformIO libdeps cache ──────────
CRYPTO := ../MeshCore/.pio/libdeps/Heltec_v3_repeater/Crypto
CRYPTO_SRC := \
$(CRYPTO)/AES128.cpp $(CRYPTO)/AES256.cpp $(CRYPTO)/AESCommon.cpp \
$(CRYPTO)/Ed25519.cpp $(CRYPTO)/SHA256.cpp $(CRYPTO)/SHA512.cpp \
$(CRYPTO)/Curve25519.cpp $(CRYPTO)/BigNumberUtil.cpp \
$(CRYPTO)/Hash.cpp $(CRYPTO)/Crypto.cpp \
$(CRYPTO)/BLAKE2s.cpp \
$(CRYPTO)/Cipher.cpp $(CRYPTO)/BlockCipher.cpp \
$(CRYPTO)/NoiseSource.cpp
# ── ed25519 reference C impl from MeshCore/lib/ ──────────────────────
ED := ../MeshCore/lib/ed25519
ED_SRC := \
$(ED)/add_scalar.c $(ED)/fe.c $(ED)/ge.c $(ED)/key_exchange.c \
$(ED)/keypair.c $(ED)/sc.c $(ED)/seed.c $(ED)/sha512.c \
$(ED)/sign.c $(ED)/verify.c
BIN := meshcore-linux
all: $(BIN)
$(BIN): $(LINUX_SRC) $(MESHCORE_SRC) $(CRYPTO_SRC) $(ED_SRC) $(CLPP_SRC)
$(CXX) $(CXXFLAGS) $(CXXFLAGS_EXTRA) -I$(CLPP) $^ -o $@ $(LDFLAGS)
run: $(BIN)
./$(BIN) config/config.example.json
clean:
rm -f $(BIN) tests/test_pymc_proto tests/captured_tx.hex tests/mock_modem.log tests/binary.log
rm -rf tests/.interop_state
# Pure C++ unit tests for the wire-protocol layer (pymc_proto.h).
# No MeshCore deps — fast, hermetic, runs in CI without ../MeshCore.
TEST_BIN := tests/test_pymc_proto
$(TEST_BIN): tests/test_pymc_proto.cpp src/pymc_proto.h
$(CXX) -std=c++17 -Wall -Wextra -Wno-unused-parameter -Isrc \
tests/test_pymc_proto.cpp -o $(TEST_BIN)
test: $(TEST_BIN)
$(TEST_BIN)
# Software-side interop test. Needs $(BIN) built; spins
# up the Python mock modem, drives the binary via /api/command, verifies
# the captured on-air bytes parse as a valid signed MeshCore advert.
interop: $(BIN)
bash tests/run_interop.sh
.PHONY: all run clean test interop