Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #
  2. # meg4/platform/glfw_pa/Makefile
  3. #
  4. # Copyright (C) 2023 bzt
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. #
  20. # @brief The GLFW + portaudio Makefile
  21. #
  22. BACKEND=glfw
  23. # MacOS
  24. ifneq ("$(wildcard /Library/Frameworks/GLFW*)","")
  25. PACKAGE = MacOS
  26. CFLAGS = -I/Library/Frameworks/GLFW.framework/Headers -I/Library/Frameworks/GLFW.framework/Versions/A/Headers -D_MACOS_=1 -x objective-c -fobjc-exceptions
  27. LIBS = -F/Library/Frameworks -framework GLFW -framework GL -framework OpenAL -framework AppKit
  28. else
  29. # Windows MinGW
  30. ifneq ("$(wildcard /bin/*.exe)","")
  31. PACKAGE = Win
  32. LDFLAGS += -mwindows -static-libgcc
  33. LIBS += -Wl,--nxcompat -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive
  34. ifneq ("$(wildcard portaudio/*)","")
  35. CFLAGS += -I./portaudio/include
  36. EXTRA += ./portaudio/lib/.libs/libportaudio.a
  37. else
  38. LIBS += -lportaudio
  39. endif
  40. ifneq ("$(wildcard glfw3/*)","")
  41. CFLAGS += -I./glfw3/include
  42. EXTRA += ./glfw3/build/src/libglfw3.a
  43. else
  44. LIBS += -lglfw
  45. endif
  46. LIBS += -lGL -luser32 -lcomdlg32 -lshlwapi -lws2_32
  47. else
  48. # Linux
  49. PACKAGE = Linux
  50. ifneq ("$(wildcard portaudio/*)","")
  51. CFLAGS += -I./portaudio/include
  52. EXTRA += ./portaudio/lib/.libs/libportaudio.a
  53. else
  54. LIBS += -lportaudio
  55. endif
  56. ifneq ("$(wildcard glfw3/*)","")
  57. CFLAGS += -I./glfw3/include
  58. EXTRA += ./glfw3/build/src/libglfw3.a
  59. else
  60. LIBS += -lglfw
  61. endif
  62. LIBS += -lGL -lm -ldl -lpthread
  63. endif
  64. endif
  65. ifneq ($(NOGLES),)
  66. CFLAGS += -DNOGLES=1
  67. endif
  68. ifneq ($(JOYFALLBACK),)
  69. CFLAGS += -DJOYFALLBACK=1
  70. endif
  71. include ../common.mk
  72. ifneq ("$(wildcard portaudio/*)","")
  73. portaudio/lib/.libs/libportaudio.a:
  74. ifeq ($(wildcard portaudio/configure),)
  75. @cd portaudio && ./autogen.sh
  76. endif
  77. ifeq ($(wildcard portaudio/Makefile),)
  78. @cd portaudio && ./configure --disable-shared --enable-static
  79. endif
  80. @make --no-print-directory -s -C portaudio all
  81. endif
  82. ifneq ("$(wildcard glfw3/*)","")
  83. glfw3/build/src/libglfw3.a:
  84. ifeq ($(wildcard glfw3/build/Makefile),)
  85. @cd glfw3 && cmake -S . -B build -D GLFW_BUILD_EXAMPLES=OFF -D GLFW_BUILD_TESTS=OFF -D GLFW_BUILD_DOCS=0FF
  86. endif
  87. @make --no-print-directory -s -C glfw3/build all
  88. endif
  89. static-glfw3:
  90. git clone https://github.com/glfw/glfw.git
  91. mv glfw glfw3
  92. static-pa:
  93. git clone https://github.com/PortAudio/portaudio.git