aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2019-11-07 18:44:19 +0100
committercbdev <cb@cbcdn.com>2019-11-07 18:44:19 +0100
commit350f0d2d2eaff5f0d57b09857102e2df1e96d733 (patch)
treefe81a48535d700195034e9173018c9a9a63d02d0 /Makefile
parent6c75f07260639fd2bc6d328d5f00c72ab4382fa8 (diff)
downloadmidimonster-350f0d2d2eaff5f0d57b09857102e2df1e96d733.tar.gz
midimonster-350f0d2d2eaff5f0d57b09857102e2df1e96d733.tar.bz2
midimonster-350f0d2d2eaff5f0d57b09857102e2df1e96d733.zip
Makefile install target and packaging instructions (Fixes #28)
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