prefix=/usr/local
#CXX = g++ -g -ggdb -funroll-loops `avifile-config --cflags` 
CXX = g++ -O6 `avifile-config --cflags` -funroll-loops -fomit-frame-pointer
LIBMPEG3=libmpeg3-1.5
LIBMPEG3-OPTIONS=		#-no-css #-no-mmx
all: libmpeg3_t avi2divx mpeg2divx

avi2divx: Makefile avi2divx.cpp
	$(CXX) -o avi2divx avi2divx.cpp `avifile-config --libs` -lpthread

mpeg2divx: Makefile mpeg2divx.cpp
	$(CXX) -I./$(LIBMPEG3) -o mpeg2divx mpeg2divx.cpp `avifile-config --libs` -lpthread $(LIBMPEG3)/*/libmpeg3.a

libmpeg3_t: 
	make -C $(LIBMPEG3)

install: all	
	install -m 755 avi2divx mpeg2divx $(prefix)/bin

strip: all
	strip avi2divx mpeg2divx
	
clean:
	rm -f avi2divx mpeg2divx core* *.o

distclean: clean
	cd $(LIBMPEG3) ; make clean ; cd ..
	rm -f *.avi
