1#!/usr/bin/make -f 2OPTIMIZATIONS ?= -msse -msse2 -mfpmath=sse -ffast-math -fomit-frame-pointer -O3 -fno-finite-math-only -DNDEBUG 3#OPTIMIZATIONS ?= -mtune=cortex-a53 -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -O3 -fno-finite-math-only -fvisibility=hidden -fdata-sections -ffunction-sections -DNDEBUG # -fopt-info-vec-optimize 4PREFIX ?= /usr 5CFLAGS ?= $(OPTIMIZATIONS) -Wall 6URI_PREFIX='"http://polyeffects.com/lv2"' 7 8PKG_CONFIG?=pkg-config 9STRIP?=strip 10STRIPFLAGS?=-s 11 12chorus_VERSION?=$(shell git describe --tags HEAD 2>/dev/null | sed 's/-g.*$$//;s/^v//' || echo "LV2") 13############################################################################### 14 15LV2DIR ?= $(PREFIX)/lib/lv2 16LOADLIBES=-lm 17LV2NAME=chorus 18BUNDLE=chorus.lv2 19BUILDDIR=build/ 20targets= 21 22UNAME=$(shell uname) 23ifeq ($(UNAME),Darwin) 24 LV2LDFLAGS=-dynamiclib 25 LIB_EXT=.dylib 26 EXTENDED_RE=-E 27 STRIPFLAGS=-u -r -arch all -s lv2syms 28 targets+=lv2syms 29else 30 LV2LDFLAGS=-Wl,-Bstatic -Wl,-Bdynamic 31 LIB_EXT=.so 32 EXTENDED_RE=-r 33endif 34 35ifneq ($(XWIN),) 36 CXX=$(XWIN)-gcc 37 STRIP=$(XWIN)-strip 38 LV2LDFLAGS=-Wl,-Bstatic -Wl,-Bdynamic -Wl,--as-needed 39 LIB_EXT=.dll 40 override LDFLAGS += -static-libgcc -static-libstdc++ 41else 42 override CFLAGS += -fPIC -fvisibility=hidden 43endif 44 45targets+=$(BUILDDIR)$(LV2NAME)$(LIB_EXT) 46 47############################################################################### 48# extract versions 49LV2VERSION=1 50 51# check for build-dependencies 52ifeq ($(shell $(PKG_CONFIG) --exists lv2 || echo no), no) 53 $(error "LV2 SDK was not found") 54endif 55 56override CFLAGS += -lstdc++ `$(PKG_CONFIG) --cflags lv2` 57 58# build target definitions 59default: all 60 61all: $(BUILDDIR)manifest.ttl $(BUILDDIR)$(LV2NAME).ttl $(targets) 62 63lv2syms: 64 echo "_lv2_descriptor" > lv2syms 65 66$(BUILDDIR)manifest.ttl: manifest.ttl 67 @mkdir -p $(BUILDDIR) 68 cat manifest.ttl > $(BUILDDIR)manifest.ttl 69 70$(BUILDDIR)$(LV2NAME).ttl: $(LV2NAME).ttl 71 @mkdir -p $(BUILDDIR) 72 cat $(LV2NAME).ttl > $(BUILDDIR)$(LV2NAME).ttl 73 74$(BUILDDIR)$(LV2NAME)$(LIB_EXT): $(LV2NAME).cpp 75 @mkdir -p $(BUILDDIR) 76 $(CXX) $(CPPFLAGS) $(CFLAGS) \ 77 -o $(BUILDDIR)$(LV2NAME)$(LIB_EXT) $(LV2NAME).cpp \ 78 -shared -DURI_PREFIX=$(URI_PREFIX) $(LV2LDFLAGS) $(LDFLAGS) $(LOADLIBES) 79 $(STRIP) $(STRIPFLAGS) $(BUILDDIR)$(LV2NAME)$(LIB_EXT) 80 81# install/uninstall/clean target definitions 82 83install: all 84 install -d $(DESTDIR)$(LV2DIR)/$(BUNDLE) 85 install -m755 $(BUILDDIR)$(LV2NAME)$(LIB_EXT) $(DESTDIR)$(LV2DIR)/$(BUNDLE) 86 install -m644 $(BUILDDIR)manifest.ttl $(BUILDDIR)$(LV2NAME).ttl $(DESTDIR)$(LV2DIR)/$(BUNDLE) 87 88uninstall: 89 rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/manifest.ttl 90 rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/$(LV2NAME).ttl 91 rm -f $(DESTDIR)$(LV2DIR)/$(BUNDLE)/$(LV2NAME)$(LIB_EXT) 92 -rmdir $(DESTDIR)$(LV2DIR)/$(BUNDLE) 93 94clean: 95 rm -f $(BUILDDIR)manifest.ttl $(BUILDDIR)$(LV2NAME).ttl $(BUILDDIR)$(LV2NAME)$(LIB_EXT) lv2syms 96 -test -d $(BUILDDIR) && rmdir $(BUILDDIR) || true 97 98.PHONY: clean all install uninstall 99