all: 
	@echo "Here are some builds to choose from:"
	@echo
	@echo "	gnu-oss, static-gnu-oss, debug-gnu-oss, gnu-alsa, ..., gnu, ...: GNU g++ compiler and OSS/ALSA/both output in stripped dynamic or static linked form and unstripped dynamic form"
	@echo
	@echo "	tru64: Compaq's cxx and MME output (created for XP1000 Alpha workstation; hopefully applicable to other Tru64 machines, too); this is code that basically works (but crashes when you try to remove an mme output at runtime) and performs just as it is able to with the crappy mmeserver. Tell me if you got an AlphaStation that can produce continuously smooth music playback."
	@echo
	@echo
	@echo "	gnu-generic: g++ and no platform-specific outputs (debugging)"
	@echo
	@echo "	clean: remove binaries and object files"
	@echo
	@echo "There are at least two interesting variables to set:"
	@echo "	SNDFILE=yes"
	@echo "enables the libsndfile input... adding support for, well, many sound files."
	@echo "	VORBISFILE=yes"
	@echo "does the same for input of OGG/Vorbis files using libvorbisfile"
	@echo
	@echo "There's no install target. Installation means just copying the dermixd (or static_ / -debug) binary somewhere in out \$$PATH. Make sure you have the needed decoder binary(ies) in the \$$PATH, too."
	@echo
	@echo "Also, I startet using variadic macros for debugging, which are officially only part of the C99 standard, not ANSI C++. If you or your compiler don't like this, check out the gnu-strict target (note to self: I need some auto Makefile stuff)." 

######################################################
#                     The Builds                     #
######################################################

#There are some custom macros that influence the build:

#features:
#OUT_OSS to enable building of oss output; make sure to have out_oss.o in ADDOBJ!
#OUT_MME to enable building of mme output; make sure to have out_mme.o in ADDOBJ!
#OUT_ALSA to enable building of alsa output; make sure to have out_alsa.o in ADDOBJ!

#hacks:
#WANT_PORT_T enable use of type in_port_t for port number, otherwise it's u_int16_t; Tru64 wants it, GNU/Linux not

#configurator builds

SNDFILE=no
VORBISFILE=no
EXTRA_LIBS=
ADDFLAGS=
ADDOBJS=
ADDSRCS=
ifeq ($(SNDFILE), yes)
	EXTRA_LIBS:=$(EXTRA_LIBS) -lsndfile
	ADDFLAGS:=$(ADDFLAGS) -DIN_SNDFILE
	ADDOBJS:=$(ADDOBJS) in_sndfile.o
	ADDSRCS:=$(ADDSRCS) in_sndfile.cxx
endif
ifeq ($(VORBISFILE), yes)
	EXTRA_LIBS:=$(EXTRA_LIBS) -lvorbisfile
	ADDFLAGS:=$(ADDFLAGS) -DIN_VORBISFILE
	ADDOBJS:=$(ADDOBJS) in_vorbisfile.o
	ADDSRCS:=$(ADDSRCS) in_vorbisfile.cxx
endif

linux:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-D_REENTRANT -DOUT_OSS -DOUT_ALSA $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o out_alsa.o $(ADDOBJS)' \
	CC=$(CXX) \
	$(MAKE) dermixd

gnu:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-Wall -fno-exceptions -D_REENTRANT -DOUT_OSS -DOUT_ALSA $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o out_alsa.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) dermixd

%-strict:
	@echo preparing source tree for non-C99 compiler
	mkdir -p strict-src
	#Tru64 doesn't even have a cp that knows -v!
	cp *.cxx *.hxx Makefile strict-src
	perl scripts/undebug.pl strict-src/*.cxx
	cd strict-src && $(MAKE) `echo $@ | perl -pe 's/-strict//'`

gnu-oneshot:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-Wall -fno-exceptions  -D_REENTRANT -DOUT_OSS -DOUT_ALSA $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDSRC='out_oss.cxx out_alsa.cxx $(ADDSRCS)' \
	CC=g++ \
	$(MAKE) dermixd-oneshot

gnu-test-action:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-Wall -fno-exceptions -D_REENTRANT -DOUT_OSS -DOUT_ALSA $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o out_alsa.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) tests/action

linux-icc:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-Wall -D_REENTRANT -DOUT_OSS -DOUT_ALSA -march=pentiumii -O3 -fomit-frame-pointer -ipo -no-prec-div -funroll-loops -rcd  $(CPPFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o out_alsa.o $(ADDOBJS)' \
	CC=icc \
	$(MAKE) dermixd

static-gnu:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-Wall -D_REENTRANT -DOUT_OSS -DOUT_ALSA $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o out_alsa.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) static-dermixd

debug-gnu:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-Wall -pedantic-errors -fno-exceptions -D_REENTRANT -DOUT_OSS -DOUT_ALSA -g $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o out_alsa.o' \
	CC=g++ \
	$(MAKE) dermixd_debug

gnu-oss:
	LDFLAGS='-lpthread $(EXTRA_LIBS)' \
	CFLAGS='-Wall -fno-exceptions -D_REENTRANT -DOUT_OSS $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) dermixd

static-gnu-oss:
	LDFLAGS='-lpthread $(EXTRA_LIBS)' \
	CFLAGS='-Wall -D_REENTRANT -DOUT_OSS $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) static-dermixd

debug-gnu-oss:
	LDFLAGS='-lpthread $(EXTRA_LIBS)' \
	CFLAGS='-Wall -fno-exceptions -D_REENTRANT -DOUT_OSS -g $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_oss.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) dermixd_debug

gnu-alsa:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-Wall -fno-exceptions -D_REENTRANT -DOUT_ALSA $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_alsa.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) dermixd

static-gnu-alsa:
	LDFLAGS='-lpthread -lasound $(EXTRA_LIBS)' \
	CFLAGS='-Wall -fno-exceptions  -D_REENTRANT -DOUT_ALSA $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_alsa.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) static-dermixd

debug-gnu-alsa:
	LDFLAGS='-lpthread -lasound' \
	CFLAGS='-Wall -fno-exceptions -D_REENTRANT -DOUT_ALSA -g $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_alsa.o $(ADDOBJS)' \
	CC=g++ \
	$(MAKE) dermixd_debug

tru64:
	CC=cxx \
	CFLAGS='-I/usr/include/mme -std ansi -D__USE_STD_IOSTREAM -DBAD_OSTRINGSTREAM -DWANT_PORT_T -DOUT_MME -pthread $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_mme.o $(ADDOBJS)' \
	LDFLAGS='-lrt -lm -lmme $(EXTRA_LIBS)' \
	$(MAKE) dermixd

debug-tru64:
	CC=cxx \
	CFLAGS='-I/usr/include/mme -std ansi -D__USE_STD_IOSTREAM -DBAD_OSTRINGSTREAM -DWANT_PORT_T -DOUT_MME -pthread $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='out_mme.o $(ADDOBJS) \
	LDFLAGS='-lrt -lm -lmme $(EXTRA_LIBS)' \
	$(MAKE) dermixd_debug

gnu-generic:
	LDFLAGS='-lpthread $(EXTRA_LIBS)' \
	CFLAGS='-Wall -fno-exceptions -D_REENTRANT $(CPPFLAGS) $(CXXFLAGS) $(ADDFLAGS)' \
	ADDOBJ='$(ADDOBJS)'\
	CC=g++ \
	$(MAKE) dermixd


################################################################################
#Object Files

#automatic section - object files with dependencies
#makeobject.pl *.cxx | perl -e 'while(<STDIN>){ $_ =~ s/\s*(out|in)_(alsa|mme|oss|sndfile|vorbisfile)\.(o|cxx)//g if $_ =~ /^(objects|sources)/; print $_;}'
action.o: action.cxx common.hxx action.hxx comparse.hxx tstring.hxx debug.hxx param.hxx comm_data.hxx socket_writer_data.hxx netcomm.hxx thread_container.hxx
	$(CC) $(CFLAGS) -c -o $@ action.cxx

action_queue.o: action_queue.cxx common.hxx action_queue.hxx debug.hxx param.hxx comm_data.hxx action.hxx tstring.hxx socket_writer_data.hxx netcomm.hxx thread_container.hxx
	$(CC) $(CFLAGS) -c -o $@ action_queue.cxx

audio_fifo.o: audio_fifo.cxx common.hxx piperead.hxx audio_buffer.hxx audio_fifo.hxx param.hxx secsleep.hxx debug.hxx comm_data.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ audio_fifo.cxx

audio_functions.o: audio_functions.cxx common.hxx audio_buffer.hxx debug.hxx param.hxx comm_data.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ audio_functions.cxx

browse.o: browse.cxx browse.hxx common.hxx communicator.hxx debug.hxx param.hxx comm_data.hxx action.hxx communicator_actions.hxx thread_container.hxx socket_writer_data.hxx tstring.hxx action_errors.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ browse.cxx

comm_data.o: comm_data.cxx common.hxx debug.hxx param.hxx comm_data.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ comm_data.cxx

communicator_actions.o: communicator_actions.cxx action.hxx communicator_actions.hxx common.hxx socket_writer_data.hxx debug.hxx action_errors.hxx param.hxx comm_data.hxx netcomm.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ communicator_actions.cxx

communicator.o: communicator.cxx common.hxx version.hxx comparse.hxx netcomm.hxx communicator.hxx secsleep.hxx browse.hxx peers.hxx debug.hxx param.hxx comm_data.hxx action.hxx communicator_actions.hxx thread_container.hxx socket_writer_data.hxx tstring.hxx action_errors.hxx
	$(CC) $(CFLAGS) -c -o $@ communicator.cxx

comparse.o: comparse.cxx
	$(CC) $(CFLAGS) -c -o $@ comparse.cxx

in_dummy.o: in_dummy.cxx common.hxx audio_buffer.hxx audio_functions.hxx input.hxx in_dummy.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx tstring.hxx action.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ in_dummy.cxx

in_mpg123.o: in_mpg123.cxx common.hxx comparse.hxx in_mpg123.hxx debug.hxx param.hxx comm_data.hxx action_queue.hxx waiter_group.hxx audio_fifo.hxx input.hxx tstring.hxx action.hxx audio_buffer.hxx thread_container.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ in_mpg123.cxx

input_actions.o: input_actions.cxx action.hxx input_actions.hxx common.hxx socket_writer_data.hxx debug.hxx param.hxx comm_data.hxx netcomm.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ input_actions.cxx

input_base.o: input_base.cxx common.hxx input.hxx input_actions.hxx action_errors.hxx audio_functions.hxx comparse.hxx scanner.hxx mixer.hxx debug.hxx param.hxx comm_data.hxx audio_buffer.hxx thread_container.hxx action_queue.hxx action.hxx tstring.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ input_base.cxx

input.o: input.cxx common.hxx audio_buffer.hxx audio_fifo.hxx input.hxx in_dummy.hxx in_sine.hxx in_mpg123.hxx in_vorbisfile.hxx in_raw_s16.hxx in_sndfile.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx waiter_group.hxx tstring.hxx action.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ input.cxx

in_raw_s16.o: in_raw_s16.cxx common.hxx debug.hxx audio_buffer.hxx audio_functions.hxx input.hxx in_raw_s16.hxx comparse.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx tstring.hxx action.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ in_raw_s16.cxx

in_sine.o: in_sine.cxx common.hxx audio_buffer.hxx audio_functions.hxx input.hxx in_sine.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx tstring.hxx action.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ in_sine.cxx

in_sndfile.o: in_sndfile.cxx common.hxx input.hxx in_sndfile.hxx debug.hxx param.hxx comm_data.hxx audio_buffer.hxx thread_container.hxx action_queue.hxx tstring.hxx action.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ in_sndfile.cxx

in_vorbisfile.o: in_vorbisfile.cxx in_vorbisfile.hxx debug.hxx input.hxx common.hxx audio_buffer.hxx thread_container.hxx action_queue.hxx param.hxx comm_data.hxx tstring.hxx action.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ in_vorbisfile.cxx

main.o: main.cxx common.hxx version.hxx mixer.hxx param_init.hxx action.hxx communicator_actions.hxx debug.hxx param.hxx comm_data.hxx socket_writer_data.hxx action_errors.hxx tstring.hxx netcomm.hxx thread_container.hxx
	$(CC) $(CFLAGS) -c -o $@ main.cxx

mixer_actions.o: mixer_actions.cxx common.hxx audio_buffer.hxx audio_fifo.hxx audio_functions.hxx input.hxx output.hxx netcomm.hxx socket_writer_data.hxx action.hxx communicator.hxx mixer_data.hxx mixer_tools.hxx mixer_actions.hxx mixer_stuff.hxx tstring.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx communicator_actions.hxx action_errors.hxx
	$(CC) $(CFLAGS) -c -o $@ mixer_actions.cxx

mixer.o: mixer.cxx common.hxx audio_buffer.hxx audio_functions.hxx output.hxx input.hxx netcomm.hxx socket_writer_data.hxx action.hxx communicator.hxx mixer_data.hxx mixer_tools.hxx mixer_actions.hxx secsleep.hxx mixer_stuff.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx communicator_actions.hxx tstring.hxx action_errors.hxx
	$(CC) $(CFLAGS) -c -o $@ mixer.cxx

mixer_data.o: mixer_data.cxx common.hxx netcomm.hxx audio_buffer.hxx audio_functions.hxx input.hxx output.hxx socket_writer_data.hxx action.hxx mixer_data.hxx mixer_tools.hxx communicator_actions.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx action_errors.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ mixer_data.cxx

mixer_tools.o: mixer_tools.cxx common.hxx audio_buffer.hxx audio_functions.hxx input.hxx output.hxx netcomm.hxx socket_writer_data.hxx action.hxx mixer_data.hxx mixer_tools.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ mixer_tools.cxx

netcomm.o: netcomm.cxx common.hxx debug.hxx netcomm.hxx param.hxx comm_data.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ netcomm.cxx

out_alsa.o: out_alsa.cxx common.hxx audio_buffer.hxx output.hxx out_alsa.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ out_alsa.cxx

out_dummy.o: out_dummy.cxx common.hxx audio_buffer.hxx output.hxx out_dummy.hxx secsleep.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ out_dummy.cxx

out_mme.o: out_mme.cxx common.hxx audio_buffer.hxx output.hxx out_mme.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ out_mme.cxx

out_oss.o: out_oss.cxx common.hxx audio_buffer.hxx output.hxx out_oss.hxx secsleep.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ out_oss.cxx

output_base.o: output_base.cxx common.hxx audio_buffer.hxx output.hxx thread_container.hxx debug.hxx param.hxx comm_data.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ output_base.cxx

output.o: output.cxx common.hxx audio_buffer.hxx output.hxx out_dummy.hxx out_oss.hxx out_mme.hxx out_alsa.hxx out_text.hxx out_raw_s16.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ output.cxx

out_raw_s16.o: out_raw_s16.cxx common.hxx audio_buffer.hxx output.hxx out_raw_s16.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ out_raw_s16.cxx

out_text.o: out_text.cxx common.hxx audio_buffer.hxx output.hxx out_text.hxx debug.hxx param.hxx comm_data.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ out_text.cxx

param.o: param.cxx param.hxx debug.hxx
	$(CC) $(CFLAGS) -c -o $@ param.cxx

param_init.o: param_init.cxx common.hxx main_parm.hxx in_mpg123_parm.hxx out_alsa_parm.hxx audio_fifo_parm.hxx debug.hxx param.hxx comm_data.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ param_init.cxx

peers.o: peers.cxx common.hxx peers.hxx socket_writer_data.hxx debug.hxx param.hxx comm_data.hxx action.hxx netcomm.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ peers.cxx

piperead.o: piperead.cxx common.hxx secsleep.hxx debug.hxx param.hxx comm_data.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ piperead.cxx

scanner.o: scanner.cxx common.hxx scanner.hxx scan_power.hxx debug.hxx param.hxx comm_data.hxx audio_buffer.hxx input.hxx tstring.hxx thread_container.hxx action_queue.hxx action.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ scanner.cxx

scan_power.o: scan_power.cxx scan_power.hxx scanner.hxx debug.hxx common.hxx audio_buffer.hxx input.hxx tstring.hxx param.hxx comm_data.hxx thread_container.hxx action_queue.hxx action.hxx socket_writer_data.hxx netcomm.hxx
	$(CC) $(CFLAGS) -c -o $@ scan_power.cxx

secsleep.o: secsleep.cxx
	$(CC) $(CFLAGS) -c -o $@ secsleep.cxx

socket_writer_data.o: socket_writer_data.cxx common.hxx socket_writer_data.hxx debug.hxx param.hxx comm_data.hxx netcomm.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ socket_writer_data.cxx

spies.o: spies.cxx common.hxx socket_writer_data.hxx debug.hxx param.hxx comm_data.hxx netcomm.hxx thread_container.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ spies.cxx

thread_container.o: thread_container.cxx thread_container.hxx common.hxx debug.hxx tstring.hxx param.hxx comm_data.hxx
	$(CC) $(CFLAGS) -c -o $@ thread_container.cxx

tstring.o: tstring.cxx tstring.hxx debug.hxx
	$(CC) $(CFLAGS) -c -o $@ tstring.cxx

version.o: version.cxx
	$(CC) $(CFLAGS) -c -o $@ version.cxx

waiter_group.o: waiter_group.cxx waiter_group.hxx common.hxx comm_data.hxx debug.hxx param.hxx tstring.hxx
	$(CC) $(CFLAGS) -c -o $@ waiter_group.cxx

objects = action.o action_queue.o audio_fifo.o audio_functions.o browse.o comm_data.o communicator_actions.o communicator.o comparse.o in_dummy.o in_mpg123.o input_actions.o input_base.o input.o in_raw_s16.o in_sine.o main.o mixer_actions.o mixer.o mixer_data.o mixer_tools.o netcomm.o out_dummy.o output_base.o output.o out_raw_s16.o out_text.o param.o param_init.o peers.o piperead.o scanner.o scan_power.o secsleep.o socket_writer_data.o spies.o thread_container.o tstring.o version.o waiter_group.o
sources = action.cxx action_queue.cxx audio_fifo.cxx audio_functions.cxx browse.cxx comm_data.cxx communicator_actions.cxx communicator.cxx comparse.cxx in_dummy.cxx in_mpg123.cxx input_actions.cxx input_base.cxx input.cxx in_raw_s16.cxx in_sine.cxx main.cxx mixer_actions.cxx mixer.cxx mixer_data.cxx mixer_tools.cxx netcomm.cxx out_dummy.cxx output_base.cxx output.cxx out_raw_s16.cxx out_text.cxx param.cxx param_init.cxx peers.cxx piperead.cxx scanner.cxx scan_power.cxx secsleep.cxx socket_writer_data.cxx spies.cxx thread_container.cxx tstring.cxx version.cxx waiter_group.cxx


################################################################################
#Real Builds

targets = dermixd static-dermixd dermixd_debug static-dermixd_debug

dermixd_debug: $(objects) $(ADDOBJ)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(objects) $(ADDOBJ)

static-dermixd_debug: $(objects) $(ADDOBJ)
	$(CC) $(CFLAGS) -static -o $@ $(objects) $(ADDOBJ) $(LDFLAGS) 

dermixd: $(objects) $(ADDOBJ)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(objects) $(ADDOBJ)

dermixd-oneshot: $(sources) $(ADDSRC)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(sources) $(ADDSRC)

static-dermixd: $(objects) $(ADDOBJ)
	$(CC) $(CFLAGS) -static -o $@ $(objects) $(ADDOBJ) $(LDFLAGS) 

clean:
	rm -f $(targets) *.o
	rm -rf strict-src

################################################################################
#Testing Stuff
#makeobject.pl tests/*.cxx | perl -e 'while(<STDIN>){ $_ =~ s/\s*out_(alsa|mme|oss)\.o//g if $_ =~ s/^objects/testobjects/; print $_;}'
tests/action.o: tests/action.cxx tests/../common.hxx tests/../action.hxx tests/../communicator_actions.hxx param.hxx comm_data.hxx common.hxx socket_writer_data.hxx param.hxx comm_data.hxx
	$(CC) $(CFLAGS) -c -o $@ $<

tests/debug.o: tests/debug.cxx common.hxx param.hxx comm_data.hxx
	$(CC) $(CFLAGS) -c -o $@ $<

tests/signtheint.o: tests/signtheint.cxx
	$(CC) $(CFLAGS) -c -o $@ $<

tests/stringer.o: tests/stringer.cxx
	$(CC) $(CFLAGS) -c -o $@ $<

testobjects = tests/action.o tests/debug.o tests/signtheint.o tests/stringer.o


tests/action: tests/action.o communicator_actions.o action.o comparse.o
	$(CC) $(CFLAGS) -o $@ $^
