1207842Smm# $FreeBSD: stable/10/lib/liblzma/Makefile 313619 2017-02-11 06:55:35Z ngie $
2207842Smm
3208099SdelphijLIB=		lzma
4313619SngieLZMADIR=	${SRCTOP}/contrib/xz/src/liblzma
5207842Smm
6313619Sngie.PATH: ${LZMADIR:H}/common
7292588SdelphijSRCS+=	tuklib_physmem.c tuklib_cpucores.c
8207842Smm
9207842Smm.PATH: ${LZMADIR}/api/lzma
10207842Smm
11207842SmmMAININCS=	../lzma.h
12207842SmmMAININCSDIR=	${INCLUDEDIR}
13207842Smm
14207842SmmLZMAINCS+=	base.h \
15207842Smm		bcj.h \
16207842Smm		block.h \
17207842Smm		check.h \
18207842Smm		container.h \
19207842Smm		delta.h \
20207842Smm		filter.h \
21207844Smm		hardware.h \
22207844Smm		index.h \
23207842Smm		index_hash.h \
24292588Sdelphij		lzma12.h \
25207842Smm		stream_flags.h \
26207842Smm		version.h \
27207842Smm		vli.h
28207842Smm
29207842SmmLZMAINCSDIR=	${INCLUDEDIR}/lzma
30207842Smm
31207842SmmINCSGROUPS=	MAININCS LZMAINCS
32207842Smm
33207842Smm.PATH: ${LZMADIR}/common
34207842SmmSRCS+=	common.c \
35207842Smm	block_util.c \
36207842Smm	easy_preset.c \
37207842Smm	filter_common.c \
38207842Smm	hardware_physmem.c \
39292588Sdelphij	hardware_cputhreads.c \
40207842Smm	index.c \
41207842Smm	stream_flags_common.c \
42207842Smm	vli_size.c \
43207842Smm	alone_encoder.c \
44207842Smm	block_buffer_encoder.c \
45207842Smm	block_encoder.c \
46207842Smm	block_header_encoder.c \
47207842Smm	easy_buffer_encoder.c \
48207842Smm	easy_encoder.c \
49207842Smm	easy_encoder_memusage.c \
50207842Smm	filter_buffer_encoder.c \
51207842Smm	filter_encoder.c \
52207842Smm	filter_flags_encoder.c \
53207842Smm	index_encoder.c \
54207842Smm	stream_buffer_encoder.c \
55207842Smm	stream_encoder.c \
56207842Smm	stream_flags_encoder.c \
57207842Smm	vli_encoder.c \
58207842Smm	alone_decoder.c \
59207842Smm	auto_decoder.c \
60207842Smm	block_buffer_decoder.c \
61207842Smm	block_decoder.c \
62207842Smm	block_header_decoder.c \
63207842Smm	easy_decoder_memusage.c \
64207842Smm	filter_buffer_decoder.c \
65207842Smm	filter_decoder.c \
66207842Smm	filter_flags_decoder.c \
67207842Smm	index_decoder.c \
68207842Smm	index_hash.c \
69207842Smm	stream_buffer_decoder.c \
70207842Smm	stream_decoder.c \
71207842Smm	stream_flags_decoder.c \
72292588Sdelphij	stream_encoder_mt.c \
73292588Sdelphij	vli_decoder.c \
74292588Sdelphij	outqueue.c
75207842Smm
76292588Sdelphij
77207842Smm.PATH: ${LZMADIR}/check
78207842SmmSRCS+=	check.c \
79207842Smm	crc32_table.c \
80207842Smm	crc64_table.c \
81207842Smm	sha256.c
82207842Smm.if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "i386"
83207842SmmSRCS+=	crc32_x86.S \
84207842Smm	crc64_x86.S
85218723SdimACFLAGS+=	-Wa,--noexecstack
86207842Smm.else
87207842SmmSRCS+=	crc32_fast.c \
88207842Smm	crc64_fast.c
89207842Smm.endif
90207842Smm
91207842Smm.PATH: ${LZMADIR}/lz
92207842SmmSRCS+=	lz_encoder.c \
93207842Smm	lz_encoder_mf.c \
94207842Smm	lz_decoder.c
95207842Smm
96207842Smm.PATH: ${LZMADIR}/lzma
97207842SmmSRCS+=	lzma_encoder.c \
98207842Smm	lzma_encoder_presets.c \
99207842Smm	lzma_encoder_optimum_fast.c \
100207842Smm	lzma_encoder_optimum_normal.c \
101207842Smm	fastpos_table.c \
102207842Smm	lzma_decoder.c \
103207842Smm	lzma2_encoder.c \
104207842Smm	lzma2_decoder.c
105207842Smm
106207842Smm.PATH: ${LZMADIR}/rangecoder
107207842SmmSRCS+=	price_table.c
108207842Smm
109207842Smm.PATH: ${LZMADIR}/delta
110207842SmmSRCS+=	delta_common.c \
111207842Smm	delta_encoder.c \
112207842Smm	delta_decoder.c
113207842Smm
114207842Smm.PATH: ${LZMADIR}/simple
115207842SmmSRCS+=	simple_coder.c \
116207842Smm	simple_encoder.c \
117207842Smm	simple_decoder.c \
118207842Smm	x86.c \
119207842Smm	powerpc.c \
120207842Smm	ia64.c \
121207842Smm	arm.c \
122207842Smm	armthumb.c \
123207842Smm	sparc.c
124292588Sdelphij
125292588Sdelphij.PATH: ${LZMADIR}
126292588Sdelphij
127292588SdelphijVERSION_MAJOR!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_MAJOR" {print $$3 } ' \
128292588Sdelphij			${LZMADIR}/api/lzma/version.h
129292588SdelphijVERSION_MINOR!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_MINOR" {print $$3 } ' \
130292588Sdelphij			${LZMADIR}/api/lzma/version.h
131292588SdelphijVERSION_PATCH!=	awk '$$1 == "\#define" && $$2 == "LZMA_VERSION_PATCH" {print $$3 } ' \
132292588Sdelphij			${LZMADIR}/api/lzma/version.h
133292588Sdelphij
134207842SmmWARNS?=	3
135207842Smm
136207842SmmCFLAGS+=	-DHAVE_CONFIG_H \
137208099Sdelphij		-DTUKLIB_SYMBOL_PREFIX=lzma_ \
138207842Smm		-I${.CURDIR} \
139207842Smm		-I${LZMADIR}/api \
140207842Smm		-I${LZMADIR}/common \
141207842Smm		-I${LZMADIR}/check \
142207842Smm		-I${LZMADIR}/lz \
143207842Smm		-I${LZMADIR}/rangecoder \
144207842Smm		-I${LZMADIR}/lzma \
145207842Smm		-I${LZMADIR}/delta \
146207842Smm		-I${LZMADIR}/simple \
147313619Sngie		-I${LZMADIR:H}/common
148207842Smm
149292588SdelphijDPADD+=		${LIBPTHREAD}
150292588SdelphijLDADD+=		-lpthread
151292588Sdelphij
152208099SdelphijVERSION_DEF=	${.CURDIR}/Versions.def
153208099SdelphijSYMBOL_MAPS=	${.CURDIR}/Symbol.map
154208099SdelphijCFLAGS+=	-DSYMBOL_VERSIONING
155208099Sdelphij
156292588SdelphijCLEANFILES+=	liblzma.pc
157292588Sdelphij
158292747Sume.if !defined(LIBRARIES_ONLY)
159292588Sdelphijall: liblzma.pc
160292588Sdelphijliblzma.pc: liblzma.pc.in
161292588Sdelphij	@sed -e 's,@prefix@,/usr,g ; \
162292588Sdelphij		s,@exec_prefix@,/usr,g  ; \
163292747Sume		s,@libdir@,/usr/lib,g ; \
164292747Sume		s,@includedir@,/usr/include,g ; \
165292588Sdelphij		s,@PACKAGE_URL@,http://tukaani.org/xz/,g ; \
166292588Sdelphij		s,@PACKAGE_VERSION@,${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},g ; \
167292588Sdelphij		s,@PTHREAD_CFLAGS@,,g ; \
168292588Sdelphij		s,@PTHREAD_LIBS@,,g' ${.ALLSRC} > ${.TARGET}
169292588Sdelphij
170292588Sdelphijbeforeinstall:
171292588Sdelphij	@${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
172292588Sdelphij		liblzma.pc ${DESTDIR}${LIBDATADIR}/pkgconfig
173292747Sume.endif
174292588Sdelphij
175207842Smm.include <bsd.lib.mk>
176