diff options
Diffstat (limited to 'src/Makefile')
| -rw-r--r-- | src/Makefile | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/src/Makefile b/src/Makefile index ab0b307..c997ae3 100644 --- a/src/Makefile +++ b/src/Makefile | |||
| @@ -6,7 +6,9 @@ FUZZ_CXX ?= clang++ | |||
| 6 | 6 | ||
| 7 | SECP_INC ?= /usr/local/include | 7 | SECP_INC ?= /usr/local/include |
| 8 | SECP_LIB ?= /usr/local/lib | 8 | SECP_LIB ?= /usr/local/lib |
| 9 | RANDOMX_DIR ?= $(HOME)/RandomX | 9 | # The root Makefile exports RANDOMX_DIR (default: <repo>/randomx-build, built |
| 10 | # by deps-randomx). This fallback only applies when src/ is built standalone. | ||
| 11 | RANDOMX_DIR ?= $(abspath $(CURDIR)/..)/randomx-build | ||
| 10 | 12 | ||
| 11 | IMGUI_DIR = imgui | 13 | IMGUI_DIR = imgui |
| 12 | 14 | ||
| @@ -52,17 +54,18 @@ LIBS = -L$(SECP_LIB) -lsecp256k1 \ | |||
| 52 | # binary. Nothing crashed here, and nothing would say so if it had. | 54 | # binary. Nothing crashed here, and nothing would say so if it had. |
| 53 | HEADERS = headers_core.h headers.h util.h main.h serialize.h uint256.h \ | 55 | HEADERS = headers_core.h headers.h util.h main.h serialize.h uint256.h \ |
| 54 | key.h bignum.h script.h db.h base58.h net.h nostr.h \ | 56 | key.h bignum.h script.h db.h base58.h net.h nostr.h \ |
| 55 | randomx_pow.h btfaddr.h btfchan.h btfrv.h btftunnel.h market.h \ | 57 | randomx_pow.h btfaddr.h btfchan.h btfrv.h btftunnel.h \ |
| 56 | selftest.h walletcmd.h wallet_sqlite.h compat.h sockcount.h proxy.h tor.h font_roboto.h | 58 | selftest.h walletcmd.h wallet_sqlite.h compat.h sockcount.h proxy.h tor.h font_roboto.h \ |
| 59 | compactblock.h | ||
| 57 | 60 | ||
| 58 | IMGUI_OBJS = obj/imgui.o obj/imgui_draw.o obj/imgui_tables.o \ | 61 | IMGUI_OBJS = obj/imgui.o obj/imgui_draw.o obj/imgui_tables.o \ |
| 59 | obj/imgui_widgets.o obj/imgui_impl_glfw.o obj/imgui_impl_opengl3.o | 62 | obj/imgui_widgets.o obj/imgui_impl_glfw.o obj/imgui_impl_opengl3.o |
| 60 | 63 | ||
| 61 | NODE_OBJS = obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \ | 64 | NODE_OBJS = obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \ |
| 62 | obj/market.o obj/sha.o obj/nostr.o obj/randomx_pow.o \ | 65 | obj/sha.o obj/nostr.o obj/randomx_pow.o \ |
| 63 | obj/btfaddr.o obj/btfchan.o obj/btfrv.o obj/btftunnel.o obj/rpc.o \ | 66 | obj/btfaddr.o obj/btfchan.o obj/btfrv.o obj/btftunnel.o obj/rpc.o \ |
| 64 | obj/selftest.o obj/bip32.o obj/walletcmd.o obj/wallet_sqlite.o \ | 67 | obj/selftest.o obj/bip32.o obj/walletcmd.o obj/wallet_sqlite.o \ |
| 65 | obj/proxy.o obj/tor.o | 68 | obj/proxy.o obj/tor.o obj/compactblock.o |
| 66 | 69 | ||
| 67 | GUI_OBJS = obj/gui.o obj/main_gui.o | 70 | GUI_OBJS = obj/gui.o obj/main_gui.o |
| 68 | 71 | ||
| @@ -101,7 +104,7 @@ obj/imgui_impl_opengl3.o: $(IMGUI_DIR)/imgui_impl_opengl3.cpp | |||
| 101 | $(CXX) -c $(CXXFLAGS) -o $@ $< | 104 | $(CXX) -c $(CXXFLAGS) -o $@ $< |
| 102 | 105 | ||
| 103 | bitflash: $(IMGUI_OBJS) $(NODE_OBJS) $(GUI_OBJS) | 106 | bitflash: $(IMGUI_OBJS) $(NODE_OBJS) $(GUI_OBJS) |
| 104 | $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS) | 107 | $(CXX) $(CXXFLAGS) $(LDHARDFLAGS) -o $@ $^ $(LIBS) |
| 105 | @echo "Built: bitflash" | 108 | @echo "Built: bitflash" |
| 106 | 109 | ||
| 107 | # ---- headless node --------------------------------------------------------- | 110 | # ---- headless node --------------------------------------------------------- |
| @@ -115,6 +118,20 @@ bitflash: $(IMGUI_OBJS) $(NODE_OBJS) $(GUI_OBJS) | |||
| 115 | # Objects go to obj-node/ because main_gui.cpp is compiled twice, with and | 118 | # Objects go to obj-node/ because main_gui.cpp is compiled twice, with and |
| 116 | # without -DBITFLASH_NO_GUI, and the two must not overwrite each other. | 119 | # without -DBITFLASH_NO_GUI, and the two must not overwrite each other. |
| 117 | 120 | ||
| 121 | # RandomX links a hand-written assembly JIT stub, jit_compiler_x86_static.S, | ||
| 122 | # which carries no .note.GNU-stack marker. Older binutils -- Debian 12's, which | ||
| 123 | # is what builds against the oldest glibc we ship to -- reads a missing marker | ||
| 124 | # as "this object wants an executable stack" and marks the whole binary RWE, | ||
| 125 | # switching NX off for the process. Newer toolchains default the other way, so | ||
| 126 | # identical source produced GNU_STACK RW on Ubuntu 26.04 and RWE on bookworm, | ||
| 127 | # announced by nothing louder than a linker warning in the middle of the build. | ||
| 128 | # | ||
| 129 | # Assert it here rather than inherit whichever default the build host happens | ||
| 130 | # to carry. The JIT maps its own W^X pages and never executes from the stack, | ||
| 131 | # so nothing needs the permission this takes away. Check with: | ||
| 132 | # readelf -lW bitflash-node | grep -A1 GNU_STACK # expect RW, not RWE | ||
| 133 | LDHARDFLAGS = -Wl,-z,noexecstack | ||
| 134 | |||
| 118 | NODE_LIBS = -L$(SECP_LIB) -lsecp256k1 \ | 135 | NODE_LIBS = -L$(SECP_LIB) -lsecp256k1 \ |
| 119 | -L$(RANDOMX_DIR)/build -lrandomx \ | 136 | -L$(RANDOMX_DIR)/build -lrandomx \ |
| 120 | -lsodium -lssl -lcrypto -ldb_cxx -lsqlite3 -lpthread | 137 | -lsodium -lssl -lcrypto -ldb_cxx -lsqlite3 -lpthread |
| @@ -135,7 +152,7 @@ obj-node/sha.o: sha.cpp sha.h | |||
| 135 | $(CXX) -c $(CXXFLAGS) -DBITFLASH_NO_GUI -O3 -o $@ $< | 152 | $(CXX) -c $(CXXFLAGS) -DBITFLASH_NO_GUI -O3 -o $@ $< |
| 136 | 153 | ||
| 137 | bitflash-node: $(NODE_ONLY_OBJS) | 154 | bitflash-node: $(NODE_ONLY_OBJS) |
| 138 | $(CXX) $(CXXFLAGS) -o $@ $^ $(NODE_LIBS) | 155 | $(CXX) $(CXXFLAGS) $(LDHARDFLAGS) -o $@ $^ $(NODE_LIBS) |
| 139 | @echo "Built: bitflash-node (headless, no libGL needed)" | 156 | @echo "Built: bitflash-node (headless, no libGL needed)" |
| 140 | 157 | ||
| 141 | obj-fuzz/%.o: %.cpp $(HEADERS) | 158 | obj-fuzz/%.o: %.cpp $(HEADERS) |
| @@ -178,13 +195,28 @@ fuzz-script-smoke: fuzz-script | |||
| 178 | ./fuzz-script -runs=128 ../work/fuzz-corpus/script | 195 | ./fuzz-script -runs=128 ../work/fuzz-corpus/script |
| 179 | 196 | ||
| 180 | clean: | 197 | clean: |
| 181 | rm -rf obj obj-node obj-fuzz bitflash bitflash-node fuzz-net-message fuzz-script test_bip32 | 198 | rm -rf obj obj-node obj-fuzz bitflash bitflash-node fuzz-net-message fuzz-script test_bip32 test_compactblock |
| 182 | 199 | ||
| 183 | test_bip32: test_bip32.cpp bip32.cpp bip32.h bip39_english.h | 200 | test_bip32: test_bip32.cpp bip32.cpp bip32.h bip39_english.h |
| 184 | $(CXX) $(CXXFLAGS) -o $@ test_bip32.cpp bip32.cpp -lssl -lcrypto | 201 | $(CXX) $(CXXFLAGS) -o $@ test_bip32.cpp bip32.cpp -lssl -lcrypto |
| 185 | 202 | ||
| 186 | tests: test_bip32 bitflash-node | 203 | # Upstream shipped test_compactblock.cpp with no build rule at all, so it was |
| 204 | # never compiled there. It links the standalone way test_bip32 does: it supplies | ||
| 205 | # its own mapTransactions and GetAppDir so main.cpp stays out of the link, and | ||
| 206 | # only needs sha.cpp/util.cpp for Hash() and the logging helpers. | ||
| 207 | # | ||
| 208 | # TEST_LIBS is overridable for the same reason NODE_LIBS is: the pinned dep tree | ||
| 209 | # ships libsodium as a static archive only, so a build against it passes | ||
| 210 | # TEST_LIBS="... -l:libsodium.a ...". | ||
| 211 | TEST_LIBS ?= -lsodium -lssl -lcrypto -lpthread | ||
| 212 | |||
| 213 | test_compactblock: test_compactblock.cpp compactblock.cpp compactblock.h $(HEADERS) | ||
| 214 | $(CXX) $(CXXFLAGS) -o $@ test_compactblock.cpp compactblock.cpp sha.cpp util.cpp \ | ||
| 215 | $(TEST_LIBS) | ||
| 216 | |||
| 217 | tests: test_bip32 test_compactblock bitflash-node | ||
| 187 | ./test_bip32 | 218 | ./test_bip32 |
| 219 | ./test_compactblock | ||
| 188 | ./bitflash-node -selftest=wallet-keypool | 220 | ./bitflash-node -selftest=wallet-keypool |
| 189 | ./bitflash-node -selftest=wallet-hd | 221 | ./bitflash-node -selftest=wallet-hd |
| 190 | ./bitflash-node -selftest=wallet-format | 222 | ./bitflash-node -selftest=wallet-format |
| @@ -196,6 +228,7 @@ tests: test_bip32 bitflash-node | |||
| 196 | ./bitflash-node -selftest=network-params | 228 | ./bitflash-node -selftest=network-params |
| 197 | ./bitflash-node -selftest=consensus-limits | 229 | ./bitflash-node -selftest=consensus-limits |
| 198 | ./bitflash-node -selftest=pool-stratum | 230 | ./bitflash-node -selftest=pool-stratum |
| 231 | ./bitflash-node -selftest=payout-ledger | ||
| 199 | ./bitflash-node -selftest=parse-money | 232 | ./bitflash-node -selftest=parse-money |
| 200 | ./bitflash-node -selftest=socks5-proxy | 233 | ./bitflash-node -selftest=socks5-proxy |
| 201 | ./bitflash-node -selftest=managed-tor | 234 | ./bitflash-node -selftest=managed-tor |