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.

97 lines
2.3KB

  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. 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 gl && echo true),true)
  60. $(error OpenGL missing, cannot continue)
  61. endif
  62. ifneq ($(shell pkg-config --exists x11 && echo true),true)
  63. $(error X11 missing, cannot continue)
  64. endif
  65. endif
  66. # --------------------------------------------------------------
  67. # Set libs stuff
  68. ifeq ($(LINUX),true)
  69. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  70. DGL_LIBS = $(shell pkg-config --libs gl x11)
  71. endif
  72. ifeq ($(MACOS),true)
  73. DGL_LIBS = -framework OpenGL -framework Cocoa
  74. endif
  75. ifeq ($(WIN32),true)
  76. DGL_LIBS = -lopengl32 -lgdi32
  77. endif
  78. # --------------------------------------------------------------