1*b2614801Sfslongjinuser_sub_dirs = apps 20aec6827Sfslongjin 30aec6827SfslongjinSUBDIR_ROOTS := . 40aec6827SfslongjinDIRS := . $(shell find $(SUBDIR_ROOTS) -type d) 5b7437b24SfslongjinGARBAGE_PATTERNS := *.o *.s~ *.s *.S~ *.c~ *.h~ sys_api_lib 60aec6827SfslongjinGARBAGE := $(foreach DIR,$(DIRS),$(addprefix $(DIR)/,$(GARBAGE_PATTERNS))) 70aec6827Sfslongjin 80aec6827Sfslongjin 9afeca182Sfslongjintmp_output_dir=$(ROOT_PATH)/bin/tmp/user 10afeca182Sfslongjinoutput_dir=$(ROOT_PATH)/bin/user 11afeca182Sfslongjin 12afeca182SfslongjinCFLAGS := $(GLOBAL_CFLAGS) -I $(shell pwd)/libs 13afeca182Sfslongjincurrent_CFLAGS := $(CFLAGS) 14*b2614801Sfslongjin 15*b2614801SfslongjinECHO: 16*b2614801Sfslongjin @echo "$@" 17*b2614801Sfslongjin 18*b2614801Sfslongjin$(user_sub_dirs): ECHO 19*b2614801Sfslongjin 20*b2614801Sfslongjin $(MAKE) -C $@ all CFLAGS="$(CFLAGS)" tmp_output_dir="$(tmp_output_dir)" output_dir="$(output_dir)" sys_libs_dir="$(shell pwd)/libs" 21*b2614801Sfslongjin 22*b2614801Sfslongjinother_dirs: $(user_sub_dirs) 23*b2614801Sfslongjin 24*b2614801Sfslongjinall: sys_api_lib 250aec6827Sfslongjin 26e2a59dbdSfslongjin $(shell if [ ! -e $(tmp_output_dir) ];then mkdir -p $(tmp_output_dir); fi) 27e2a59dbdSfslongjin $(shell if [ ! -e $(output_dir) ];then mkdir -p $(output_dir); fi) 28e2a59dbdSfslongjin 29*b2614801Sfslongjin# 在成功编译系统库之后,开始编译用户态其他文件 30*b2614801Sfslongjin $(MAKE) other_dirs 31e2a59dbdSfslongjin 32e2a59dbdSfslongjin# 系统库 33e2a59dbdSfslongjinsys_api_lib: 34*b2614801Sfslongjin $(MAKE) -C libs all CFLAGS="$(CFLAGS)" tmp_output_dir="$(tmp_output_dir)" output_dir="$(output_dir)" sys_libs_dir="$(shell pwd)/libs" 35afeca182Sfslongjin 360aec6827Sfslongjin 37afeca182Sfslongjin 380aec6827Sfslongjinclean: 390aec6827Sfslongjin rm -rf $(GARBAGE) 40afeca182Sfslongjin