在 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