TARGETNAME = inverter BUILDFOLDER = ./build/ TARGET = $(BUILDFOLDER)$(TARGETNAME) TEST_TARGETNAME = test TEST_BUILDFOLDER = ./test/build/ TEST_TARGET = $(TEST_BUILDFOLDER)$(TEST_TARGETNAME) INC = -Isrc/include -I/usr/include -I/usr/include/libftdi1 CFLAGS = -Wall -Wpedantic -Wextra -g CPPFLAGS = SRC = $(wildcard src/*.c) TEST_SRC = $(filter-out src/main.c, $(SRC) $(wildcard test/*.c)) $(TARGETNAME): $(TARGET) $(TARGET): $(SRC) mkdir -p $(BUILDFOLDER) cc -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(INC) -lm -lftdi1 $(TEST_TARGETNAME): $(TEST_TARGET) $(TEST_TARGET): $(TEST_SRC) mkdir -p $(TEST_BUILDFOLDER) cc -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(INC) -lm -lftdi1 -lcunit clean: rm -fr ./src/*.o $(BUILDFOLDER)* rm -fr $(TEST_BUILDFOLDER)*