xref: /DragonOS/user/Makefile (revision 237e95c6ddce72d72ae7fedfeca412fab82b3622)
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
1856528782Sfslongjin$(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
2256528782Sfslongjinapp: $(user_sub_dirs)
23b2614801Sfslongjin
2456528782Sfslongjinall: 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
2856528782Sfslongjin	@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)
38*237e95c6Swwc-15172310230	$(MAKE) clean -C libs
39*237e95c6Swwc-15172310230	@list='$(user_sub_dirs)'; for subdir in $$list; do \
40*237e95c6Swwc-15172310230		echo "Clean in dir: $$subdir";\
41*237e95c6Swwc-15172310230		cd $$subdir && $(MAKE) clean;\
42*237e95c6Swwc-15172310230		cd .. ;\
43*237e95c6Swwc-15172310230	done
44afeca182Sfslongjin