# ARCHIVE
#
# Description:
#   The Author's private utility. 
#   Cint source file archiver 
#
# Usage:
#   $ sh ARCHIVE
#
# Output:
#   cint.tar.gz
#

# readline
rm readline/*.o malloc/*.o glob/*.o malloc/*.o 

#include 
rm include/G__* include/\#* include/*~ include/*/*~ include/*/\#* include/mkincld
rm stl/\#* stl/*~ 

# Store STL dll
mkdir G__dll_store
cd stl
for i in *.dll
do
  echo mv $i ../G__dll_store/$i
  mv $i ../G__dll_store/$i
done
cd ..

# Store non-STL DLL
mv include/long.dll G__dll_store/long.dll
mv include/cintsock.dll G__dll_store/cintsock.dll
mv include/posix.dll G__dll_store/posix.dll
mv include/sys/ipc.dll G__dll_store/ipc.dll
mv include/pthread.dll G__dll_store/pthread.dll
mv include/stdfunc.dll G__dll_store/stdfunc.dll
mv include/stdcxxfunc.dll G__dll_store/stdcxxfunc.dll
mv include/X11/xlib.dll G__dll_store/xlib.dll
mv include/GL/gl.dll G__dll_store/gl.dll


# demo
rm demo/*/G__*
rm demo/makecint/*/G__*
rm demo/makecint/*/*.o
rm demo/makecint/*/core
rm demo/*/core
rm -r demo/makecint/*/ptrepository
rm demo/\#* demo/*/\#* demo/*/*/\#*
rm demo/*~ demo/*/*~ demo/*/*/*~
rm platform/\#* platform/*/\#* platform/*/*/\#*
rm platform/*~ platform/*/*~ platform/*/*/*~
rm platform/symantec/symantec.tar.gz
(cd lib/WildCard;make clean)
(cd lib/xlib;make clean)
rm lib/socket/*.exe
rm include/*.dl* include/*.o include/*.exe include/mkincld include/G__* include/Makeit include/makereadf include/makelongif include/iosenum.h.bk include/*.def include/*.lib
rm tool/ifdef/*.exe
rm test/error test/testdiff.txt test/a.out test/\#* test/*.o test/*.obj test/*.dll test/G__*
rm test/*.exe
rm test/*.exe.stackdump
rm /*.exe.stackdump

# lib
rm lib/*/\#* lib/*/*~ lib/*/G__* lib/*/core

# other
rm */\#* */*~ \#* *~ */core

mv include/iosenum.h include/iosenum.h.bk
echo '                    ' > include/iosenum.h

case $1 in
nt)
	tar cvf cintnt.tar CINT* include/* src/*
	compress cintnt.tar
	;;
shar|sh|arc)
	SHAR=gnushar
	#SHAR=shar
	$SHAR -Z Makefile* platform src/*.cxx src/*.cpp src/*.c src/*.h src/Make* src/HISTORY src/README.txt ARCHIVE ARCHIVEBIN INSTALLBIN G__ci.h main/*.c main/*.cxx lib README* RELNOTE.txt FAQ* setup uninstall setup.bat include stl tool doc/*.txt doc/man?/*.? readline/*.c readline/*.h readline/COPYING readline/ChangeLog readline/Makefile* readline/doc/* readline/examples/* glob/* malloc/* demo cxx2C C2cxx cxx2cpp cxx2cpp.c EXPOSE exportcint exportroot exportgcc3 > cint.arc
	;;
*) 
	tar cvf cint.tar Makefile* platform src/*.cxx src/*.cpp src/*.c src/*.h src/Make* src/HISTORY src/*.txt ARCHIVE ARCHIVEBIN INSTALLBIN main/*.c main/*.cxx G__ci.h lib README* FAQ* RELNOTE.txt setup setup.bat include stl tool doc/*.txt doc/man?/*.? readline/*.c readline/*.h readline/COPYING readline/ChangeLog readline/Makefile* readline/doc/* readline/examples/* glob/* malloc/* demo cxx2C C2cxx cxx2cpp cxx2cpp.c EXPOSE exportcint exportroot exportgcc3 removesrc.bat chmod.cxx test

   case $1 in
   compress)
	rm cint.tar.Z
	compress cint.tar 
	ls -l cint.tar.Z
	echo
	echo Now cint system is packed into a file cint.tar.Z
	echo Copy it to your system, do 
	echo '$ zcat cint.tar.Z | tar xf -'
	echo '$ sh setup' 
	echo and add the directory to the command path. Then you can utilize
	echo full functionality of the cint.
	echo 
	;;
   *)
	rm cint.tar.gz
	gzip cint.tar 
	ls -l cint.tar.gz
	echo
	echo Now cint system is packed into a file cint.tar.gz
	echo Copy it to your system, do 
	echo '$ gunzip -c cint.tar.gz | tar xvf -'
	echo '$ sh setup' 
	echo and add the directory to the command path. Then you can utilize
	echo full functionality of the cint.
	echo 
	case $1 in 
	encode) 
		uuencode cint.tar.gz cint.tar.gz > cint.tar.gz.en
		ll cint.tar.gz.en
		echo '$ uudecode cint.tar.gz.en' 
		;;
	esac
	;;
   esac
	;;
esac

mv include/iosenum.h.bk include/iosenum.h

# Restore non-STL DLL
mv G__dll_store/long.dll include/long.dll
mv G__dll_store/cintsock.dll include/cintsock.dll
mv G__dll_store/posix.dll include/posix.dll
mv G__dll_store/ipc.dll include/sys/ipc.dll
mv G__dll_store/pthread.dll include/pthread.dll
mv G__dll_store/stdfunc.dll include/stdfunc.dll
mv G__dll_store/stdcxxfunc.dll include/stdcxxfunc.dll
mv G__dll_store/xlib.dll include/X11/xlib.dll
mv G__dll_store/gl.dll include/GL/gl.dll

# restore STL DLL
cd G__dll_store
for i in *.dll
do
  mv $i ../stl/$i
done
cd ..
rmdir G__dll_store
