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

114 lines
2.6KB

  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 -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
  21. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections -Wl,--strip-all
  22. ifeq ($(MACOS),true)
  23. # MacOS linker flags
  24. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
  25. endif
  26. ifeq ($(RASPPI),true)
  27. # Raspberry-Pi optimization flags
  28. BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
  29. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  30. endif
  31. ifneq ($(WIN32),true)
  32. # not needed for Windows
  33. BASE_FLAGS += -fPIC -DPIC
  34. endif
  35. ifeq ($(DEBUG),true)
  36. BASE_FLAGS += -DDEBUG -O0 -g
  37. LINK_OPTS =
  38. else
  39. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  40. CXXFLAGS += -fvisibility-inlines-hidden
  41. LINK_OPTS += -Wl,--strip-all
  42. endif
  43. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  44. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
  45. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  46. ifeq ($(MACOS),true)
  47. # No C++11 support
  48. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS)
  49. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  50. endif
  51. # --------------------------------------------------------------
  52. # Check for required libs
  53. ifeq ($(LINUX),true)
  54. ifneq ($(shell pkg-config --exists gl && echo true),true)
  55. $(error OpenGL missing, cannot continue)
  56. endif
  57. ifneq ($(shell pkg-config --exists x11 && echo true),true)
  58. $(error X11 missing, cannot continue)
  59. endif
  60. endif
  61. # --------------------------------------------------------------
  62. # Set libs stuff
  63. ifeq ($(LINUX),true)
  64. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  65. DGL_LIBS = $(shell pkg-config --libs gl x11)
  66. endif
  67. ifeq ($(MACOS),true)
  68. DGL_LIBS = -framework OpenGL -framework Cocoa
  69. endif
  70. ifeq ($(WIN32),true)
  71. DGL_LIBS = -lopengl32 -lgdi32
  72. endif
  73. # --------------------------------------------------------------
  74. # Set extension
  75. EXT = so
  76. ifeq ($(MACOS),true)
  77. EXT = dylib
  78. endif
  79. ifeq ($(WIN32),true)
  80. EXT = dll
  81. endif
  82. # --------------------------------------------------------------
  83. # Set shared library CLI arg
  84. SHARED = -shared
  85. ifeq ($(MACOS),true)
  86. SHARED = -dynamiclib
  87. endif
  88. # --------------------------------------------------------------