This repository has been archived on 2024-12-31. You can view files and clone it, but cannot push or open issues or pull requests.
MEMZ/NyanMBR/Makefile

56 lines
1.4 KiB
Makefile
Raw Normal View History

2017-04-14 07:00:23 -04:00
CC = cc
PY = python2
NASM = nasm
QEMU = qemu-system-i386
2017-04-12 09:53:46 -04:00
2017-04-14 07:00:23 -04:00
CCFLAGS =
ASFLAGS =
2017-04-12 06:15:35 -04:00
2017-05-02 05:02:20 -04:00
MUSIC = Data/Song/nyan.mid
# Don't change the build directory, it is hardcoded on other places
BUILDDIR = Build
2017-04-15 14:57:28 -04:00
FRAMES = $(sort $(wildcard Data/Image/Frames/*.png))
SPECIAL = $(sort $(wildcard Data/Image/Special/*.png))
STAGE1ASM = $(wildcard Source/Stage1/*.asm)
STAGE2ASM = $(shell find Source/Stage2 -name *.asm -type f)
2017-04-14 07:00:23 -04:00
all: disk.img
2017-04-12 06:15:35 -04:00
2017-04-14 07:00:23 -04:00
dir: $(BUILDDIR)
2017-04-14 07:00:23 -04:00
$(BUILDDIR):
mkdir -p $(BUILDDIR)
2017-04-12 06:15:35 -04:00
2017-04-29 06:50:32 -04:00
$(BUILDDIR)/frames.bin: $(FRAMES) Data/Image/png2bin.py
2017-04-15 14:57:28 -04:00
$(PY) Data/Image/png2bin.py $(FRAMES) $@
2017-04-29 06:50:32 -04:00
$(BUILDDIR)/special.bin: $(SPECIAL) Data/Image/png2bin.py
2017-04-15 14:57:28 -04:00
$(PY) Data/Image/png2bin.py $(SPECIAL) $@
2017-04-12 06:15:35 -04:00
2017-04-14 07:00:23 -04:00
$(BUILDDIR)/song.bin: $(MUSIC)
$(PY) Data/Song/midi2bin.py $(MUSIC) $@
2017-04-12 06:15:35 -04:00
$(BUILDDIR)/compress: Source/Compressor/compress.c
$(CC) Source/Compressor/compress.c -o $@ $(CCFLAGS)
2017-04-14 07:00:23 -04:00
2017-04-15 14:57:28 -04:00
$(BUILDDIR)/stage2.bin: $(STAGE2ASM) $(BUILDDIR)/song.bin $(BUILDDIR)/frames.bin $(BUILDDIR)/special.bin
cd Source/Stage2 && $(NASM) main.asm -o ../../$@ $(ASFLAGS)
$(BUILDDIR)/stage2-compressed.bin: $(BUILDDIR)/stage2.bin $(BUILDDIR)/compress
$(BUILDDIR)/compress $(BUILDDIR)/stage2.bin $@
disk.img: dir $(STAGE1ASM) $(BUILDDIR)/stage2-compressed.bin
cd Source/Stage1 && $(NASM) main.asm -o ../../disk.img $(ASFLAGS)
2017-04-12 06:15:35 -04:00
test: disk.img
2017-04-12 09:53:46 -04:00
$(QEMU) -s -soundhw pcspk -fda disk.img
2017-04-12 09:22:35 -04:00
clean:
2017-04-14 07:00:23 -04:00
rm -r $(BUILDDIR)
rm disk.img
2017-04-12 09:22:35 -04:00
2017-04-14 07:00:23 -04:00
.PHONY: test clean all dir