#    $Id: Makefile.in,v 1.2 2002/10/24 19:26:49 jjminer Exp $

#You may wish to add -DNO_UNISTD and -DNO_SYSTEM to CFLAGS if
#your system lacks the /usr/include/unistd.h header file
#or the system() function, respectively. Non-unix systems
#will also definitely have different linker syntax.

srcdir=@srcdir@
builddir=@builddir@

# potential flags CGICDEBUG
CFLAGS=@CFLAGS@
CC=@CC@
AR=@AR@
LIBS=-L./ -lcgic
FORCE_RM=@RM@ -f

all: libcgic.a cgictest capture

libcgic.a: cgic.o $(srcdir)/cgic.h
	rm -f libcgic.a
	$(AR) rc libcgic.a cgic.o

cgictest: cgictest.o libcgic.a 
	$(CC) $(CFLAGS) cgictest.o -o cgictest ${LIBS}

tmp: $(srcdir)/tmp.c
	cc -o tmp -I. $(srcdir)/tmp.c $(LIBS)

capture: capture.o libcgic.a
	$(CC) $(CFLAGS) capture.o -o capture ${LIBS}

clean:
	$(FORCE_RM) *.o *.a cgictest capture

distclean:
	$(FORCE_RM) Makefile

%.o: $(srcdir)/%.c $(builddir)/Makefile
	$(CC) $(CFLAGS) -c $<

DISTDIR=cgic1.07-pubcookie1.01
TARFILE=cgic1.07-pubcookie1.01.tar

tar:
	rm -f ${DISTDIR} ${TARFILE}.gz
	ln -s . ${DISTDIR}
	tar -cf ${TARFILE} \
		${DISTDIR}/CHANGES \
		${DISTDIR}/Makefile \
		${DISTDIR}/capture.c \
		${DISTDIR}/cgic.c \
		${DISTDIR}/cgic.c.orig \
		${DISTDIR}/cgic.h \
		${DISTDIR}/cgic.h.orig \
		${DISTDIR}/cgic.html \
		${DISTDIR}/cgic.txt \
		${DISTDIR}/cgictest.c \
		${DISTDIR}/license.txt \
		${DISTDIR}/readme.txt \
		${DISTDIR}/support.txt \
		${DISTDIR}/testform.html 
	gzip ${TARFILE}
	rm -f ${DISTDIR}
