在 DOS 窗口用 MakeFile 有些许不便,这时候配合 DOS 命令效果不错。把我正学习的实现一个操做系统的目前进度下的这两个文件贴出来。学习
::Img.bat make -s ALL @if errorlevel 1 goto error cd Release img -n vFloppy.img @if errorlevel 1 goto error img -a vFloppy.img Loader.sys Kernel.exe @if errorlevel 1 goto error cd.. @goto end :error pause :end
# MakeFile # 四彩 # 2015-12-04 .PHONY: CLS BootPath = .\Boot KernelPath = .\Kernel ReleasePath = .\Release ImgPath = .\Tool\Img ALL: - md $(ReleasePath) 1>nul 2>nul MAKE Img.exe BootSector.sys Loader.sys %.sys: $(BootPath)\%.asm nasm -fbin -o $(ReleasePath)\$@ $< Img.exe: $(ImgPath)\Img.c $(ImgPath)\FAT12.c $(ImgPath)\FAT12.h gcc -m32 -s -Os -o $(ReleasePath)\$@ $^ CLS: - rm /s /q $(ReleasePath) 1>nul 2>nul