summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-16 17:47:47 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-16 17:47:47 +0100
commitb97d08b127a002b6cfda0851f02ae84e3b0381b8 (patch)
treed1e0dd931db1a9ff7c4dff96bad999d3b41d9f15
parentff0037ae54eccb71672f2abb88e60e2467cacf65 (diff)
downloadtoy-debugger-b97d08b127a002b6cfda0851f02ae84e3b0381b8.tar.gz
Added macOS make option
-rw-r--r--Makefile17
-rw-r--r--tdbg.cpp3
2 files changed, 18 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index b6264b0..12f9c1f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,22 @@
+UNAME_S := $(shell uname -s)
+
+ifeq ($(UNAME_S),Linux)
+ LLVM_PREFIX := /usr/lib/llvm/21
+endif
+ifeq ($(UNAME_S),Darwin)
+ LLVM_PREFIX := /System/Volumes/Data/opt/homebrew/Cellar/llvm/21.1.8
+endif
+
+CXXFLAGS := -I$(LLVM_PREFIX)/include -std=c++17
+LDFLAGS := -L$(LLVM_PREFIX)/lib -Wl,-rpath,$(LLVM_PREFIX)/lib -llldb
+
all: tdbg example
tdbg: tdbg.cpp
- clang++ tdbg.cpp -o tdbg -I/usr/lib/llvm/21/include -L/usr/lib/llvm/21/lib -Wl,-rpath,/usr/lib/llvm/21/lib -llldb -std=c++17
+ clang++ tdbg.cpp -o tdbg $(CXXFLAGS) $(LDFLAGS)
example: example.c
clang -g -o example example.c
+
+clean:
+ rm -f tdbg example
diff --git a/tdbg.cpp b/tdbg.cpp
index 2c6e9d4..572cce9 100644
--- a/tdbg.cpp
+++ b/tdbg.cpp
@@ -721,9 +721,10 @@ int main(int argc, char** argv) {
}
} else if (ev.type == TB_EVENT_MOUSE) {
int main_window_height = tb_height() - LOG_WINDOW_HEIGHT - STATUS_WINDOW_HEIGHT;
+
+ // Log window scrolling
int log_start_y = main_window_height;
int log_end_y = tb_height() - STATUS_WINDOW_HEIGHT;
-
if (ev.y >= log_start_y && ev.y < log_end_y) {
if (ev.key == TB_KEY_MOUSE_WHEEL_UP) {
int max_scroll = std::max(0, (int)log_buffer.size() - (LOG_WINDOW_HEIGHT - 2));