1178715Skientzle# $FreeBSD$
2178715Skientzle
3228797SmmLIBARCHIVEDIR=	${.CURDIR}/../../../contrib/libarchive
4178715Skientzle
5228797Smm.PATH: ${LIBARCHIVEDIR}/tar/test
6178715SkientzleTESTS=	\
7178715Skientzle	test_0.c				\
8178715Skientzle	test_basic.c				\
9178715Skientzle	test_copy.c				\
10224153Smm	test_empty_mtree.c			\
11248616Smm	test_extract_tar_bz2.c			\
12248616Smm	test_extract_tar_grz.c			\
13248616Smm	test_extract_tar_gz.c			\
14248616Smm	test_extract_tar_lrz.c			\
15248616Smm	test_extract_tar_lz.c			\
16248616Smm	test_extract_tar_lzma.c			\
17248616Smm	test_extract_tar_lzo.c			\
18248616Smm	test_extract_tar_xz.c			\
19238856Smm	test_format_newc.c			\
20178715Skientzle	test_help.c				\
21232153Smm	test_option_C_upper.c			\
22232153Smm	test_option_H_upper.c			\
23232153Smm	test_option_L_upper.c			\
24232153Smm	test_option_O_upper.c			\
25224153Smm	test_option_T_upper.c			\
26232153Smm	test_option_U_upper.c			\
27232153Smm	test_option_X_upper.c			\
28248616Smm	test_option_a.c				\
29232153Smm	test_option_b.c				\
30248616Smm	test_option_b64encode.c			\
31232153Smm	test_option_exclude.c			\
32232153Smm	test_option_gid_gname.c			\
33248616Smm	test_option_grzip.c			\
34248616Smm	test_option_j.c				\
35232153Smm	test_option_k.c				\
36232153Smm	test_option_keep_newer_files.c		\
37248616Smm	test_option_lrzip.c			\
38248616Smm	test_option_lzma.c			\
39248616Smm	test_option_lzop.c			\
40232153Smm	test_option_n.c				\
41248616Smm	test_option_newer_than.c		\
42238856Smm	test_option_nodump.c			\
43248616Smm	test_option_older_than.c		\
44181979Skientzle	test_option_q.c				\
45224153Smm	test_option_r.c				\
46189512Skientzle	test_option_s.c				\
47232153Smm	test_option_uid_uname.c			\
48248616Smm	test_option_uuencode.c			\
49248616Smm	test_option_xz.c			\
50248616Smm	test_option_z.c				\
51179322Skientzle	test_patterns.c				\
52232153Smm	test_print_longpath.c			\
53178715Skientzle	test_stdio.c				\
54184807Skientzle	test_strip_components.c			\
55183009Skientzle	test_symlink_dir.c			\
56178715Skientzle	test_version.c
57178715Skientzle
58178715Skientzle# Build the test program
59228797SmmSRCS=	${TAR_SRCS}				\
60178715Skientzle	${TESTS}				\
61178715Skientzle	list.h					\
62178715Skientzle	main.c
63178715Skientzle
64248616Smm.PATH: ${LIBARCHIVEDIR}/test_utils
65248616SmmSRCS+=	test_utils.c
66248616Smm
67178715SkientzleCLEANFILES+= list.h
68178715Skientzle
69178715SkientzleNO_MAN=yes
70178715Skientzle
71178715SkientzlePROG=bsdtar_test
72207849SmmDPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBLZMA}
73232153SmmCFLAGS+=	-DPLATFORM_CONFIG_H=\"${.CURDIR}/../../../lib/libarchive/config_freebsd.h\"
74207849SmmLDADD= -larchive -lz -lbz2 -llzma
75178715SkientzleCFLAGS+= -static -g -O2 -Wall
76232153SmmCFLAGS+= -I${.CURDIR}/../../../lib/libarchive -I${.OBJDIR}
77248616SmmCFLAGS+= -I${LIBARCHIVEDIR}/tar -I${LIBARCHIVEDIR}/test_utils
78178715Skientzle
79178715Skientzle# Uncomment to link against dmalloc
80178715Skientzle#LDADD+= -L/usr/local/lib -ldmalloc
81178715Skientzle#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
82178715Skientzle
83178715Skientzlecheck test:	bsdtar_test
84228797Smm	./bsdtar_test -p ${.OBJDIR}/../bsdtar -r ${LIBARCHIVEDIR}/tar/test
85178715Skientzle
86178715Skientzlelist.h: ${TESTS} Makefile
87228797Smm	(cd ${LIBARCHIVEDIR}/tar/test; cat ${TESTS}) | \
88228797Smm	grep DEFINE_TEST > ${.OBJDIR}/list.h
89178715Skientzle
90178715Skientzleclean:
91228797Smm	rm -f ${CLEANFILES}
92178715Skientzle	rm -f *.out
93178715Skientzle	rm -f *.o
94178715Skientzle	rm -f *.core
95178715Skientzle	rm -f *~
96178715Skientzle	rm -f list.h
97178715Skientzle	rm -f archive.h ../archive.h
98178715Skientzle	-chmod -R +w /tmp/bsdtar_test.*
99178715Skientzle	rm -rf /tmp/bsdtar_test.*
100178715Skientzle
101178715Skientzle.include <bsd.prog.mk>
102