DISTRHO MVerb
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.

154 lines
3.5KB

  1. #!/usr/bin/make -f
  2. # Makefile for DISTRHO Plugins #
  3. # ---------------------------- #
  4. # Created by falkTX
  5. #
  6. AR ?= ar
  7. CC ?= gcc
  8. CXX ?= g++
  9. # --------------------------------------------------------------
  10. # Fallback to Linux if no other OS defined
  11. ifneq ($(HAIKU),true)
  12. ifneq ($(MACOS),true)
  13. ifneq ($(WIN32),true)
  14. LINUX=true
  15. endif
  16. endif
  17. endif
  18. # --------------------------------------------------------------
  19. # Set build and link flags
  20. BASE_FLAGS = -Wall -Wextra -pipe
  21. BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections
  22. ifneq ($(MACOS),true)
  23. # MacOS doesn't support this
  24. BASE_OPTS += -mfpmath=sse
  25. endif
  26. ifeq ($(MACOS),true)
  27. # MacOS linker flags
  28. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
  29. else
  30. # Common linker flags
  31. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  32. endif
  33. ifeq ($(MODDUO),true)
  34. # MOD Duo optimization flags
  35. BASE_OPTS = -O2 -ffast-math -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
  36. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  37. endif
  38. ifeq ($(RASPPI),true)
  39. # Raspberry-Pi optimization flags
  40. BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
  41. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  42. endif
  43. ifeq ($(PANDORA),true)
  44. # OpenPandora optimization flags
  45. BASE_OPTS = -O2 -ffast-math -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
  46. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  47. endif
  48. ifeq ($(NOOPT),true)
  49. # No optimization flags
  50. BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
  51. endif
  52. ifneq ($(WIN32),true)
  53. # not needed for Windows
  54. BASE_FLAGS += -fPIC -DPIC
  55. endif
  56. ifeq ($(DEBUG),true)
  57. BASE_FLAGS += -DDEBUG -O0 -g
  58. LINK_OPTS =
  59. else
  60. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  61. CXXFLAGS += -fvisibility-inlines-hidden
  62. endif
  63. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  64. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS) $(CPPFLAGS)
  65. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  66. ifeq ($(MACOS),true)
  67. # No C++11 support
  68. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS) $(CPPFLAGS)
  69. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  70. endif
  71. # --------------------------------------------------------------
  72. # Check for optional libs
  73. ifeq ($(LINUX),true)
  74. HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
  75. HAVE_JACK = $(shell pkg-config --exists jack && echo true)
  76. HAVE_LIBLO = $(shell pkg-config --exists liblo && echo true)
  77. endif
  78. ifeq ($(MACOS),true)
  79. HAVE_DGL = true
  80. endif
  81. ifeq ($(WIN32),true)
  82. HAVE_DGL = true
  83. endif
  84. # --------------------------------------------------------------
  85. # Set libs stuff
  86. ifeq ($(HAVE_DGL),true)
  87. ifeq ($(LINUX),true)
  88. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  89. DGL_LIBS = $(shell pkg-config --libs gl x11)
  90. endif
  91. ifeq ($(MACOS),true)
  92. DGL_LIBS = -framework OpenGL -framework Cocoa
  93. endif
  94. ifeq ($(WIN32),true)
  95. DGL_LIBS = -lopengl32 -lgdi32
  96. endif
  97. endif # HAVE_DGL
  98. # --------------------------------------------------------------
  99. # Set app extension
  100. ifeq ($(WIN32),true)
  101. APP_EXT = .exe
  102. endif
  103. # --------------------------------------------------------------
  104. # Set shared lib extension
  105. LIB_EXT = .so
  106. ifeq ($(MACOS),true)
  107. LIB_EXT = .dylib
  108. endif
  109. ifeq ($(WIN32),true)
  110. LIB_EXT = .dll
  111. endif
  112. # --------------------------------------------------------------
  113. # Set shared library CLI arg
  114. SHARED = -shared
  115. ifeq ($(MACOS),true)
  116. SHARED = -dynamiclib
  117. endif
  118. # --------------------------------------------------------------