# Generated automatically from Makefile.in by configure.
#
# mad - MPEG audio decoder
# Copyright (C) 2000 Robert Leslie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# $Id: Makefile.in,v 1.10 2000/09/20 01:06:22 rob Exp $
#

## OPTIONS ####################################################################

# Fixed Point Math multiply options:
# (set by --enable-fpm during configure)
#
# FPM_APPROX	use 32-bit approximation
# FPM_64BIT	use 64-bit (long long) accuracy
# FPM_INTEL	use Intel assembly
# FPM_ARM	use ARM V4 assembly
# FPM_MIPS	use MIPS assembly
# FPM_SPARC	use SPARC V8 assembly
# (default)	use slow explicit computation

FPM =		-DFPM_INTEL

# Architecture-Specific Optimization options (supported architectures only):
# (set by --enable-aso during configure)
#
# ASO_IMDCT	optimize Layer III IMDCT

ASO =		

# Other options:
# (now kept in config.h)
#
# OPT_SSO	use fast subband synthesis approximation optimization
# OPT_ISKLUGE	use Layer III intensity stereo kluge

## ENVIRONMENT ################################################################



src =		.

prefix =	/usr/local
exec_prefix =	${prefix}

MANDEST =	${prefix}/man

INCDEST =	${prefix}/include
LIBDEST =	${exec_prefix}/lib

MANEXT =	3

INSTALL =	/usr/bin/install -c
LIBINSTALL =	${INSTALL} -m 644

CC =		gcc
INCLUDES =	
DEFINES =	-DHAVE_CONFIG_H $(FPM) $(ASO)
LIBS =		

AR =		ar
RANLIB =	ranlib

ARCH =		-m486
DEBUGGER =	-g
OPTIMIZER =	-O
PROFILER =	

COPTS =		 -Wall $(ARCH) $(DEBUGGER) $(OPTIMIZER) $(PROFILER)
LDOPTS =	 $(PROFILER)

## FLAGS ######################################################################

CFLAGS =	$(SOOPTS) $(COPTS) $(INCLUDES) $(DEFINES)
LDFLAGS =	$(LDOPTS)

## OBJECTS ####################################################################

TARGETS =	$(LIBMAD) $(INCMAD)

LIBMAD =	libmad.a
INCMAD =	mad.h

LIBMADSO =	libmad.so
SOMAJOR =	0.11
SOMINOR =	4b

MISCOBJS =	

MADOBJS =	version.o fixed.o bit.o timer.o stream.o frame.o synth.o  \
		decoder.o layer12.o layer3.o huffman.o $(MISCOBJS)
MADINCLUDES =	version.h fixed.h bit.h timer.h stream.h frame.h synth.h  \
		decoder.h

## GENERIC RULES ##############################################################

all :: $(TARGETS)

check :: all
	@echo "No self-tests available."

install :: all
	$(LIBINSTALL) $(LIBMAD) "$(LIBDEST)/."
	$(LIBINSTALL) $(INCMAD) "$(INCDEST)/."

again :: clean all

clean ::
	rm -f $(TARGETS) *.o *.a *.so* gmon.* core

distclean :: clean
	rm -f mad.h
	rm -f config.status config.cache config.log config.h
	rm -f Makefile

maintainer-clean :: distclean
	rm -f config.h.in configure

dist :: $(INCMAD)
	$(MAKE) config.h.in configure
	$(MAKE) distclean

depend ::
	( sed -n -e '1,/^## DEPEND/p' Makefile.in;  \
	  echo;  \
	  $(CC) -MM $(DEFINES) *.c;  \
	) > Makefile.in.new
	mv -f Makefile.in.new Makefile.in

## AUTOCONF RULES #############################################################

Makefile: config.status
	./config.status && touch .stamp/config.h

.stamp/config.h: config.status
	./config.status && touch .stamp/config.h

config.status: .stamp/configure .stamp/config.h.in Makefile.in
	./config.status --recheck

.stamp/configure: configure.in
	autoconf && touch .stamp/configure

.stamp/config.h.in: configure.in acconfig.h
	autoheader &&  \
	sed -e '/\$$''Id: /s/\$$//g' config.h.in >config.h.in.new &&  \
	mv -f config.h.in.new config.h.in &&  \
	touch .stamp/config.h.in

## BUILD RULES ################################################################

$(LIBMAD): $(MADOBJS)
	$(AR) rc $@ $(MADOBJS)
	$(RANLIB) $@

$(INCMAD): Makefile mad.h.sed ../COPYRIGHT $(MADINCLUDES)
	(sed -e '1s|.*|/*|' -e '1b' -e '$$s|.*| */|' -e '$$b'  \
		-e 's/^.*/ *&/' ../COPYRIGHT; echo;  \
	if [ ".$(FPM)" != "." ]; then  \
		echo ".$(FPM)" | sed -e 's|^\.-D|# define |'; echo;  \
	fi;  \
	sed -ne 's/^# *define  *OPT_\(SPEED\|ACCURACY\).*/# define OPT_\1/p'  \
		config.h; echo;  \
	sed -ne 's/^# *define  *\(SIZEOF_.*\)/# define \1/p'  \
		config.h; echo;  \
	sed -n -f mad.h.sed $(MADINCLUDES)) | cat -s >$@

$(LIBMADSO): $(LIBMADSO).$(SOMAJOR)
	rm -f $(LIBMADSO)
	ln -s $(LIBMADSO).$(SOMAJOR) $(LIBMADSO)

$(LIBMADSO).$(SOMAJOR): $(LIBMADSO).$(SOMAJOR).$(SOMINOR)
	rm -f $(LIBMADSO).$(SOMAJOR)
	ln -s $(LIBMADSO).$(SOMAJOR).$(SOMINOR) $(LIBMADSO).$(SOMAJOR)

$(LIBMADSO).$(SOMAJOR).$(SOMINOR): Makefile *.c *.h
	rm -f $(MADOBJS)
	$(MAKE) $(MADOBJS) SOOPTS=-fPIC
	$(CC) -shared -Wl,-soname,$(LIBMADSO).$(SOMAJOR) $(LDFLAGS)  \
		$(MADOBJS) -o $(LIBMADSO).$(SOMAJOR).$(SOMINOR)
	rm -f $(MADOBJS)

.c.s:
	$(CC) $(ARCH) $(OPTIMIZER) $(INCLUDES) $(DEFINES) -S $<

*.o *.s: Makefile

## DEPENDENCIES ###############################################################

bit.o: bit.c config.h bit.h
decoder.o: decoder.c config.h stream.h bit.h frame.h fixed.h timer.h \
 synth.h decoder.h
fixed.o: fixed.c config.h fixed.h
frame.o: frame.c config.h bit.h stream.h frame.h fixed.h timer.h \
 layer12.h layer3.h
huffman.o: huffman.c config.h huffman.h
layer12.o: layer12.c config.h fixed.h bit.h stream.h frame.h timer.h \
 layer12.h sf_table.dat qc_table.dat
layer3.o: layer3.c config.h fixed.h bit.h stream.h frame.h timer.h \
 huffman.h layer3.h rq_table.dat imdct_s.dat
stream.o: stream.c config.h bit.h stream.h
synth.o: synth.c config.h fixed.h frame.h timer.h stream.h bit.h \
 synth.h D.dat
timer.o: timer.c config.h timer.h
version.o: version.c config.h version.h
