
PGM	= yank

# Available CFLAG options:
#
#	EBUG      - To allow debugging output via the -x<int> option.
#	EGO       - The name of the executable (on MSDOS look in util.h).
#	HARD_EDGE - To disable the automatic creation of edges.
#	SUN       - To compensate for SUN's sprintf implementation.
#	NOENUM    - Define if your C compiler lacks enumerations.
#	C_ONLY    - Only output for the C configurer (ie. -C implied).
#	O_ONLY    - Only output for the Occam configurer (ie. -O implied).
#

## To compile on the SUN use:
CC	= cc -O
O	= o
ICCFIX	= -c
DATE	= `date '+%D'`
TIME	= `date '+%T'`
DATETIME= -D__TIME__=\"$(TIME)\" -D__DATE__=\"$(DATE)\"
CFLAGS	= -DEBUG -DSUN -DEGO=\"$(PGM)\" $(DATETIME)
LDLINE	= $(CC) $(LDFLAGS) -o $(PGM) $(OBJS)

## To compile on the SUN with gcc use:
#CC	= gcc -g
#O	= o
#ICCFIX	= -c
#CFLAGS	= -DEBUG -DSUN -DEGO=\"$(PGM)\"
#LDLINE	= $(CC) $(LDFLAGS) -o $(PGM) $(OBJS)

## To compile with icc on the SUN use:
#CC	= icc -TA -WD -WN -WT
#O	= tco
#TESTOP	= -i
#CFLAGS	= -DEBUG -DEGO=\"$(PGM)\"
#LDLINE	= ilink -TA -O $(PGM).lku -ME C.ENTRY $(OBJS) centry.lib libc.lib
#COLINE	= icollect $(PGM).lku -t -o $(PGM).btl

## To compile on the PC use:
## Be sure to check EGO in util.h!
#CC	= cl
#O	= obj
#ICCFIX	= -c
#CFLAGS	= -DEBUG -DC_ONLY
#LDLINE	= $(CC) /AC /F F00 -o $(PGM) $(OBJS)
#COLINE	= echo Done.

## To compile with icc on the PC use:
#CC	= icc /TA /WD /WN /WT
#O	= tco
#CFLAGS	= /DEBUG /DMSDOS
#LDLINE	= ilink /TA /O $(PGM).lku /ME C.ENTRY $(OBJS) centry.lib libc.lib
#COLINE	= icollect $(PGM).lku /T /O $(PGM).btl

SRCS	= channel.c cmdline.c cnstrct.c \
	  fudge.c main.c reader.c util.c

OBJS	= channel.$(O) cmdline.$(O) cnstrct.$(O) \
	  fudge.$(O) main.$(O) reader.$(O) util.$(O)

DOLLAR	= $

$(PGM) all: $(OBJS)
	$(LDLINE)
	$(COLINE)

channel.$(O): util.h channel.c
	$(CC) $(CFLAGS) $(ICCFIX) channel.c

cmdline.$(O): util.h cmdline.c
	$(CC) $(CFLAGS) $(ICCFIX) cmdline.c

cnstrct.$(O): util.h cnstrct.c
	$(CC) $(CFLAGS) $(ICCFIX) cnstrct.c

fudge.$(O): util.h fudge.c
	$(CC) $(CFLAGS) $(ICCFIX) fudge.c

main.$(O): util.h main.c
	$(CC) $(CFLAGS) $(ICCFIX) main.c

reader.$(O): util.h reader.c
	$(CC) $(CFLAGS) $(ICCFIX) reader.c

util.$(O): util.h util.c
	$(CC) $(CFLAGS) $(ICCFIX) util.c

util.h: makefile

lint:
	lint $(CFLAGS) $(SRCS)


## The following targets are for UNIX systems.

man: yank.1 makefile
	/lib/cpp -P $(CFLAGS) -DPROGRAM=$(PGM) yank.1 | \
	sed -e '1,/^__BEGIN__/d' -e '/^$(DOLLAR)/d' | \
	nroff -man > 1.$(PGM)
	col < 1.yank > yank.man

run: $(PGM) tests/testit
#	( $(PGM) input -o $(PGM).out ; diff output $(PGM).out ) 2>&1 | less
	tests/testit $(TESTOP) 2>&1 | less

spell:
	spell +tests/spell.lib yank.1

clean:
	rm -f *.o *.out *.obj *.tco *~ core $(PGM).cfb $(PGM).lku
	rm -f tests/*~ tests/core tests/out[0-9].[CO]

clobber: clean
	rm -f $(PGM) 1.$(PGM) $(PGM).btl
