375 lines
12 KiB
Makefile
375 lines
12 KiB
Makefile
#!/usr/bin/make -f
|
|
|
|
# these can be overridden using make variables. e.g.
|
|
# make CFLAGS=-O2
|
|
# make install DESTDIR=$(CURDIR)/debian/fil4.lv2 PREFIX=/usr
|
|
#
|
|
PREFIX ?= /usr/local
|
|
BINDIR ?= $(PREFIX)/bin
|
|
MANDIR ?= $(PREFIX)/share/man/man1
|
|
# see http://lv2plug.in/pages/filesystem-hierarchy-standard.html, don't use libdir
|
|
LV2DIR ?= $(PREFIX)/lib/lv2
|
|
|
|
CXXFLAGS ?= -Wall -g -Wno-unused-function
|
|
|
|
PKG_CONFIG?=pkg-config
|
|
STRIP?= strip
|
|
|
|
BUILDOPENGL?=yes
|
|
BUILDJACKAPP?=yes
|
|
|
|
fil4_VERSION ?= $(shell (git describe --tags HEAD || echo "0") | sed 's/-g.*$$//;s/^v//')
|
|
RW ?= robtk/
|
|
|
|
###############################################################################
|
|
|
|
MACHINE=$(shell uname -m)
|
|
ifneq (,$(findstring x64,$(MACHINE)))
|
|
HAVE_SSE=yes
|
|
endif
|
|
ifneq (,$(findstring 86,$(MACHINE)))
|
|
HAVE_SSE=yes
|
|
endif
|
|
|
|
ifeq ($(HAVE_SSE),yes)
|
|
OPTIMIZATIONS ?= -msse -msse2 -mfpmath=sse -ffast-math -fomit-frame-pointer -O3 -fno-finite-math-only -DNDEBUG
|
|
else
|
|
OPTIMIZATIONS ?= -fomit-frame-pointer -O3 -fno-finite-math-only -DNDEBUG
|
|
endif
|
|
|
|
###############################################################################
|
|
|
|
BUILDDIR = build/
|
|
APPBLD = x42/
|
|
|
|
###############################################################################
|
|
|
|
LV2NAME=fil4
|
|
LV2GUI=fil4UI_gl
|
|
BUNDLE=fil4.lv2
|
|
targets=
|
|
|
|
LOADLIBES=-lm
|
|
LV2UIREQ=
|
|
GLUICFLAGS=-I.
|
|
|
|
ifneq ($(MOD),)
|
|
INLINEDISPLAY=no
|
|
BUILDOPENGL=no
|
|
BUILDJACKAPP=no
|
|
MODLABEL1=mod:label \"x42-eq mono\";
|
|
MODLABEL2=mod:label \"x42-eq stereo\";
|
|
MODBRAND=mod:brand \"x42\";
|
|
else
|
|
MODLABEL1=
|
|
MODLABEL2=
|
|
MODBRAND=
|
|
endif
|
|
|
|
UNAME=$(shell uname)
|
|
ifeq ($(UNAME),Darwin)
|
|
LV2LDFLAGS=-dynamiclib
|
|
LIB_EXT=.dylib
|
|
EXE_EXT=
|
|
UI_TYPE=ui:CocoaUI
|
|
PUGL_SRC=$(RW)pugl/pugl_osx.mm
|
|
PKG_GL_LIBS=
|
|
GLUICFLAGS+=-DROBTK_UPSCALE
|
|
GLUILIBS=-framework Cocoa -framework OpenGL -framework CoreFoundation
|
|
STRIPFLAGS=-u -r -arch all -s $(RW)lv2syms
|
|
EXTENDED_RE=-E
|
|
else
|
|
LV2LDFLAGS=-Wl,-Bstatic -Wl,-Bdynamic -Wl,--as-needed
|
|
LIB_EXT=.so
|
|
EXE_EXT=
|
|
UI_TYPE=ui:X11UI
|
|
PUGL_SRC=$(RW)pugl/pugl_x11.c
|
|
PKG_GL_LIBS=glu gl
|
|
GLUILIBS=-lX11
|
|
GLUICFLAGS+=`$(PKG_CONFIG) --cflags glu`
|
|
STRIPFLAGS= -s
|
|
EXTENDED_RE=-r
|
|
endif
|
|
|
|
ifneq ($(XWIN),)
|
|
CC=$(XWIN)-gcc
|
|
CXX=$(XWIN)-g++
|
|
STRIP=$(XWIN)-strip
|
|
LV2LDFLAGS=-Wl,-Bstatic -Wl,-Bdynamic -Wl,--as-needed
|
|
LIB_EXT=.dll
|
|
EXE_EXT=.exe
|
|
PUGL_SRC=$(RW)pugl/pugl_win.cpp
|
|
PKG_GL_LIBS=
|
|
UI_TYPE=ui:WindowsUI
|
|
GLUILIBS=-lws2_32 -lwinmm -lopengl32 -lglu32 -lgdi32 -lcomdlg32 -lpthread
|
|
GLUICFLAGS=-I.
|
|
override LDFLAGS += -static-libgcc -static-libstdc++
|
|
endif
|
|
|
|
ifeq ($(EXTERNALUI), yes)
|
|
UI_TYPE=
|
|
endif
|
|
|
|
ifeq ($(UI_TYPE),)
|
|
UI_TYPE=kx:Widget
|
|
LV2UIREQ+=lv2:requiredFeature kx:Widget;
|
|
override CXXFLAGS += -DXTERNAL_UI
|
|
endif
|
|
|
|
targets+=$(BUILDDIR)$(LV2NAME)$(LIB_EXT)
|
|
|
|
UITTL=
|
|
ifneq ($(BUILDOPENGL), no)
|
|
targets+=$(BUILDDIR)$(LV2GUI)$(LIB_EXT)
|
|
UITTL=ui:ui $(LV2NAME):ui_gl ;
|
|
endif
|
|
ifneq ($(MOD),)
|
|
targets+=$(BUILDDIR)modgui
|
|
endif
|
|
|
|
###############################################################################
|
|
# extract versions
|
|
LV2VERSION=$(fil4_VERSION)
|
|
include git2lv2.mk
|
|
|
|
###############################################################################
|
|
# check for build-dependencies
|
|
ifeq ($(shell $(PKG_CONFIG) --exists lv2 || echo no), no)
|
|
$(error "LV2 SDK was not found")
|
|
endif
|
|
|
|
ifeq ($(shell $(PKG_CONFIG) --exists fftw3f || echo no), no)
|
|
$(error "fftw3f library was not found")
|
|
endif
|
|
|
|
ifeq ($(shell $(PKG_CONFIG) --atleast-version=1.6.0 lv2 || echo no), no)
|
|
$(error "LV2 SDK needs to be version 1.6.0 or later")
|
|
endif
|
|
|
|
ifneq ($(BUILDOPENGL)$(BUILDJACKAPP), nono)
|
|
ifeq ($(shell $(PKG_CONFIG) --exists pango cairo $(PKG_GL_LIBS) || echo no), no)
|
|
$(error "This plugin requires cairo pango $(PKG_GL_LIBS)")
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(BUILDJACKAPP), no)
|
|
ifeq ($(shell $(PKG_CONFIG) --exists jack || echo no), no)
|
|
$(warning *** libjack from http://jackaudio.org is required)
|
|
$(error Please install libjack-dev or libjack-jackd2-dev)
|
|
endif
|
|
JACKAPP=$(APPBLD)x42-fil4$(EXE_EXT)
|
|
endif
|
|
|
|
# check for lv2_atom_forge_object new in 1.8.1 deprecates lv2_atom_forge_blank
|
|
ifeq ($(shell $(PKG_CONFIG) --atleast-version=1.8.1 lv2 && echo yes), yes)
|
|
override CXXFLAGS += -DHAVE_LV2_1_8
|
|
endif
|
|
|
|
ifneq ($(BUILDOPENGL)$(BUILDJACKAPP), nono)
|
|
ifneq ($(MAKECMDGOALS), submodules)
|
|
ifeq ($(wildcard $(RW)robtk.mk),)
|
|
$(warning "**********************************************************")
|
|
$(warning This plugin needs https://github.com/x42/robtk)
|
|
$(warning "**********************************************************")
|
|
$(info )
|
|
$(info set the RW environment variale to the location of the robtk headers)
|
|
ifeq ($(wildcard .git),.git)
|
|
$(info or run 'make submodules' to initialize robtk as git submodule)
|
|
endif
|
|
$(info )
|
|
$(warning "**********************************************************")
|
|
$(error robtk not found)
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
# LV2 idle >= lv2-1.6.0
|
|
GLUICFLAGS+=-DHAVE_IDLE_IFACE
|
|
LV2UIREQ+=lv2:requiredFeature ui:idleInterface; lv2:extensionData ui:idleInterface;
|
|
|
|
# add library dependent flags and libs
|
|
override CXXFLAGS += $(OPTIMIZATIONS) -DVERSION="\"$(fil4_VERSION)\""
|
|
override CXXFLAGS += `$(PKG_CONFIG) --cflags lv2`
|
|
ifeq ($(XWIN),)
|
|
override CXXFLAGS += -fPIC -fvisibility=hidden
|
|
else
|
|
override CXXFLAGS += -DPTW32_STATIC_LIB
|
|
endif
|
|
|
|
ifneq ($(INLINEDISPLAY),no)
|
|
override CXXFLAGS += `$(PKG_CONFIG) --cflags cairo pangocairo pango` -I$(RW) -DDISPLAY_INTERFACE
|
|
override LOADLIBES += `$(PKG_CONFIG) $(PKG_UI_FLAGS) --libs cairo pangocairo pango`
|
|
ifneq ($(XWIN),)
|
|
override LOADLIBES += -lpthread -lusp10
|
|
endif
|
|
endif
|
|
|
|
GLUICFLAGS+=`$(PKG_CONFIG) --cflags cairo pango fftw3f` $(CXXFLAGS)
|
|
GLUILIBS+=`$(PKG_CONFIG) $(PKG_UI_FLAGS) --libs cairo pango pangocairo fftw3f $(PKG_GL_LIBS)`
|
|
|
|
ifneq ($(XWIN),)
|
|
GLUILIBS+=-lpthread -lusp10
|
|
endif
|
|
|
|
GLUICFLAGS+=$(LIC_CFLAGS)
|
|
GLUILIBS+=$(LIC_LOADLIBES)
|
|
|
|
#GLUICFLAGS+=-DUSE_GUI_THREAD
|
|
ifeq ($(GLTHREADSYNC), yes)
|
|
GLUICFLAGS+=-DTHREADSYNC
|
|
endif
|
|
|
|
ifneq ($(LIC_CFLAGS),)
|
|
LV2SIGN=, <http:\\/\\/harrisonconsoles.com\\/lv2\\/license\#interface>
|
|
override CXXFLAGS += -I$(RW)
|
|
endif
|
|
|
|
ROBGL+= Makefile
|
|
|
|
JACKCFLAGS=-I. $(CXXFLAGS) $(LIC_CFLAGS)
|
|
JACKCFLAGS+=`$(PKG_CONFIG) --cflags jack lv2 pango pangocairo $(PKG_GL_LIBS)`
|
|
JACKLIBS=-lm $(GLUILIBS) $(LOADLIBES)
|
|
|
|
|
|
###############################################################################
|
|
# build target definitions
|
|
default: all
|
|
|
|
submodule_pull:
|
|
-test -d .git -a .gitmodules -a -f Makefile.git && $(MAKE) -f Makefile.git submodule_pull
|
|
|
|
submodule_update:
|
|
-test -d .git -a .gitmodules -a -f Makefile.git && $(MAKE) -f Makefile.git submodule_update
|
|
|
|
submodule_check:
|
|
-test -d .git -a .gitmodules -a -f Makefile.git && $(MAKE) -f Makefile.git submodule_check
|
|
|
|
submodules:
|
|
-test -d .git -a .gitmodules -a -f Makefile.git && $(MAKE) -f Makefile.git submodules
|
|
|
|
all: submodule_check $(BUILDDIR)manifest.ttl $(BUILDDIR)$(LV2NAME).ttl $(targets) $(JACKAPP)
|
|
|
|
$(BUILDDIR)manifest.ttl: lv2ttl/manifest.ttl.in lv2ttl/manifest.gui.in lv2ttl/manifest.modgui.in Makefile
|
|
@mkdir -p $(BUILDDIR)
|
|
sed "s/@LV2NAME@/$(LV2NAME)/g;s/@LIB_EXT@/$(LIB_EXT)/" \
|
|
lv2ttl/manifest.ttl.in > $(BUILDDIR)manifest.ttl
|
|
ifneq ($(BUILDOPENGL), no)
|
|
sed "s/@LV2NAME@/$(LV2NAME)/g;s/@LIB_EXT@/$(LIB_EXT)/;s/@UI_TYPE@/$(UI_TYPE)/;s/@LV2GUI@/$(LV2GUI)/g" \
|
|
lv2ttl/manifest.gui.in >> $(BUILDDIR)manifest.ttl
|
|
endif
|
|
ifneq ($(MOD),)
|
|
sed "s/@LV2NAME@/$(LV2NAME)/;s/@URISUFFIX@/mono/;s/@NAMESUFFIX@/ Mono/" \
|
|
lv2ttl/manifest.modgui.in >> $(BUILDDIR)manifest.ttl
|
|
sed "s/@LV2NAME@/$(LV2NAME)/;s/@URISUFFIX@/stereo/;s/@NAMESUFFIX@/ Stereo/" \
|
|
lv2ttl/manifest.modgui.in >> $(BUILDDIR)manifest.ttl
|
|
endif
|
|
|
|
$(BUILDDIR)$(LV2NAME).ttl: Makefile lv2ttl/$(LV2NAME).ttl.in lv2ttl/$(LV2NAME).gui.in \
|
|
lv2ttl/$(LV2NAME).ports.ttl.in lv2ttl/$(LV2NAME).mono.ttl.in lv2ttl/$(LV2NAME).stereo.ttl.in
|
|
@mkdir -p $(BUILDDIR)
|
|
sed "s/@LV2NAME@/$(LV2NAME)/g" \
|
|
lv2ttl/$(LV2NAME).ttl.in > $(BUILDDIR)$(LV2NAME).ttl
|
|
ifneq ($(BUILDOPENGL), no)
|
|
sed "s/@LV2NAME@/$(LV2NAME)/g;s/@UI_TYPE@/$(UI_TYPE)/;s/@UI_REQ@/$(LV2UIREQ)/" \
|
|
lv2ttl/$(LV2NAME).gui.in >> $(BUILDDIR)$(LV2NAME).ttl
|
|
endif
|
|
sed "s/@LV2NAME@/$(LV2NAME)/g;s/@URISUFFIX@/mono/;s/@NAMESUFFIX@/ Mono/;s/@CTLSIZE@/65888/;s/@SIGNATURE@/$(LV2SIGN)/;s/@VERSION@/lv2:microVersion $(LV2MIC) ;lv2:minorVersion $(LV2MIN) ;/g;s/@UITTL@/$(UITTL)/;s/@MODBRAND@/$(MODBRAND)/;s/@MODLABEL@/$(MODLABEL1)/" \
|
|
lv2ttl/$(LV2NAME).ports.ttl.in >> $(BUILDDIR)$(LV2NAME).ttl
|
|
cat lv2ttl/$(LV2NAME).mono.ttl.in >> $(BUILDDIR)$(LV2NAME).ttl
|
|
sed "s/@LV2NAME@/$(LV2NAME)/g;s/@URISUFFIX@/stereo/;s/@NAMESUFFIX@/ Stereo/;s/@CTLSIZE@/131424/;s/@SIGNATURE@/$(LV2SIGN)/;s/@VERSION@/lv2:microVersion $(LV2MIC) ;lv2:minorVersion $(LV2MIN) ;/g;s/@UITTL@/$(UITTL)/;s/@MODBRAND@/$(MODBRAND)/;s/@MODLABEL@/$(MODLABEL2)/" \
|
|
lv2ttl/$(LV2NAME).ports.ttl.in >> $(BUILDDIR)$(LV2NAME).ttl
|
|
cat lv2ttl/$(LV2NAME).stereo.ttl.in >> $(BUILDDIR)$(LV2NAME).ttl
|
|
|
|
DSP_SRC = src/lv2.c
|
|
DSP_DEPS = $(DSP_SRC) src/filters.h src/iir.h src/hip.h src/uris.h src/lop.h src/idpy.c
|
|
GUI_DEPS = gui/analyser.cc gui/analyser.h gui/fft.c gui/fil4.c src/uris.h src/lop.h
|
|
|
|
$(BUILDDIR)$(LV2NAME)$(LIB_EXT): $(DSP_DEPS) Makefile
|
|
@mkdir -p $(BUILDDIR)
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIC_CFLAGS)\
|
|
-o $(BUILDDIR)$(LV2NAME)$(LIB_EXT) $(DSP_SRC) \
|
|
-shared $(LV2LDFLAGS) $(LDFLAGS) $(LOADLIBES) $(LIC_LOADLIBES)
|
|
$(STRIP) $(STRIPFLAGS) $(BUILDDIR)$(LV2NAME)$(LIB_EXT)
|
|
|
|
jackapps: $(JACKAPP)
|
|
|
|
$(eval x42_fil4_JACKSRC = -DX42_MULTIPLUGIN src/lv2.c)
|
|
x42_fil4_JACKGUI = gui/fil4.c
|
|
x42_fil4_LV2HTTL = lv2ttl/plugins.h
|
|
x42_fil4_JACKDESC = lv2ui_descriptor
|
|
$(APPBLD)x42-fil4$(EXE_EXT): $(DSP_DEPS) $(GUI_DEPS) \
|
|
$(x42_fil4_JACKGUI) $(x42_fil4_LV2HTTL)
|
|
|
|
ifneq ($(BUILDOPENGL)$(BUILDJACKAPP), nono)
|
|
-include $(RW)robtk.mk
|
|
endif
|
|
|
|
$(BUILDDIR)$(LV2GUI)$(LIB_EXT): gui/$(LV2NAME).c
|
|
|
|
$(BUILDDIR)modgui: modgui/
|
|
@mkdir -p $(BUILDDIR)/modgui
|
|
cp -r modgui/* $(BUILDDIR)modgui/
|
|
|
|
###############################################################################
|
|
# install/uninstall/clean target definitions
|
|
|
|
install: install-bin install-man
|
|
|
|
uninstall: uninstall-bin uninstall-man
|
|
|
|
install-bin: all
|
|
install -d $(DESTDIR)$(LV2DIR)/$(BUNDLE)
|
|
install -m644 $(BUILDDIR)manifest.ttl $(BUILDDIR)$(LV2NAME).ttl $(DESTDIR)$(LV2DIR)/$(BUNDLE)
|
|
install -m755 $(BUILDDIR)$(LV2NAME)$(LIB_EXT) $(DESTDIR)$(LV2DIR)/$(BUNDLE)
|
|
ifneq ($(BUILDOPENGL), no)
|
|
install -m755 $(BUILDDIR)$(LV2GUI)$(LIB_EXT) $(DESTDIR)$(LV2DIR)/$(BUNDLE)
|
|
endif
|
|
ifneq ($(BUILDJACKAPP), no)
|
|
install -d $(DESTDIR)$(BINDIR)
|
|
install -m755 $(APPBLD)x42-fil4$(EXE_EXT) $(DESTDIR)$(BINDIR)
|
|
endif
|
|
ifneq ($(MOD),)
|
|
install -d $(DESTDIR)$(LV2DIR)/$(BUNDLE)/modgui
|
|
install -t $(DESTDIR)$(LV2DIR)/$(BUNDLE)/modgui $(BUILDDIR)modgui/*
|
|
endif
|
|
|
|
uninstall-bin:
|
|
rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/manifest.ttl
|
|
rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/$(LV2NAME).ttl
|
|
rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/$(LV2NAME)$(LIB_EXT)
|
|
rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/$(LV2GUI)$(LIB_EXT)
|
|
rm -rf $(DESTDIR)$(LV2DIR)/$(BUNDLE)/modgui
|
|
rm -f $(DESTDIR)$(BINDIR)/x42-fil4$(EXE_EXT)
|
|
-rmdir $(DESTDIR)$(LV2DIR)/$(BUNDLE)
|
|
-rmdir $(DESTDIR)$(BINDIR)
|
|
|
|
install-man:
|
|
ifneq ($(BUILDJACKAPP), no)
|
|
install -d $(DESTDIR)$(MANDIR)
|
|
install -m644 x42-fil4.1 $(DESTDIR)$(MANDIR)
|
|
endif
|
|
|
|
uninstall-man:
|
|
rm -f $(DESTDIR)$(MANDIR)/x42-fil4.1
|
|
-rmdir $(DESTDIR)$(MANDIR)
|
|
|
|
man: $(APPBLD)x42-fil4
|
|
help2man -N -o x42-fil4.1 -n "x42 JACK Parametric Equalizer" $(APPBLD)x42-fil4
|
|
|
|
clean:
|
|
rm -f $(BUILDDIR)manifest.ttl $(BUILDDIR)$(LV2NAME).ttl \
|
|
$(BUILDDIR)$(LV2NAME)$(LIB_EXT) \
|
|
$(BUILDDIR)$(LV2GUI)$(LIB_EXT)
|
|
rm -rf $(BUILDDIR)*.dSYM
|
|
rm -rf $(APPBLD)x42-*
|
|
rm -rf $(BUILDDIR)modgui
|
|
-test -d $(APPBLD) && rmdir $(APPBLD) || true
|
|
-test -d $(BUILDDIR) && rmdir $(BUILDDIR) || true
|
|
|
|
distclean: clean
|
|
rm -f cscope.out cscope.files tags
|
|
|
|
.PHONY: clean all install uninstall distclean jackapps man \
|
|
install-bin uninstall-bin install-man uninstall-man \
|
|
submodule_check submodules submodule_update submodule_pull
|