# Here is the original makefile for a sample program with long identifiers.
#
#snakeomatic:	main.o move.o screen.o
#		cc main.o move.o screen.o -lm
#
#main.o:	snakeomatic.h main.c
#		cc -c main.c
#
#move.o:		snakeomatic.h move.c
#		cc -c move.c
#
#screen.o:	snakeomatic.h screen.c
#		cc -c screen.c

#---------------------------------------------------------------------------
#
# Makefile modified for hash8.  Each source file xxx has been renamed L_xxx.
# The "ncc" shell script filters each L_xxx file with hash8 and puts
# the result in file xxx, which is then compiled.
#
# Also note that any .h file must also be filtered by hash8.
#
# The file TABLE is the identifier mapping table.  You should "make TABLE"
# before your first compilation to initilize the mapping table.
# After that, you should not have to remake the table, even if you
# make corrections in the code.  Hash8 will automatically update
# the table when necessary.
#
SYSTEM = /usr/include/stdio /usr/include/signal.h /usr/include/sgtty.h 

snakeomatic:	main.o move.o screen.o
		cc main.o move.o screen.o -lm 2>&1 | hash8 _decode TABLE

main.o:		snakeomatic.h L_main.c
		ncc main.c

move.o:		snakeomatic.h L_move.c
		ncc move.c

screen.o:	snakeomatic.h L_screen.c
		ncc screen.c

snakeomatic.h:  L_snakeomatic.h
		cat L_snakeomatic.h | hash8 encode TABLE >snakeomatic.h

#
# When the identifier map is first created, all the system #include files
# should be run through hash8.  This usually not necessary, but it
# is possible that your program's identifiers could have a common prefix
# with a system identifier.  By processing the system #include files first,
# we ensure that those identifiers will not be changed.
#
TABLE:		hash8 $(SYSTEM)
		rm -f TABLE
		cat $(SYSTEM) | hash8 encode TABLE >/dev/null

hash8:		hash8.c
		cc $(CFLAGS) hash8.c -o hash8
