Skip to content

Commit 5c4e99a

Browse files
author
falkTX
committed
Merge branch 'master' of github.com:DISTRHO/DPF-Max-Gen
2 parents 8baf480 + 32c2796 commit 5c4e99a

File tree

7 files changed

+372
-0
lines changed

7 files changed

+372
-0
lines changed

Makefile.mk

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#!/usr/bin/make -f
2+
# Makefile for DISTRHO Plugins #
3+
# ---------------------------- #
4+
# Created by falkTX
5+
#
6+
7+
AR ?= ar
8+
CC ?= gcc
9+
CXX ?= g++
10+
11+
# --------------------------------------------------------------
12+
# Fallback to Linux if no other OS defined
13+
14+
ifneq ($(HAIKU),true)
15+
ifneq ($(MACOS),true)
16+
ifneq ($(WIN32),true)
17+
LINUX=true
18+
endif
19+
endif
20+
endif
21+
22+
# --------------------------------------------------------------
23+
# Set build and link flags
24+
25+
BASE_FLAGS = -Wall -Wextra -pipe
26+
BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections
27+
28+
ifneq ($(MACOS),true)
29+
# MacOS doesn't support this
30+
BASE_OPTS += -mfpmath=sse
31+
endif
32+
33+
ifeq ($(MACOS),true)
34+
# MacOS linker flags
35+
LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
36+
else
37+
# Common linker flags
38+
LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed
39+
ifneq ($(SKIP_STRIPPING),true)
40+
LINK_OPTS += -Wl,--strip-all
41+
endif
42+
endif
43+
44+
ifeq ($(RASPPI),true)
45+
# Raspberry-Pi optimization flags
46+
BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
47+
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
48+
endif
49+
50+
ifeq ($(PANDORA),true)
51+
# OpenPandora optimization flags
52+
BASE_OPTS = -O2 -ffast-math -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
53+
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
54+
endif
55+
56+
ifeq ($(NOOPT),true)
57+
# No optimization flags
58+
BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
59+
endif
60+
61+
ifneq ($(WIN32),true)
62+
# not needed for Windows
63+
BASE_FLAGS += -fPIC -DPIC
64+
endif
65+
66+
ifeq ($(DEBUG),true)
67+
BASE_FLAGS += -DDEBUG -O0 -g
68+
LINK_OPTS =
69+
else
70+
BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
71+
CXXFLAGS += -fvisibility-inlines-hidden
72+
endif
73+
74+
BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
75+
BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS) $(CPPFLAGS)
76+
LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
77+
78+
ifeq ($(MACOS),true)
79+
# No C++11 support
80+
BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS) $(CPPFLAGS)
81+
LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
82+
endif
83+
84+
# --------------------------------------------------------------
85+
# Check for optional libs
86+
87+
ifeq ($(LINUX),true)
88+
HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
89+
HAVE_JACK = $(shell pkg-config --exists jack && echo true)
90+
HAVE_LIBLO = $(shell pkg-config --exists liblo && echo true)
91+
endif
92+
93+
ifeq ($(MACOS),true)
94+
HAVE_DGL = true
95+
endif
96+
97+
ifeq ($(WIN32),true)
98+
HAVE_DGL = true
99+
endif
100+
101+
# --------------------------------------------------------------
102+
# Set libs stuff
103+
104+
ifeq ($(HAVE_DGL),true)
105+
106+
ifeq ($(LINUX),true)
107+
DGL_FLAGS = $(shell pkg-config --cflags gl x11)
108+
DGL_LIBS = $(shell pkg-config --libs gl x11)
109+
endif
110+
111+
ifeq ($(MACOS),true)
112+
DGL_LIBS = -framework OpenGL -framework Cocoa
113+
endif
114+
115+
ifeq ($(WIN32),true)
116+
DGL_LIBS = -lopengl32 -lgdi32
117+
endif
118+
119+
endif # HAVE_DGL
120+
121+
# --------------------------------------------------------------
122+
# Set app extension
123+
124+
ifeq ($(WIN32),true)
125+
APP_EXT = .exe
126+
endif
127+
128+
# --------------------------------------------------------------
129+
# Set shared lib extension
130+
131+
LIB_EXT = .so
132+
133+
ifeq ($(MACOS),true)
134+
LIB_EXT = .dylib
135+
endif
136+
137+
ifeq ($(WIN32),true)
138+
LIB_EXT = .dll
139+
endif
140+
141+
# --------------------------------------------------------------
142+
# Set shared library CLI arg
143+
144+
SHARED = -shared
145+
146+
ifeq ($(MACOS),true)
147+
SHARED = -dynamiclib
148+
endif
149+
150+
# --------------------------------------------------------------

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
An experiment with Max generated code and DPF.
44

55
Based on https://github.com/Cycling74/gen-plugin-export.
6+
7+
If you want to build your own plugins use https://github.com/moddevices/max-gen-skeleton instead, which provides a base skeleton and scripts to facilitate the creating of such plugins.

plugins/Makefile.mk

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#!/usr/bin/make -f
2+
# Makefile for DISTRHO Plugins #
3+
# ---------------------------- #
4+
# Created by falkTX
5+
#
6+
7+
# NAME, OBJS_DSP and OBJS_UI have been defined before
8+
9+
include ../../Makefile.mk
10+
11+
ifeq ($(OBJS_UI),)
12+
HAVE_DGL = false
13+
endif
14+
15+
# --------------------------------------------------------------
16+
# Set which plugin formats to build
17+
18+
BUILD_JACK = true
19+
ifeq ($(LINUX),true)
20+
BUILD_LADSPA = true
21+
BUILD_DSSI = true
22+
endif
23+
BUILD_LV2 = true
24+
BUILD_VST2 = true
25+
26+
# --------------------------------------------------------------
27+
# Basic setup
28+
29+
TARGET_DIR = ../../bin
30+
31+
BUILD_C_FLAGS += -I.
32+
BUILD_CXX_FLAGS += -I. -I../common -I../common/gen_dsp -I../../dpf/distrho -I../../dpf/dgl -Wno-unused-parameter
33+
34+
ifeq ($(HAVE_DGL),true)
35+
BASE_FLAGS += -DHAVE_DGL
36+
endif
37+
38+
ifeq ($(HAVE_JACK),true)
39+
BASE_FLAGS += -DHAVE_JACK
40+
endif
41+
42+
ifeq ($(HAVE_LIBLO),true)
43+
BASE_FLAGS += -DHAVE_LIBLO
44+
endif
45+
46+
# --------------------------------------------------------------
47+
# Set plugin binary file targets
48+
49+
jack = $(TARGET_DIR)/$(NAME)$(APP_EXT)
50+
ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa$(LIB_EXT)
51+
dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi$(LIB_EXT)
52+
dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui$(APP_EXT)
53+
lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT)
54+
lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp$(LIB_EXT)
55+
lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui$(LIB_EXT)
56+
vst = $(TARGET_DIR)/$(NAME)-vst$(LIB_EXT)
57+
58+
# --------------------------------------------------------------
59+
# Set distrho code files
60+
61+
DISTRHO_PLUGIN_FILES = ../../dpf/distrho/DistrhoPluginMain.cpp
62+
63+
ifeq ($(HAVE_DGL),true)
64+
DISTRHO_UI_FILES = ../../dpf/distrho/DistrhoUIMain.cpp ../../dpf/libdgl.a
65+
endif
66+
67+
# --------------------------------------------------------------
68+
# Handle plugins without UI
69+
70+
ifneq ($(HAVE_DGL),true)
71+
dssi_ui =
72+
lv2_ui =
73+
DISTRHO_UI_FILES =
74+
DGL_LIBS =
75+
OBJS_UI =
76+
endif
77+
78+
# --------------------------------------------------------------
79+
# all needs to be first
80+
81+
all:
82+
83+
# --------------------------------------------------------------
84+
# Common
85+
86+
%.c.o: %.c
87+
$(CC) $< $(BUILD_C_FLAGS) -MD -MP -c -o $@
88+
89+
%.cpp.o: %.cpp
90+
$(CXX) $< $(BUILD_CXX_FLAGS) -MD -MP -c -o $@
91+
92+
clean:
93+
rm -f *.d *.o
94+
rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2/
95+
96+
# --------------------------------------------------------------
97+
# JACK
98+
99+
jack: $(jack)
100+
101+
$(jack): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES)
102+
mkdir -p $(shell dirname $@)
103+
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs jack) -DDISTRHO_PLUGIN_TARGET_JACK -o $@
104+
105+
# --------------------------------------------------------------
106+
# LADSPA
107+
108+
ladspa: $(ladspa_dsp)
109+
110+
$(ladspa_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES)
111+
mkdir -p $(shell dirname $@)
112+
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LADSPA -o $@
113+
114+
# --------------------------------------------------------------
115+
# DSSI
116+
117+
dssi: $(dssi_dsp) $(dssi_ui)
118+
dssi_dsp: $(dssi_dsp)
119+
dssi_ui: $(dssi_ui)
120+
121+
$(dssi_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES)
122+
mkdir -p $(shell dirname $@)
123+
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@
124+
125+
$(dssi_ui): $(OBJS_UI) $(DISTRHO_UI_FILES)
126+
mkdir -p $(shell dirname $@)
127+
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@
128+
129+
# --------------------------------------------------------------
130+
# LV2
131+
132+
lv2_one: $(lv2)
133+
lv2_dsp: $(lv2_dsp)
134+
lv2_sep: $(lv2_dsp) $(lv2_ui)
135+
136+
$(lv2): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES)
137+
mkdir -p $(shell dirname $@)
138+
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@
139+
140+
$(lv2_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES)
141+
mkdir -p $(shell dirname $@)
142+
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@
143+
144+
$(lv2_ui): $(OBJS_UI) $(DISTRHO_UI_FILES)
145+
mkdir -p $(shell dirname $@)
146+
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@
147+
148+
# --------------------------------------------------------------
149+
# VST
150+
151+
vst: $(vst)
152+
153+
$(vst): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES)
154+
mkdir -p $(shell dirname $@)
155+
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_VST -o $@
156+
157+
# --------------------------------------------------------------
158+
159+
-include $(OBJS_DSP:%.o=%.d)
160+
ifeq ($(HAVE_DGL),true)
161+
-include $(OBJS_UI:%.o=%.d)
162+
endif
163+
164+
# --------------------------------------------------------------

plugins/bitcrush/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,27 @@ BUILD_CXX_FLAGS += -I../common -I../common/gen_dsp
2828
# --------------------------------------------------------------
2929
# Enable all possible plugin types
3030

31+
ifeq ($(BUILD_JACK),true)
3132
ifeq ($(HAVE_JACK),true)
3233
TARGETS += jack
3334
endif
35+
endif
3436

37+
<<<<<<< HEAD
38+
TARGETS += ladspa
39+
=======
40+
ifeq ($(BUILD_LADSPA),true)
3541
TARGETS += ladspa
42+
endif
43+
44+
ifeq ($(BUILD_LV2),true)
45+
>>>>>>> 32c2796b78396662fcc5bfce3bd6a02e8958a44a
3646
TARGETS += lv2_dsp
47+
endif
48+
49+
ifeq ($(BUILD_VST2),true)
3750
TARGETS += vst
51+
endif
3852

3953
all: $(TARGETS)
4054

plugins/freeverb/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,27 @@ BUILD_CXX_FLAGS += -I../common -I../common/gen_dsp
2828
# --------------------------------------------------------------
2929
# Enable all possible plugin types
3030

31+
ifeq ($(BUILD_JACK),true)
3132
ifeq ($(HAVE_JACK),true)
3233
TARGETS += jack
3334
endif
35+
endif
3436

37+
<<<<<<< HEAD
38+
TARGETS += ladspa
39+
=======
40+
ifeq ($(BUILD_LADSPA),true)
3541
TARGETS += ladspa
42+
endif
43+
44+
ifeq ($(BUILD_LV2),true)
45+
>>>>>>> 32c2796b78396662fcc5bfce3bd6a02e8958a44a
3646
TARGETS += lv2_dsp
47+
endif
48+
49+
ifeq ($(BUILD_VST2),true)
3750
TARGETS += vst
51+
endif
3852

3953
all: $(TARGETS)
4054

0 commit comments

Comments
 (0)