31 lines
706 B
Makefile
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)*
|