--- /dev/null
+SUBDIRS_LIB="libavcodec libavdevice libavfilter libavformat libavutil libpostproc"
+SUBDIRS_MORE="libswscale"
+
+function create_omk () {
+ f=$1
+ fomk=$2
+
+ rm -f $fomk
+ cat >$fomk <<"EOF"
+include $(srcdir)/../config.mak-omk
+
+EOF
+ cat $f/Makefile | \
+ grep -v '^include' | \
+ sed -e 's/\.o\>/.c/g' \
+ -e 's/\(YASM.*\)\.c/\1.asm/g' \
+ -e 's/x86\/h264_idct_sse2.c/x86\/h264_idct_sse2.asm/g' \
+ >>$fomk
+
+ if [ "$f" == "libavcodec" ] ; then
+ cat >>$fomk <<"EOF"
+
+OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes) $(MMX-OBJS-y)
+
+SUBDIRS=x86
+
+EOF
+ touch $f/x86/Makefile.omk
+ git add $f/x86/Makefile.omk
+ fi
+ cat >>$fomk <<"EOF"
+lib_LIBRARIES:=$(NAME)
+$(NAME)_SOURCES:=$(OBJS) $(OBJS-y) $(OBJS-yes)
+renamed_include_HEADERS:=$(foreach h,$(HEADERS),$(h)->lib$(NAME)/$(h) )
+INCLUDES += -I $(srcdir)/..
+EOF
+ git add $fomk
+
+ return
+}
+
+if [ ! -e Makefile.omk ] ; then
+
+ echo "SUBDIRS=$SUBDIRS_LIB $SUBDIRS_MORE" >Makefile.omk
+
+ git add Makefile.omk
+
+ for f in $SUBDIRS_LIB ; do
+ rm -f $f/Makefile.omk
+ cp $f/Makefile $f/Makefile.omk
+ git add $f/Makefile.omk
+ done
+
+ git commit -m "Added copies of makefiles for OMK build."
+
+fi
+
+if [ ! -e libswscale/Makefile.omk ] ; then
+
+ for f in $SUBDIRS_MORE ; do
+ mkdir -p $f-omk
+ rm -f $f-omk/Makefile.omk
+ cp $f/Makefile $f-omk/Makefile.omk
+ ( cd $f ; ln -sf ../$f-omk/Makefile.omk Makefile.omk )
+ git add $f-omk/Makefile.omk
+ done
+
+ git commit -m "Added copy of libswscale/Makefile for omkization."
+
+fi
+
+for f in $SUBDIRS_LIB ; do
+ create_omk $f $f/Makefile.omk
+done
+
+for f in $SUBDIRS_MORE ; do
+ create_omk $f $f-omk/Makefile.omk
+done