TARGETS = cortex_crc

.PHONY: clean

-include ../system.config
CC = gcc
OBJCOPY = objcopy
CFLAGS = -I.

BUILDDIR = ../../../build/tools
OUTPUTDIR = ../../../output

BINS = $(addprefix $(BUILDDIR)/, $(TARGETS))

all: builddir $(BINS)
	@mkdir -p $(OUTPUTDIR)
	@cp $(BINS) $(OUTPUTDIR)

builddir:
	@mkdir -p $(BUILDDIR)


$(BUILDDIR)/cortex_crc: $(BUILDDIR)/cortex_crc.o

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


clean:
	rm -rf $(BUILDDIR)
