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

126 lines
2.9KB

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