include ${srcdir}../Makefile.unit-settings

INCLUDES+=-I${LIBRESWANSRCDIR} -I${KLIPSINC} -I${LIBRESWANSRCDIR}/include
UCFLAGS+=${USERCOMPILE} ${PORTINCLUDE} ${INCLUDES}

all:	check

${TESTCASE}:	${TESTCASE}.o ${IPSEC_OBJS} Makefile
	${CC} -g -o ${TESTCASE} ${TESTCASE}.o ${IPSEC_OBJS} ${KUTILLIB} ${LIBRESWANLIB} ${LSWLOGLIB} ${LIBRESWANLIB} -lefence

${TESTCASE}.o: ${srcdir}${TESTCASE}.c 
	${CC} ${UCFLAGS} -c -o ${TESTCASE}.o ${srcdir}${TESTCASE}.c

# build version.c using version number from Makefile.ver
version.c:	${KLIPSSRC}/version.in.c ${LIBRESWANSRCDIR}/Makefile.ver
	sed '/"/s/@IPSECVERSION@/$(IPSECVERSION)/' ${KLIPSSRC}/version.in.c >$@

ifneq (${PACKFILE},)
${TESTCASE}.o: ${PACKFILE}.c 
endif

${PACKFILE}.c: ${INPUTS}
	${PCAP2SKB} ${INPUTS} >$*.c

clean:
	rm -rf *.o ${PACKFILE}.c ${TESTCASE}

check:	${TESTCASE}
	-rm -f pfkey.out
	./${TESTCASE}-run.sh | sed -f ${srcdir}../conup.sed | tee ${TESTCASE}.conn.new  | diff - ${srcdir}${TESTCASE}.conn
	hexdump -C pfkey.out | sed -f ${srcdir}../fixup.sed | tee ${TESTCASE}.out.new | diff - ${srcdir}${TESTCASE}.out

install:	
	@true
