#
#   Makefile for ctie distribution		-	21 Dec 92
#
#   This file makes CTIE and needs ctangle from cweb distribution.
#

CTANGLE=../ctangle.exe
BINDIR=.
CTIE=$(BINDIR)/ctie.exe

# directory for CWEB inputs in @i files
#CWEBINPUTS= /usr/local/lib/cweb

YDEFS = -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE \
-D_CRT_OBSOLETE_NO_DEPRECATE -D_SECURE_SCL=0

CFLAGS=-DWIN32=1 -O2 -MD $(YDEFS) -nologo -I. -I../.. -I../../kpathsea
LDFLAGS=
KPATHSEAFLAGS=../../kpathsea/kpathsealib.lib

default: ctie.exe


# CTIE

ctie.exe: ctie-k.obj $(KPATHSEAFLAGS)
	$(CC) $(LDFLAGS) $(CFLAGS) -Fe$@ ctie-k.obj $(KPATHSEAFLAGS)

#
# On windows, target is not updated by ctangle if it exists
# even if dependent files are newer. So I remove the target
# if dependent files are newer. --ak
#
ctie-k.c: ctie.w ctie-k.ch $(CTANGLE)
	rm -f $@
	$(CTANGLE) --verbose ctie.w ctie-k.ch ctie-k.c

install: ctie.exe
	cp -p ctie.exe c:/usr/local/bin/
	cp -p ctie.exe c:/usr/work/edrive/wk/dist/CWEB/bin/

clean::
	rm -f *.obj *.exe *~


ttest:  $(CTIE)
	$(CTIE) -c ctie.outc ctie.tie ctie.cf?
	diff ctie.outc ctie.chf.gen
	$(CTIE) -m ctie.outm ctie.tie ctie.cf?
	diff ctie.outm ctie.master.gen
