include ../../Makefile.conf

TARGET=libcmsis.a

# Includes
CFLAGS+= -I.

C_SRC=$(wildcard *.c)
C_OBJ=$(subst .c,.o,$(C_SRC))

ASM_SRC=$(wildcard *.s)
ASM_OBJ=$(subst .s,.s.o,$(ASM_SRC))
ASMFLAGS=-x assembler-with-cpp

OBJ=$(C_OBJ) $(ASM_OBJ)

.PHONY: all clean

all: $(TARGET)

$(TARGET): $(OBJ)
	$(AR) -cr $@ $^

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

%.s.o: %.s
	$(CC) $(CFLAGS) $(ASMFLAGS) -o $@ -c $^

clean:
	mv $(OBJ) /tmp/
	mv $(TARGET) /tmp/