aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 17 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 2d88c49..5a83a2d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,7 @@
-.PHONY: all clean run sanitize backends windows full backends-full
+.PHONY: all clean run sanitize backends windows full backends-full install
OBJS = config.o backend.o plugin.o
-PLUGINDIR = "\"./backends/\""
-PLUGINDIR_W32 = "\"backends\\\\\""
+PREFIX ?= /usr
SYSTEM := $(shell uname -s)
CFLAGS ?= -g -Wall -Wpedantic
@@ -11,7 +10,6 @@ CFLAGS += -fvisibility=hidden
#CFLAGS += -DDEBUG
midimonster: LDLIBS = -ldl
-midimonster: CFLAGS += -DPLUGINS=$(PLUGINDIR)
# Work around strange linker passing convention differences in Linux and OSX
ifeq ($(SYSTEM),Linux)
@@ -21,6 +19,14 @@ ifeq ($(SYSTEM),Darwin)
midimonster: LDFLAGS += -Wl,-export_dynamic
endif
+# Allow overriding the locations for backend plugins and default configuration
+ifdef DEFAULT_CFG
+midimonster: CFLAGS += -DDEFAULT_CFG=\"$(DEFAULT_CFG)\"
+endif
+ifdef PLUGINS
+midimonster: CFLAGS += -DPLUGINS=\"$(PLUGINS)\"
+endif
+
all: midimonster backends
full: midimonster backends-full
@@ -39,7 +45,7 @@ midimonster: midimonster.c portability.h $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) $(LDLIBS) -o $@
midimonster.exe: export CC = x86_64-w64-mingw32-gcc
-midimonster.exe: CFLAGS += -DPLUGINS=$(PLUGINDIR_W32) -Wno-format
+midimonster.exe: CFLAGS += -Wno-format
midimonster.exe: LDLIBS = -lws2_32
midimonster.exe: LDFLAGS += -Wl,--out-implib,libmmapi.a
midimonster.exe: midimonster.c portability.h $(OBJS)
@@ -55,6 +61,12 @@ clean:
run:
valgrind --leak-check=full --show-leak-kinds=all ./midimonster
+install:
+ install -d "$(DESTDIR)$(PREFIX)/bin"
+ install -d "$(DESTDIR)$(PREFIX)/lib/midimonster"
+ install -m 0755 midimonster "$(DESTDIR)$(PREFIX)/bin"
+ install -m 0755 backends/*.so "$(DESTDIR)$(PREFIX)/lib/midimonster"
+
sanitize: export CC = clang
sanitize: export CFLAGS += -g -Wall -Wpedantic -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer
sanitize: midimonster backends