Makefile解释实例.docx

  1. 1、本文档共12页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Makefile解释实例

OBJS = \bio.o\console.o\exec.o\file.o\fs.o\ide.o\ioapic.o\kalloc.o\kbd.o\lapic.o\log.o\main.o\mp.o\picirq.o\pipe.o\proc.o\sleeplock.o\spinlock.o\string.o\swtch.o\syscall.o\sysfile.o\sysproc.o\timer.o\trapasm.o\trap.o\uart.o\vectors.o\vm.o\定义了一个变量OBJS,内容为等号后面的内容,‘\’为换行符,方便阅读# Cross-compiling (e.g., on Mac OS X)# TOOLPREFIX = i386-jos-elf# Using native tools (e.g., on X86 Linux)#TOOLPREFIX = # Try to infer the correct TOOLPREFIX if not set如果变量TOOLPERFIX为空那么为TOOLPREFIX赋个值objdump命令是:查看目标文件/可执行文件的构成的gcc工具/反汇编如果都不是,则将echo错误信息信息“*** Error: Couldnt find an i386-*-elf version of GCC/binutils”本来是从标准输出-赋给变量,重定向到了标准错误里ifndef TOOLPREFIXTOOLPREFIX := $(shell if i386-jos-elf-objdump -i 21 | grep ^elf32-i386$$ /dev/null 21; \then echo i386-jos-elf-; \elif objdump -i 21 | grep elf32-i386 /dev/null 21; \then echo ; \else echo *** 12; \echo *** Error: Couldnt find an i386-*-elf version of GCC/binutils. 12; \echo *** Is the directory with i386-jos-elf-gcc in your PATH? 12; \echo *** If your i386-*-elf toolchain is installed with a command 12; \echo *** prefix other than i386-jos-elf-, set your TOOLPREFIX 12; \echo *** environment variable to that prefix and run make again. 12; \echo *** To turn off this error, run gmake TOOLPREFIX= .... 12; \echo *** 12; exit 1; fi)endif如果变量QEMU为空,那么给QEMU赋值前面加个shell意为要执行shell脚本了如果能够在当前路径找到可执行文件qemu,那么首先不输出(因为/dev/null了),并把该路径赋给变量QEMU,退出。如果在当前路径下能够找到可执行文件qemu-system-i386,那么不输出(因为/dev/null了),把该路径赋给变量QEMU,退出。如果qemu和qemu-system-i386的路径都为空,那么把qemu的值设为/Applications/Q.app/Contents/MacOS/i386-softmmu.app/Contents/MacOS/i386-softmmu检测qemu文件是否存在且可执行权限如果存在,则将变量QEMU设为/Applications/Q.app/Contents/MacOS/i386-softmmu.app/Contents/MacOS/i386-softmmu,并且退出。如果上面没有退出——即上面的if没进去,那么执行下面,$(echo错误信息) ,并且由于是12,本来是从标准输出-赋给变量,重定向到了标准错误里# If the makefile cant find QEMU, specify its path here# QEMU = qemu-system-i386# Try to infer the correct QEMUifndef QEMUQEMU = $(shell if which qemu /dev/null; \then echo qemu; exit; \elif which qemu-system-i386 /dev/null; \then echo qemu-syst

文档评论(0)

jiupshaieuk12 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:6212135231000003

1亿VIP精品文档

相关文档