xref: /freebsd/lib/liblzma/Makefile (revision 4436b51dff5736e74da464946049ea6899a88938)
1# $FreeBSD$
2
3LIB=		lzma
4LZMADIR=	${.CURDIR}/../../contrib/xz/src/liblzma
5
6.PATH: ${LZMADIR}/../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	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	stream_buffer_encoder.c \
55	stream_encoder.c \
56	stream_flags_encoder.c \
57	vli_encoder.c \
58	alone_decoder.c \
59	auto_decoder.c \
60	block_buffer_decoder.c \
61	block_decoder.c \
62	block_header_decoder.c \
63	easy_decoder_memusage.c \
64	filter_buffer_decoder.c \
65	filter_decoder.c \
66	filter_flags_decoder.c \
67	index_decoder.c \
68	index_hash.c \
69	stream_buffer_decoder.c \
70	stream_decoder.c \
71	stream_flags_decoder.c \
72	stream_encoder_mt.c \
73	vli_decoder.c \
74	outqueue.c
75
76
77.PATH: ${LZMADIR}/check
78SRCS+=	check.c \
79	crc32_table.c \
80	crc64_table.c \
81	sha256.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!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_MAJOR" {print $$3 } ' \
128			${LZMADIR}/api/lzma/version.h
129VERSION_MINOR!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_MINOR" {print $$3 } ' \
130			${LZMADIR}/api/lzma/version.h
131VERSION_PATCH!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_PATCH" {print $$3 } ' \
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}/../common
148
149LIBADD+=	pthread
150
151VERSION_DEF=	${.CURDIR}/Versions.def
152SYMBOL_MAPS=	${.CURDIR}/Symbol.map
153CFLAGS+=	-DSYMBOL_VERSIONING
154
155CLEANFILES+=	liblzma.pc
156
157FILES=		liblzma.pc
158FILESDIR=	${LIBDATADIR}/pkgconfig
159
160liblzma.pc: liblzma.pc.in
161	sed -e 's,@prefix@,/usr,g ; \
162		s,@exec_prefix@,/usr,g  ; \
163		s,@libdir@,/usr/lib,g ; \
164		s,@includedir@,/usr/include,g ; \
165		s,@PACKAGE_URL@,http://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