#!/bin/sh

function nocr()
{
	if [ $1 -nt $2 -o ! -f $2 ]; then
		$mydir/util/addremcr - $1 $2
		touch -r $1 $2
		echo $1
	fi
}

mydir=.

nocr $1/docs/zdoom.txt README
nocr $1/INSTALL INSTALL
nocr $1/Makefile Makefile
nocr $1/docs/classes.txt docs/Classes
nocr $1/docs/doomlic.txt docs/DoomLicense
nocr $1/docs/colors.txt docs/colors.txt
nocr $1/docs/commands.txt docs/commands.txt
nocr $1/docs/history.txt docs/history.txt
nocr $1/docs/rh-log.txt docs/rh-log.txt
nocr $1/docs/notes.txt docs/notes.txt
nocr $1/docs/README.Carmack docs/README.Carmack
nocr $1/docs/README.asm docs/README.asm
nocr $1/docs/README.gl docs/README.gl

pushd $1
mydir=`dirs -l +1`

for i in src/*.cpp src/*.h src/*.nas src/g_doom/* src/g_heretic/* src/g_hexen/* src/g_raven/* src/g_shared/* src/fmodsound/* src/Linux/*; do
	nocr $i $mydir/$i
done

for i in src/win32/* src/*.ds?; do
	if [ $i -nt $mydir/$i -o ! -f $mydir/$i ]; then
		cp $i $mydir/$i
		chmod 644 $mydir/$i
		touch -r $i $mydir/$i
	fi
done

popd
