xref: /freebsd/lib/liblzma/Makefile (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
1# $FreeBSD$
2
3PACKAGE=lib${LIB}
4LIB=		lzma
5LZMADIR=	${SRCTOP}/contrib/xz/src/liblzma
6
7.PATH: ${LZMADIR:H}/common
8SRCS+=	tuklib_physmem.c tuklib_cpucores.c
9
10.PATH: ${LZMADIR}/api/lzma
11
12MAININCS=	../lzma.h
13MAININCSDIR=	${INCLUDEDIR}
14
15LZMAINCS+=	base.h \
16		bcj.h \
17		block.h \
18		check.h \
19		container.h \
20		delta.h \
21		filter.h \
22		hardware.h \
23		index.h \
24		index_hash.h \
25		lzma12.h \
26		stream_flags.h \
27		version.h \
28		vli.h
29
30LZMAINCSDIR=	${INCLUDEDIR}/lzma
31
32INCSGROUPS=	MAININCS LZMAINCS
33
34.PATH: ${LZMADIR}/common
35SRCS+=	common.c \
36	block_util.c \
37	easy_preset.c \
38	filter_common.c \
39	hardware_physmem.c \
40	hardware_cputhreads.c \
41	index.c \
42	stream_flags_common.c \
43	string_conversion.c \
44	vli_size.c \
45	alone_encoder.c \
46	block_buffer_encoder.c \
47	block_encoder.c \
48	block_header_encoder.c \
49	easy_buffer_encoder.c \
50	easy_encoder.c \
51	easy_encoder_memusage.c \
52	filter_buffer_encoder.c \
53	filter_encoder.c \
54	filter_flags_encoder.c \
55	index_encoder.c \
56	lzip_decoder.c \
57	microlzma_encoder.c \
58	microlzma_decoder.c \
59	stream_buffer_encoder.c \
60	stream_encoder.c \
61	stream_flags_encoder.c \
62	vli_encoder.c \
63	alone_decoder.c \
64	auto_decoder.c \
65	block_buffer_decoder.c \
66	block_decoder.c \
67	block_header_decoder.c \
68	easy_decoder_memusage.c \
69	file_info.c \
70	filter_buffer_decoder.c \
71	filter_decoder.c \
72	filter_flags_decoder.c \
73	index_decoder.c \
74	index_hash.c \
75	stream_buffer_decoder.c \
76	stream_decoder.c \
77	stream_decoder_mt.c \
78	stream_flags_decoder.c \
79	stream_encoder_mt.c \
80	vli_decoder.c \
81	outqueue.c
82
83
84.PATH: ${LZMADIR}/check
85SRCS+=	check.c \
86	crc32_table.c \
87	crc64_table.c
88.if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "i386"
89SRCS+=	crc32_x86.S \
90	crc64_x86.S
91ACFLAGS+=	-Wa,--noexecstack
92.else
93SRCS+=	crc32_fast.c \
94	crc64_fast.c
95.endif
96
97.PATH: ${LZMADIR}/lz
98SRCS+=	lz_encoder.c \
99	lz_encoder_mf.c \
100	lz_decoder.c
101
102.PATH: ${LZMADIR}/lzma
103SRCS+=	lzma_encoder.c \
104	lzma_encoder_presets.c \
105	lzma_encoder_optimum_fast.c \
106	lzma_encoder_optimum_normal.c \
107	fastpos_table.c \
108	lzma_decoder.c \
109	lzma2_encoder.c \
110	lzma2_decoder.c
111
112.PATH: ${LZMADIR}/rangecoder
113SRCS+=	price_table.c
114
115.PATH: ${LZMADIR}/delta
116SRCS+=	delta_common.c \
117	delta_encoder.c \
118	delta_decoder.c
119
120.PATH: ${LZMADIR}/simple
121SRCS+=	simple_coder.c \
122	simple_encoder.c \
123	simple_decoder.c \
124	x86.c \
125	powerpc.c \
126	ia64.c \
127	arm.c \
128	arm64.c \
129	armthumb.c \
130	sparc.c
131
132.PATH: ${LZMADIR}
133
134VERSION_MAJOR!=	sed -n '/define.*LZMA_VERSION_MAJOR/{s,[^0-9.],,gp;q;}' \
135			${LZMADIR}/api/lzma/version.h
136VERSION_MINOR!=	sed -n '/define.*LZMA_VERSION_MINOR/{s,[^0-9.],,gp;q;}' \
137			${LZMADIR}/api/lzma/version.h
138VERSION_PATCH!=	sed -n '/define.*LZMA_VERSION_PATCH/{s,[^0-9.],,gp;q;}' \
139			${LZMADIR}/api/lzma/version.h
140
141WARNS?=	3
142
143CFLAGS+=	-DHAVE_CONFIG_H \
144		-DTUKLIB_SYMBOL_PREFIX=lzma_ \
145		-I${.CURDIR} \
146		-I${LZMADIR}/api \
147		-I${LZMADIR}/common \
148		-I${LZMADIR}/check \
149		-I${LZMADIR}/lz \
150		-I${LZMADIR}/rangecoder \
151		-I${LZMADIR}/lzma \
152		-I${LZMADIR}/delta \
153		-I${LZMADIR}/simple \
154		-I${LZMADIR:H}/common
155
156LIBADD+=	md pthread
157
158VERSION_DEF=	${.CURDIR}/Versions.def
159SYMBOL_MAPS=	${.CURDIR}/Symbol.map
160CFLAGS+=	-DSYMBOL_VERSIONING
161
162CLEANFILES+=	liblzma.pc
163
164PCFILES=	liblzma.pc
165
166liblzma.pc: liblzma.pc.in
167	sed -e 's,@prefix@,/usr,g ; \
168		s,@exec_prefix@,/usr,g ; \
169		s,@libdir@,${LIBDIR},g ; \
170		s,@sharedlibdir@,${SHLIBDIR},g ; \
171		s,@includedir@,${INCLUDEDIR},g ; \
172		s,@LIBS@,-pthread -lmd,g ; \
173		s,@PACKAGE_URL@,https://tukaani.org/xz/,g ; \
174		s,@PACKAGE_VERSION@,${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},g ; \
175		s,@PTHREAD_CFLAGS@,,g ; \
176		s,@PTHREAD_LIBS@,,g' ${.ALLSRC} > ${.TARGET}
177
178.include <bsd.lib.mk>
179