Bump version to 1
[zyn.git] / GNUmakefile
blob6a5dda0849a33f733539e58fb6168d83a68a1cc6
1 # Copyright (C) 2006,2007 Nedko Arnaudov <nedko@arnaudov.name>
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; version 2 of the License
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
16 PLUGIN_NAME = zynadd
17 VERSION = 0
18 LIBRARIES = -DPIC -Wall $(strip $(shell pkg-config --libs fftw3 lv2dynparamplugin1))
20 CC = gcc -c
21 CXX = g++ -c
22 CFLAGS := -g -fPIC -DPIC -Wall -Werror $(strip $(shell pkg-config --cflags fftw3 lv2core lv2dynparamplugin1))
24 GENDEP_SED_EXPR = "s/^\\(.*\\)\\.o *: /$(subst /,\/,$(@:.d=.o)) $(subst /,\/,$@) : /g"
25 GENDEP_C = set -e; $(GCC_PREFIX)gcc -MM $(CFLAGS) $< | sed $(GENDEP_SED_EXPR) > $@; [ -s $@ ] || rm -f $@
26 GENDEP_CXX = set -e; $(GCC_PREFIX)g++ -MM $(CXXFLAGS) $< | sed $(GENDEP_SED_EXPR) > $@; [ -s $@ ] || rm -f $@
28 # These files go into the bundle
29 BUNDLE_FILES = manifest.ttl zynadd.ttl zynadd.so
31 # These are the source files for the plugin
32 PLUGIN_SOURCES_CXX = addsynth.cpp
34 PLUGIN_SOURCES_CXX += addnote.cpp
35 PLUGIN_SOURCES_CXX += lfo.cpp
36 PLUGIN_SOURCES_CXX += filter_parameters.cpp
37 PLUGIN_SOURCES_CXX += envelope_parameters.cpp
38 PLUGIN_SOURCES_CXX += filter.cpp
39 PLUGIN_SOURCES_CXX += analog_filter.cpp
40 PLUGIN_SOURCES_CXX += formant_filter.cpp
41 PLUGIN_SOURCES_CXX += envelope.cpp
42 PLUGIN_SOURCES_CXX += sv_filter.cpp
43 PLUGIN_SOURCES_CXX += resonance.cpp
44 PLUGIN_SOURCES_CXX += addsynth_component_amp_globals.cpp
45 PLUGIN_SOURCES_CXX += addsynth_component_amp_envelope.cpp
46 PLUGIN_SOURCES_CXX += addsynth_component_lfo.cpp
47 PLUGIN_SOURCES_CXX += addsynth_component_filter_globals.cpp
48 PLUGIN_SOURCES_CXX += addsynth_component_filter_analog.cpp
49 PLUGIN_SOURCES_CXX += addsynth_component_filter_formant.cpp
50 PLUGIN_SOURCES_CXX += addsynth_component_filter_sv.cpp
51 PLUGIN_SOURCES_CXX += addsynth_component_filter_envelope.cpp
52 PLUGIN_SOURCES_CXX += addsynth_component_frequency_globals.cpp
53 PLUGIN_SOURCES_CXX += addsynth_component_frequency_envelope.cpp
54 PLUGIN_SOURCES_CXX += addsynth_component_voice_globals.cpp
56 PLUGIN_SOURCES_C = lv2plugin.c zynadd.c util.c zynadd_dynparam.c log.c
57 PLUGIN_SOURCES_C += fft.c
58 PLUGIN_SOURCES_C += zynadd_dynparam_value_changed_callbacks.c
59 PLUGIN_SOURCES_C += zynadd_dynparam_forest_map.c
60 PLUGIN_SOURCES_C += zynadd_dynparam_forest_map_top.c
61 PLUGIN_SOURCES_C += zynadd_dynparam_forest_map_voice.c
62 PLUGIN_SOURCES_C += portamento.c
63 PLUGIN_SOURCES_C += oscillator.c
64 PLUGIN_SOURCES_C += oscillator_access.c
65 PLUGIN_SOURCES_C += filter_sv.c
67 # Derived variables - do not edit
68 PLUGIN_OBJECTS = $(subst .cpp,.o,$(PLUGIN_SOURCES_CXX)) $(subst .c,.o,$(PLUGIN_SOURCES_C))
69 ALL_SOURCES_CXX = $(sort $(PLUGIN_SOURCES_CXX))
70 ALL_SOURCES_C = $(sort $(PLUGIN_SOURCES_C))
72 default: $(PLUGIN_NAME).lv2
74 all: $(PLUGIN_NAME).lv2 zyn
76 zyn: addnote_cpp.o main.o util.o
77 @echo "Creating standalone zyn ..."
78 @g++ -g $^ -o $@ $(LIBRARIES)
80 %.o:%.c
81 @echo "Compiling $< to $@ ..."
82 @$(CC) $(CFLAGS) $< -o $@
84 %.o:%.cpp
85 @echo "Compiling $< to $@ ..."
86 @$(CXX) $(CFLAGS) $< -o $@
88 # Remove all generated files
89 clean:
90 -rm -rf $(PLUGIN_NAME).lv2 zynadd.so zynadd_gtk *.d *.o zyn
92 rebuild: clean zyn
94 # The main target - the LV2 plugin bundle
95 $(PLUGIN_NAME).lv2: $(BUNDLE_FILES)
96 @echo "Creating LV2 bundle $@ ..."
97 @rm -rf $(PLUGIN_NAME).lv2
98 @mkdir $(PLUGIN_NAME).lv2
99 @cp $(BUNDLE_FILES) $(PLUGIN_NAME).lv2
101 # The plugin module
102 zynadd.so: $(PLUGIN_OBJECTS)
103 @echo "Creating LV2 shared library $@ ..."
104 g++ -shared -fPIC $(LDFLAGS) $(PLUGIN_OBJECTS) $(LIBRARIES) -o $@
105 @echo "Checking for undefined zyn symbols"
106 @nm $@ |grep ' U zyn' ; RESULT=$$? ; if test $${RESULT} -eq 0; then rm zynadd.so; fi ; test ! $${RESULT} -eq 0
108 DEPFILES = $(ALL_SOURCES_CXX:.cpp=.d) $(ALL_SOURCES_C:.c=.d)
110 # All header dependencies need to be generated and included
111 -include $(DEPFILES)
113 $(DEPFILES):
115 # This is how to generate the dependency files
116 %.d: %.cpp
117 @echo "Generating dependency for $< to $@ ..."
118 @$(GENDEP_CXX)
120 %.d: %.c
121 @echo "Generating dependency for $< to $@ ..."
122 @$(GENDEP_C)
124 install: $(PLUGIN_NAME).lv2
125 @./install_lv2.sh zynadd.lv2
127 .install_timestamp: $(PLUGIN_NAME).lv2
128 @echo "Installing..."
129 @sudo ./install_lv2.sh zynadd.lv2
130 @touch .install_timestamp
132 # compile/link if needs to and install using sudo, if compile/link was not a nop
133 maybe_sudo_install: .install_timestamp
135 # run it through zynjacku and use jack_connect to connect it
136 test_run: maybe_sudo_install
137 @(sleep 2 ; jack_snapshot restore ~/zynadd.jack_snapshot)&
138 @zynjacku http://home.gna.org/zyn/zynadd/1