include $(CONFIG) CDIRS := stdio ctype string CFILES += $(foreach dir,$(CDIRS),$(wildcard $(dir)/*.c)) OFILES := $(patsubst %.c,%.o,$(CFILES)) CFLAGS := -ffreestanding -nostdlib all: ${OFILES} ar rcs $(OUT)/libc-headless.a $(OFILES) %.o:%.c $(CC) $(CFLAGS) -c $< -o $@