1*ebfedea0SLionel Sambuc# $NetBSD: Makefile,v 1.4 2011/02/12 23:21:33 christos Exp $ 2*ebfedea0SLionel Sambuc 3*ebfedea0SLionel SambucCC=gcc 4*ebfedea0SLionel SambucSRC_PREFIX=../src 5*ebfedea0SLionel SambucCFLAGS=-I../include -I$(SRC_PREFIX) -D SASLC_TEST_DIR=\"`pwd`/\" 6*ebfedea0SLionel SambucATFLIBS=-latf-c -lssl 7*ebfedea0SLionel SambucLDFLAGS=`pwd`/$(SRC_PREFIX)/libsaslc.so -ggdb 8*ebfedea0SLionel SambucTEST_CASES_C=t_dict t_session t_crypto t_error t_saslc t_parser 9*ebfedea0SLionel SambucTEST_CASES=$(TEST_CASES_C) 10*ebfedea0SLionel SambucVALGRIND=valgrind 11*ebfedea0SLionel SambucVALGRIND_OPTS=--leak-check=full -q 12*ebfedea0SLionel Sambuc 13*ebfedea0SLionel Sambucall: build 14*ebfedea0SLionel Sambuc 15*ebfedea0SLionel Sambucbuild: $(TEST_CASES_SH) $(TEST_CASES_C) example_client 16*ebfedea0SLionel Sambuc 17*ebfedea0SLionel Sambuc$(TEST_CASES_SH): 18*ebfedea0SLionel Sambuc @echo "building $@" 19*ebfedea0SLionel Sambuc @$(ENV) atf-compile -o $@ $@.sh 20*ebfedea0SLionel Sambuc 21*ebfedea0SLionel Sambuc$(TEST_CASES_C): 22*ebfedea0SLionel Sambuc @echo "building $@" 23*ebfedea0SLionel Sambuc @$(CC) -o $@.o -c $@.c $(CFLAGS) -I/usr/include/local 24*ebfedea0SLionel Sambuc @$(CC) -o $@ $@.o $(LDFLAGS) $(ATFLIBS) 25*ebfedea0SLionel Sambuc 26*ebfedea0SLionel Sambucatf: 27*ebfedea0SLionel Sambuc @echo "" 28*ebfedea0SLionel Sambuc @echo "*************************************" 29*ebfedea0SLionel Sambuc @echo "* ATF TESTS: *" 30*ebfedea0SLionel Sambuc @echo "*************************************" 31*ebfedea0SLionel Sambuc @echo "" 32*ebfedea0SLionel Sambuc @$(ENV) atf-run -v test_dir=`pwd` | $(ENV) atf-report 33*ebfedea0SLionel Sambuc 34*ebfedea0SLionel Sambucvalgrind: 35*ebfedea0SLionel Sambuc @echo "" 36*ebfedea0SLionel Sambuc @echo "*************************************" 37*ebfedea0SLionel Sambuc @echo "* VALGRIND TESTS: *" 38*ebfedea0SLionel Sambuc @echo "*************************************" 39*ebfedea0SLionel Sambuc @echo "" 40*ebfedea0SLionel Sambuc @for prog in $(TEST_CASES); do \ 41*ebfedea0SLionel Sambuc echo "$$prog:"; \ 42*ebfedea0SLionel Sambuc for testcase in `./$$prog -l | grep ident | awk {'print $$2'}`; do \ 43*ebfedea0SLionel Sambuc echo " * $$testcase"; \ 44*ebfedea0SLionel Sambuc $(VALGRIND) $(VALGRIND_OPTS) ./$$prog $$testcase ; \ 45*ebfedea0SLionel Sambuc done \ 46*ebfedea0SLionel Sambuc done 47*ebfedea0SLionel Sambuc 48*ebfedea0SLionel Sambuctests: build atf valgrind 49*ebfedea0SLionel Sambuc 50*ebfedea0SLionel Sambucexample_client: example_client.c 51*ebfedea0SLionel Sambuc 52*ebfedea0SLionel Sambucclean: 53*ebfedea0SLionel Sambuc @rm -f $(TEST_CASES_C) $(TEST_CASES_SH) *.o resfile \ 54*ebfedea0SLionel Sambuc example_client 55