CC ?= cc
CFLAGS := -std=c11 -Wall -Wextra -Werror -pedantic -O2
.PHONY: test clean
test: test_control test_modbus test_settings test_service
	./test_control
	./test_modbus
	./test_settings
	./test_service
test_settings: control.c settings.c settings.h test_settings.c
	$(CC) $(CFLAGS) control.c settings.c test_settings.c -lm -o $@
test_control: control.c control.h test_control.c
	$(CC) $(CFLAGS) control.c test_control.c -lm -o $@
test_modbus: control.c control.h modbus.c modbus.h test_modbus.c
	$(CC) $(CFLAGS) control.c modbus.c test_modbus.c -lm -o $@
clean:
	rm -f test_control test_modbus test_settings test_service

test_service: control.c settings.c service.c test_service.c
	$(CC) $(CFLAGS) control.c settings.c service.c test_service.c -lm -o $@
