include $(ROOT)/mk/grabsrc.mk
include $(ROOT)/mk/arch/toolchain-$(ARCH).mk
include $(ROOT)/mk/user/$(ARCH).mk

.PHONY: all clean

SRCFILES := $(call GRABSRC, \
							. \
							syscall \
							string \
							system \
							printf \
							sync \
							args \
							util \
							ubsan \
							umalloc \
							fs \
							time \
							jump \
						)

CFLAGS += -isystem $(ROOT)/share -isystem $(ROOT)/ulib -isystem $(ROOT)/std/include \
					-isystem $(ROOT)/ulib/std -DPRINTF_INCLUDE_CONFIG_H=1 \
					-DULIB_FLOAT_SUPPORT=0

ASFILES := $(call GET_ASFILES, $(SRCFILES))
CFILES := $(call GET_CFILES, $(SRCFILES))
OBJ := $(call GET_OBJ, $(SRCFILES))

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

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

libulib.a: $(OBJ)
	$(AR) rcs libulib.a $(OBJ)

all: libulib.a

clean:
	rm -f $(OBJ)
	rm -f libulib.a
