55DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)
66
77PLUGIN_DIR := ../../Source/Plugins
8+ COMMON_DIR := ../../Source/Plugins/CommonLibs
89
910ifndef CONFIG
1011 CONFIG=Debug
1112endif
1213
1314ifeq ($(CONFIG),Debug)
14- BINDIR := $(CURDIR)/build/intermediate/Debug
15+ BINDIR := $(CURDIR)/build
1516 LIBDIR := $(CURDIR)/build/intermediate/Debug
1617 OBJDIR := $(CURDIR)/build/intermediate/plugins/Debug
1718 OUTDIR := $(CURDIR)/build/plugins
@@ -27,12 +28,12 @@ ifeq ($(CONFIG),Debug)
2728 LDDEPS :=
2829 RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.5" -D "JUCE_APP_VERSION_HEX=0x305" -I /usr/include -I /usr/include/freetype2 -I $(CURDIR)/../../Source/Plugins/Headers
2930
30- CLEANCMD = rm -rf $(OUTDIR)/* $(OBJDIR)
31+ CLEANCMD = rm -rf $(OUTDIR)/* $(OBJDIR) $(BINDIR)/$(addsuffix .so,$(notdir $(COMMONDIRS)))
3132endif
3233
3334ifeq ($(CONFIG),Release)
3435 BINDIR := $(CURDIR)/build
35- LIBDIR := $(CURDIR)/build
36+ LIBDIR := $(CURDIR)/build/intermediate/Release
3637 OBJDIR := $(CURDIR)/build/intermediate/plugins/Release
3738 OUTDIR := $(CURDIR)/build/plugins
3839
@@ -47,16 +48,21 @@ ifeq ($(CONFIG),Release)
4748 LDDEPS1 :=
4849 RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.5" -D "JUCE_APP_VERSION_HEX=0x305" -I /usr/include -I /usr/include/freetype2 -I $(CURDIR)/../../Source/Plugins/Headers
4950
50- CLEANCMD = rm -rf $(OUTDIR)/* $(OBJDIR)
51+ CLEANCMD = rm -rf $(OUTDIR)/* $(OBJDIR) $(BINDIR)/$(addsuffix .so,$(notdir $(COMMONDIRS)))
5152endif
5253
54+ LIB_PREFIX :=
55+
5356export
5457
5558SUBDIRS := $(wildcard $(PLUGIN_DIR)/*)
59+ COMMONDIRS := $(wildcard $(COMMON_DIR)/*)
5660
57- .PHONY: clean all notify $(SUBDIRS) $(notdir $(SUBDIRS))
61+ .PHONY: clean all notify $(SUBDIRS) $(notdir $(SUBDIRS)) clean/$(notdir $(SUBDIRS)) libs $(COMMONDIRS)
5862
59- all: notify $(SUBDIRS)
63+ all: notify libs $(SUBDIRS)
64+
65+ libs: $(COMMONDIRS)
6066
6167notify:
6268 @echo "Building Open-Ephys Plugins"
@@ -65,7 +71,9 @@ PLUGINNAME=$(shell echo $@ | rev | cut -d'/' -f-1 | rev)
6571
6672# if there are a .jucer file in the plugin folder - try to find Makefile in the Source/ folder
6773$(SUBDIRS): CXXFLAGS += -D "OEPLUGIN" -I $(CURDIR)/../../Source/Plugins/CommonLibs
68- $(SUBDIRS):
74+ $(COMMONDIRS): OUTDIR := $(BINDIR)
75+ $(COMMONDIRS): LIB_PREFIX := lib
76+ $(SUBDIRS) $(COMMONDIRS):
6977 @if [ -f $@/*.jucer ] && ([ -f $@/Source/Makefile ]); then \
7078 echo "Found jucer project for" $(PLUGINNAME) "..."; \
7179 $(MAKE) -C $@/Source clean ; \
@@ -74,14 +82,15 @@ $(SUBDIRS):
7482 $(MAKE) -C $@ ; fi \
7583 fi
7684
85+
7786.SECONDEXPANSION:
7887$(notdir $(SUBDIRS)): $$(PLUGIN_DIR)/$$@
7988
8089clean:
8190 @echo Cleaning open-ephys plugins
8291 @$(CLEANCMD)
8392
84- clean/$(notdir $(SUBDIRS)):
93+ $(addprefix clean/, $(notdir $(SUBDIRS) )):
8594 @echo Cleaning $(notdir $@)
8695 $(MAKE) -C $(PLUGIN_DIR)/$(notdir $@) clean
8796
0 commit comments