CC = @CC@
CFLAGS = @CFLAGS@ @SHOBJFLAGS@
CPPFLAGS = @CPPFLAGS@ -I@srcdir@ @DEFS@
LDFLAGS = @LDFLAGS@ @SHOBJLDFLAGS@
LIBS = @LIBS@
INSTALL = @INSTALL@
PACKAGE_VERSION = @PACKAGE_VERSION@
TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
PACKAGE_INSTALL_DIR = $(TCL_PACKAGE_PATH)/tcltls$(PACKAGE_VERSION)

all: tcltls.@SHOBJEXT@

tcltls.@SHOBJEXT@: tls.o tlsBIO.o tlsIO.o tlsX509.o
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o tcltls.@SHOBJEXT@ tls.o tlsBIO.o tlsIO.o tlsX509.o $(LIBS)

install: tcltls.@SHOBJEXT@ pkgIndex.tcl

tls.o: @srcdir@/tls.c @srcdir@/tlsInt.h @srcdir@/tclOpts.h @srcdir@/tls.tcl.h
tlsBIO.o: @srcdir@/tlsBIO.c @srcdir@/tlsInt.h
tlsIO.o: @srcdir@/tlsIO.c @srcdir@/tlsInt.h
tlsX509.o: @srcdir@/tlsX509.c @srcdir@/tlsInt.h

@srcdir@/tls.tcl.h: tls.tcl
	xxd -i < tls.tcl > '@srcdir@/tls.tcl.h.new'
	mv '@srcdir@/tls.tcl.h.new' '@srcdir@/tls.tcl.h'

%.o: @srcdir@/%.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -o "$@" -c "$<"

clean:
	rm -f tls.o tlsBIO.o tlsIO.o tlsX509.o
	rm -f tcltls.@SHOBJEXT@

distclean: clean
	rm -f config.log config.status
	rm -f Makefile pkgIndex.tcl

mrproper: distclean
	rm -f @srcdir@/tls.tcl.h
	rm -f @srcdir@/configure @srcdir@/config.sub @srcdir@/config.guess @srcdir@/install-sh
	rm -f @srcdir@/aclocal.m4
	rm -rf @srcdir@/aclocal @srcdir@/autom4te.cache

.PHONY: all install clean distclean mrproper
