# Module for non-recursive mpg123 build system.

EXTRA_DIST += src/libmpg123/mpg123.h.in

EXTRA_PROGRAMS += src/libmpg123/testcpu
src_libmpg123_testcpu_DEPENDENCIES = src/libmpg123/getcpuflags.$(OBJEXT)
src_libmpg123_testcpu_SOURCES = src/libmpg123/testcpu.c
src_libmpg123_testcpu_LDADD = \
  src/compat/libcompat.la \
  src/libmpg123/getcpuflags.$(OBJEXT)

# Necessary?
CLEANFILES += src/libmpg123/*.a

lib_LTLIBRARIES += src/libmpg123/libmpg123.la
nodist_include_HEADERS += src/libmpg123/mpg123.h
include_HEADERS += src/libmpg123/fmt123.h

src_libmpg123_libmpg123_la_LDFLAGS = \
  -no-undefined \
  -version-info @LIBMPG123_VERSION@ \
  -export-symbols-regex '^mpg123_'
src_libmpg123_libmpg123_la_LIBADD = \
  src/compat/libcompat.la \
  @DECODER_LOBJ@ @LFS_LOBJ@ @LIBS@
src_libmpg123_libmpg123_la_DEPENDENCIES = \
  src/compat/libcompat.la \
  @DECODER_LOBJ@ @LFS_LOBJ@

src_libmpg123_libmpg123_la_SOURCES = \
  src/libmpg123/fmt123.h \
  src/libmpg123/mpeghead.h \
  src/libmpg123/parse.c \
  src/libmpg123/parse.h \
  src/libmpg123/frame.c \
  src/libmpg123/format.c \
  src/libmpg123/frame.h \
  src/libmpg123/reader.h \
  src/libmpg123/debug.h \
  src/libmpg123/decode.h \
  src/libmpg123/sample.h \
  src/libmpg123/dct64.c \
  src/libmpg123/synth.h \
  src/libmpg123/synth_mono.h \
  src/libmpg123/synth_ntom.h \
  src/libmpg123/synth_8bit.h \
  src/libmpg123/synths.h \
  src/libmpg123/equalizer.c \
  src/libmpg123/huffman.h \
  src/libmpg123/newhuffman.h \
  src/libmpg123/icy.h \
  src/libmpg123/icy2utf8.h \
  src/libmpg123/id3.h \
  src/libmpg123/id3.c \
  src/libmpg123/true.h \
  src/libmpg123/getbits.h \
  src/libmpg123/optimize.h \
  src/libmpg123/optimize.c \
  src/libmpg123/readers.c \
  src/libmpg123/tabinit.c \
  src/libmpg123/libmpg123.c \
  src/libmpg123/gapless.h \
  src/libmpg123/mpg123lib_intern.h \
  src/libmpg123/abi_align.h \
  src/libmpg123/mangle.h \
  src/libmpg123/getcpuflags.h \
  src/libmpg123/index.h \
  src/libmpg123/index.c

EXTRA_src_libmpg123_libmpg123_la_SOURCES = \
  src/libmpg123/lfs_alias.c \
  src/libmpg123/lfs_wrap.c \
  src/libmpg123/icy.c \
  src/libmpg123/icy2utf8.c \
  src/libmpg123/l2tables.h \
  src/libmpg123/layer1.c \
  src/libmpg123/layer2.c \
  src/libmpg123/layer3.c \
  src/libmpg123/dither.h \
  src/libmpg123/dither_impl.h \
  src/libmpg123/dither.c \
  src/libmpg123/feature.c \
  src/libmpg123/dct36_3dnowext.S \
  src/libmpg123/dct36_3dnow.S \
  src/libmpg123/dct36_sse.S \
  src/libmpg123/dct36_x86_64.S \
  src/libmpg123/dct36_avx.S \
  src/libmpg123/dct36_neon.S \
  src/libmpg123/dct36_neon64.S \
  src/libmpg123/dct64_3dnowext.S \
  src/libmpg123/dct64_3dnow.S \
  src/libmpg123/dct64_altivec.c \
  src/libmpg123/dct64_i386.c \
  src/libmpg123/dct64_i486.c \
  src/libmpg123/dct64_mmx.S \
  src/libmpg123/dct64_sse.S \
  src/libmpg123/dct64_sse_float.S \
  src/libmpg123/dct64_x86_64.S \
  src/libmpg123/dct64_x86_64_float.S \
  src/libmpg123/dct64_neon.S \
  src/libmpg123/dct64_neon_float.S \
  src/libmpg123/dct64_neon64.S \
  src/libmpg123/dct64_neon64_float.S \
  src/libmpg123/dct64_avx.S \
  src/libmpg123/dct64_avx_float.S \
  src/libmpg123/synth_3dnowext.S \
  src/libmpg123/synth_3dnow.S \
  src/libmpg123/synth_altivec.c \
  src/libmpg123/synth_i486.c \
  src/libmpg123/synth_i586_dither.S \
  src/libmpg123/synth_i586.S \
  src/libmpg123/synth_mmx.S \
  src/libmpg123/synth_sse3d.h \
  src/libmpg123/synth_sse.S \
  src/libmpg123/synth_sse_float.S \
  src/libmpg123/synth_sse_s32.S \
  src/libmpg123/synth_sse_accurate.S \
  src/libmpg123/synth_stereo_sse_float.S \
  src/libmpg123/synth_stereo_sse_s32.S \
  src/libmpg123/synth_stereo_sse_accurate.S \
  src/libmpg123/synth_x86_64.S \
  src/libmpg123/synth_x86_64_float.S \
  src/libmpg123/synth_x86_64_s32.S \
  src/libmpg123/synth_x86_64_accurate.S \
  src/libmpg123/synth_stereo_x86_64.S \
  src/libmpg123/synth_stereo_x86_64_float.S \
  src/libmpg123/synth_stereo_x86_64_s32.S \
  src/libmpg123/synth_stereo_x86_64_accurate.S \
  src/libmpg123/synth_arm.S \
  src/libmpg123/synth_arm_accurate.S \
  src/libmpg123/synth_neon.S \
  src/libmpg123/synth_neon_float.S \
  src/libmpg123/synth_neon_s32.S \
  src/libmpg123/synth_neon_accurate.S \
  src/libmpg123/synth_stereo_neon.S \
  src/libmpg123/synth_stereo_neon_float.S \
  src/libmpg123/synth_stereo_neon_s32.S \
  src/libmpg123/synth_stereo_neon_accurate.S \
  src/libmpg123/synth_neon64.S \
  src/libmpg123/synth_neon64_float.S \
  src/libmpg123/synth_neon64_s32.S \
  src/libmpg123/synth_neon64_accurate.S \
  src/libmpg123/synth_stereo_neon64.S \
  src/libmpg123/synth_stereo_neon64_float.S \
  src/libmpg123/synth_stereo_neon64_s32.S \
  src/libmpg123/synth_stereo_neon64_accurate.S \
  src/libmpg123/synth_stereo_avx.S \
  src/libmpg123/synth_stereo_avx_float.S \
  src/libmpg123/synth_stereo_avx_s32.S \
  src/libmpg123/synth_stereo_avx_accurate.S \
  src/libmpg123/ntom.c \
  src/libmpg123/synth.c \
  src/libmpg123/synth_8bit.c \
  src/libmpg123/synth_real.c \
  src/libmpg123/synth_s32.c \
  src/libmpg123/equalizer_3dnow.S \
  src/libmpg123/tabinit_mmx.S \
  src/libmpg123/stringbuf.c \
  src/libmpg123/getcpuflags.S \
  src/libmpg123/getcpuflags_x86_64.S \
  src/libmpg123/getcpuflags_arm.c \
  src/libmpg123/check_neon.S \
  src/libmpg123/l12_integer_tables.h \
  src/libmpg123/l3_integer_tables.h

if USE_YASM_FOR_AVX
## Override rules for the sources that should be assembled with yasm

AVX_SRCS = \
  src/libmpg123/dct36_avx.S \
  src/libmpg123/dct64_avx.S \
  src/libmpg123/dct64_avx_float.S \
  src/libmpg123/synth_stereo_avx.S \
  src/libmpg123/synth_stereo_avx_float.S \
  src/libmpg123/synth_stereo_avx_s32.S \
  src/libmpg123/synth_stereo_avx_accurate.S

AVX_OBJS = $(AVX_SRCS:.S=.@OBJEXT@)

ASM_DEPS = \
  src/libmpg123/mangle.h \
  $(top_builddir)/src/config.h \
  src/intsym.h

$(AVX_OBJS): %.@OBJEXT@: %.S $(ASM_DEPS)
	$(CPP) $(DEFAULT_INCLUDES) $(INCLUDES) -DASMALIGN_BALIGN $< | @YASM@ - @YASMFLAGS@ @YASM_FORMAT@ -o $@

$(AVX_OBJS:.@OBJEXT@=.lo): %.lo: %.@OBJEXT@
	@echo "# Generated by ltmain.sh (GNU libtool)" >$@
	@echo "pic_object='`basename $<`'" >>$@
	@echo "non_pic_object='`basename $<`'" >>$@

endif
