#       $NetBSD$

NOMAN=                  # set
PROG=                   prop
SRCS=                   main.c

CPPFLAGS+=              -DDEBUG
CPPFLAGS+=              -I${NETBSDSRCDIR}/common/include
CPPFLAGS+=              -I${NETBSDSRCDIR}/common/lib/libprop

DPADD+=                 ${LIBPTHREAD}
LDADD+=                 -lpthread
CFLAGS+=                -g -Wall -Werror

# Pull in proplib sources, get PROPLIB_CODECS defined.
include "${NETBSDSRCDIR}/common/lib/libprop/Makefile.inc"

SAMPLEDIR=              ${.CURDIR}/../samples
SAMPLES!=               cd ${SAMPLEDIR} && ls

for file in ${SAMPLES}
for codec in ${PROPLIB_CODECS}
${file}.${codec}: ${SAMPLEDIR}/${file}
       @if PROPLIB_SCN_TRACEFILE=${.TARGET}.out \
           ./${PROG} -s -O ${codec} -o ./${.TARGET} ${.ALLSRC} ; then \
               echo PASSED convert ${.TARGET} ; \
       else \
               echo FAILED convert ${.TARGET} ; \
       fi
       @if PROPLIB_SCN_TRACEFILE=${.TARGET}.cmp \
           ./${PROG} -s -e ${.TARGET} ${.ALLSRC} ; then \
               echo PASSED compare ${.TARGET} ; \
       else \
               echo FAILED compare ${.TARGET} ; \
       fi

CLEANFILES+=    ${file}.${codec} ${file}.${codec}.out ${file}.${codec}.cmp
CONVERSIONS+=   ${file}.${codec}
endfor
endfor

# Run the full cartesian product.
regress: .PHONY ${PROG} .WAIT ${CONVERSIONS}

include <bsd.prog.mk>