CC = gcc
#
#  Don't give -DDEBUG unless you want all the interaction between
#  MUA and sendmail logged into a file.
#
CFLAGS = -Wall -g -O # -DDEBUG
TARGET = sendmail

################ You don't need to touch below. ################

DISTNAME = kesmpre-0.2

SRCS = main.c invoke.c convert.c misc.c hmconv1.0pl3.c mail_hcode2.1mp2.c \
       writen.c
OBJS = main.o invoke.o convert.o misc.o hmconv1.0pl3.o mail_hcode2.1mp2.o \
       writen.o
DOCSRCS = INSTALL.sgml README.sgml
DOCS = INSTALL README

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) -o $(TARGET) $(OBJS)

docs: $(DOCS)

% : %.txt
	mv $< $@
%.txt : %.sgml
	sgml2txt -k -f $<

dist:
	rm -rf ../$(DISTNAME)
	mkdir ../$(DISTNAME)
	cp *.[ch] $(DOCS) ChangeLog Makefile .depend ../$(DISTNAME)
	(cd ..; tar zcvf ~/html/kesmpre/$(DISTNAME).tar.gz $(DISTNAME))

depend .depend:
	$(CC) -MM $(SRCS) > .depend
	for i in $(DOCSRCS); do \
		echo `basename $$i .sgml` : $$i >> .depend ; \
	done

clean:
	rm -f *.o $(TARGET) core

include .depend
