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