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.

91 lines
2.2KB

  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 -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. endif
  42. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  43. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
  44. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  45. ifeq ($(MACOS),true)
  46. # No C++11 support
  47. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS)
  48. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  49. endif
  50. # --------------------------------------------------------------
  51. # Check for required libs
  52. ifeq ($(LINUX),true)
  53. ifneq ($(shell pkg-config --exists gl && echo true),true)
  54. $(error OpenGL missing, cannot continue)
  55. endif
  56. ifneq ($(shell pkg-config --exists x11 && echo true),true)
  57. $(error X11 missing, cannot continue)
  58. endif
  59. endif
  60. # --------------------------------------------------------------
  61. # Set libs stuff
  62. ifeq ($(LINUX),true)
  63. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  64. DGL_LIBS = $(shell pkg-config --libs gl x11)
  65. endif
  66. ifeq ($(MACOS),true)
  67. DGL_LIBS = -framework OpenGL -framework Cocoa
  68. endif
  69. ifeq ($(WIN32),true)
  70. DGL_LIBS = -lopengl32 -lgdi32
  71. endif
  72. # --------------------------------------------------------------