xref: /freebsd/lib/liblzma/Makefile (revision 5bb3134a8c21cb87b30e135ef168483f0333dabb)
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	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	stream_buffer_encoder.c \
56	stream_encoder.c \
57	stream_flags_encoder.c \
58	vli_encoder.c \
59	alone_decoder.c \
60	auto_decoder.c \
61	block_buffer_decoder.c \
62	block_decoder.c \
63	block_header_decoder.c \
64	easy_decoder_memusage.c \
65	filter_buffer_decoder.c \
66	filter_decoder.c \
67	filter_flags_decoder.c \
68	index_decoder.c \
69	index_hash.c \
70	stream_buffer_decoder.c \
71	stream_decoder.c \
72	stream_flags_decoder.c \
73	stream_encoder_mt.c \
74	vli_decoder.c \
75	outqueue.c
76
77
78.PATH: ${LZMADIR}/check
79SRCS+=	check.c \
80	crc32_table.c \
81	crc64_table.c
82.if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "i386"
83SRCS+=	crc32_x86.S \
84	crc64_x86.S
85ACFLAGS+=	-Wa,--noexecstack
86.else
87SRCS+=	crc32_fast.c \
88	crc64_fast.c
89.endif
90
91.PATH: ${LZMADIR}/lz
92SRCS+=	lz_encoder.c \
93	lz_encoder_mf.c \
94	lz_decoder.c
95
96.PATH: ${LZMADIR}/lzma
97SRCS+=	lzma_encoder.c \
98	lzma_encoder_presets.c \
99	lzma_encoder_optimum_fast.c \
100	lzma_encoder_optimum_normal.c \
101	fastpos_table.c \
102	lzma_decoder.c \
103	lzma2_encoder.c \
104	lzma2_decoder.c
105
106.PATH: ${LZMADIR}/rangecoder
107SRCS+=	price_table.c
108
109.PATH: ${LZMADIR}/delta
110SRCS+=	delta_common.c \
111	delta_encoder.c \
112	delta_decoder.c
113
114.PATH: ${LZMADIR}/simple
115SRCS+=	simple_coder.c \
116	simple_encoder.c \
117	simple_decoder.c \
118	x86.c \
119	powerpc.c \
120	ia64.c \
121	arm.c \
122	armthumb.c \
123	sparc.c
124
125.PATH: ${LZMADIR}
126
127VERSION_MAJOR!=	sed -n '/define.*LZMA_VERSION_MAJOR/{s,[^0-9.],,gp;q;}' \
128			${LZMADIR}/api/lzma/version.h
129VERSION_MINOR!=	sed -n '/define.*LZMA_VERSION_MINOR/{s,[^0-9.],,gp;q;}' \
130			${LZMADIR}/api/lzma/version.h
131VERSION_PATCH!=	sed -n '/define.*LZMA_VERSION_PATCH/{s,[^0-9.],,gp;q;}' \
132			${LZMADIR}/api/lzma/version.h
133
134WARNS?=	3
135
136CFLAGS+=	-DHAVE_CONFIG_H \
137		-DTUKLIB_SYMBOL_PREFIX=lzma_ \
138		-I${.CURDIR} \
139		-I${LZMADIR}/api \
140		-I${LZMADIR}/common \
141		-I${LZMADIR}/check \
142		-I${LZMADIR}/lz \
143		-I${LZMADIR}/rangecoder \
144		-I${LZMADIR}/lzma \
145		-I${LZMADIR}/delta \
146		-I${LZMADIR}/simple \
147		-I${LZMADIR:H}/common
148
149LIBADD+=	md pthread
150
151VERSION_DEF=	${.CURDIR}/Versions.def
152SYMBOL_MAPS=	${.CURDIR}/Symbol.map
153CFLAGS+=	-DSYMBOL_VERSIONING
154
155CLEANFILES+=	liblzma.pc
156
157PCFILES=	liblzma.pc
158
159liblzma.pc: liblzma.pc.in
160	sed -e 's,@prefix@,/usr,g ; \
161		s,@exec_prefix@,/usr,g ; \
162		s,@libdir@,/usr/lib,g ; \
163		s,@includedir@,/usr/include,g ; \
164		s,@LIBS@,-pthread -lmd,g ; \
165		s,@PACKAGE_URL@,https://tukaani.org/xz/,g ; \
166		s,@PACKAGE_VERSION@,${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},g ; \
167		s,@PTHREAD_CFLAGS@,,g ; \
168		s,@PTHREAD_LIBS@,,g' ${.ALLSRC} > ${.TARGET}
169
170.include <bsd.lib.mk>
171