PREFIX=/mingw

SOVER=0

AACdec_SOURCES=\
./libAACdec/src/aacdecoder.cpp \
./libAACdec/src/aacdecoder_lib.cpp \
./libAACdec/src/aacdec_drc.cpp \
./libAACdec/src/aacdec_hcr.cpp \
./libAACdec/src/aacdec_hcrs.cpp \
./libAACdec/src/aacdec_hcr_bit.cpp \
./libAACdec/src/aacdec_pns.cpp \
./libAACdec/src/aacdec_tns.cpp \
./libAACdec/src/aac_ram.cpp \
./libAACdec/src/aac_rom.cpp \
./libAACdec/src/block.cpp \
./libAACdec/src/channel.cpp \
./libAACdec/src/channelinfo.cpp \
./libAACdec/src/conceal.cpp \
./libAACdec/src/ldfiltbank.cpp \
./libAACdec/src/pulsedata.cpp \
./libAACdec/src/rvlc.cpp \
./libAACdec/src/rvlcbit.cpp \
./libAACdec/src/rvlcconceal.cpp \
./libAACdec/src/stereo.cpp

AACenc_SOURCES=\
./libAACenc/src/aacenc.cpp \
./libAACenc/src/aacenc_hcr.cpp \
./libAACenc/src/aacenc_lib.cpp \
./libAACenc/src/aacenc_pns.cpp \
./libAACenc/src/aacEnc_ram.cpp \
./libAACenc/src/aacEnc_rom.cpp \
./libAACenc/src/aacenc_tns.cpp \
./libAACenc/src/adj_thr.cpp \
./libAACenc/src/bandwidth.cpp \
./libAACenc/src/band_nrg.cpp \
./libAACenc/src/bitenc.cpp \
./libAACenc/src/bit_cnt.cpp \
./libAACenc/src/block_switch.cpp \
./libAACenc/src/channel_map.cpp \
./libAACenc/src/chaosmeasure.cpp \
./libAACenc/src/dyn_bits.cpp \
./libAACenc/src/grp_data.cpp \
./libAACenc/src/intensity.cpp \
./libAACenc/src/line_pe.cpp \
./libAACenc/src/metadata_compressor.cpp \
./libAACenc/src/metadata_main.cpp \
./libAACenc/src/ms_stereo.cpp \
./libAACenc/src/noisedet.cpp \
./libAACenc/src/pnsparam.cpp \
./libAACenc/src/pre_echo_control.cpp \
./libAACenc/src/psy_configuration.cpp \
./libAACenc/src/psy_main.cpp \
./libAACenc/src/qc_main.cpp \
./libAACenc/src/quantize.cpp \
./libAACenc/src/sf_estim.cpp \
./libAACenc/src/spreading.cpp \
./libAACenc/src/tonality.cpp \
./libAACenc/src/transform.cpp

FDK_SOURCES=\
./libFDK/src/autocorr2nd.cpp \
./libFDK/src/dct.cpp \
./libFDK/src/FDK_bitbuffer.cpp \
./libFDK/src/FDK_core.cpp \
./libFDK/src/FDK_crc.cpp \
./libFDK/src/FDK_hybrid.cpp \
./libFDK/src/FDK_tools_rom.cpp \
./libFDK/src/FDK_trigFcts.cpp \
./libFDK/src/fft.cpp \
./libFDK/src/fft_rad2.cpp \
./libFDK/src/fixpoint_math.cpp \
./libFDK/src/mdct.cpp \
./libFDK/src/qmf.cpp \
./libFDK/src/scale.cpp

MpegTPDec_SOURCES=\
./libMpegTPDec/src/tpdec_adif.cpp \
./libMpegTPDec/src/tpdec_adts.cpp \
./libMpegTPDec/src/tpdec_asc.cpp \
./libMpegTPDec/src/tpdec_latm.cpp \
./libMpegTPDec/src/tpdec_lib.cpp

MpegTPEnc_SOURCES=\
./libMpegTPEnc/src/tpenc_adif.cpp \
./libMpegTPEnc/src/tpenc_adts.cpp \
./libMpegTPEnc/src/tpenc_asc.cpp \
./libMpegTPEnc/src/tpenc_latm.cpp \
./libMpegTPEnc/src/tpenc_lib.cpp

PCMutils_SOURCES=\
./libPCMutils/src/limiter.cpp \
./libPCMutils/src/pcmutils_lib.cpp

SBRdec_SOURCES=\
./libSBRdec/src/env_calc.cpp \
./libSBRdec/src/env_dec.cpp \
./libSBRdec/src/env_extr.cpp \
./libSBRdec/src/huff_dec.cpp \
./libSBRdec/src/lpp_tran.cpp \
./libSBRdec/src/psbitdec.cpp \
./libSBRdec/src/psdec.cpp \
./libSBRdec/src/psdec_hybrid.cpp \
./libSBRdec/src/sbrdecoder.cpp \
./libSBRdec/src/sbrdec_drc.cpp \
./libSBRdec/src/sbrdec_freq_sca.cpp \
./libSBRdec/src/sbr_crc.cpp \
./libSBRdec/src/sbr_deb.cpp \
./libSBRdec/src/sbr_dec.cpp \
./libSBRdec/src/sbr_ram.cpp \
./libSBRdec/src/sbr_rom.cpp

SBRenc_SOURCES=\
./libSBRenc/src/bit_sbr.cpp \
./libSBRenc/src/code_env.cpp \
./libSBRenc/src/env_bit.cpp \
./libSBRenc/src/env_est.cpp \
./libSBRenc/src/fram_gen.cpp \
./libSBRenc/src/invf_est.cpp \
./libSBRenc/src/mh_det.cpp \
./libSBRenc/src/nf_est.cpp \
./libSBRenc/src/ps_bitenc.cpp \
./libSBRenc/src/ps_encode.cpp \
./libSBRenc/src/ps_main.cpp \
./libSBRenc/src/resampler.cpp \
./libSBRenc/src/sbrenc_freq_sca.cpp \
./libSBRenc/src/sbr_encoder.cpp \
./libSBRenc/src/sbr_misc.cpp \
./libSBRenc/src/sbr_ram.cpp \
./libSBRenc/src/sbr_rom.cpp \
./libSBRenc/src/ton_corr.cpp \
./libSBRenc/src/tran_det.cpp

SYS_SOURCES=\
./libSYS/src/conv_string.cpp \
./libSYS/src/genericStds.cpp

SOURCES=$(AACdec_SOURCES) $(AACenc_SOURCES) $(FDK_SOURCES) \
        $(MpegTPDec_SOURCES) $(MpegTPEnc_SOURCES) $(PCMutils_SOURCES) \
        $(SBRdec_SOURCES) $(SBRenc_SOURCES) $(SYS_SOURCES)

OBJS=$(SOURCES:.cpp=.o)

INCLUDE=-I libAACdec/include -I libAACenc/include -I libFDK/include \
	-I libMpegTPDec/include -I libMpegTPEnc/include \
	-I libPCMutils/include -I libSBRdec/include -I libSBRenc/include \
	-I libSYS/include

CPPFLAGS=$(INCLUDE)
CXXFLAGS=-O2 -Wall -fno-exceptions -fno-rtti

all: libfdk-aac.a libfdk-aac-$(SOVER).dll

install: libfdk-aac.a libfdk-aac-$(SOVER).dll
	if test -d stage; then rm -fr stage; fi
	mkdir -p stage/bin
	mkdir -p stage/lib
	mkdir -p stage/include/fdk-aac
	cp -p libfdk-aac-$(SOVER).dll stage/bin
	cp -p libfdk-aac.a $(PREFIX)/lib
	cp -p libfdk-aac.dll.a stage/lib
	cp -p libAACdec/include/aacdecoder_lib.h stage/include/fdk-aac
	cp -p libAACenc/include/aacenc_lib.h stage/include/fdk-aac
	cp -p libSYS/include/FDK_Audio.h stage/include/fdk-aac
	cp -p libSYS/include/genericStds.h stage/include/fdk-aac
	cp -p libSYS/include/machine_type.h stage/include/fdk-aac
	cp -pr stage/* $(PREFIX)/
	cd stage
	zip -r $(PREFIX)/libfdk-aac-win32-bin.zip *
	cd ..

libfdk-aac.a: $(OBJS)
	$(AR) cru $@ $(OBJS)

libfdk-aac-$(SOVER).dll: $(OBJS)
	$(CC) -shared -o $@ \
	    -Wl,--out-implib=libfdk-aac.dll.a \
	    -Wl,--version-script=libfdk-aac.version \
	    -Wl,--enable-auto-import \
	    -Wl,--whole-archive $(OBJS) \
	    -Wl,--no-whole-archive

clean:
	rm $(OBJS)
