aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--backends/Makefile14
2 files changed, 22 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 60534ba..cda8fae 100644
--- a/Makefile
+++ b/Makefile
@@ -2,11 +2,20 @@
OBJS = config.o backend.o plugin.o
PLUGINDIR = "\"./backends/\""
+SYSTEM := $(shell uname -s)
+
CFLAGS ?= -g -Wall
#CFLAGS += -DDEBUG
midimonster: LDLIBS = -ldl
midimonster: CFLAGS += -DPLUGINS=$(PLUGINDIR)
+
+# Work around strange linker passing convention differences in Linux and OSX
+ifeq ($(SYSTEM),Linux)
midimonster: LDFLAGS += -Wl,-export-dynamic
+endif
+ifeq ($(SYSTEM),Darwin)
+midimonster: LDFLAGS += -Wl,-export_dynamic
+endif
all: midimonster backends
diff --git a/backends/Makefile b/backends/Makefile
index 85fe152..446ad70 100644
--- a/backends/Makefile
+++ b/backends/Makefile
@@ -1,9 +1,21 @@
.PHONY: all clean
-BACKENDS = artnet.so midi.so osc.so loopback.so evdev.so sacn.so
+LINUX_BACKENDS = midi.so evdev.so
+BACKENDS = artnet.so osc.so loopback.so sacn.so
+
+SYSTEM := $(shell uname -s)
CFLAGS += -fPIC -I../
LDFLAGS += -shared
+# Build Linux backends if possible
+ifeq ($(SYSTEM),Linux)
+BACKENDS += $(LINUX_BACKENDS)
+endif
+# Convince OSX that missing functions are present at runtime
+ifeq ($(SYSTEM),Darwin)
+LDFLAGS += -undefined dynamic_lookup
+endif
+
midi.so: LDLIBS = -lasound
evdev.so: CFLAGS += $(shell pkg-config --cflags libevdev)
evdev.so: LDLIBS = $(shell pkg-config --libs libevdev)