ArchiSys/TP/TP2/rendu/Makefile
2024-04-19 09:05:42 +02:00

25 lines
659 B
Makefile

SRC = $(wildcard *.c)
OBJ = $(filter-out build/main.o build/test.o, $(SRC:%.c=build/%.o))
FLAGS = -Wall -Wextra -g -O3
TEST_SRCDIR = tests
FAIL_TESTS_SRC += $(wildcard $(TEST_SRCDIR)/fail/*.c)
SUCC_TESTS_SRC += $(wildcard $(TEST_SRCDIR)/success/*.c)
TESTS_OBJ = $(FAIL_TESTS_SRC:$(TEST_SRCDIR)/fail/%.c=build/test-fail-%) $(SUCC_TESTS_SRC:$(TEST_SRCDIR)/success/%.c=build/test-success-%)
all: build-tests
build-tests: $(TESTS_OBJ)
build/test-fail-%: tests/fail/%.c $(OBJ)
gcc $^ -o $@ $(FLAGS)
build/test-success-%: tests/success/%.c $(OBJ)
gcc $^ -o $@ $(FLAGS)
build/%.o: %.c %.h
gcc -c $< -o $@ $(FLAGS)
clean:
rm -f build/*