ArchiSys/TP/TP2/rendu/Makefile

25 lines
659 B
Makefile
Raw Permalink Normal View History

2024-04-19 08:12:31 +02:00
SRC = $(wildcard *.c)
OBJ = $(filter-out build/main.o build/test.o, $(SRC:%.c=build/%.o))
FLAGS = -Wall -Wextra -g -O3
2024-04-19 09:05:42 +02:00
TEST_SRCDIR = tests
2024-04-19 08:12:31 +02:00
2024-04-19 09:05:42 +02:00
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-%)
2024-04-19 08:12:31 +02:00
2024-04-19 09:05:42 +02:00
all: build-tests
build-tests: $(TESTS_OBJ)
build/test-fail-%: tests/fail/%.c $(OBJ)
gcc $^ -o $@ $(FLAGS)
build/test-success-%: tests/success/%.c $(OBJ)
2024-04-19 08:12:31 +02:00
gcc $^ -o $@ $(FLAGS)
build/%.o: %.c %.h
gcc -c $< -o $@ $(FLAGS)
clean:
rm -f build/*