bugfix: 用户态程序编译错误的问题

This commit is contained in:
fslongjin 2022-09-11 21:28:19 +08:00
parent 774ebf0763
commit 5652878249
4 changed files with 15 additions and 17 deletions

View File

@ -21,7 +21,6 @@ endif
all: kernel user all: kernel user
.PHONY: kernel .PHONY: kernel
kernel: kernel:
mkdir -p bin/kernel/ mkdir -p bin/kernel/

View File

@ -53,7 +53,7 @@ all: kernel
@echo "Generating kernel ELF file..." @echo "Generating kernel ELF file..."
# 生成内核文件 # 生成内核文件
objcopy -I elf64-x86-64 -O elf64-x86-64 -R ".comment" -R ".eh_frame" kernel ../bin/kernel/kernel.elf objcopy -I elf64-x86-64 -O elf64-x86-64 -R ".comment" -R ".eh_frame" kernel ../bin/kernel/kernel.elf
@echo "Done." @echo "Kernel Build Done."
ECHO: ECHO:
@echo "$@" @echo "$@"

View File

@ -15,19 +15,17 @@ current_CFLAGS := $(CFLAGS)
ECHO: ECHO:
@echo "$@" @echo "$@"
$(user_sub_dirs): ECHO $(user_sub_dirs): ECHO sys_api_lib
$(MAKE) -C $@ all CFLAGS="$(CFLAGS)" tmp_output_dir="$(tmp_output_dir)" output_dir="$(output_dir)" sys_libs_dir="$(shell pwd)/libs" $(MAKE) -C $@ all CFLAGS="$(CFLAGS)" tmp_output_dir="$(tmp_output_dir)" output_dir="$(output_dir)" sys_libs_dir="$(shell pwd)/libs"
other_dirs: $(user_sub_dirs) app: $(user_sub_dirs)
all: sys_api_lib
all: app
$(shell if [ ! -e $(tmp_output_dir) ];then mkdir -p $(tmp_output_dir); fi) $(shell if [ ! -e $(tmp_output_dir) ];then mkdir -p $(tmp_output_dir); fi)
$(shell if [ ! -e $(output_dir) ];then mkdir -p $(output_dir); fi) $(shell if [ ! -e $(output_dir) ];then mkdir -p $(output_dir); fi)
# 在成功编译系统库之后,开始编译用户态其他文件 @echo 用户态程序编译完成
$(MAKE) other_dirs
# 系统库 # 系统库
sys_api_lib: sys_api_lib:

View File

@ -1,10 +1,11 @@
user_apps_sub_dirs=shell about user_apps_sub_dirs=shell about
all: ECHO:
@list='$(user_apps_sub_dirs)'; for subdir in $$list; do \ @echo "$@"
echo "make all in $$subdir";\
cd $$subdir;\ $(user_apps_sub_dirs): ECHO
$(MAKE) all CFLAGS="$(CFLAGS) -I $(shell pwd)";\
cd ..;\ $(MAKE) -C $@ all CFLAGS="$(CFLAGS)" tmp_output_dir="$(tmp_output_dir)" output_dir="$(output_dir)" sys_libs_dir="$(sys_libs_dir)"
done
all: $(user_apps_sub_dirs)