diff options
| author | bitflash-coin <bookofshamers@outlook.com> | 2026-08-04 06:34:32 -0700 |
|---|---|---|
| committer | bitflash-coin <bookofshamers@outlook.com> | 2026-08-04 06:34:32 -0700 |
| commit | 5ce650382352c1503f40abf08129ada69402af55 (patch) | |
| tree | 6a18198901f1e2c4933f1ac53c9365eec512bf63 /src/makefile.mingw | |
| parent | f34113291da7e5e3dc7d2468d4f9c212c05c584b (diff) | |
public commit
Diffstat (limited to 'src/makefile.mingw')
| -rw-r--r-- | src/makefile.mingw | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/src/makefile.mingw b/src/makefile.mingw new file mode 100644 index 0000000..e076c49 --- /dev/null +++ b/src/makefile.mingw | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | # Bitflash Windows build — ImGui + GLFW + OpenGL3 | ||
| 2 | # Run from MSYS2 UCRT64: make -f makefile.mingw | ||
| 3 | |||
| 4 | CXX = g++ | ||
| 5 | |||
| 6 | DEPS = ../deps | ||
| 7 | RANDOMX = ../RandomX | ||
| 8 | IMGUI_DIR = imgui | ||
| 9 | |||
| 10 | # See the long note in Makefile: -w hid the format bug that segfaulted the node | ||
| 11 | # on glibc (issue #5), and -w cannot be narrowed, so format diagnostics are now | ||
| 12 | # fatal and only the categories this tree actually produces are silenced. | ||
| 13 | WARNFLAGS = -Wformat -Werror=format \ | ||
| 14 | -Wno-deprecated-declarations -Wno-write-strings \ | ||
| 15 | -Wno-narrowing -Wno-unused-result | ||
| 16 | |||
| 17 | # FD_SETSIZE has to be defined before winsock2.h and it has to be the same | ||
| 18 | # number in every translation unit -- fd_set carries an array of that length, | ||
| 19 | # so disagreeing about it means disagreeing about sizeof(fd_set). That is why | ||
| 20 | # it lives here as a -D and not as a #define in a header. Windows defaults to | ||
| 21 | # 64, which capped this node at 63 watchable peers no matter how many it had. | ||
| 22 | CXXFLAGS = -std=gnu++14 -O2 $(WARNFLAGS) -fpermissive -pthread \ | ||
| 23 | -DWIN32 -DNOPCH -DFD_SETSIZE=1024 \ | ||
| 24 | -DSECP256K1_STATIC \ | ||
| 25 | -I$(DEPS)/include -I$(RANDOMX)/src \ | ||
| 26 | -I$(DEPS)/include/nlohmann \ | ||
| 27 | -IC:/msys64/ucrt64/include \ | ||
| 28 | -I$(IMGUI_DIR) | ||
| 29 | |||
| 30 | LIBS = -L$(DEPS)/lib -lsecp256k1 \ | ||
| 31 | -L$(RANDOMX)/build -lrandomx \ | ||
| 32 | -lsodium -lssl -lcrypto -ldb_cxx -lpthread \ | ||
| 33 | -LC:/msys64/ucrt64/lib \ | ||
| 34 | -lglfw3 -lopengl32 -lgdi32 \ | ||
| 35 | -lkernel32 -luser32 -lcomdlg32 -lwinspool -lwinmm \ | ||
| 36 | -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid \ | ||
| 37 | -lrpcrt4 -ladvapi32 -lws2_32 -lmswsock -lcrypt32 | ||
| 38 | |||
| 39 | IMGUI_OBJS = obj/imgui.o obj/imgui_draw.o obj/imgui_tables.o \ | ||
| 40 | obj/imgui_widgets.o obj/imgui_impl_glfw.o obj/imgui_impl_opengl3.o | ||
| 41 | |||
| 42 | NODE_OBJS = obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \ | ||
| 43 | obj/market.o obj/sha.o obj/nostr.o obj/randomx_pow.o \ | ||
| 44 | obj/btfaddr.o obj/btfchan.o obj/btfrv.o obj/btftunnel.o obj/rpc.o \ | ||
| 45 | obj/selftest.o obj/bip32.o obj/walletcmd.o | ||
| 46 | |||
| 47 | GUI_OBJS = obj/gui.o obj/main_gui.o obj/bitflash_res.o | ||
| 48 | |||
| 49 | # Every header a .cpp here includes has to be listed, not just the interesting | ||
| 50 | # ones. sockcount.h was missing, and it declares a struct that lives in a | ||
| 51 | # function-local static shared across translation units: editing it rebuilt | ||
| 52 | # some objects and not others, and the linker said so in a warning easy to walk | ||
| 53 | # past -- "duplicate section ... has different size". That is one object | ||
| 54 | # indexing a struct by the old layout and another by the new one, in the same | ||
| 55 | # binary. Nothing crashed here, and nothing would say so if it had. | ||
| 56 | HEADERS = headers_core.h headers.h util.h main.h serialize.h uint256.h \ | ||
| 57 | key.h bignum.h script.h db.h base58.h net.h nostr.h \ | ||
| 58 | randomx_pow.h btfaddr.h btfchan.h btfrv.h btftunnel.h market.h \ | ||
| 59 | selftest.h walletcmd.h sockcount.h compat.h font_roboto.h | ||
| 60 | |||
| 61 | all: bitflash.exe | ||
| 62 | |||
| 63 | obj/bitflash_res.o: bitflash.rc rc/bitcoin.ico | ||
| 64 | mkdir -p obj | ||
| 65 | windres -o $@ -i bitflash.rc | ||
| 66 | |||
| 67 | obj/%.o: %.cpp $(HEADERS) | ||
| 68 | mkdir -p obj | ||
| 69 | $(CXX) -c $(CXXFLAGS) -o $@ $< | ||
| 70 | |||
| 71 | obj/sha.o: sha.cpp sha.h | ||
| 72 | mkdir -p obj | ||
| 73 | $(CXX) -c $(CXXFLAGS) -O3 -o $@ $< | ||
| 74 | |||
| 75 | obj/imgui.o: $(IMGUI_DIR)/imgui.cpp | ||
| 76 | mkdir -p obj | ||
| 77 | $(CXX) -c $(CXXFLAGS) -o $@ $< | ||
| 78 | |||
| 79 | obj/imgui_draw.o: $(IMGUI_DIR)/imgui_draw.cpp | ||
| 80 | mkdir -p obj | ||
| 81 | $(CXX) -c $(CXXFLAGS) -o $@ $< | ||
| 82 | |||
| 83 | obj/imgui_tables.o: $(IMGUI_DIR)/imgui_tables.cpp | ||
| 84 | mkdir -p obj | ||
| 85 | $(CXX) -c $(CXXFLAGS) -o $@ $< | ||
| 86 | |||
| 87 | obj/imgui_widgets.o: $(IMGUI_DIR)/imgui_widgets.cpp | ||
| 88 | mkdir -p obj | ||
| 89 | $(CXX) -c $(CXXFLAGS) -o $@ $< | ||
| 90 | |||
| 91 | obj/imgui_impl_glfw.o: $(IMGUI_DIR)/imgui_impl_glfw.cpp | ||
| 92 | mkdir -p obj | ||
| 93 | $(CXX) -c $(CXXFLAGS) -o $@ $< | ||
| 94 | |||
| 95 | obj/imgui_impl_opengl3.o: $(IMGUI_DIR)/imgui_impl_opengl3.cpp | ||
| 96 | mkdir -p obj | ||
| 97 | $(CXX) -c $(CXXFLAGS) -o $@ $< | ||
| 98 | |||
| 99 | bitflash.exe: $(IMGUI_OBJS) $(NODE_OBJS) $(GUI_OBJS) | ||
| 100 | $(CXX) $(CXXFLAGS) -mwindows -o $@ $^ $(LIBS) | ||
| 101 | @echo "Built: bitflash.exe" | ||
| 102 | |||
| 103 | clean: | ||
| 104 | rm -rf obj bitflash.exe test_bip32.exe | ||
| 105 | |||
| 106 | test_bip32.exe: test_bip32.cpp bip32.cpp bip32.h bip39_english.h | ||
| 107 | $(CXX) $(CXXFLAGS) -o $@ test_bip32.cpp bip32.cpp -lssl -lcrypto -lcrypt32 | ||
| 108 | @echo "Built: test_bip32.exe" | ||
| 109 | |||
| 110 | tests: test_bip32.exe bitflash.exe | ||
| 111 | ./test_bip32.exe | ||
| 112 | ./bitflash.exe -selftest=wallet-keypool | ||
| 113 | ./bitflash.exe -selftest=wallet-hd | ||
| 114 | ./bitflash.exe -selftest=wallet-format | ||
| 115 | ./bitflash.exe -selftest=wallet-crypto | ||
| 116 | ./bitflash.exe -selftest=wallet-encrypt | ||
| 117 | ./bitflash.exe -selftest=net-message | ||
| 118 | ./bitflash.exe -selftest=consensus-limits | ||