#!/bin/sh

# Building Tremor on MinGW/MSYS is not too easy -- none of the
# configure stuff seems to work, so I just wrote a quick script to do
# the build instead.  *Much* simpler than trying to make sense of
# 100Ks of indecipherable scripts and Makefiles.  You need to run this
# on MinGW/MSYS, and then use the resulting libvorbisidec.a when
# building sbagen.exe (see mk-xmingw).

DEFS="-DBYTE_ORDER=4321 -DBIG_ENDIAN=1234 -DLITTLE_ENDIAN=4321 -D_REENTRANT -DUSE_MEMORY_H"

for xx in mdct.c block.c window.c \
	  synthesis.c info.c \
	  floor1.c floor0.c vorbisfile.c \
	  res012.c mapping0.c registry.c codebook.c \
	  sharedbook.c framing.c bitwise.c
do
    echo == $xx
    gcc -c -O2 -fsigned-char $DEFS $xx || exit 1
done

ar rv libvorbisidec.a *.o || exit 1

