GNUmakefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # function pkg_check(pkg_config_name, ruby_name)
  2. pkg_check = \
  3. $(strip \
  4. $(if $(shell pkg-config --exists $1 && echo yes), \
  5. ruby += $2 \
  6. , \
  7. $(warning Package $1 not found, disabling driver) \
  8. ) \
  9. )
  10. ifeq ($(ruby),)
  11. ifeq ($(platform),windows)
  12. ruby += video.wgl video.direct3d video.directdraw video.gdi
  13. ruby += audio.asio audio.wasapi audio.xaudio2 audio.directsound audio.waveout
  14. ruby += input.windows
  15. else ifeq ($(platform),macos)
  16. ruby += video.cgl
  17. ruby += audio.openal
  18. ruby += input.quartz #input.carbon
  19. else ifeq ($(platform),linux)
  20. ruby += video.glx video.glx2 video.xvideo video.xshm
  21. ruby += audio.oss audio.alsa
  22. $(eval $(call pkg_check,openal,audio.openal))
  23. $(eval $(call pkg_check,libpulse,audio.pulseaudio))
  24. $(eval $(call pkg_check,libpulse,audio.pulseaudiosimple))
  25. $(eval $(call pkg_check,ao,audio.ao))
  26. ruby += input.xlib
  27. $(eval $(call pkg_check,sdl2,input.sdl))
  28. $(eval $(call pkg_check,udev,input.udev))
  29. else ifeq ($(platform),bsd)
  30. ruby += video.glx video.glx2 video.xvideo video.xshm
  31. ruby += audio.oss
  32. $(eval $(call pkg_check,openal,audio.openal))
  33. $(eval $(call pkg_check,libpulse,audio.pulseaudio))
  34. $(eval $(call pkg_check,libpulse,audio.pulseaudiosimple))
  35. ruby += input.xlib
  36. $(eval $(call pkg_check,sdl2,input.sdl))
  37. endif
  38. endif
  39. ifeq ($(platform),macos)
  40. ruby.flags := $(flags.objcpp)
  41. else
  42. ruby.flags := $(flags.cpp)
  43. endif
  44. ruby.flags += $(foreach c,$(subst .,_,$(call strupper,$(ruby))),-D$c)
  45. ruby.flags += $(if $(findstring input.sdl,$(ruby)),$(shell sdl2-config --cflags))
  46. ruby.options :=
  47. ruby.options += $(if $(findstring video.cgl,$(ruby)),-framework OpenGL)
  48. ruby.options += $(if $(findstring video.direct3d,$(ruby)),-ld3d9)
  49. ruby.options += $(if $(findstring video.directdraw,$(ruby)),-lddraw)
  50. ruby.options += $(if $(findstring video.glx,$(ruby)),-lGL)
  51. ruby.options += $(if $(findstring video.wgl,$(ruby)),-lopengl32)
  52. ruby.options += $(if $(findstring video.xvideo,$(ruby)),-lXv)
  53. ruby.options += $(if $(findstring audio.alsa,$(ruby)),-lasound)
  54. ruby.options += $(if $(findstring audio.ao,$(ruby)),-lao)
  55. ruby.options += $(if $(findstring audio.directsound,$(ruby)),-ldsound -luuid)
  56. ruby.options += $(if $(findstring audio.pulseaudio,$(ruby)),-lpulse)
  57. ruby.options += $(if $(findstring audio.pulseaudiosimple,$(ruby)),-lpulse-simple)
  58. ruby.options += $(if $(findstring audio.wasapi,$(ruby)),-lavrt -luuid)
  59. ruby.options += $(if $(findstring audio.waveout,$(ruby)),-lwinmm)
  60. ruby.options += $(if $(findstring audio.xaudio2,$(ruby)),-lole32)
  61. ruby.options += $(if $(findstring input.sdl,$(ruby)),$(shell sdl2-config --libs))
  62. ruby.options += $(if $(findstring input.udev,$(ruby)),-ludev)
  63. ruby.options += $(if $(findstring input.windows,$(ruby)),-ldinput8 -ldxguid)
  64. ifeq ($(platform),windows)
  65. ruby.options += $(if $(findstring audio.openal,$(ruby)),-lopenal32)
  66. endif
  67. ifeq ($(platform),macos)
  68. ruby.options += -framework IOKit
  69. ruby.options += $(if $(findstring audio.openal,$(ruby)),-framework OpenAL)
  70. endif
  71. ifeq ($(platform),linux)
  72. ruby.options += -lX11 -lXext -lXrandr
  73. ruby.options += $(if $(findstring audio.openal,$(ruby)),-lopenal)
  74. endif
  75. ifeq ($(platform),bsd)
  76. ruby.options += -lX11 -lXext -lXrandr
  77. ruby.options += $(if $(findstring audio.openal,$(ruby)),-lopenal -fuse-ld=bfd)
  78. # -fuse-ld=bfd: see FreeBSD bug 219089
  79. endif
  80. ruby.objects := $(object.path)/ruby.o
  81. $(object.path)/ruby.o: $(ruby.path)/ruby.cpp $(call rwildcard,$(ruby.path))
  82. $(info Compiling $< ...)
  83. @$(compiler) $(ruby.flags) $(flags) $(flags.deps) -c $< -o $@
  84. ruby.verbose:
  85. $(info ruby Drivers:)
  86. $(foreach n,$(ruby),$(info $([space]) $n))