COMPILER = gcc
COMPILERFLAGS = -O2 -m486 -m80387 -DDAMN_INTEL_BYTE_ORDER -DOS2 -ggdb -ffast-math -pipe
#-DDEBUG
INCLUDEDIRS = -I/emx/include -I/emx/include/cpp -I/emx/mmpm
CFLAGS = $(COMPILERFLAGS)
CFLAGSO0 = -O0 -m486 -DDAMN_INTEL_BYTE_ORDER -funroll-loops -DOS2 -ggdb
LFLAGS = -L/emx/mmpm -L/emx/lib -los2me -ggdb maplay.def -lc_import -s

# debugging: -ggdb -DDEBUG
# profiling: -pg (gprof) or -p (prof)
# strip command has to be removed for debugging or profiling


OBJS = maplay.o ibitstream.o header.o scalefactors.o subband_layer_1.o subband_layer_2.o \
       synthesis_filter.o obuffer.o crc.o ulaw.o playwav.o \
	bit_res.o layer3.o huffman.o


.SUFFIXES:	.cc .s .o

all:		maplay.exe
# playwav.s

maplay.exe:	$(OBJS) maplay.def
		$(COMPILER) $(OBJS) $(LFLAGS) -o $@ $(LIBRARIES) -lm
#		-strip $@

obuffer.o:	all.h audio_includes.h crc.h header.h ibitstream.h obuffer.h ulaw.h obuffer.cc playwav.h
		$(COMPILER) -c $(CFLAGSO0) $(INCLUDEDIRS) $*.cc -o $@

#playwav.s:	playwav.cc playwav.h
#		$(COMPILER) -c $(CFLAGS) $(INCLUDEDIRS) $*.cc -S

.cc.o:
		$(COMPILER) -c $(CFLAGS) $(INCLUDEDIRS) $*.cc -o $@

.cc.s:
		$(COMPILER) -c $(CFLAGS) $(INCLUDEDIRS) $*.cc -S

depend:
		makedepend $(INCLUDEDIRS) -w100 *.cc

clean:
		-rm -f maplay.exe
		-rm -f *.o


crc.o:			all.h crc.h
header.o:		all.h crc.h header.h ibitstream.h
ibitstream.o:		all.h ibitstream.h
maplay.o:		all.h audio_includes.h crc.h header.h ibitstream.h obuffer.h \
			scalefactors.h subband.h subband_layer_1.h subband_layer_2.h \
			synthesis_filter.h ulaw.h
scalefactors.o:		all.h scalefactors.h
ulaw.o:			all.h ulaw.h
subband_layer_1.o:	all.h audio_includes.h crc.h header.h ibitstream.h obuffer.h \
			scalefactors.h subband.h subband_layer_1.h synthesis_filter.h ulaw.h
subband_layer_2.o:	all.h audio_includes.h crc.h header.h ibitstream.h obuffer.h \
			scalefactors.h subband.h subband_layer_2.h synthesis_filter.h ulaw.h
synthesis_filter.o:	all.h audio_includes.h crc.h header.h ibitstream.h obuffer.h \
			synthesis_filter.h ulaw.h
playwav.o:		playwav.cc playwav.h

# DO NOT DELETE THIS LINE -- make depend depends on it.
