Makefile revision 175044
1# $FreeBSD: head/lib/libarchive/test/Makefile 175044 2008-01-01 22:28:04Z kientzle $
2
3# Where to find the libarchive sources
4LA_SRCDIR=${.CURDIR}/..
5.PATH: ${LA_SRCDIR}
6
7# Get a list of all libarchive source files
8LA_SRCS!=make -f ${LA_SRCDIR}/Makefile -V SRCS
9
10TESTFILES= \
11	test_compat_gtar_1.tgz					\
12	test_compat_zip_1.zip					\
13	test_read_format_gtar_sparse_1_13.tgz			\
14	test_read_format_gtar_sparse_1_17.tgz			\
15	test_read_format_gtar_sparse_1_17_posix00.tgz		\
16	test_read_format_gtar_sparse_1_17_posix01.tgz		\
17	test_read_format_gtar_sparse_1_17_posix10.tgz		\
18	test_read_format_gtar_sparse_1_17_posix10_modified.tar
19
20TESTS= \
21	test_acl_basic.c			\
22	test_acl_pax.c				\
23	test_archive_api_feature.c		\
24	test_bad_fd.c				\
25	test_compat_gtar.c			\
26	test_compat_zip.c			\
27	test_empty_write.c			\
28	test_entry.c				\
29	test_entry_strmode.c			\
30	test_read_compress_program.c		\
31	test_read_data_large.c			\
32	test_read_extract.c			\
33	test_read_format_ar.c			\
34	test_read_format_cpio_bin.c		\
35	test_read_format_cpio_bin_Z.c		\
36	test_read_format_cpio_bin_bz2.c		\
37	test_read_format_cpio_bin_gz.c		\
38	test_read_format_cpio_odc.c		\
39	test_read_format_cpio_svr4_gzip.c	\
40	test_read_format_cpio_svr4c_Z.c		\
41	test_read_format_empty.c		\
42	test_read_format_gtar_gz.c		\
43	test_read_format_gtar_sparse.c		\
44	test_read_format_iso_gz.c		\
45	test_read_format_isorr_bz2.c		\
46	test_read_format_mtree.c		\
47	test_read_format_pax_bz2.c		\
48	test_read_format_tar.c			\
49	test_read_format_tbz.c			\
50	test_read_format_tgz.c			\
51	test_read_format_tz.c			\
52	test_read_format_zip.c			\
53	test_read_large.c			\
54	test_read_pax_truncated.c		\
55	test_read_position.c			\
56	test_read_truncated.c			\
57	test_tar_filenames.c			\
58	test_tar_large.c			\
59	test_write_compress_program.c		\
60	test_write_disk.c			\
61	test_write_disk_perms.c			\
62	test_write_disk_secure.c		\
63	test_write_format_ar.c			\
64	test_write_format_cpio.c		\
65	test_write_format_cpio_odc.c		\
66	test_write_format_cpio_newc.c		\
67	test_write_format_cpio_empty.c		\
68	test_write_format_shar_empty.c		\
69	test_write_format_tar.c			\
70	test_write_format_tar_empty.c		\
71	test_write_open_memory.c
72
73
74# Build the test program using all libarchive sources + the test sources.
75SRCS= ${LA_SRCS}				\
76	${TESTS}				\
77	list.h					\
78	main.c					\
79	read_open_memory.c
80
81CLEANFILES+= list.h archive.h
82
83NO_MAN=yes
84
85PROG=libarchive_test
86INTERNALPROG=yes  # Don't install this; it's just for testing
87DPADD=${LIBBZ2} ${LIBZ}
88CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
89LDADD= -lz -lbz2
90CFLAGS+= -static -g
91CFLAGS+= -I${.OBJDIR}
92CFLAGS+= -I${.CURDIR}
93CFLAGS+= -I${LA_SRCDIR}
94# Without this, libarchive source files find archive.h in LA_SRCDIR,
95# which may not be the same as archive.h in the test dir.
96CFLAGS+= -I-
97
98# Uncomment to link against dmalloc
99LDADD+= -L/usr/local/lib -ldmalloc
100CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
101WARNS=6
102
103# Build libarchive_test and run it.
104check test: libarchive_test ${TESTFILES}
105	./libarchive_test
106
107.for f in ${TESTFILES}
108${f}: ${f}.uu
109	uudecode -p ${.CURDIR}/${f}.uu >${f}
110.endfor
111
112INCS=archive.h list.h
113
114# Build archive.h, but in our .OBJDIR, not libarchive's
115# This keeps libarchive_test and libarchive builds completely separate.
116archive.h: ${LA_SRCDIR}/archive.h.in ${LA_SRCDIR}/Makefile
117	cd ${LA_SRCDIR} && unset MAKEOBJDIRPREFIX && MAKEOBJDIR=${.OBJDIR} make archive.h
118
119# list.h is just a list of all tests, as indicated by DEFINE_TEST macro lines
120list.h: ${TESTS} Makefile
121	(cd ${.CURDIR}; cat ${TESTS}) | grep DEFINE_TEST > list.h
122
123CLEANFILES += *.out *.o *.core *~ list.h archive.h ${TESTFILES}
124
125cleantest:
126	-chmod -R +w /tmp/libarchive_test.*
127	rm -rf /tmp/libarchive_test.*
128
129.include <bsd.prog.mk>
130