1GARBAGE_PATTERNS := *.o *.s~ *.s *.S~ *.c~ *.h~ kernel 2GARBAGE := $(foreach DIR,$(DIRS),$(addprefix $(DIR)/,$(GARBAGE_PATTERNS))) 3 4all: libc 5 6CFLAGS += -I . 7 8libc_sub_dirs=math sys 9 10ifeq ($(ARCH), __x86_64__) 11libc_sub_dirs += arch/x86_64 12endif 13 14$(libc_sub_dirs): ECHO 15 $(MAKE) -C $@ all CFLAGS="$(CFLAGS)" ASFLAGS="$(ASFLAGS) -I $(shell pwd)" 16 17libc_objs:= $(shell find ./*.c) 18 19ECHO: 20 @echo "$@" 21 22 23$(libc_objs): ECHO 24 $(CC) $(CFLAGS) -c $@ -o $@.o 25 26clean: 27 cargo clean 28 rm -rf $(GARBAGE) 29 @list='$(libc_sub_dirs)'; for subdir in $$list; do \ 30 echo "Clean in dir: $$subdir";\ 31 cd $$subdir && $(MAKE) clean;\ 32 cd .. ;\ 33 done 34 35libc: $(libc_objs) $(libc_sub_dirs) libc_rust 36 37libc_rust: 38 rustup default nightly 39 cargo +nightly build --release --target ./x86_64-unknown-none.json