os_filename = os.bat tests = test/qemu-system-i386 test/qemu-system-arm test/virtualbox test/bochs test/gui-sh test/dosbox os_image_size_kb = 1440 os_sectors_before_partition = 720 # CHS parameters for 1.44 MB floppy disk os_floppy_chs_h = 2 os_floppy_chs_s = 9 .PHONY: all # all: os.arm.disasm all: $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm os.file .gitignore Makefile ../deploy-screenshots: Makefile mkdir -p $@ touch $@ $(os_filename): os.asm ../deploy-screenshots Makefile rm -f $@ nasm -o $@ $< mformat -v "Example OS" \ -T $$(($(os_image_size_kb)*1024/512-$(os_sectors_before_partition))) \ -h $(os_floppy_chs_h) \ -s $(os_floppy_chs_s) \ -i "$@@@$$(($(os_sectors_before_partition)*512))" # mcopy … "$@@@$$(($(os_sectors_before_partition)*512))" chmod a+x-w $@ os.file: $(os_filename) Makefile file -kr $< > $@ os.ndisasm.disasm: $(os_filename) Makefile ../utils/compact-ndisasm.sh $< $@ os.reasm.asm: os.ndisasm.disasm Makefile sed -r -e 's/^[^ ]+ +[^ ]+ +//' $< > $@ os.reasm: os.reasm.asm $(os_filename) Makefile nasm $< -o $@ @echo "diff $@ $(os_filename)" @diff $@ $(os_filename) \ && echo "Re-assembled file is identical to $(os_filename)" \ || (../utils/compact-ndisasm.sh $@ os.reasm.disasm; \ echo "Re-assembled file is different from $(os_filename). Use meld os.ndisasm.disasm os.reasm.disasm to see differences."; \ exit 1) #os.arm.disasm: $(os_filename) Makefile # arm-none-eabi-objdump --endian=little -marm -b binary -D --adjust-vma=0x8000 $< > $@ .PHONY: clean clean: Makefile rm -f $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm os.file os.arm.disasm .gitignore: Makefile echo /$(os_filename) > $@ echo /os.ndisasm.disasm >> $@ echo /os.reasm.asm >> $@ echo /os.reasm >> $@ echo /os.reasm.disasm >> $@ echo /os.file >> $@ echo /os.arm.disasm >> $@ .PHONY: test test: $(tests) all Makefile .PHONY: $(tests) $(tests): $(os_filename) ../deploy-screenshots Makefile cd .. && ./utils/gui-wrapper.sh 800x600x24 ./$@.sh example-os/$<