# Copyright (c) 2015-2020 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 . OBJS=libsyscalls.a libngdevkit.a ngdevkit-crt0.o ngdevkit-crti.o ngdevkit-crtn.o ngdevkit-cd-crt0.o SYSCALL_OBJS=\ close \ _exit \ exit \ fstat \ getpid \ gettimeofday \ isatty \ kill \ link \ lseek \ open \ raise \ read \ sbrk \ times \ unlink \ write NGDEVKIT_OBJS=\ soft-dip \ soft-dip-jp \ soft-dip-us \ soft-dip-eu \ bios-ram \ bios-backup-ram \ bios-calls \ ng_text_tall_args \ ng_text_args \ ng_center_text_tall_args \ ng_center_text_args \ ng_cls_args \ ng_wait_vblank \ ng_memory_card_inserted \ ng_memory_card_write_protected \ ng_memory_card_unlock \ ng_memory_card_lock NGDEVKIT_CFLAGS=-I../include -std=c99 -fomit-frame-pointer NGDEVKIT_OPTS=-O0 all: $(OBJS) ngdevkit ngdevkit-cd -include ../Makefile.config libsyscalls.a: $(SYSCALL_OBJS:%=syscall/%.o) $(NGAR) cru $@ $^ && $(NGRANLIB) $@ libngdevkit.a: $(NGDEVKIT_OBJS:%=libngdevkit/%.o) $(NGAR) cru $@ $^ && $(NGRANLIB) $@ ngdevkit: $(NGGCC) -dumpspecs | sed -e 's/\(-lc\)/\1 -lsyscalls \1/' \ -e 's/\(crtbegin.o%s\)/-T ngdevkit.ld%s ngdevkit-crt0.o%s ngdevkit-crti.o%s \1/' \ -e 's/\(crtend.o%s\)/\1 ngdevkit-crtn.o%s/' > $@ ngdevkit-cd: ngdevkit sed -e 's/ngdevkit-crt0.o/ngdevkit-cd-crt0.o/' $< > $@ %.o: %.c $(NGGCC) $(NGDEVKIT_CFLAGS) $(NGDEVKIT_OPTS) -I../include -c $< -o $@ %.o: %.S $(NGGCC) -I../include -c $< -o $@ ngdevkit-cd-crt0.o: ngdevkit-crt0.S $(NGGCC) -I../include -D__NEO_GEO_CD__ -c $< -o $@ install: install-objs install-specs install-dirs: OBJDIR=$(DESTDIR)$(prefix)/m68k-neogeo-elf/lib && \ SPECSDIR=$(DESTDIR)$(prefix)/m68k-neogeo-elf/lib/gcc/m68k-neogeo-elf/$$($(NGGCC) -dumpversion) && \ $(INSTALL) -d $$OBJDIR && $(INSTALL) -d $$SPECSDIR install-objs: install-dirs $(OBJS) ngdevkit.ld DIR=$(DESTDIR)$(prefix)/m68k-neogeo-elf/lib && \ $(INSTALL) $(filter-out install-dirs,$^) $$DIR install-specs: install-dirs ngdevkit ngdevkit-cd DIR=$(DESTDIR)$(prefix)/m68k-neogeo-elf/lib/gcc/m68k-neogeo-elf/$$($(NGGCC) -dumpversion) && \ $(INSTALL) $(filter-out install-dirs,$^) $$DIR clean: rm -f *.o libngdevkit/*.o syscall/*.o *~ *.a ngdevkit ngdevkit-cd .PHONY: install clean