TARGET = test
LIBS = -lm
CC = gcc
# -fsingle-precision-constant as the firmware builds (make/fw.mk), so that
# 360.0 and M_PI are the floats they are on the target
CFLAGS = -O2 -g -Wall -Wextra -Wundef -std=gnu99 -fsingle-precision-constant \
         -I. -I../../util -I../.. -DNO_STM32
SOURCES = main.c ../../util/utils_math.c
OBJECTS = $(notdir $(SOURCES:.c=.o))

.PHONY: default all clean run

default: $(TARGET)
all: default

%.o: ../../util/%.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

$(TARGET): $(OBJECTS)
	$(CC) $(OBJECTS) -Wall $(LIBS) -o $@

clean:
	rm -f $(OBJECTS) $(TARGET)

run: $(TARGET)
	./$(TARGET)
