From a38e81899860b2ede08f3df2c974c653b784c849 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 21 Feb 2015 13:12:48 +0000 Subject: [PATCH] Rework makefiles to make build-deps optional --- Makefile | 6 ++++++ Makefile.mk | 26 ++++++++++++++------------ dpf | 2 +- plugins/Makefile.mk | 28 +++++++++++++++++++++------- plugins/Nekobi/Makefile | 27 +++++++++++++++++++++++---- 5 files changed, 65 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index c7141ad..bac29f7 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,16 @@ # Created by falkTX # +include Makefile.mk + all: libs plugins gen # -------------------------------------------------------------- libs: +ifeq ($(HAVE_DGL),true) $(MAKE) -C dpf/dgl +endif plugins: libs $(MAKE) all -C plugins/Nekobi @@ -26,7 +30,9 @@ dpf/utils/lv2_ttl_generator: # -------------------------------------------------------------- clean: +ifeq ($(HAVE_DGL),true) $(MAKE) clean -C dpf/dgl +endif $(MAKE) clean -C dpf/utils/lv2-ttl-generator $(MAKE) clean -C plugins/Nekobi diff --git a/Makefile.mk b/Makefile.mk index a540947..87d2f5e 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -75,27 +75,27 @@ LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS) endif # -------------------------------------------------------------- -# Check for required libs +# Check for optional libs ifeq ($(LINUX),true) -ifneq ($(shell pkg-config --exists jack && echo true),true) -$(error JACK missing, cannot continue) -endif -ifneq ($(shell pkg-config --exists gl && echo true),true) -$(error OpenGL missing, cannot continue) -endif -ifneq ($(shell pkg-config --exists x11 && echo true),true) -$(error X11 missing, cannot continue) -endif +# HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true) +HAVE_JACK = $(shell pkg-config --exists jack && echo true) +HAVE_LIBLO = $(shell pkg-config --exists liblo && echo true) endif -ifneq ($(shell pkg-config --exists liblo && echo true),true) -$(error liblo missing, cannot continue) +ifeq ($(MACOS),true) +HAVE_DGL = true +endif + +ifeq ($(WIN32),true) +HAVE_DGL = true endif # -------------------------------------------------------------- # Set libs stuff +ifeq ($(HAVE_DGL),true) + ifeq ($(LINUX),true) DGL_FLAGS = $(shell pkg-config --cflags gl x11) DGL_LIBS = $(shell pkg-config --libs gl x11) @@ -109,6 +109,8 @@ ifeq ($(WIN32),true) DGL_LIBS = -lopengl32 -lgdi32 endif +endif # HAVE_DGL + # -------------------------------------------------------------- # Set extension diff --git a/dpf b/dpf index 7169815..17befcd 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 7169815782a5d14447e16a1ac3adf3ab32d7d92b +Subproject commit 17befcdaa6d5e281aea22c5d83e3326f6ee9373c diff --git a/plugins/Makefile.mk b/plugins/Makefile.mk index a46910f..f067866 100644 --- a/plugins/Makefile.mk +++ b/plugins/Makefile.mk @@ -16,6 +16,18 @@ TARGET_DIR = ../../bin BUILD_C_FLAGS += -I. BUILD_CXX_FLAGS += -I. -I../../dpf/distrho -I../../dpf/dgl +ifeq ($(HAVE_DGL),true) +BASE_FLAGS += -DHAVE_DGL +endif + +ifeq ($(HAVE_JACK),true) +BASE_FLAGS += -DHAVE_JACK +endif + +ifeq ($(HAVE_LIBLO),true) +BASE_FLAGS += -DHAVE_LIBLO +endif + # -------------------------------------------------------------- # Set plugin binary file targets @@ -28,17 +40,16 @@ lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp.$(EXT) lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui.$(EXT) vst = $(TARGET_DIR)/$(NAME)-vst.$(EXT) -ifeq ($(WIN32),true) -dssi_ui += .exe -endif - -# TODO: MacOS VST bundle - # -------------------------------------------------------------- # Set distrho code files DISTRHO_PLUGIN_FILES = ../../dpf/distrho/DistrhoPluginMain.cpp + +ifeq ($(HAVE_DGL),true) DISTRHO_UI_FILES = ../../dpf/distrho/DistrhoUIMain.cpp ../../dpf/libdgl.a +else +TARGET_NOUI = true +endif # -------------------------------------------------------------- # Handle plugins without UI @@ -90,7 +101,9 @@ $(ladspa_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) # -------------------------------------------------------------- # DSSI -dssi: $(dssi_dsp) $(dssi_ui) +dssi: $(dssi_dsp) $(dssi_ui) +dssi_dsp: $(dssi_dsp) +dssi_ui: $(dssi_ui) $(dssi_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) mkdir -p $(shell dirname $@) @@ -104,6 +117,7 @@ $(dssi_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) # LV2 lv2_one: $(lv2) +lv2_dsp: $(lv2_dsp) lv2_sep: $(lv2_dsp) $(lv2_ui) $(lv2): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) diff --git a/plugins/Nekobi/Makefile b/plugins/Nekobi/Makefile index ce16ca5..f17c0ba 100644 --- a/plugins/Nekobi/Makefile +++ b/plugins/Nekobi/Makefile @@ -27,10 +27,29 @@ include ../Makefile.mk # -------------------------------------------------------------- # Enable all possible plugin types -ifeq ($(LINUX),true) -all: jack dssi lv2_sep vst -else -all: dssi lv2_sep vst +ifeq ($(HAVE_DGL),true) +ifeq ($(HAVE_JACK),true) +TARGETS += jack +endif endif +ifeq ($(LINUX),true) +TARGETS += dssi_dsp +ifeq ($(HAVE_DGL),true) +ifeq ($(HAVE_LIBLO),true) +TARGETS += dssi_ui +endif +endif +endif + +ifeq ($(HAVE_DGL),true) +TARGETS += lv2_sep +else +TARGETS += lv2_dsp +endif + +TARGETS += vst + +all: $(TARGETS) + # --------------------------------------------------------------