I have started writing tests for the config functions. This has resulted in a few changes to the config code (tests working I guess) I have also added a special "all" config file which (as the name suggests) runs all test suites In the makefile I have added the compiled test files to the clean target and added targets for building and running tests
37 lines
588 B
Makefile
37 lines
588 B
Makefile
# This was stolen from here: https://avikdas.com/2019/12/16/makefiles-for-c-cpp-projects.html
|
|
|
|
CFILES = $(wildcard src/*.c)
|
|
OBJFILES = $(CFILES:.c=.o)
|
|
TESTFILES = $(wildcard tests/*.c)
|
|
TESTOUT = $(TESTFILES:.c=)
|
|
OUT = yaip
|
|
CFLAGS = -Wall
|
|
LDLIBS = -lsqlite3
|
|
CC = gcc
|
|
|
|
|
|
.PHONY: default
|
|
default: $(OUT)
|
|
|
|
|
|
.PHONY: run
|
|
run: $(OUT)
|
|
./$(OUT)
|
|
|
|
$(OUT): $(OBJFILES)
|
|
$(CC) -o $@ $^ $(LDLIBS)
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c -o $@ $^
|
|
|
|
tests/%.test: tests/%.test.c tests/munit/munit.c
|
|
$(CC) $? -o $@
|
|
|
|
|
|
test-%: tests/%.test
|
|
$<
|
|
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f $(OBJFILES) $(OUT) $(TESTOUT)
|