xref: /freebsd/lib/liblzma/Makefile (revision 60a517b66a69b8c011b04063ef63a938738719bd)
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	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