
GCC = /app/gcc-3.0.2/bin/gcc
# Note: gcc-3.3.2 seems to have a bug; it emits DW_AT_inline=2,
# which means `declared as inline but ignored', but the function
# `times' is inlined away!! gcc-3.0.2 works well.

test:
	$(GCC) -O -gdwarf-2 -o fact main.c fact.c
	readelf+ -X fact > fact.xml
	bscg                  fact fact.xml > fact.dot
	bscg --more           fact fact.xml > fact-more.dot
	bscg --nolocal        fact fact.xml > fact-nolocal.dot
	bscg --only main.c    fact fact.xml > fact-only.dot
	bscg --callers times  fact fact.xml > fact-callers.dot

	dot -Tgif fact.dot > fact.gif
	dot -Tgif fact-more.dot > fact-more.gif
	dot -Tgif fact-nolocal.dot > fact-nolocal.gif
	dot -Tgif fact-only.dot > fact-only.gif
	dot -Tgif fact-callers.dot > fact-callers.gif

test2:
	$(GCC) -O -gdwarf-2 -o fact main.c fact.c
	readelf+ -X fact > fact.xml
	bscg                  fact fact.xml > fact.dot
	bscg --more           fact fact.xml > fact-more.dot
	bscg --nolocal        fact fact.xml > fact-nolocal.dot
	bscg --only main.c    fact fact.xml > fact-only.dot
	bscg --callers times  fact fact.xml > fact-callers.dot

	bscg.csh fact.dot
	bscg.csh fact-more.dot
	bscg.csh fact-nolocal.dot
	bscg.csh fact-only.dot
	bscg.csh fact-callers.dot

clean:
	-rm -rf a.out fact *.gif *.dot
