1# Copyright (C) 2012-2021  The Bochs Project
2#
3# This library is free software; you can redistribute it and/or
4# modify it under the terms of the GNU Lesser General Public
5# License as published by the Free Software Foundation; either
6# version 2 of the License, or (at your option) any later version.
7#
8# This library is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11# Lesser General Public License for more details.
12#
13# You should have received a copy of the GNU Lesser General Public
14# License along with this library; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
16
17# Makefile for the iodev/sound component of bochs
18
19
20@SUFFIX_LINE@
21
22prefix          = @prefix@
23exec_prefix     = @exec_prefix@
24srcdir          = @srcdir@
25VPATH = @srcdir@
26bindir          = @bindir@
27libdir          = @libdir@
28datarootdir     = @datarootdir@
29mandir          = @mandir@
30man1dir         = $(mandir)/man1
31man5dir         = $(mandir)/man5
32docdir          = $(datarootdir)/doc/bochs
33sharedir        = $(datarootdir)/bochs
34top_builddir    = ..
35top_srcdir      = @top_srcdir@
36
37SHELL = @SHELL@
38
39@SET_MAKE@
40
41CXX = @CXX@
42CXXFLAGS = $(BX_INCDIRS) @CXXFLAGS@ @GUI_CXXFLAGS@
43
44LDFLAGS = @LDFLAGS@
45LIBS = @LIBS@
46RANLIB = @RANLIB@
47PLUGIN_PATH=@libdir@
48top_builddir    = ../..
49LIBTOOL=@LIBTOOL@
50WIN32_DLL_IMPORT_LIBRARY=../../@WIN32_DLL_IMPORT_LIB@
51
52SOUNDLOW_OBJS = sounddummy.o soundfile.o @SOUNDLOW_OBJS@
53
54BX_INCDIRS = -I.. -I../.. -I$(srcdir)/.. -I$(srcdir)/../.. -I../../@INSTRUMENT_DIR@ -I$(srcdir)/../../@INSTRUMENT_DIR@
55LOCAL_CXXFLAGS = $(MCH_CFLAGS)
56
57OBJS_THAT_CANNOT_BE_PLUGINS = \
58  soundmod.o \
59  soundlow.o
60
61OBJS_THAT_CAN_BE_PLUGINS = \
62  @SOUNDHW_OBJS@ \
63  $(SOUNDLOW_OBJS)
64
65OBJS_THAT_SUPPORT_OTHER_PLUGINS = opl.o
66
67NONPLUGIN_OBJS = @IODEV_EXT_NON_PLUGIN_OBJS@
68PLUGIN_OBJS = @IODEV_EXT_PLUGIN_OBJS@
69ALSA_SOUND_LINK_OPTS = @ALSA_SOUND_LINK_OPTS@
70SDL_SOUND_LINK_OPTS = @SDL_SOUND_LINK_OPTS@
71WIN_SOUND_LINK_OPTS = -lwinmm
72WIN_SOUND_LINK_OPTS_VCPP = winmm.lib
73
74SOUNDHW_DLL_TARGETS = @SOUNDHW_DLL_TARGETS@
75
76all: libsound.a
77
78plugins: @PLUGIN_TARGET_2@
79
80plugins_gcc: $(PLUGIN_OBJS:@PLUGIN_LIBNAME_TRANSFORMATION@)
81
82plugins_msvc: bx_sounddummy.dll bx_soundfile.dll bx_soundwin.dll $(SOUNDHW_DLL_TARGETS)
83
84libsound.a: $(NONPLUGIN_OBJS)
85	@RMCOMMAND@ libsound.a
86	@MAKELIB@ $(NONPLUGIN_OBJS)
87	$(RANLIB) libsound.a
88
89# standard compile rule for C++ files
90.@CPP_SUFFIX@.o:
91	$(CXX) @DASH@c  $(CXXFLAGS) $(LOCAL_CXXFLAGS) @CXXFP@$< @OFP@$@
92
93##### building plugins with libtool
94%.lo: %.@CPP_SUFFIX@
95	$(LIBTOOL) --mode=compile --tag CXX $(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $< -o $@
96
97libbx_%.la: %.lo
98	$(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH)
99
100# special link rules for plugins that require more than one object file
101libbx_sb16.la: sb16.lo opl.lo
102	$(LIBTOOL) --mode=link --tag CXX $(CXX) -module sb16.lo opl.lo -o libbx_sb16.la -rpath $(PLUGIN_PATH)
103
104libbx_soundalsa.la: soundalsa.lo
105	$(LIBTOOL) --mode=link --tag CXX $(CXX) -module soundalsa.lo -o libbx_soundalsa.la -rpath $(PLUGIN_PATH) $(ALSA_SOUND_LINK_OPTS)
106
107libbx_soundsdl.la: soundsdl.lo
108	$(LIBTOOL) --mode=link --tag CXX $(CXX) -module soundsdl.lo -o libbx_soundsdl.la -rpath $(PLUGIN_PATH) $(SDL_SOUND_LINK_OPTS)
109
110#### building DLLs for win32 (Cygwin and MinGW/MSYS)
111bx_%.dll: %.o
112	$(CXX) $(CXXFLAGS) -shared -o $@ $< $(WIN32_DLL_IMPORT_LIBRARY)
113
114# special link rules for plugins with Cygwin, MinGW/MSYS and MSVC nmake
115bx_sb16.dll: sb16.o opl.o
116	@LINK_DLL@ sb16.o opl.o $(WIN32_DLL_IMPORT_LIBRARY)
117
118bx_es1370.dll: es1370.o
119	@LINK_DLL@ es1370.o $(WIN32_DLL_IMPORT_LIBRARY)
120
121bx_sounddummy.dll: sounddummy.o
122	@LINK_DLL@ sounddummy.o $(WIN32_DLL_IMPORT_LIBRARY)
123
124bx_soundfile.dll: soundfile.o
125	@LINK_DLL@ soundfile.o $(WIN32_DLL_IMPORT_LIBRARY)
126
127bx_soundwin.dll: soundwin.o
128	@LINK_DLL@ soundwin.o $(WIN32_DLL_IMPORT_LIBRARY) $(WIN_SOUND_LINK_OPTS@LINK_VAR@)
129
130##### end DLL section
131
132clean:
133	@RMCOMMAND@ -rf .libs *.lo *.o *.la *.a *.dll *.exp *.lib
134
135dist-clean: clean
136	@RMCOMMAND@ Makefile
137
138###########################################
139# dependencies generated by
140#  gcc -MM -I.. -I../.. -I../../instrument/stubs *.cc | sed -e 's/\.cc/.@CPP_SUFFIX@/g'
141#  gcc -MM -I.. -I../.. -I../../instrument/stubs *.cc | \
142#     sed -e 's/\.cc/.@CPP_SUFFIX@/g' -e 's/\.o:/.lo:/g'
143#
144# This means that every source file is listed twice, once with a .o rule
145# and then again with an identical .lo rule.  The .lo rules are used when
146# building plugins.
147###########################################
148es1370.o: es1370.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
149 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
150 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../param_names.h \
151 ../../pc_system.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
152 ../../memory/memory-bochs.h ../../gui/siminterface.h ../../gui/gui.h \
153 soundlow.h ../../bxthread.h soundmod.h ../pci.h es1370.h
154opl.o: opl.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
155 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
156 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../param_names.h \
157 ../../pc_system.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
158 ../../memory/memory-bochs.h ../../gui/siminterface.h ../../gui/gui.h \
159 opl.h
160sb16.o: sb16.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
161 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
162 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../param_names.h \
163 ../../pc_system.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
164 ../../memory/memory-bochs.h ../../gui/siminterface.h ../../gui/gui.h \
165 soundlow.h ../../bxthread.h soundmod.h sb16.h opl.h
166soundalsa.o: soundalsa.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
167 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
168 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
169 soundlow.h ../../bxthread.h soundmod.h soundalsa.h
170sounddummy.o: sounddummy.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
171 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
172 ../../misc/bswap.h ../../plugin.h ../../extplugin.h soundlow.h \
173 ../../bxthread.h
174soundfile.o: soundfile.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
175 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
176 ../../misc/bswap.h ../../plugin.h ../../extplugin.h soundlow.h \
177 ../../bxthread.h soundmod.h soundfile.h
178soundlow.o: soundlow.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
179 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
180 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
181 soundlow.h ../../bxthread.h
182soundmod.o: soundmod.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
183 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
184 ../../misc/bswap.h ../../plugin.h ../../extplugin.h \
185 ../../gui/siminterface.h ../../param_names.h soundmod.h soundlow.h \
186 ../../bxthread.h
187soundoss.o: soundoss.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
188 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
189 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
190 soundlow.h ../../bxthread.h soundmod.h soundoss.h
191soundosx.o: soundosx.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
192 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
193 ../../misc/bswap.h ../../plugin.h ../../extplugin.h soundlow.h \
194 ../../bxthread.h soundmod.h soundosx.h
195soundsdl.o: soundsdl.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
196 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
197 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
198 soundlow.h ../../bxthread.h soundmod.h soundsdl.h
199soundwin.o: soundwin.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
200 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
201 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
202 soundlow.h ../../bxthread.h soundmod.h soundwin.h
203es1370.lo: es1370.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
204 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
205 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../param_names.h \
206 ../../pc_system.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
207 ../../memory/memory-bochs.h ../../gui/siminterface.h ../../gui/gui.h \
208 soundlow.h ../../bxthread.h soundmod.h ../pci.h es1370.h
209opl.lo: opl.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
210 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
211 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../param_names.h \
212 ../../pc_system.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
213 ../../memory/memory-bochs.h ../../gui/siminterface.h ../../gui/gui.h \
214 opl.h
215sb16.lo: sb16.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
216 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
217 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../param_names.h \
218 ../../pc_system.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
219 ../../memory/memory-bochs.h ../../gui/siminterface.h ../../gui/gui.h \
220 soundlow.h ../../bxthread.h soundmod.h sb16.h opl.h
221soundalsa.lo: soundalsa.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
222 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
223 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
224 soundlow.h ../../bxthread.h soundmod.h soundalsa.h
225sounddummy.lo: sounddummy.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
226 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
227 ../../misc/bswap.h ../../plugin.h ../../extplugin.h soundlow.h \
228 ../../bxthread.h
229soundfile.lo: soundfile.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
230 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
231 ../../misc/bswap.h ../../plugin.h ../../extplugin.h soundlow.h \
232 ../../bxthread.h soundmod.h soundfile.h
233soundlow.lo: soundlow.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
234 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
235 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
236 soundlow.h ../../bxthread.h
237soundmod.lo: soundmod.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
238 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
239 ../../misc/bswap.h ../../plugin.h ../../extplugin.h \
240 ../../gui/siminterface.h ../../param_names.h soundmod.h soundlow.h \
241 ../../bxthread.h
242soundoss.lo: soundoss.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
243 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
244 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
245 soundlow.h ../../bxthread.h soundmod.h soundoss.h
246soundosx.lo: soundosx.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
247 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
248 ../../misc/bswap.h ../../plugin.h ../../extplugin.h soundlow.h \
249 ../../bxthread.h soundmod.h soundosx.h
250soundsdl.lo: soundsdl.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
251 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
252 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
253 soundlow.h ../../bxthread.h soundmod.h soundsdl.h
254soundwin.lo: soundwin.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
255 ../../gui/paramtree.h ../../logio.h ../../instrument/stubs/instrument.h \
256 ../../misc/bswap.h ../../plugin.h ../../extplugin.h ../../pc_system.h \
257 soundlow.h ../../bxthread.h soundmod.h soundwin.h
258