inv-sw-linux/Makefile
2024-01-16 16:28:21 +01:00

31 lines
706 B
Makefile

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
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
$(TEST_TARGETNAME): $(TEST_TARGET)
$(TEST_TARGET): $(TEST_SRC)
mkdir -p $(TEST_BUILDFOLDER)
cc -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(INC) -lm -lcunit
clean:
rm -fr ./src/*.o $(BUILDFOLDER)*
rm -fr $(TEST_BUILDFOLDER)*