# Copyright (c) 2015-2019 Damien Ciabrini # This file is part of ngdevkit # # ngdevkit is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # ngdevkit is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with ngdevkit. If not, see . MROM=rom/sm1.sm1 SROM=rom/sfix.sfix PROMS=rom/sp-s2.sp1 rom/aes-bios.bin rom/neo-epo.bin rom/neo-po.bin AES_PROMS=rom/aes-bios.bin rom/neo-epo.bin rom/neo-po.bin ZROM=rom/000-lo.lo AES_BIOS=rom/aes.zip MVS_BIOS=rom/neogeo.zip all: $(AES_BIOS) $(MVS_BIOS) -include ../Makefile.config NULLSOUNDSRCDIR=../nullsound NULLSOUND=../nullsound/nullsound.lib BIOS_OBJS=credits controllers gfx Z80_OBJS=user_commands Z80_HEX=nullsound_driver.ihx VERSION=@PACKAGE_VERSION@ BIOSCFLAGS=-I../include -std=c99 -fomit-frame-pointer BIOSOPTS=-O2 BIOSLDFLAGS=-nostartfiles -T bios.ld -L../runtime $(AES_BIOS): $(AES_PROMS) $(ZROM) $(SROM) $(MROM) cd rom && /bin/echo -e "===\n\ nullbios AES $(VERSION), an open source replacement BIOS for the Neo Geo\n\ https://github.com/dciabrin/ngdevkit\n\ ===" | /usr/bin/zip -qz $(@:rom/%=%) $(^:rom/%=%) $(MVS_BIOS): $(PROMS) $(ZROM) $(SROM) $(MROM) cd rom && /bin/echo -e "===\n\ nullbios $(VERSION), an open source replacement BIOS for the Neo Geo\n\ https://github.com/dciabrin/ngdevkit\n\ ===" | /usr/bin/zip -qz $(@:rom/%=%) $(^:rom/%=%) $(MROM): $(Z80_HEX) | rom $(NGSDOBJCOPY) -I ihex -O binary $< $@ --pad-to 131072 user_commands.rel: user_commands.s $(NGSDAS) -g -l -p -u -I$(NULLSOUNDSRCDIR) -o $@ $< $(SROM): | rom dd if=/dev/zero bs=1024 count=128 of=$@ rom/sp-s2.sp1: sp-s2.elf | rom $(NGOBJCOPY) -O binary -S -R .comment --reverse-bytes=2 $< $@ rom/aes-bios.bin: aes-bios.elf | rom $(NGOBJCOPY) -O binary -S -R .comment --reverse-bytes=2 $< $@ rom/neo-po.bin rom/neo-epo.bin: rom/aes-bios.bin cp $< $@ $(ZROM): | rom $(PYTHON) zoom-rom.py -o $@ rom: mkdir $@ bios-backup-ram.o: BIOSOPTS=-O0 bios-ram.o: BIOSOPTS=-O0 %.o: %.c $(NGGCC) $(BIOSCFLAGS) $(BIOSOPTS) -c $< -o $@ sp-s2.elf: sp-s2.o $(BIOS_OBJS:%=%.o) $(NGGCCLD) $(BIOSLDFLAGS) $^ -lngdevkit -o $@ sp-s2.o: biosstart.S $(NGGCC) -DBIOS_ROM_HARDWARE=1 -DBIOS_ROM_COUNTRY=2 -I../include -c $< -o $@ aes-bios.elf: aes-bios.o $(BIOS_OBJS:%=%.o) $(NGGCCLD) $(BIOSLDFLAGS) $^ -lngdevkit -o $@ aes-bios.o: biosstart.S $(NGGCC) -DBIOS_ROM_HARDWARE=0 -DBIOS_ROM_COUNTRY=2 -I../include -c $< -o $@ $(Z80_HEX): $(Z80_OBJS:%=%.rel) $(MAKE) -C $(NULLSOUNDSRCDIR) $(NGSDLD) -b DATA=0xf800 -i $@ $(NULLSOUND) $^ install: $(AES_BIOS) $(MVS_BIOS) $(Z80_HEX) $(INSTALL) -d $(DESTDIR)$(prefix)/share/ngdevkit && \ $(INSTALL) $^ $(DESTDIR)$(prefix)/share/ngdevkit clean: rm -f *.o *~ *.elf *.rel *.lst *.rst *.ihx rom/*.* .PHONY: install clean bios