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