
CC = arm-none-eabi-gcc
AR = arm-none-eabi-ar
OBJCPY = arm-none-eabi-objcopy
OUTDIR = release/out_embedded
LIBFILE = libTestFloat.a

#override CFLAGS = -mthumb -mabi=aapcs -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fshort-wchar -Wdouble-promotion -fsingle-precision-constant
override CFLAGS = -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fshort-wchar -Wdouble-promotion -fsingle-precision-constant

LIBDIR = $(OUTDIR)/lib

OBJS = testFile.o

REALOBJS = $(addprefix $(OUTDIR)/, $(OBJS))

all: $(LIBDIR)/$(LIBFILE)

$(LIBDIR)/$(LIBFILE): $(REALOBJS)
	$(AR) rcs $@ $(REALOBJS)

# Object rules
$(OUTDIR)/%.o: src/%.c $ $(OUTDIR)
	$(CC) $(PRIORCFLAGS) -c -o $@ $< $(CFLAGS)

$(OUTDIR):
	mkdir -p $(OUTDIR)
	mkdir -p $(LIBDIR)

.PHONY: clean
clean:
	rm -rf $(OUTDIR)