From ac6dfff691521d40966a92b119d4c43a071e3b5f Mon Sep 17 00:00:00 2001 From: Dan Nelson <41842184+danwritecode@users.noreply.github.com> Date: Thu, 6 Jun 2024 21:48:35 -0400 Subject: [PATCH] Debug mode (#151) * added debug mode to make with separate binary * updated makefile --- .gitignore | 1 + main.c | 5 ++--- makefile | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index cbf7c7c..79e13fe 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ main *.bin *.o clings +clings_debug diff --git a/main.c b/main.c index 52f70f8..7b88b77 100644 --- a/main.c +++ b/main.c @@ -11,7 +11,6 @@ #include #include -const bool DEBUG_MODE = false; const int TOTAL_EXERCISES_DIRS = 2; // TODO: Make this dynamic in the future static volatile sig_atomic_t keep_running = 1; @@ -74,10 +73,10 @@ int main() { Exercise exercise = create_exercise(dirs[d]); bool file_diff = is_file_diff(&exercise); - if (DEBUG_MODE == true) { + #ifdef DEBUG display_debug(&exercise); continue; - } + #endif if (rerun_all == true) { exec_exercise(&exercise, &exercise_state); diff --git a/makefile b/makefile index 238b579..77ba217 100644 --- a/makefile +++ b/makefile @@ -8,6 +8,9 @@ TARGET = clings all: $(TARGET) +debug: CFLAGS += -DDEBUG +debug: $(TARGET) + $(TARGET): $(OBJS) $(CC) $(CFLAGS) -o $(TARGET) $(OBJS) @@ -17,5 +20,5 @@ $(TARGET): $(OBJS) clean: rm -f $(OBJS) $(TARGET) -.PHONY: all clean +.PHONY: all clean debug