#! /bin/csh
# $Header: RCS/MakeLinks,v 1.11 89/11/16 12:42:03 mao Exp $

# set OD = /a/postgres/goh/postgres/obj.dec
# set SD = /a/postgres/goh/postgres/src

set OD = $argv[1]
set SD = $argv[2]

foreach i (`cat dirs.mk`) 
	if  (($i !~ lib/H* ) && ($i !~ lib/Gen*)) then 
		echo "***" $i
		pushd $SD/$i >& /dev/null
		set x = ( `echo *.{c,h,y,lex,sed}` ) >& /dev/null
		if (  "$x" != "" ) then
			popd  >& /dev/null
			pushd $OD/$i >& /dev/null
			foreach j ( $x )
				if ( -f $j ) then
				else
					echo linking $j
					ln -s $SD/$i/$j $j
				endif
			end
		endif
		popd >& /dev/null
	endif
end

