Makefile revision 154847
1# $FreeBSD: head/lib/libarchive/Makefile 154847 2006-01-26 05:28:56Z kientzle $
2
3# This Makefile is for use with the FreeBSD buid system.  For
4# non-FreeBSD systems, you should first "make distfile" on FreeBSD,
5# then use the resulting tar.gz archive--which contains a portable
6# autoconf/automake-generated build system--on the other system.
7
8LIB=	archive
9DPADD=	${LIBBZ2} ${LIBZ}
10LDADD=	-lbz2 -lz
11
12# Versioning <sigh>.  There are three distinct sets of version
13# numbers:
14#    * libarchive version
15#    * libtool version (for shared libs built using configure script)
16#    * FreeBSD SHLIB_MAJOR
17# The following logic helps ensure that there is some consistency across
18# these three:
19
20# First, the libarchive version is in three parts:
21# Bumped ONLY when API/ABI breakage happens (non-backwards-compatible change).
22ARCHIVE_API_MAJOR=	1
23# Bumped when significant new features are added.
24# Also used to bump SHLIB_MAJOR for reasons other than API/ABI breakage.
25# Note: Do NOT reset this to zero after bumping ARCHIVE_API_MAJOR!
26ARCHIVE_API_MINOR=	2
27# Bumped often. ;-)
28ARCHIVE_API_REVISION=	37
29# Full libarchive version combines the above three numbers.
30VERSION= ${ARCHIVE_API_MAJOR}.${ARCHIVE_API_MINOR}.${ARCHIVE_API_REVISION}
31
32# The FreeBSD SHLIB_MAJOR is computed from the above values.
33SHLIB_MAJOR!= echo $$((${ARCHIVE_API_MAJOR} + ${ARCHIVE_API_MINOR}))
34
35# The SHLIB_MAJOR computation above helps ensure that the libtool
36# version (computed in configure.ac.in) provides the same
37# shared library number as is used on FreeBSD.
38
39CFLAGS+=	-DPACKAGE_NAME=\"lib${LIB}\"
40CFLAGS+=	-DPACKAGE_VERSION=\"${VERSION}\"
41CFLAGS+=	-I${.OBJDIR}
42
43# FreeBSD/arm has some limitations.
44.if ${MACHINE_ARCH} == "arm"
45WARNS?= 3
46.else
47WARNS?=	6
48.endif
49
50# Headers to be installed in /usr/include
51INCS=	archive.h archive_entry.h
52
53# C sources to be compiled.  This is one part of SRCS below.
54BASE_SRCS= archive_check_magic.c			\
55	archive_entry.c					\
56	archive_read.c					\
57	archive_read_data_into_buffer.c			\
58	archive_read_data_into_fd.c			\
59	archive_read_extract.c				\
60	archive_read_open_fd.c				\
61	archive_read_open_file.c			\
62	archive_read_support_compression_all.c		\
63	archive_read_support_compression_bzip2.c	\
64	archive_read_support_compression_compress.c	\
65	archive_read_support_compression_gzip.c		\
66	archive_read_support_compression_none.c		\
67	archive_read_support_format_all.c		\
68	archive_read_support_format_cpio.c		\
69	archive_read_support_format_iso9660.c		\
70	archive_read_support_format_tar.c		\
71	archive_read_support_format_tp.c		\
72	archive_read_support_format_zip.c		\
73	archive_string.c				\
74	archive_string_sprintf.c			\
75	archive_util.c					\
76	archive_write.c					\
77	archive_write_open_fd.c				\
78	archive_write_open_file.c			\
79	archive_write_set_compression_bzip2.c		\
80	archive_write_set_compression_gzip.c		\
81	archive_write_set_compression_none.c		\
82	archive_write_set_format.c			\
83	archive_write_set_format_by_name.c		\
84	archive_write_set_format_cpio.c			\
85	archive_write_set_format_pax.c			\
86	archive_write_set_format_shar.c			\
87	archive_write_set_format_ustar.c
88
89# Note: archive.h does need to be in SRCS, since it is built
90# from archive.h.in.  But it does not get included in DIST_FILES
91# below, so I build up SRCS in two steps.
92SRCS=	${BASE_SRCS} archive.h
93
94# Man pages to be installed.
95MAN=	archive_entry.3					\
96	archive_read.3					\
97	archive_util.3					\
98	archive_write.3					\
99	libarchive.3					\
100	libarchive-formats.5				\
101	tar.5
102
103# Symlink the man pages under each function name.
104MLINKS+=	archive_entry.3 archive_entry_acl_add_entry.3
105MLINKS+=	archive_entry.3 archive_entry_acl_add_entry_w.3
106MLINKS+=	archive_entry.3 archive_entry_acl_clear.3
107MLINKS+=	archive_entry.3 archive_entry_acl_count.3
108MLINKS+=	archive_entry.3 archive_entry_acl_next.3
109MLINKS+=	archive_entry.3 archive_entry_acl_next_w.3
110MLINKS+=	archive_entry.3 archive_entry_acl_reset.3
111MLINKS+=	archive_entry.3 archive_entry_acl_text_w.3
112MLINKS+=	archive_entry.3 archive_entry_clear.3
113MLINKS+=	archive_entry.3 archive_entry_clone.3
114MLINKS+=	archive_entry.3 archive_entry_copy_fflags_text_w.3
115MLINKS+=	archive_entry.3 archive_entry_copy_gname_w.3
116MLINKS+=	archive_entry.3 archive_entry_copy_hardlink_w.3
117MLINKS+=	archive_entry.3 archive_entry_copy_pathname_w.3
118MLINKS+=	archive_entry.3 archive_entry_copy_stat.3
119MLINKS+=	archive_entry.3 archive_entry_copy_symlink_w.3
120MLINKS+=	archive_entry.3 archive_entry_copy_uname_w.3
121MLINKS+=	archive_entry.3 archive_entry_fflags.3
122MLINKS+=	archive_entry.3 archive_entry_fflags_text.3
123MLINKS+=	archive_entry.3 archive_entry_free.3
124MLINKS+=	archive_entry.3 archive_entry_gid.3
125MLINKS+=	archive_entry.3 archive_entry_gname.3
126MLINKS+=	archive_entry.3 archive_entry_gname_w.3
127MLINKS+=	archive_entry.3 archive_entry_hardlink.3
128MLINKS+=	archive_entry.3 archive_entry_ino.3
129MLINKS+=	archive_entry.3 archive_entry_mode.3
130MLINKS+=	archive_entry.3 archive_entry_mtime.3
131MLINKS+=	archive_entry.3 archive_entry_mtime_nsec.3
132MLINKS+=	archive_entry.3 archive_entry_new.3
133MLINKS+=	archive_entry.3 archive_entry_pathname.3
134MLINKS+=	archive_entry.3 archive_entry_pathname_w.3
135MLINKS+=	archive_entry.3 archive_entry_rdev.3
136MLINKS+=	archive_entry.3 archive_entry_rdevmajor.3
137MLINKS+=	archive_entry.3 archive_entry_rdevminor.3
138MLINKS+=	archive_entry.3 archive_entry_set_fflags.3
139MLINKS+=	archive_entry.3 archive_entry_set_gid.3
140MLINKS+=	archive_entry.3 archive_entry_set_gname.3
141MLINKS+=	archive_entry.3 archive_entry_set_hardlink.3
142MLINKS+=	archive_entry.3 archive_entry_set_link.3
143MLINKS+=	archive_entry.3 archive_entry_set_mode.3
144MLINKS+=	archive_entry.3 archive_entry_set_pathname.3
145MLINKS+=	archive_entry.3 archive_entry_set_rdevmajor.3
146MLINKS+=	archive_entry.3 archive_entry_set_rdevminor.3
147MLINKS+=	archive_entry.3 archive_entry_set_size.3
148MLINKS+=	archive_entry.3 archive_entry_set_symlink.3
149MLINKS+=	archive_entry.3 archive_entry_set_uid.3
150MLINKS+=	archive_entry.3 archive_entry_set_uname.3
151MLINKS+=	archive_entry.3 archive_entry_size.3
152MLINKS+=	archive_entry.3 archive_entry_stat.3
153MLINKS+=	archive_entry.3 archive_entry_symlink.3
154MLINKS+=	archive_entry.3 archive_entry_uid.3
155MLINKS+=	archive_entry.3 archive_entry_uname.3
156MLINKS+=	archive_entry.3 archive_entry_uname_w.3
157MLINKS+=	archive_read.3 archive_read_data.3
158MLINKS+=	archive_read.3 archive_read_data_block.3
159MLINKS+=	archive_read.3 archive_read_data_into_buffer.3
160MLINKS+=	archive_read.3 archive_read_data_into_fd.3
161MLINKS+=	archive_read.3 archive_read_data_skip.3
162MLINKS+=	archive_read.3 archive_read_extract.3
163MLINKS+=	archive_read.3 archive_read_extract_set_progress_callback.3
164MLINKS+=	archive_read.3 archive_read_finish.3
165MLINKS+=	archive_read.3 archive_read_new.3
166MLINKS+=	archive_read.3 archive_read_next_header.3
167MLINKS+=	archive_read.3 archive_read_open.3
168MLINKS+=	archive_read.3 archive_read_open_fd.3
169MLINKS+=	archive_read.3 archive_read_open_file.3
170MLINKS+=	archive_read.3 archive_read_set_bytes_per_block.3
171MLINKS+=	archive_read.3 archive_read_support_compression_all.3
172MLINKS+=	archive_read.3 archive_read_support_compression_bzip2.3
173MLINKS+=	archive_read.3 archive_read_support_compression_compress.3
174MLINKS+=	archive_read.3 archive_read_support_compression_gzip.3
175MLINKS+=	archive_read.3 archive_read_support_compression_none.3
176MLINKS+=	archive_read.3 archive_read_support_format_all.3
177MLINKS+=	archive_read.3 archive_read_support_format_cpio.3
178MLINKS+=	archive_read.3 archive_read_support_format_iso9660.3
179MLINKS+=	archive_read.3 archive_read_support_format_tar.3
180MLINKS+=	archive_read.3 archive_read_support_format_zip.3
181MLINKS+=	archive_util.3 archive_compression.3
182MLINKS+=	archive_util.3 archive_compression_name.3
183MLINKS+=	archive_util.3 archive_errno.3
184MLINKS+=	archive_util.3 archive_error_string.3
185MLINKS+=	archive_util.3 archive_format.3
186MLINKS+=	archive_util.3 archive_format_name.3
187MLINKS+=	archive_util.3 archive_set_error.3
188MLINKS+=	archive_write.3 archive_write_data.3
189MLINKS+=	archive_write.3 archive_write_finish.3
190MLINKS+=	archive_write.3 archive_write_header.3
191MLINKS+=	archive_write.3 archive_write_new.3
192MLINKS+=	archive_write.3 archive_write_open.3
193MLINKS+=	archive_write.3 archive_write_open_fd.3
194MLINKS+=	archive_write.3 archive_write_open_file.3
195MLINKS+=	archive_write.3 archive_write_prepare.3
196MLINKS+=	archive_write.3 archive_write_set_bytes_per_block.3
197MLINKS+=	archive_write.3 archive_write_set_bytes_in_last_block.3
198MLINKS+=	archive_write.3 archive_write_set_callbacks.3
199MLINKS+=	archive_write.3 archive_write_set_compression_bzip2.3
200MLINKS+=	archive_write.3 archive_write_set_compression_gzip.3
201MLINKS+=	archive_write.3 archive_write_set_format_pax.3
202MLINKS+=	archive_write.3 archive_write_set_format_shar.3
203MLINKS+=	archive_write.3 archive_write_set_format_ustar.3
204MLINKS+=	libarchive.3 archive.3
205
206# Build archive.h from archive.h.in by substituting version information.
207archive.h:	archive.h.in Makefile
208	cat ${.CURDIR}/archive.h.in |					\
209		sed 's/@VERSION@/${VERSION}/g' | 			\
210		sed 's/@SHLIB_MAJOR@/${SHLIB_MAJOR}/g' |		\
211		sed 's/@ARCHIVE_API_MAJOR@/${ARCHIVE_API_MAJOR}/g' |	\
212		sed 's/@ARCHIVE_API_MINOR@/${ARCHIVE_API_MINOR}/g' |	\
213		sed 's/@ARCHIVE_API_REVISION@/${ARCHIVE_API_REVISION}/g' | \
214		cat > archive.h
215
216# archive.h needs to be cleaned
217CLEANFILES+=	archive.h
218
219#
220# Voodoo for building a distfile that uses autoconf/automake/etc.
221#
222
223# Files that just get copied to the distfile build directory
224DIST_WORK_DIR=	${.OBJDIR}/lib${LIB}-${VERSION}
225CLEANDIRS+=	${DIST_WORK_DIR}
226DISTFILE=	lib${LIB}-${VERSION}.tar.gz
227# DIST_FILES is the list of files to include in the distribution.
228DIST_FILES=	${BASE_SRCS}
229DIST_FILES+=	${MAN}
230DIST_FILES+=	archive.h.in
231DIST_FILES+=	archive_entry.h archive_platform.h
232DIST_FILES+=	archive_private.h archive_string.h
233DIST_FILES+=	Makefile.am
234
235distfile:
236	rm -rf ${DIST_WORK_DIR}
237	mkdir ${DIST_WORK_DIR}
238	# Copy the DIST_FILES; ignore errors, don't preserve permissions.
239	for f in ${DIST_FILES}; do				\
240		cat ${.CURDIR}/$$f >${DIST_WORK_DIR}/$$f || true; \
241	done
242	# Build configure.ac from configure.ac.in
243	cat ${.CURDIR}/configure.ac.in |				\
244		sed 's/@VERSION@/${VERSION}/g' |			\
245		sed 's/@SHLIB_MAJOR@/${SHLIB_MAJOR}/g' | 		\
246		sed 's/@ARCHIVE_API_MAJOR@/${ARCHIVE_API_MAJOR}/g' |	\
247		sed 's/@ARCHIVE_API_MINOR@/${ARCHIVE_API_MINOR}/g' |	\
248		sed 's/@ARCHIVE_API_REVISION@/${ARCHIVE_API_REVISION}/g' | \
249		cat > ${DIST_WORK_DIR}/configure.ac
250	# Prepare some auxiliary files.
251	(cd ${DIST_WORK_DIR} && libtoolize)
252	(cd ${DIST_WORK_DIR} && aclocal && autoheader)
253	# Build the configure script and portable Makefile
254	(cd ${DIST_WORK_DIR} && autoconf && automake -a --foreign)
255	# Now, use automake-generated Makefile to build the final dist file.
256	(cd ${DIST_WORK_DIR} && ./configure && make distcheck && make dist)
257	mv ${DIST_WORK_DIR}/${DISTFILE} ${.OBJDIR}
258	@echo ==================================================
259	@echo Created ${.OBJDIR}/${DISTFILE}
260	@echo ==================================================
261
262.include <bsd.lib.mk>
263