xref: /freebsd/lib/liblzma/Makefile (revision f6a3b357e9be4c6423c85eff9a847163a0d307c8)
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	sha256.c
83.if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "i386"
84SRCS+=	crc32_x86.S \
85	crc64_x86.S
86ACFLAGS+=	-Wa,--noexecstack
87.else
88SRCS+=	crc32_fast.c \
89	crc64_fast.c
90.endif
91
92.PATH: ${LZMADIR}/lz
93SRCS+=	lz_encoder.c \
94	lz_encoder_mf.c \
95	lz_decoder.c
96
97.PATH: ${LZMADIR}/lzma
98SRCS+=	lzma_encoder.c \
99	lzma_encoder_presets.c \
100	lzma_encoder_optimum_fast.c \
101	lzma_encoder_optimum_normal.c \
102	fastpos_table.c \
103	lzma_decoder.c \
104	lzma2_encoder.c \
105	lzma2_decoder.c
106
107.PATH: ${LZMADIR}/rangecoder
108SRCS+=	price_table.c
109
110.PATH: ${LZMADIR}/delta
111SRCS+=	delta_common.c \
112	delta_encoder.c \
113	delta_decoder.c
114
115.PATH: ${LZMADIR}/simple
116SRCS+=	simple_coder.c \
117	simple_encoder.c \
118	simple_decoder.c \
119	x86.c \
120	powerpc.c \
121	ia64.c \
122	arm.c \
123	armthumb.c \
124	sparc.c
125
126.PATH: ${LZMADIR}
127
128VERSION_MAJOR!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_MAJOR" {print $$3 } ' \
129			${LZMADIR}/api/lzma/version.h
130VERSION_MINOR!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_MINOR" {print $$3 } ' \
131			${LZMADIR}/api/lzma/version.h
132VERSION_PATCH!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_PATCH" {print $$3 } ' \
133			${LZMADIR}/api/lzma/version.h
134
135WARNS?=	3
136
137CFLAGS+=	-DHAVE_CONFIG_H \
138		-DTUKLIB_SYMBOL_PREFIX=lzma_ \
139		-I${.CURDIR} \
140		-I${LZMADIR}/api \
141		-I${LZMADIR}/common \
142		-I${LZMADIR}/check \
143		-I${LZMADIR}/lz \
144		-I${LZMADIR}/rangecoder \
145		-I${LZMADIR}/lzma \
146		-I${LZMADIR}/delta \
147		-I${LZMADIR}/simple \
148		-I${LZMADIR:H}/common
149
150LIBADD+=	pthread
151
152VERSION_DEF=	${.CURDIR}/Versions.def
153SYMBOL_MAPS=	${.CURDIR}/Symbol.map
154CFLAGS+=	-DSYMBOL_VERSIONING
155
156CLEANFILES+=	liblzma.pc
157
158FILES=		liblzma.pc
159FILESDIR=	${LIBDATADIR}/pkgconfig
160
161liblzma.pc: liblzma.pc.in
162	sed -e 's,@prefix@,/usr,g ; \
163		s,@exec_prefix@,/usr,g  ; \
164		s,@libdir@,/usr/lib,g ; \
165		s,@includedir@,/usr/include,g ; \
166		s,@PACKAGE_URL@,http://tukaani.org/xz/,g ; \
167		s,@PACKAGE_VERSION@,${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},g ; \
168		s,@PTHREAD_CFLAGS@,,g ; \
169		s,@PTHREAD_LIBS@,,g' ${.ALLSRC} > ${.TARGET}
170
171.include <bsd.lib.mk>
172