diff options
author | cbdev <cb@cbcdn.com> | 2021-06-30 03:03:48 +0200 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2021-06-30 03:03:48 +0200 |
commit | bc3d80e9e6c038c87a64432586670c663a23e53d (patch) | |
tree | 5a28b0004a7f3492455316f34bb2c783e670f944 /backends/Makefile | |
parent | 8a0a413f1dd5593189dd6b651babcff9b2495451 (diff) | |
parent | f16f7db86662fcdbf45b6373257c90c824b0b4b0 (diff) | |
download | midimonster-bc3d80e9e6c038c87a64432586670c663a23e53d.tar.gz midimonster-bc3d80e9e6c038c87a64432586670c663a23e53d.tar.bz2 midimonster-bc3d80e9e6c038c87a64432586670c663a23e53d.zip |
Merge branch 'master' into debian/master
Diffstat (limited to 'backends/Makefile')
-rw-r--r-- | backends/Makefile | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/backends/Makefile b/backends/Makefile index 700c9b3..be870d6 100644 --- a/backends/Makefile +++ b/backends/Makefile @@ -1,16 +1,26 @@ .PHONY: all clean full +# Backends that can only be built on Linux LINUX_BACKENDS = midi.so evdev.so -WINDOWS_BACKENDS = artnet.dll osc.dll loopback.dll sacn.dll maweb.dll winmidi.dll openpixelcontrol.dll rtpmidi.dll -BACKENDS = artnet.so osc.so loopback.so sacn.so lua.so maweb.so jack.so openpixelcontrol.so python.so rtpmidi.so +# Backends that can only be built on Windows (mostly due to the .DLL extension) +WINDOWS_BACKENDS = artnet.dll osc.dll loopback.dll sacn.dll maweb.dll winmidi.dll openpixelcontrol.dll rtpmidi.dll wininput.dll visca.dll mqtt.dll +# Backends that can be built on any platform that can load .SO libraries +BACKENDS = artnet.so osc.so loopback.so sacn.so lua.so maweb.so jack.so openpixelcontrol.so python.so rtpmidi.so visca.so mqtt.so +# Backends that require huge dependencies to be installed OPTIONAL_BACKENDS = ola.so +# Backends that need to be built manually (but still should be included in the clean target) +MANUAL_BACKENDS = lua.dll + +# The backend library, providing platform-independent abstractions for common things BACKEND_LIB = libmmbackend.o +# Evaluate which system we are on SYSTEM := $(shell uname -s) # Generate debug symbols unless overridden CFLAGS ?= -g CPPFLAGS ?= -g +# All backends are shared libraries CFLAGS += -fPIC -I../ -Wall -Wpedantic CPPFLAGS += -fPIC -I../ LDFLAGS += -shared @@ -24,6 +34,7 @@ ifeq ($(SYSTEM),Darwin) LDFLAGS += -undefined dynamic_lookup endif +# Most of these next few backends just pull in the backend lib, some set additional flags artnet.so: ADDITIONAL_OBJS += $(BACKEND_LIB) artnet.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) artnet.dll: LDLIBS += -lws2_32 @@ -36,12 +47,20 @@ sacn.so: ADDITIONAL_OBJS += $(BACKEND_LIB) sacn.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) sacn.dll: LDLIBS += -lws2_32 +visca.so: ADDITIONAL_OBJS += $(BACKEND_LIB) +visca.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) +visca.dll: LDLIBS += -lws2_32 + +mqtt.so: ADDITIONAL_OBJS += $(BACKEND_LIB) +mqtt.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) +mqtt.dll: LDLIBS += -lws2_32 + openpixelcontrol.so: ADDITIONAL_OBJS += $(BACKEND_LIB) openpixelcontrol.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) openpixelcontrol.dll: LDLIBS += -lws2_32 maweb.so: ADDITIONAL_OBJS += $(BACKEND_LIB) -maweb.so: LDLIBS = -lssl +maweb.so: LDLIBS = $(shell pkg-config --libs openssl || echo "-DBUILD_ERROR=\"Missing pkg-config data for openssl\"") maweb.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) maweb.dll: LDLIBS += -lws2_32 maweb.dll: CFLAGS += -DMAWEB_NO_LIBSSL @@ -53,6 +72,8 @@ rtpmidi.dll: LDLIBS += -lws2_32 -liphlpapi winmidi.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) winmidi.dll: LDLIBS += -lwinmm -lws2_32 +wininput.dll: LDLIBS += -lwinmm + jack.so: LDLIBS = -ljack -lpthread midi.so: LDLIBS = -lasound evdev.so: CFLAGS += $(shell pkg-config --cflags libevdev || echo "-DBUILD_ERROR=\"Missing pkg-config data for libevdev\"") @@ -62,28 +83,38 @@ ola.so: CPPFLAGS += -Wno-write-strings # The pkg-config name for liblua5.3 is subject to discussion. I prefer 'lua5.3' (which works on Debian and OSX), # but Arch requires 'lua53' which works on Debian, too, but breaks on OSX. -lua.so: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") -lua.so: LDLIBS += $(shell pkg-config --libs lua53 || pkg-config --libs lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") -lua.dll: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") +lua.so: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || pkg-config --cflags lua || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") +lua.so: LDLIBS += $(shell pkg-config --libs lua53 || pkg-config --libs lua5.3 || pkg-config --libs lua || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") +lua.dll: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || pkg-config --cflags lua || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") lua.dll: LDLIBS += -L../ -llua53 -python.so: CFLAGS += $(shell pkg-config --cflags python3 || pkg-config --cflags python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") -python.so: CFLAGS += $(shell pkg-config --libs python3 || pkg-config --libs python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") +# Python seems to ship their own little python3-config tool instead of properly maintaining their pkg-config files. +# This one also spams a good deal of unwanted flags into CFLAGS, so we use only --includes. On the other hand, the --libs +# info from this one seems to include the actual interpreter library only on some systems, which makes it worse than useless. +python.so: CFLAGS += $(shell python3-config --includes || pkg-config --cflags python3 || pkg-config --cflags python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") +python.so: LDLIBS += $(shell pkg-config --libs python3-embed || python3-config --libs || pkg-config --libs python3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") +python.so: LDFLAGS += $(shell python3-config --ldflags || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") +python.dll: CFLAGS += $(shell python3-config --includes || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") +python.dll: LDLIBS += -L../ -lpython3 +# Generic rules on how to build .SO/.DLL's from C and CPP sources %.so :: %.c %.h $(BACKEND_LIB) - $(CC) $(CFLAGS) $(LDLIBS) $< $(ADDITIONAL_OBJS) -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) $< $(ADDITIONAL_OBJS) -o $@ $(LDFLAGS) $(LDLIBS) %.dll :: %.c %.h $(BACKEND_LIB) $(CC) $(CFLAGS) $< $(ADDITIONAL_OBJS) -o $@ $(LDFLAGS) $(LDLIBS) %.so :: %.cpp %.h - $(CXX) $(CPPFLAGS) $(LDLIBS) $< $(ADDITIONAL_OBJS) -o $@ $(LDFLAGS) + $(CXX) $(CPPFLAGS) $< $(ADDITIONAL_OBJS) -o $@ $(LDFLAGS) $(LDLIBS) +# This is the actual first named target, and thus the default all: $(BACKEND_LIB) $(BACKENDS) +# Build an import lib for the windows build if it's not already there ../libmmapi.a: $(MAKE) -C ../ midimonster.exe +# Override a bunch of stuff for the windows target and it's DLL dependencies %.dll: export CC = x86_64-w64-mingw32-gcc %.dll: LDLIBS += -lmmapi %.dll: LDFLAGS += -L../ @@ -92,7 +123,9 @@ windows: CFLAGS += -Wno-format -Wno-pointer-sign windows: export CC = x86_64-w64-mingw32-gcc windows: ../libmmapi.a $(BACKEND_LIB) $(WINDOWS_BACKENDS) +# Optional target including the backends that require large dependencies full: $(BACKEND_LIB) $(BACKENDS) $(OPTIONAL_BACKENDS) +# Clean up all generated files clean: - $(RM) $(BACKEND_LIB) $(BACKENDS) $(OPTIONAL_BACKENDS) $(WINDOWS_BACKENDS) + $(RM) $(BACKEND_LIB) $(BACKENDS) $(OPTIONAL_BACKENDS) $(WINDOWS_BACKENDS) $(MANUAL_BACKENDS) |