Browse Source

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

fslongjin 2 years ago
parent
commit
5652878249
4 changed files with 15 additions and 17 deletions
  1. 0 1
      Makefile
  2. 1 1
      kernel/Makefile
  3. 6 8
      user/Makefile
  4. 8 7
      user/apps/Makefile

+ 0 - 1
Makefile

@@ -19,7 +19,6 @@ endif
 
 .PHONY: all
 all: kernel user
-	
 
 
 .PHONY: kernel

+ 1 - 1
kernel/Makefile

@@ -53,7 +53,7 @@ all: kernel
 	@echo "Generating kernel ELF file..."
 # 生成内核文件
 	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 "$@"

+ 6 - 8
user/Makefile

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

+ 8 - 7
user/apps/Makefile

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