Solved exercise 2 - create a simple tree program clone

This commit is contained in:
Fabio Scotto di Santolo
2025-06-30 22:25:31 +02:00
parent 7bc220f92c
commit a629f9de01
6 changed files with 162 additions and 0 deletions

27
exercises/tree/Makefile Normal file
View File

@@ -0,0 +1,27 @@
CC = gcc
CFLAGS = -Wall -Wextra -std=c11 -g
SRC = main.c tree.c
OBJ = $(SRC:.c=.o)
EXEC = tree
# Main target
all: $(EXEC)
# Build executable
$(EXEC): $(OBJ)
$(CC) $(CFLAGS) -o $@ $^
# Run test suite
test: all
@cd test && ./run_tests.sh
# Clean object files and executable
clean:
rm -f $(OBJ) $(EXEC)
# Full cleanup (also test artifacts)
distclean: clean
cd test && rm -f actual_output.txt valgrind.log expected_output.txt && rm -rf testdir
.PHONY: all test clean distclean