NESe (pronounced "Nessie") is a NES emulator based on the e6502 emulator, also written in C with a focus on speed and portability for use on embedded platforms, especially ARM.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
1.9KB

  1. SHORT_PLATFORM = linux
  2. ifeq ($(PLATFORM),win64)
  3. CROSS_COMPILE = x86_64-w64-mingw32-
  4. EXTENSION = .exe
  5. SHORT_PLATFORM = win
  6. LDFLAGS += -lSDL2
  7. else ifeq ($(PLATFORM),win32)
  8. CROSS_COMPILE = i686-w64-mingw32-
  9. EXTENSION = .exe
  10. SHORT_PLATFORM = win
  11. LDFLAGS += -lSDL2
  12. else
  13. CFLAGS += $(shell sdl2-config --cflags)
  14. LDFLAGS += $(shell sdl2-config --libs)
  15. endif
  16. ifneq ($(PLATFORM),)
  17. PLAT_SUFFIX = -$(PLATFORM)
  18. endif
  19. CC = $(CROSS_COMPILE)gcc
  20. LD = $(CC)
  21. RFLAGS += -O3 -s
  22. RFLAGS += -DSTANDALONE
  23. DFLAGS += -g
  24. DFLAGS += -DDEBUG_MAPPER
  25. #DFLAGS += -DDEBUG_RENDER
  26. #DFLAGS += -DDEBUG_PPU
  27. DFLAGS += -DDEBUG_VRAM -DDEBUG_OAM
  28. #DFLAGS += -DDEBUG_APU
  29. #DFLAGS += -DDEBUG_INPUT
  30. DFLAGS += -DE6502_DEBUG
  31. CFLAGS += -DE6502_ILLEGAL
  32. CFLAGS += $(PFLAGS) -Wall -Werror -Wshadow -Wunused -I./ -Isrc/
  33. CFLAGS += -Iinc/$(PLATFORM)/SDL2
  34. LDFLAGS += $(PFLAGS)
  35. LDFLAGS += -Llib/$(PLATFORM)
  36. OBJDIR = obj$(PLAT_SUFFIX)
  37. SRCDIR = src
  38. BINDIR = bin$(PLAT_SUFFIX)
  39. # nese
  40. TARGET_1 = nese$(EXTENSION)
  41. SRC_SRCS_1 = nese.c ines.c
  42. SRC_SRCS_1 += nes.c ppu.c input.c
  43. SRC_SRCS_1 += cart.c mapper.c
  44. SRC_SRCS_1 += apu.c audio.c
  45. SRC_SRCS_1 += file.c save.c
  46. SRC_SRCS_1 += overlay.c menu.c
  47. SRC_SRCS_1 += state.c ini.c
  48. SRC_SRCS_1 += compat.c
  49. SRC_SRCS_1 += sdl_render.c sdl_input.c sdl_audio.c sdl_timer.c
  50. SRC_SRCS_1 += sdl_overlay.c sdl_effect.c
  51. PLAT_SRCS_1 = filemap.c
  52. MAPDIR = src/map
  53. MAP_SRCS_1 = nrom.c mmc1.c uxrom.c cnrom.c mmc3.c
  54. EXT_SRCS_1 = e6502/e6502.c e6502/opcodes.c blip-buf/blip_buf.c
  55. SRCS_1 = $(SRC_SRCS_1:%=$(SRCDIR)/%)
  56. SRCS_1 += $(MAP_SRCS_1:%=$(MAPDIR)/%)
  57. SRCS_1 += $(PLAT_SRCS_1:%=src/$(SHORT_PLATFORM)/%)
  58. SRCS_1 += $(EXT_SRCS_1)
  59. OBJS_1 = $(SRCS_1:%.c=$(OBJDIR)/%.o)
  60. all: debug
  61. debug: EFLAGS=$(DFLAGS)
  62. release: EFLAGS=$(RFLAGS)
  63. debug release: $(BINDIR)/$(TARGET_1)
  64. clean: ; rm -rf obj*/ bin*/
  65. $(BINDIR)/$(TARGET_1): $(OBJS_1)
  66. @mkdir -p $(@D)
  67. $(LD) $^ $(LDFLAGS) -o $@
  68. $(OBJDIR)/%.o: %.c
  69. @mkdir -p $(@D)
  70. $(CC) $(EFLAGS) $(CFLAGS) -c $< -o $@
  71. .PHONY: all debug release clean