Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # $OpenBSD: Makefile,v 1.1 2015/12/22 04:20:22 bentley Exp $
  2. # https://github.com/sinamas/gambatte/pull/6
  3. .SUFFIXES: .c .cpp .o
  4. LIB = libgambatte/libgambatte.a
  5. SDL_NAME = gambatte_sdl
  6. SDL_TARGET = gambatte_sdl/$(SDL_NAME)
  7. TEST = test/testrunner
  8. PYTHON ?= python
  9. SDL_OBJECTS = \
  10. gambatte_sdl/src/audiosink.o \
  11. gambatte_sdl/src/blitterwrapper.o \
  12. gambatte_sdl/src/gambatte_sdl.o \
  13. gambatte_sdl/src/parser.o \
  14. gambatte_sdl/src/sdlblitter.o \
  15. gambatte_sdl/src/str_to_sdlkey.o \
  16. gambatte_sdl/src/usec.o \
  17. common/adaptivesleep.o \
  18. common/resample/src/chainresampler.o \
  19. common/resample/src/i0.o \
  20. common/resample/src/kaiser50sinc.o \
  21. common/resample/src/kaiser70sinc.o \
  22. common/resample/src/makesinckernel.o \
  23. common/resample/src/resamplerinfo.o \
  24. common/resample/src/u48div.o \
  25. common/rateest.o \
  26. common/skipsched.o \
  27. common/videolink/rgb32conv.o \
  28. common/videolink/vfilterinfo.o \
  29. common/videolink/vfilters/catrom2x.o \
  30. common/videolink/vfilters/catrom3x.o \
  31. common/videolink/vfilters/kreed2xsai.o \
  32. common/videolink/vfilters/maxsthq2x.o \
  33. common/videolink/vfilters/maxsthq3x.o
  34. LIB_OBJECTS = \
  35. libgambatte/src/bitmap_font.o \
  36. libgambatte/src/cpu.o \
  37. libgambatte/src/gambatte.o \
  38. libgambatte/src/initstate.o \
  39. libgambatte/src/interrupter.o \
  40. libgambatte/src/interruptrequester.o \
  41. libgambatte/src/loadres.o \
  42. libgambatte/src/memory.o \
  43. libgambatte/src/sound.o \
  44. libgambatte/src/state_osd_elements.o \
  45. libgambatte/src/statesaver.o \
  46. libgambatte/src/tima.o \
  47. libgambatte/src/file/file_zip.o \
  48. libgambatte/src/file/unzip/unzip.o \
  49. libgambatte/src/file/unzip/ioapi.o \
  50. libgambatte/src/mem/cartridge.o \
  51. libgambatte/src/mem/memptrs.o \
  52. libgambatte/src/mem/pakinfo.o \
  53. libgambatte/src/mem/rtc.o \
  54. libgambatte/src/sound/channel1.o \
  55. libgambatte/src/sound/channel2.o \
  56. libgambatte/src/sound/channel3.o \
  57. libgambatte/src/sound/channel4.o \
  58. libgambatte/src/sound/duty_unit.o \
  59. libgambatte/src/sound/envelope_unit.o \
  60. libgambatte/src/sound/length_counter.o \
  61. libgambatte/src/video.o \
  62. libgambatte/src/video/ly_counter.o \
  63. libgambatte/src/video/lyc_irq.o \
  64. libgambatte/src/video/next_m0_time.o \
  65. libgambatte/src/video/ppu.o \
  66. libgambatte/src/video/sprite_mapper.o
  67. TEST_OBJECTS = \
  68. test/testrunner.o
  69. all: $(SDL_TARGET)
  70. SDL_LFLAGS != pkg-config --libs sdl
  71. ZLIB_LFLAGS != pkg-config --libs zlib
  72. $(SDL_TARGET): $(SDL_OBJECTS) $(LIB)
  73. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ -pthread $(SDL_OBJECTS) $(LIB) \
  74. $(ZLIB_LFLAGS) $(SDL_LFLAGS)
  75. $(LIB): $(LIB_OBJECTS)
  76. $(AR) $(ARFLAGS) $@ $(LIB_OBJECTS)
  77. ranlib $@
  78. PKGCONFIG_CFLAGS != pkg-config --cflags sdl libpng zlib
  79. .c.o:
  80. $(CC) $(CFLAGS) -c $< -o $*.o
  81. .cpp.o:
  82. $(CXX) -Ilibgambatte/src -Ilibgambatte/include -Igambatte_sdl/src \
  83. -Icommon $(CXXFLAGS) -c $< -o $*.o \
  84. -DGAMBATTE_SDL_VERSION_STR=\"r571\" -DHAVE_STDINT_H \
  85. $(PKGCONFIG_CFLAGS)
  86. TEST_GBS = \
  87. test/hwtests/*.gb* \
  88. test/hwtests/*/*.gb* \
  89. test/hwtests/*/*/*.gb* \
  90. test/hwtests/*/*/*/*.gb*
  91. test: $(TEST)
  92. $(PYTHON) test/qdgbas.py \
  93. test/hwtests/*.asm \
  94. test/hwtests/*/*.asm \
  95. test/hwtests/*/*/*.asm \
  96. test/hwtests/*/*/*/*.asm
  97. $(TEST) $(TEST_GBS)
  98. PNG_LFLAGS != pkg-config --libs libpng
  99. $(TEST): $(TEST_OBJECTS) $(LIB)
  100. $(CXX) $(CXXFLAGS) -o $@ $(TEST_OBJECTS) $(LIB) \
  101. $(PNG_LFLAGS) $(ZLIB_LFLAGS)