1b2614801Sfslongjinuser_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) 14b2614801Sfslongjin 15b2614801SfslongjinECHO: 16b2614801Sfslongjin @echo "$@" 17b2614801Sfslongjin 18*56528782Sfslongjin$(user_sub_dirs): ECHO sys_api_lib 19b2614801Sfslongjin 20b2614801Sfslongjin $(MAKE) -C $@ all CFLAGS="$(CFLAGS)" tmp_output_dir="$(tmp_output_dir)" output_dir="$(output_dir)" sys_libs_dir="$(shell pwd)/libs" 21b2614801Sfslongjin 22*56528782Sfslongjinapp: $(user_sub_dirs) 23b2614801Sfslongjin 24*56528782Sfslongjinall: app 25e2a59dbdSfslongjin $(shell if [ ! -e $(tmp_output_dir) ];then mkdir -p $(tmp_output_dir); fi) 26e2a59dbdSfslongjin $(shell if [ ! -e $(output_dir) ];then mkdir -p $(output_dir); fi) 27e2a59dbdSfslongjin 28*56528782Sfslongjin @echo 用户态程序编译完成 29e2a59dbdSfslongjin 30e2a59dbdSfslongjin# 系统库 31e2a59dbdSfslongjinsys_api_lib: 32b2614801Sfslongjin $(MAKE) -C libs all CFLAGS="$(CFLAGS)" tmp_output_dir="$(tmp_output_dir)" output_dir="$(output_dir)" sys_libs_dir="$(shell pwd)/libs" 33afeca182Sfslongjin 340aec6827Sfslongjin 35afeca182Sfslongjin 360aec6827Sfslongjinclean: 370aec6827Sfslongjin rm -rf $(GARBAGE) 38afeca182Sfslongjin