#!/bin/ksh

# this should be run from the main v2html directory
if [ ! -d home_page ]
then
  echo "Error couldn't find home_page directory, run from ~/v2html"
  exit
fi

if [ ! -x build/v2html ]
then
  echo "Error couldn't find build/v2html (run ~/v2html/BUILD to make it)"
  exit
fi

rm -rf home_page/examples
mkdir home_page/examples

#########################################################################################
# signals

mkdir home_page/examples/signals

./build/v2html  -nh -nindex -m v2html730@burbleland.com -nsigpopup -o home_page/examples/signals \
	testing/sig_trace/verilog/trace_example.v

./build/v2html  -nh -nindex -m v2html730@burbleland.com -nsigpopup -o home_page/examples/signals \
	testing/sig_down/verilog/down?.v

./build/v2html  -nh -nindex -m v2html730@burbleland.com -nsigpopup -o home_page/examples/signals \
	testing/sig_up_and_down/verilog/up_and_down?.v

./build/v2html  -nh -nindex -m v2html730@burbleland.com -nsigpopup -o home_page/examples/signals \
	testing/sig_logic/verilog/logic.v

#########################################################################################
# ifdef

mkdir home_page/examples/ifdef

./build/v2html  -nh +define+D99 +define+D98=XXX -m v2html730@burbleland.com \
	-o home_page/examples/ifdef \
	+incdir+testing/preproc/includes +define+FOR_WEB_PAGE \
	testing/preproc/includes/inc3.v testing/preproc/includes/inc2.v testing/preproc/verilog/*.v


#########################################################################################
# millennium_clock 

mkdir home_page/examples/millennium_clock
mkdir home_page/examples/millennium_clock/simple
mkdir home_page/examples/millennium_clock/hier
mkdir home_page/examples/millennium_clock/hier_framed
mkdir home_page/examples/millennium_clock/hier_vframed
mkdir home_page/examples/millennium_clock/hier_cgi
mkdir home_page/examples/millennium_clock/default
mkdir home_page/examples/millennium_clock/reverse_video

mkdir home_page/examples/millennium_clock/verilog
cp    testing/mill_clock/verilog/*.v home_page/examples/millennium_clock/verilog

cd home_page/examples/millennium_clock

 cd simple
 ../../../../build/v2html  -nh -nindex -ncookies -njshier -nsigpopup +define+THE_HARD_WAY \
  -y ../verilog +libext+.v +incdir+../verilog \
  -m v2html730@burbleland.com -s ../verilog/top.v
 cd ..

 cd hier
 ../../../../build/v2html  +define+THE_HARD_WAY -njshier \
  -hc "Click on module names to jump to verilog" -htf \
  -y ../verilog +libext+.v +incdir+../verilog \
  -m v2html730@burbleland.com -s ../verilog/top.v
 cd ..

 cd hier_framed
 ../../../../build/v2html  -F +define+THE_HARD_WAY \
  -hc "Click on module names to jump to verilog in middle frame" \
  -y ../verilog +libext+.v +incdir+../verilog \
  -m v2html730@burbleland.com -s ../verilog/top.v
 cd ..

 cd hier_vframed
 ../../../../build/v2html  -VF +define+THE_HARD_WAY \
  -hc "Click on module names to jump to verilog in middle frame" \
  -y ../verilog +libext+.v +incdir+../verilog \
  -m v2html730@burbleland.com -s ../verilog/top.v
 cd ..

 cd hier_cgi
 ../../../../build/v2html  +define+THE_HARD_WAY -htf \
  -css http://www.burbleland.com/v2html/examples/millennium_clock/hier_cgi/v2html.css \
  -c /cgi-burbleland/v2html-cgi /v2html/examples/millennium_clock/hier_cgi  \
  -hc "Click on [Hide All] to activate CGI script for the first time" \
  -y ../verilog +libext+.v +incdir+../verilog \
  -m v2html730@burbleland.com -s ../verilog/top.v
 cd ..

 cd default
 ../../../../build/v2html  +define+THE_HARD_WAY  -htf \
  -hc "Click on folder to see hierarchy under top" \
  -y ../verilog +libext+.v +incdir+../verilog \
  -m v2html730@burbleland.com -s ../verilog/top.v
 cd ..

 cd reverse_video
 ../../../../build/v2html -css ../../../rv.css \
   +define+THE_HARD_WAY  -htf \
  -y ../verilog +libext+.v +incdir+../verilog \
  -m v2html730@burbleland.com -s ../verilog/top.v
 cd ..

cd ../../..

#########################################################################################
# Verilog 2001

mkdir home_page/examples/verilog_2001

./build/v2html  -m v2html730@burbleland.com \
	-o home_page/examples/verilog_2001 \
        testing/verilog2001/verilog/*.v

echo "cp scripts/BUILD_WEB_EXAMPLES home_page"
cp scripts/BUILD_WEB_EXAMPLES home_page

# make the reverse video css
echo "scripts/reverse_css.pl home_page/examples/millennium_clock/default/v2html.css > home_page/rv.css"
scripts/reverse_css.pl home_page/examples/millennium_clock/default/v2html.css > home_page/rv.css
