
include ../config.mak

LIBNAME = libmp1e.a

SRCS = audio/fft.c audio/filter.c audio/mp2.c audio/psycho.c audio/tables.c \
    common/alloc.c common/bstream.c common/fifo.c common/mmx.c common/profile.c common/sync.c common/errstr.c \
    systems/mpeg1.c systems/mpeg2.c systems/rte_output.c systems/systems.c systems/vcd.c \
    video/dct.c video/dct_ref.c video/filter.c video/mblock.c video/motion.c video/mpeg1.c video/tables.c video/vlc.c \
    global_data.c b_mp1e.c rte.c

ASM_SRCS = 

CFLAGS= $(OPTFLAGS) $(INCLUDE) \
    -DHAVE_CONFIG_H -D_GNU_SOURCE -D_REENTRANT -DFLOAT=float -I. -I.. -fPIC

LFLAGS = 

# i386 specific stuff
ifeq ($(TARGET_MMX),yes)
ASM_SRCS += audio/filter_mmx.s \
    common/bstream_mmx.s \
    video/dct_mmx.s video/filter_mmx.s video/motion_mmx.s video/vlc_mmx.s
endif

ifeq ($(TARGET_SSE2),yes)
ASM_SRCS += video/motion_sse2.s
endif

OBJS=$(SRCS:.c=.o)
ASM_OBJS=$(ASM_SRCS:.s=.o)

.SUFFIXES: .c .s .o .lo

# .PHONY: all clean

all:	$(LIBNAME)

.c.o:
	$(CC) -c $(CFLAGS) -o $@ $<

.s.o:
	$(CC) -c $(CFLAGS) -o $@ $<

$(LIBNAME):	$(OBJS) $(ASM_OBJS)
	ar rs $(LIBNAME) $(OBJS) $(ASM_OBJS)

clean:
	rm -f $(ASM_OBJS) $(OBJS) $(LIBNAME)

distclean: clean
	rm -f .depend

dep:	depend

depend:
	$(CC) -MM $(CFLAGS) $(SRCS) $(ASM_SRCS) 1>.depend

ifneq ($(wildcard .depend),)
include .depend
endif
