DISTRHO Plugin Framework
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.

106 lines
2.5KB

  1. #!/usr/bin/make -f
  2. # Makefile for dgl #
  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. ifeq ($(PANDORA),true)
  38. # OpenPandora flags
  39. BASE_OPTS = -O2 -ffast-math
  40. ifneq ($(NOOPT),true)
  41. BASE_OPTS += -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
  42. endif
  43. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  44. endif
  45. ifneq ($(WIN32),true)
  46. # not needed for Windows
  47. BASE_FLAGS += -fPIC -DPIC
  48. endif
  49. ifeq ($(DEBUG),true)
  50. BASE_FLAGS += -DDEBUG -O0 -g
  51. LINK_OPTS =
  52. else
  53. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  54. CXXFLAGS += -fvisibility-inlines-hidden
  55. endif
  56. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  57. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
  58. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  59. ifeq ($(MACOS),true)
  60. # No C++11 support
  61. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS)
  62. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  63. endif
  64. # --------------------------------------------------------------
  65. # Check for required libs
  66. ifeq ($(LINUX),true)
  67. ifneq ($(shell pkg-config --exists gl && echo true),true)
  68. $(error OpenGL missing, cannot continue)
  69. endif
  70. ifneq ($(shell pkg-config --exists x11 && echo true),true)
  71. $(error X11 missing, cannot continue)
  72. endif
  73. endif
  74. # --------------------------------------------------------------
  75. # Set libs stuff
  76. ifeq ($(LINUX),true)
  77. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  78. DGL_LIBS = $(shell pkg-config --libs gl x11)
  79. endif
  80. ifeq ($(MACOS),true)
  81. DGL_LIBS = -framework OpenGL -framework Cocoa
  82. endif
  83. ifeq ($(WIN32),true)
  84. DGL_LIBS = -lopengl32 -lgdi32
  85. endif
  86. # --------------------------------------------------------------