Skip to content

Commit

Permalink
Debug mode (danwritecode#151)
Browse files Browse the repository at this point in the history
* added debug mode to make with separate binary

* updated makefile
  • Loading branch information
danwritecode authored Jun 7, 2024
1 parent dc54855 commit ac6dfff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ main
*.bin
*.o
clings
clings_debug
5 changes: 2 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <sys/types.h>
#include <unistd.h>

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;

Expand Down Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ TARGET = clings

all: $(TARGET)

debug: CFLAGS += -DDEBUG
debug: $(TARGET)

$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS)

Expand All @@ -17,5 +20,5 @@ $(TARGET): $(OBJS)
clean:
rm -f $(OBJS) $(TARGET)

.PHONY: all clean
.PHONY: all clean debug

0 comments on commit ac6dfff

Please sign in to comment.