diff options
| author | cbdev <cb@cbcdn.com> | 2019-12-07 20:22:03 +0100 | 
|---|---|---|
| committer | cbdev <cb@cbcdn.com> | 2019-12-07 20:22:03 +0100 | 
| commit | f95dae04478b32fccaf7c6ebe1ecfd4e2fef1358 (patch) | |
| tree | 6f545dc81166ee1a0f1b21b5245a70bcbf05751d /Makefile | |
| parent | 534207d16314a4f6a69d36cf2305a3fe435a769b (diff) | |
| parent | 1bb3b9a3eaf94af045c39a1ff1ee8bf9b8e5b8ec (diff) | |
| download | midimonster-f95dae04478b32fccaf7c6ebe1ecfd4e2fef1358.tar.gz midimonster-f95dae04478b32fccaf7c6ebe1ecfd4e2fef1358.tar.bz2 midimonster-f95dae04478b32fccaf7c6ebe1ecfd4e2fef1358.zip  | |
Merge current master
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 51 | 
1 files changed, 46 insertions, 5 deletions
@@ -1,13 +1,17 @@ -.PHONY: all clean run sanitize backends +.PHONY: all clean run sanitize backends windows full backends-full install  OBJS = config.o backend.o plugin.o -PLUGINDIR = "\"./backends/\"" +PREFIX ?= /usr +PLUGIN_INSTALL = $(PREFIX)/lib/midimonster +EXAMPLES ?= $(PREFIX)/share/midimonster  SYSTEM := $(shell uname -s) -CFLAGS ?= -g -Wall +CFLAGS ?= -g -Wall -Wpedantic +# Hide all non-API symbols for export +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) @@ -17,23 +21,60 @@ 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)\" +PLUGIN_INSTALL = $(PLUGINS) +endif +  all: midimonster backends +full: midimonster backends-full + +windows: midimonster.exe +	$(MAKE) -C backends windows +  backends:  	$(MAKE) -C backends +backends-full: +	$(MAKE) -C backends full +  # This rule can not be the default rule because OSX the target prereqs are not exactly the build prereqs  midimonster: midimonster.c portability.h $(OBJS)  	$(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) $(LDLIBS) -o $@ +midimonster.exe: export CC = x86_64-w64-mingw32-gcc +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) +	$(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) $(LDLIBS) -o $@ +  clean:  	$(RM) midimonster +	$(RM) midimonster.exe +	$(RM) libmmapi.a  	$(RM) $(OBJS)  	$(MAKE) -C backends clean  run:  	valgrind --leak-check=full --show-leak-kinds=all ./midimonster +install: +		install -d "$(DESTDIR)$(PREFIX)/bin" +		install -m 0755 midimonster "$(DESTDIR)$(PREFIX)/bin" +		install -d "$(DESTDIR)$(PLUGIN_INSTALL)" +		install -m 0755 backends/*.so "$(DESTDIR)$(PLUGIN_INSTALL)" +		install -d "$(DESTDIR)$(EXAMPLES)" +		install -m 0644 configs/* "$(DESTDIR)$(EXAMPLES)" +ifdef DEFAULT_CFG +		install -Dm 0644 monster.cfg "$(DESTDIR)$(DEFAULT_CFG)" +endif +  sanitize: export CC = clang -sanitize: export CFLAGS = -g -Wall -Wpedantic -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer +sanitize: export CFLAGS += -g -Wall -Wpedantic -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer  sanitize: midimonster backends  | 
