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

150 lines
3.3KB

  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
  32. ifneq ($(SKIP_STRIPPING),true)
  33. LINK_OPTS += -Wl,--strip-all
  34. endif
  35. endif
  36. ifeq ($(RASPPI),true)
  37. # Raspberry-Pi optimization flags
  38. BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
  39. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  40. endif
  41. ifeq ($(PANDORA),true)
  42. # OpenPandora optimization flags
  43. BASE_OPTS = -O2 -ffast-math -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
  44. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  45. endif
  46. ifeq ($(NOOPT),true)
  47. # No optimization flags
  48. BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
  49. endif
  50. ifneq ($(WIN32),true)
  51. # not needed for Windows
  52. BASE_FLAGS += -fPIC -DPIC
  53. endif
  54. ifeq ($(DEBUG),true)
  55. BASE_FLAGS += -DDEBUG -O0 -g
  56. LINK_OPTS =
  57. else
  58. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  59. CXXFLAGS += -fvisibility-inlines-hidden
  60. endif
  61. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  62. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS) $(CPPFLAGS)
  63. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  64. ifeq ($(MACOS),true)
  65. # No C++11 support
  66. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS) $(CPPFLAGS)
  67. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  68. endif
  69. # --------------------------------------------------------------
  70. # Check for optional & required libs
  71. ifeq ($(LINUX),true)
  72. HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
  73. HAVE_JACK = $(shell pkg-config --exists jack && echo true)
  74. endif
  75. ifeq ($(MACOS),true)
  76. HAVE_DGL = true
  77. endif
  78. ifeq ($(WIN32),true)
  79. HAVE_DGL = true
  80. endif
  81. ifneq ($(HAVE_DGL),true)
  82. $(error OpenGL missing, cannot continue)
  83. endif
  84. # --------------------------------------------------------------
  85. # Set libs stuff
  86. ifeq ($(LINUX),true)
  87. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  88. DGL_LIBS = $(shell pkg-config --libs gl x11)
  89. endif
  90. ifeq ($(MACOS),true)
  91. DGL_LIBS = -framework OpenGL -framework Cocoa
  92. endif
  93. ifeq ($(WIN32),true)
  94. DGL_LIBS = -lopengl32 -lgdi32
  95. endif
  96. # --------------------------------------------------------------
  97. # Set app extension
  98. ifeq ($(WIN32),true)
  99. APP_EXT = .exe
  100. endif
  101. # --------------------------------------------------------------
  102. # Set shared lib extension
  103. LIB_EXT = .so
  104. ifeq ($(MACOS),true)
  105. LIB_EXT = .dylib
  106. endif
  107. ifeq ($(WIN32),true)
  108. LIB_EXT = .dll
  109. endif
  110. # --------------------------------------------------------------
  111. # Set shared library CLI arg
  112. SHARED = -shared
  113. ifeq ($(MACOS),true)
  114. SHARED = -dynamiclib
  115. endif
  116. # --------------------------------------------------------------