|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- #!/usr/bin/make -f
- # Makefile for Carla C++ code #
- # --------------------------- #
- # Created by falkTX
- #
-
- # --------------------------------------------------------------
- # Modify to enable/disable specific features
-
- # Support for LADSPA, DSSI, LV2, VST and AU plugins
- CARLA_PLUGIN_SUPPORT = true
-
- # Support for csound files (version 6, not ready yet)
- CARLA_CSOUND_SUPPORT = false
-
- # Support for GIG, SF2 and SFZ sample banks (through fluidsynth and linuxsampler)
- CARLA_SAMPLERS_SUPPORT = true
-
- # Use the free vestige header instead of the official VST SDK
- CARLA_VESTIGE_HEADER = true
-
- # --------------------------------------------------------------
- # DO NOT MODIFY PAST THIS POINT!
-
- AR ?= ar
- RM ?= rm -f
- CC ?= gcc
- CXX ?= g++
-
- # --------------------------------------------------------------
- # Fallback to Linux if no other OS defined
-
- ifneq ($(HAIKU),true)
- ifneq ($(MACOS),true)
- ifneq ($(WIN32),true)
- LINUX=true
- endif
- endif
- endif
-
- # --------------------------------------------------------------
- # Set MACOS_OR_WIN32
-
- ifeq ($(MACOS),true)
- MACOS_OR_WIN32=true
- endif
-
- ifeq ($(WIN32),true)
- MACOS_OR_WIN32=true
- endif
-
- # --------------------------------------------------------------
- # Common build and link flags
-
- BASE_FLAGS = -Wall -Wextra -pipe -DREAL_BUILD
- BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
- LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections
- # -Wl,--strip-all
-
- ifeq ($(MACOS),true)
- # MacOS linker flags
- LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
- endif
-
- ifeq ($(RASPPI),true)
- # Raspberry-Pi optimization flags
- BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
- LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
- endif
-
- ifneq ($(WIN32),true)
- # not needed for Windows
- BASE_FLAGS += -fPIC -DPIC
- endif
-
- ifeq ($(DEBUG),true)
- BASE_FLAGS += -DDEBUG -O0 -g
- LINK_OPTS =
- else
- BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
- CXXFLAGS += -fvisibility-inlines-hidden
- endif
-
- 32BIT_FLAGS = -m32
- 64BIT_FLAGS = -m64
-
- BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
- BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
- LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
-
- ifeq ($(MACOS),true)
- # No C++11 support
- BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS)
- LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
- endif
-
- # --------------------------------------------------------------
- # Strict test build
-
- ifeq ($(TESTBUILD),true)
- BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
- ifneq ($(CC),clang)
- BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
- endif
- ifneq ($(MACOS),true)
- BASE_FLAGS += -Wmissing-declarations -Wsign-conversion
- ifneq ($(CC),clang)
- BASE_FLAGS += -Wlogical-op
- endif
- endif
- CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
- CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual
- ifeq ($(LINUX),true)
- CFLAGS += -isystem /opt/kxstudio/include
- CXXFLAGS += -isystem /opt/kxstudio/include -isystem /usr/include/qt4
- endif
- ifeq ($(MACOS),true)
- CFLAGS += -isystem /opt/local/include/
- CXXFLAGS += -isystem /opt/local/include/
- endif
- ifeq ($(WIN32),true)
- CFLAGS += -isystem /opt/mingw32/include
- CXXFLAGS += -isystem /opt/mingw32/include -isystem /opt/mingw32/include/qt4
- endif
- endif
-
- # --------------------------------------------------------------
- # Check for qt, set default version (prefer qt4)
-
- ifneq ($(MACOS),true)
- HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui QtXml && echo true)
- endif
- HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Xml Qt5Widgets && echo true)
-
- ifeq ($(HAVE_QT5),true)
- DEFAULT_QT=5
- endif
-
- ifeq ($(HAVE_QT4),true)
- DEFAULT_QT=4
- endif
-
- # --------------------------------------------------------------
- # Check for required libs
-
- ifneq ($(shell pkg-config --exists liblo && echo true),true)
- $(error liblo missing, cannot continue)
- endif
-
- ifneq ($(HAVE_QT4),true)
- ifneq ($(HAVE_QT5),true)
- $(error Qt missing, cannot continue)
- endif
- endif
-
- # --------------------------------------------------------------
- # Check for dgl support
-
- ifeq ($(HAIKU),true)
- HAVE_DGL = false
- endif
-
- ifeq ($(LINUX),true)
- HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
- endif
-
- ifeq ($(MACOS),true)
- HAVE_DGL = true
- endif
-
- ifeq ($(WIN32),true)
- HAVE_DGL = true
- endif
-
- # --------------------------------------------------------------
- # Check for juce support
-
- ifeq ($(HAIKU),true)
- HAVE_JUCE = false
- endif
-
- ifeq ($(LINUX),true)
- HAVE_JUCE = $(shell pkg-config --exists x11 xinerama xext xcursor freetype2 && echo true)
- endif
-
- ifeq ($(MACOS),true)
- HAVE_JUCE = true
- endif
-
- ifeq ($(WIN32),true)
- HAVE_JUCE = true
- endif
-
- # --------------------------------------------------------------
- # Check for optional libs (required by backend or bridges)
-
- HAVE_FFMPEG = $(shell pkg-config --exists libavcodec libavformat libavutil && echo true)
- HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
- HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
- HAVE_WAYLAND = $(shell pkg-config --exists wayland-client && echo true)
- HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
-
- ifeq ($(LINUX),true)
- HAVE_ALSA = $(shell pkg-config --exists alsa && echo true)
- HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
- endif
-
- ifeq ($(CARLA_CSOUND_SUPPORT),true)
- ifeq ($(HAVE_JUCE),true)
- HAVE_CSOUND = $(shell pkg-config --exists sndfile && echo true)
- endif
- endif
-
- ifeq ($(CARLA_SAMPLERS_SUPPORT),true)
- HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
- HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true)
- endif
-
- # --------------------------------------------------------------
- # Check for optional libs (required by internal plugins)
-
- HAVE_AF_DEPS = $(shell pkg-config --exists sndfile && echo true)
- HAVE_MF_DEPS = $(shell pkg-config --exists smf && echo true)
- HAVE_PM_DEPS = $(shell pkg-config --exists libprojectM && echo true)
- HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)
- HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk_images ntk && echo true)
-
- # --------------------------------------------------------------
- # Force some features on MacOS and Windows
-
- ifeq ($(MACOS_OR_WIN32),true)
- CARLA_VESTIGE_HEADER = false
- HAVE_WAYLAND = false
- HAVE_X11 = false
- endif
-
- # --------------------------------------------------------------
- # Set base defines
-
- ifeq ($(HAVE_DGL),true)
- BASE_FLAGS += -DHAVE_DGL
- endif
-
- ifeq ($(HAVE_FFMPEG),true)
- BASE_FLAGS += -DHAVE_FFMPEG
- endif
-
- ifeq ($(HAVE_JUCE),true)
- BASE_FLAGS += -DHAVE_JUCE
- endif
-
- ifeq ($(HAVE_WAYLAND),true)
- BASE_FLAGS += -DHAVE_WAYLAND
- endif
-
- ifeq ($(HAVE_X11),true)
- BASE_FLAGS += -DHAVE_X11
- endif
-
- # --------------------------------------------------------------
- # Set libs stuff (part 1)
-
- LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
- LIBLO_LIBS = $(shell pkg-config --libs liblo)
-
- ifeq ($(DEFAULT_QT),5)
- QTCORE_FLAGS = $(shell pkg-config --cflags Qt5Core)
- QTCORE_LIBS = $(shell pkg-config --libs Qt5Core)
- QTXML_FLAGS = $(shell pkg-config --cflags Qt5Xml)
- QTXML_LIBS = $(shell pkg-config --libs Qt5Xml)
- else
- QTCORE_FLAGS = $(shell pkg-config --cflags QtCore)
- QTCORE_LIBS = $(shell pkg-config --libs QtCore)
- QTXML_FLAGS = $(shell pkg-config --cflags QtXml)
- QTXML_LIBS = $(shell pkg-config --libs QtXml)
- endif
-
- ifeq ($(HAVE_CSOUND),true)
- CSOUND_FLAGS = -DUSE_DOUBLE=1
- CSOUND_LIBS = $(shell pkg-config --libs sndfile) -lcsound64
- endif
-
- ifeq ($(HAVE_FLUIDSYNTH),true)
- FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
- FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
- endif
-
- ifeq ($(HAVE_LINUXSAMPLER),true)
- LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -Wno-unused-parameter
- LINUXSAMPLER_LIBS = $(shell pkg-config --libs linuxsampler)
- endif
-
- ifeq ($(HAVE_WAYLAND),true)
- WAYLAND_FLAGS = $(shell pkg-config --cflags wayland-client)
- WAYLAND_LIBS = $(shell pkg-config --libs wayland-client)
- endif
-
- ifeq ($(HAVE_X11),true)
- X11_FLAGS = $(shell pkg-config --cflags x11)
- X11_LIBS = $(shell pkg-config --libs x11)
- endif
-
- # --------------------------------------------------------------
- # Set libs stuff (part 2)
-
- ifeq ($(HAVE_AF_DEPS),true)
- AUDIO_DECODER_FLAGS = $(shell pkg-config --cflags sndfile)
- AUDIO_DECODER_LIBS = $(shell pkg-config --libs sndfile)
- ifeq ($(HAVE_FFMPEG),true)
- AUDIO_DECODER_FLAGS += $(shell pkg-config --cflags libavcodec libavformat libavutil)
- AUDIO_DECODER_LIBS += $(shell pkg-config --libs libavcodec libavformat libavutil)
- endif
- endif
-
- RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
-
- ifeq ($(DEBUG),true)
- RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
- RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
- endif
-
- ifneq ($(HAIKU),true)
- RTMEMPOOL_LIBS = -lpthread
- endif
-
- ifeq ($(LINUX),true)
- ifeq ($(HAVE_DGL),true)
- DGL_FLAGS = $(shell pkg-config --cflags gl x11)
- DGL_LIBS = $(shell pkg-config --libs gl x11)
- endif
- JACKBRIDGE_LIBS = -ldl -lpthread -lrt
- ifeq ($(HAVE_JUCE),true)
- JUCE_CORE_LIBS = -ldl -lpthread -lrt
- JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11)
- JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11)
- JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetype2)
- JUCE_GRAPHICS_LIBS = $(shell pkg-config --libs x11 xinerama xext freetype2)
- JUCE_GUI_BASICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext xcursor)
- JUCE_GUI_BASICS_LIBS = $(shell pkg-config --libs x11 xinerama xext xcursor) -ldl
- endif
- LILV_LIBS = -ldl -lm -lrt
- ifeq ($(HAVE_ALSA),true)
- RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
- RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
- RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
- RTMIDI_LIBS += $(shell pkg-config --libs alsa)
- endif
- ifeq ($(HAVE_PULSEAUDIO),true)
- RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
- RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
- endif
- endif
-
- ifeq ($(MACOS),true)
- DGL_LIBS = -framework OpenGL -framework Cocoa
- JACKBRIDGE_LIBS = -ldl -lpthread
- JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
- JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
- JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
- JUCE_AUDIO_PROCESSORS_LIBS = -framework Cocoa -framework Carbon
- JUCE_CORE_LIBS = -framework AppKit
- JUCE_EVENTS_LIBS = -framework AppKit
- JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
- JUCE_GUI_BASICS_LIBS = -framework Cocoa
- JUCE_GUI_EXTRA_LIBS = -framework Cocoa -framework IOKit
- LILV_LIBS = -ldl -lm
- RTAUDIO_FLAGS += -D__MACOSX_CORE__
- RTAUDIO_LIBS += -framework CoreAudio -framework CoreFoundation -lpthread
- RTMIDI_FLAGS += -D__MACOSX_CORE__
- RTMIDI_LIBS += -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
- endif
-
- ifeq ($(WIN32),true)
- DGL_LIBS = -lopengl32 -lgdi32
- JACKBRIDGE_LIBS = -lpthread
- JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
- JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
- # JUCE_EVENTS_LIBS = -lole32
- JUCE_GRAPHICS_LIBS = -lgdi32
- JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
- LILV_LIBS = -lm
- RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__
- RTAUDIO_LIBS += -ldsound -lpthread
- RTMIDI_FLAGS += -D__WINDOWS_MM__
- endif
-
- # --------------------------------------------------------------
- # Set libs stuff (part 3)
-
- ifeq ($(HAVE_DGL),true)
- NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
- endif
-
- ifeq ($(HAVE_AF_DEPS),true)
- NATIVE_PLUGINS_FLAGS += -DWANT_AUDIOFILE
- NATIVE_PLUGINS_LIBS += $(AUDIO_DECODER_LIBS)
- endif
-
- ifeq ($(HAVE_MF_DEPS),true)
- NATIVE_PLUGINS_FLAGS += -DWANT_MIDIFILE
- NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs smf)
- endif
-
- ifeq ($(HAVE_PM_DEPS),true)
- NATIVE_PLUGINS_FLAGS += -DWANT_PROJECTM
- NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs libprojectM)
- endif
-
- ifeq ($(HAVE_ZYN_DEPS),true)
- NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX
- NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3 mxml zlib)
- ifeq ($(HAVE_ZYN_UI_DEPS),true)
- NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX_UI
- NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs ntk_images ntk)
- endif
- endif
-
- # --------------------------------------------------------------
- # Set Qt tools
-
- ifeq ($(HAVE_QT4),true)
- MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
- RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
- UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
- endif
-
- ifeq ($(HAVE_QT5),true)
- QT5_LIBDIR = $(shell pkg-config --variable=libdir Qt5Core)
- ifneq (,$(wildcard $(QT5_LIBDIR)/qt5/bin/moc))
- MOC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/moc
- RCC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/rcc
- UIC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/uic
- else
- ifeq ($(MACOS),true)
- MOC_QT5 ?= $(QT5_LIBDIR)/../bin/moc
- RCC_QT5 ?= $(QT5_LIBDIR)/../bin/rcc
- UIC_QT5 ?= $(QT5_LIBDIR)/../bin/uic
- else
- MOC_QT5 ?= $(QT5_LIBDIR)/qt/bin/moc
- RCC_QT5 ?= $(QT5_LIBDIR)/qt/bin/rcc
- UIC_QT5 ?= $(QT5_LIBDIR)/qt/bin/uic
- endif
- endif
- endif
-
- # --------------------------------------------------------------
|