cc := clang
o :=
c :=
ldflags := -L ../libmsl/build -l:libmsl.a
cflags := -isystem ../libmsl

include src.mk
include app.mk
include ../generic/flags.mk
include ../$(platform)/flags.mk

all: $(app)

$(app): $(o)
	$(cc) -o $@ $(ldflags) -T ../$(platform)/link.ld $^

%.o: %.c
	$(cc) -c -o $@ $(cflags) $<

%.o: %.S
	$(cc) -c -o $@ $(cflags) $<

clean:
	rm -f $(o) $(app)

format:
	clang-format -i $$(git ls-files '*.c' '*.h')

.PHONY: all clean format
