⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile

📁 从网上下载的一个自己编写的简单的操作系统源代码,对底层了解很有好处的
💻
字号:
###########################################                                        ##  这个 Makefile 负责编译安装到软盘的 OS ##                                        ############################################# 传递给子makefile的变量## 默认传递所有变量export ##  ##CC      = gccAS      = nasmLD      = ldRM      = del CP      = copyTOPDIR = ../INCLUDE =   -I../include KerFlg = -D__KERNEL__#-fwritable-strings option place string in .data, not in .textCCFLAGS  = $(KerFlg) $(INCLUDE) -c -Wall \           -fno-builtin -nostdinc -nostdlib -fwritable-strings -O2#-fomit-frame-pointer# --nostdinc : 这个选项使gcc 只在-I 选项指定的路径中搜索#include <file> #            指定的文件. 而不搜索系统目录. #include <file> 搜索顺序:#            -I, 系统.# #include "file" : 现在当前输入文件所在目录搜索 "file" . 然后是系统.# 建议只使用 <> 包含-I 指定文件.   ^_^.#              用"" 包含当前目录的文件.ASFLAGS  = -f coffLDFLG    = -nostdlib#  最终生成文件 bootimgbootimg :  boot os.bin 	copy /b fsector.bin+setup.bin+os.bin bootimg.flp	partcopy  bootimg.flp 0 1   bootimg.flp 82000	@echo -----------------------------	@echo Slow Work for debug 	@echo -----------------------------	objdump --line-numbers --source os.o >krnllst.txt	nm --line-numbers os.o | sort >krnlsym.txt	objdump -D os.o>kerasm.txt	$(RM) *.o	$(RM) *.bin#copy /b fsector.bin+setup.bin+os.bin fboot.img#partcopy  fboot.img 0 1   fboot.img 46fff# Boot 是引导扇区内容,内核 os.bin 紧跟其后的扇区# pad 把文件大小设置成大于1.4M, 以便于使用vmWare调试#  将生成的操作系统文件从 elf 格式转换到 binary 格式os.bin: os.o	objcopy -R .comment -R .note -S -O binary $< $@os.o: kernel driver	$(LD) $(LDFLG) -T expos.lds kernel.o driver.o   -o $@#-e Start_OS -Ttext 0xc0100000 的作用由连接脚本完成#$(LD) $(KERNEL_OBJS) -e Start_OS -Ttext 0x100000 -o $@#$(LD) $(KERNEL_OBJS) -e Start_OS -Ttext 0xc0100000 -o $@		          # 因为我们的映象是binary格式.          # 所以入口点函数应该是第一个.o文件的第一个函数boot:	$(MAKE) -C ../bootkernel:	$(MAKE) -C ../kerneldriver:	$(MAKE) -C ../driverclean:	$(MAKE) clean -C ../boot	$(MAKE) clean -C ../kernel	$(MAKE) clean -C ../driver	$(RM)  *.bin	$(RM)  *.o	$(RM)  bootimg.flp	$(RM)  krnllst.txt	$(RM)  krnlsym.txt	$(RM)  kerasm.txt	$(RM)  *.bak	$(RM)  fboot.img	     install:	rawrite -f bootimg.flp -d a:	#partcopy fbootimg 0 168000 -f0 #dd   if=bootimg of=/dev/fd0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -