#
# generic Makefile to use when you've got CWEB
# (add it to, or add to it, whatever you like)
#
#======================================================================
CC = cl
CFLAGS = -nologo -QI0f -QIfdiv- -MD -O2
MLIB =
RM = rm -f
WFILES = extex.w treeprint.w wc.w wmerge.w wordtest.w oemacs.w

#======================================================================

.SUFFIXES: .tex .dvi .w

.w.tex:
	cweave $*

.tex.dvi:	
	tex $<

.w.dvi:
	make $*.tex
	make $*.dvi

.w.c:
	ctangle $*

.w.obj:
	make $*.c
	make $*.obj

.c.obj:
	$(CC) $(CFLAGS) -c $*.c

.w.exe:
	make $*.c
	$(CC) $(CFLAGS) $*.c -Fe$*.exe

#======================================================================

all: $(WFILES: .w=) excweb.exe

excweb.exe: extex.exe
	ln extex.exe excweb.exe

#oemacs: oemacs.c
#	cc $(CFLAGS) -I/usr/openwin/include oemacs.c \
#             -o oemacs -lxview -lolgx -lX11

doc: $(WFILES:.w=.dvi)

clean:
	$(RM) *~ \#~ .\#* *.o *.log *.dvi *.toc core a.out

clobber: clean
	$(RM) $(WFILES:.w=) $(WFILES:.w=.c) $(WFILES:.w=.tex)
