## H3m sh build script,
##	USAGE        ./build VER#     where VER#.m4 exists 


echo "			cleaning..."
./clean	$1


echo "			making glossary..."

./Glossary $1

echo
echo "	 		m4 $1.m4 > $1.c...	"

m4 $1.m4 > $1.c

echo
echo " 			compiling..."

## no effect 		-fpeephole -fthread-jumps -fdefer-pop 
## 			-funroll-loops -frerun-cse-after-loop -fcaller-saves
##			-fstrength-reduce -fexpensive-optimizations
##			-fcse-follow-jumps -fcse-skip-blocks
##			-fschedule-insns -fschedule-insns2  not on 486
##			-fno-function-cse -funroll-all-loops

## some effect 		-fforce-mem, bench got slower.
## 			putting ip in %esp was worth about 10% speed win 

CFLAGS="-fomit-frame-pointer"

gcc -c  -nostdlib $1.c -o $1.o 

echo
echo " 			linking..."

ld -N  -nostdlib -o H3m  $1.o arg_env.o


echo "			strip... "

strip -R .note -R .comment  H3m 


./H3m  cr cr 200 words q. | fmt
./H3m  cr cr 200 words q. | fmt > words
./H3m  : bla 3 3 3 ";" bla . . . q.

echo "

	Look OK?

"

echo "			...file H3m...	"
file H3m
echo "			...ls -l H3m..."
ls -l --color H3m

echo 
echo 

echo "ctrl&c me now if you don't want to do a detailed C-source/assembly listing," 
echo "\"aslist\" ."
echo
sleep 2
gcc -c -g -Wa,-anhl -pipe  $CFLAGS -save-temps  -nostdlib \
	  -o db.$1.o  $1.c > aslist
rm db.$1.o 

