1lib_LTLIBRARIES = libjpeg.la
2libjpeg_la_LDFLAGS = -version-info ${LIBTOOL_CURRENT}:${SO_MINOR_VERSION}:${SO_AGE} -no-undefined
3include_HEADERS = jerror.h jmorecfg.h jpeglib.h
4
5if WITH_TURBOJPEG
6lib_LTLIBRARIES += libturbojpeg.la
7libturbojpeg_la_LDFLAGS = -version-info 1:0:1 -no-undefined
8include_HEADERS += turbojpeg.h
9endif
10
11nodist_include_HEADERS = jconfig.h
12
13
14HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
15	jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h jpegcomp.h \
16	jpeg_nbits_table.h
17
18libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \
19	jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \
20	jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c \
21	jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \
22	jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \
23	jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c \
24	jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c \
25	jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c
26
27if WITH_ARITH
28libjpeg_la_SOURCES += jaricom.c
29endif
30
31if WITH_ARITH_ENC
32libjpeg_la_SOURCES += jcarith.c
33endif
34
35if WITH_ARITH_DEC
36libjpeg_la_SOURCES += jdarith.c
37endif
38
39
40SUBDIRS = java
41
42
43if WITH_TURBOJPEG
44
45libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpeg.c turbojpeg.h \
46	transupp.c transupp.h jdatadst-tj.c jdatasrc-tj.c
47
48if WITH_JAVA
49
50libturbojpeg_la_SOURCES += turbojpeg-jni.c
51libturbojpeg_la_CFLAGS = ${JNI_CFLAGS}
52TJMAPFILE = turbojpeg-mapfile.jni
53
54else
55
56TJMAPFILE = turbojpeg-mapfile
57
58endif
59
60libturbojpeg_la_SOURCES += $(TJMAPFILE)
61
62if VERSION_SCRIPT
63libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/$(TJMAPFILE)
64endif
65
66endif
67
68
69if VERSION_SCRIPT
70libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
71endif
72
73
74if WITH_SIMD
75
76SUBDIRS += simd
77libjpeg_la_LIBADD = simd/libsimd.la
78libturbojpeg_la_LIBADD = simd/libsimd.la
79
80else
81
82libjpeg_la_SOURCES += jsimd_none.c
83
84endif
85
86
87bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom
88noinst_PROGRAMS = jcstest
89
90
91if WITH_TURBOJPEG
92
93bin_PROGRAMS += tjbench
94
95noinst_PROGRAMS += tjunittest
96
97tjbench_SOURCES = tjbench.c bmp.h bmp.c tjutil.h tjutil.c rdbmp.c rdppm.c \
98	wrbmp.c wrppm.c
99
100tjbench_LDADD = libturbojpeg.la libjpeg.la -lm
101
102tjbench_CFLAGS = -DBMP_SUPPORTED -DPPM_SUPPORTED
103
104tjunittest_SOURCES = tjunittest.c tjutil.h tjutil.c
105
106tjunittest_LDADD = libturbojpeg.la
107
108endif
109
110
111cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdgif.c rdppm.c rdswitch.c
112if WITH_12BIT
113else
114cjpeg_SOURCES += rdbmp.c rdtarga.c
115endif
116
117cjpeg_LDADD = libjpeg.la
118
119cjpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED
120if WITH_12BIT
121else
122cjpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED
123endif
124
125djpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c djpeg.c rdcolmap.c rdswitch.c \
126	wrgif.c wrppm.c
127if WITH_12BIT
128else
129djpeg_SOURCES += wrbmp.c wrtarga.c
130endif
131
132djpeg_LDADD = libjpeg.la
133
134djpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED
135if WITH_12BIT
136else
137djpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED
138endif
139
140jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.c transupp.h
141
142jpegtran_LDADD = libjpeg.la
143
144rdjpgcom_SOURCES = rdjpgcom.c
145
146rdjpgcom_LDADD = libjpeg.la
147
148wrjpgcom_SOURCES = wrjpgcom.c
149
150wrjpgcom_LDADD = libjpeg.la
151
152jcstest_SOURCES = jcstest.c
153
154jcstest_LDADD = libjpeg.la
155
156dist_man1_MANS = cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1
157
158DOCS= coderules.txt jconfig.txt change.log rdrle.c wrrle.c BUILDING.txt \
159	ChangeLog.txt
160
161dist_doc_DATA = README README-turbo.txt libjpeg.txt structure.txt usage.txt \
162	wizard.txt
163
164exampledir = $(docdir)
165dist_example_DATA = example.c
166
167
168EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \
169	sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \
170	doxygen-extra.css jccolext.c jdcolext.c jdcol565.c jdmrgext.c jdmrg565.c \
171	jstdhuff.c jdcoefct.h jdmainct.h jdmaster.h jdsample.h wrppm.h \
172	md5/CMakeLists.txt
173
174dist-hook:
175	rm -rf `find $(distdir) -name .svn`
176
177
178SUBDIRS += md5
179
180if WITH_12BIT
181
182TESTORIG = testorig12.jpg
183MD5_JPEG_RGB_ISLOW = 9620f424569594bb9242b48498ad801f
184MD5_PPM_RGB_ISLOW = f3301d2219783b8b3d942b7239fa50c0
185MD5_JPEG_422_IFAST_OPT = 7322e3bd2f127f7de4b40d4480ce60e4
186MD5_PPM_422_IFAST = 79807fa552899e66a04708f533e16950
187MD5_PPM_422M_IFAST = 07737bfe8a7c1c87aaa393a0098d16b0
188MD5_JPEG_420_IFAST_Q100_PROG = a1da220b5604081863a504297ed59e55
189MD5_PPM_420_Q100_IFAST = 1b3730122709f53d007255e8dfd3305e
190MD5_PPM_420M_Q100_IFAST = 980a1a3c5bf9510022869d30b7d26566
191MD5_JPEG_GRAY_ISLOW = 235c90707b16e2e069f37c888b2636d9
192MD5_PPM_GRAY_ISLOW = 7213c10af507ad467da5578ca5ee1fca
193MD5_PPM_GRAY_ISLOW_RGB = e96ee81c30a6ed422d466338bd3de65d
194MD5_JPEG_420S_IFAST_OPT = 7af8e60be4d9c227ec63ac9b6630855e
195MD5_JPEG_3x2_FLOAT_PROG_SSE = a8c17daf77b457725ec929e215b603f8
196MD5_PPM_3x2_FLOAT_SSE = 42876ab9e5c2f76a87d08db5fbd57956
197MD5_JPEG_3x2_FLOAT_PROG_32BIT = a8c17daf77b457725ec929e215b603f8
198MD5_PPM_3x2_FLOAT_32BIT = 42876ab9e5c2f76a87d08db5fbd57956
199MD5_PPM_3x2_FLOAT_64BIT = d6fbc71153b3d8ded484dbc17c7b9cf4
200MD5_JPEG_3x2_IFAST_PROG = 1396cc2b7185cfe943d408c9d305339e
201MD5_PPM_3x2_IFAST = 3975985ef6eeb0a2cdc58daa651ccc00
202MD5_PPM_420M_ISLOW_2_1 = 4ca6be2a6f326ff9eaab63e70a8259c0
203MD5_PPM_420M_ISLOW_15_8 = 12aa9f9534c1b3d7ba047322226365eb
204MD5_PPM_420M_ISLOW_13_8 = f7e22817c7b25e1393e4ec101e9d4e96
205MD5_PPM_420M_ISLOW_11_8 = 800a16f9f4dc9b293197bfe11be10a82
206MD5_PPM_420M_ISLOW_9_8 = 06b7a92a9bc69f4dc36ec40f1937d55c
207MD5_PPM_420M_ISLOW_7_8 = 3ec444a14a4ab4eab88ffc49c48eca43
208MD5_PPM_420M_ISLOW_3_4 = 3e726b7ea872445b19437d1c1d4f0d93
209MD5_PPM_420M_ISLOW_5_8 = a8a771abdc94301d20ffac119b2caccd
210MD5_PPM_420M_ISLOW_1_2 = b419124dd5568b085787234866102866
211MD5_PPM_420M_ISLOW_3_8 = 343d19015531b7bbe746124127244fa8
212MD5_PPM_420M_ISLOW_1_4 = 35fd59d866e44659edfa3c18db2a3edb
213MD5_PPM_420M_ISLOW_1_8 = ccaed48ac0aedefda5d4abe4013f4ad7
214MD5_PPM_420_ISLOW_SKIP15_31 = 86664cd9dc956536409e44e244d20a97
215MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = 452a21656115a163029cfba5c04fa76a
216MD5_PPM_444_ISLOW_SKIP1_6 = ef63901f71ef7a75cd78253fc0914f84
217MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = 15b173fb5872d9575572fbcc1b05956f
218MD5_JPEG_CROP = cdb35ff4b4519392690ea040c56ea99c
219
220else
221
222TESTORIG = testorig.jpg
223MD5_JPEG_RGB_ISLOW = 768e970dd57b340ff1b83c9d3d47c77b
224MD5_PPM_RGB_ISLOW = 00a257f5393fef8821f2b88ac7421291
225MD5_BMP_RGB_ISLOW_565 = f07d2e75073e4bb10f6c6f4d36e2e3be
226MD5_BMP_RGB_ISLOW_565D = 4cfa0928ef3e6bb626d7728c924cfda4
227MD5_JPEG_422_IFAST_OPT = 2540287b79d913f91665e660303ab2c8
228MD5_PPM_422_IFAST = 35bd6b3f833bad23de82acea847129fa
229MD5_PPM_422M_IFAST = 8dbc65323d62cca7c91ba02dd1cfa81d
230MD5_BMP_422M_IFAST_565 = 3294bd4d9a1f2b3d08ea6020d0db7065
231MD5_BMP_422M_IFAST_565D = da98c9c7b6039511be4a79a878a9abc1
232MD5_JPEG_420_IFAST_Q100_PROG = 990cbe0329c882420a2094da7e5adade
233MD5_PPM_420_Q100_IFAST = 5a732542015c278ff43635e473a8a294
234MD5_PPM_420M_Q100_IFAST = ff692ee9323a3b424894862557c092f1
235MD5_JPEG_GRAY_ISLOW = 72b51f894b8f4a10b3ee3066770aa38d
236MD5_PPM_GRAY_ISLOW = 8d3596c56eace32f205deccc229aa5ed
237MD5_PPM_GRAY_ISLOW_RGB = 116424ac07b79e5e801f00508eab48ec
238MD5_BMP_GRAY_ISLOW_565 = 12f78118e56a2f48b966f792fedf23cc
239MD5_BMP_GRAY_ISLOW_565D = bdbbd616441a24354c98553df5dc82db
240MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8
241# See README-turbo.txt for more details on why this next bit is necessary.
242MD5_JPEG_3x2_FLOAT_PROG_SSE = 343e3f8caf8af5986ebaf0bdc13b5c71
243MD5_PPM_3x2_FLOAT_SSE = 1a75f36e5904d6fc3a85a43da9ad89bb
244MD5_JPEG_3x2_FLOAT_PROG_32BIT = 9bca803d2042bd1eb03819e2bf92b3e5
245MD5_PPM_3x2_FLOAT_32BIT = f6bfab038438ed8f5522fbd33595dcdc
246MD5_PPM_3x2_FLOAT_64BIT = 0e917a34193ef976b679a6b069b1be26
247MD5_JPEG_3x2_IFAST_PROG = 1ee5d2c1a77f2da495f993c8c7cceca5
248MD5_PPM_3x2_IFAST = fd283664b3b49127984af0a7f118fccd
249MD5_JPEG_420_ISLOW_ARI = e986fb0a637a8d833d96e8a6d6d84ea1
250MD5_JPEG_444_ISLOW_PROGARI = 0a8f1c8f66e113c3cf635df0a475a617
251MD5_PPM_420M_IFAST_ARI = 72b59a99bcf1de24c5b27d151bde2437
252MD5_JPEG_420_ISLOW = 9a68f56bc76e466aa7e52f415d0f4a5f
253MD5_PPM_420M_ISLOW_2_1 = 9f9de8c0612f8d06869b960b05abf9c9
254MD5_PPM_420M_ISLOW_15_8 = b6875bc070720b899566cc06459b63b7
255MD5_PPM_420M_ISLOW_13_8 = bc3452573c8152f6ae552939ee19f82f
256MD5_PPM_420M_ISLOW_11_8 = d8cc73c0aaacd4556569b59437ba00a5
257MD5_PPM_420M_ISLOW_9_8 = d25e61bc7eac0002f5b393aa223747b6
258MD5_PPM_420M_ISLOW_7_8 = ddb564b7c74a09494016d6cd7502a946
259MD5_PPM_420M_ISLOW_3_4 = 8ed8e68808c3fbc4ea764fc9d2968646
260MD5_PPM_420M_ISLOW_5_8 = a3363274999da2366a024efae6d16c9b
261MD5_PPM_420M_ISLOW_1_2 = e692a315cea26b988c8e8b29a5dbcd81
262MD5_PPM_420M_ISLOW_3_8 = 79eca9175652ced755155c90e785a996
263MD5_PPM_420M_ISLOW_1_4 = 79cd778f8bf1a117690052cacdd54eca
264MD5_PPM_420M_ISLOW_1_8 = 391b3d4aca640c8567d6f8745eb2142f
265MD5_BMP_420_ISLOW_256 = 4980185e3776e89bd931736e1cddeee6
266MD5_BMP_420_ISLOW_565 = bf9d13e16c4923b92e1faa604d7922cb
267MD5_BMP_420_ISLOW_565D = 6bde71526acc44bcff76f696df8638d2
268MD5_BMP_420M_ISLOW_565 = 8dc0185245353cfa32ad97027342216f
269MD5_BMP_420M_ISLOW_565D =d1be3a3339166255e76fa50a0d70d73e
270MD5_PPM_420_ISLOW_SKIP15_31 = c4c65c1e43d7275cd50328a61e6534f0
271MD5_PPM_420_ISLOW_ARI_SKIP16_139 = 087c6b123db16ac00cb88c5b590bb74a
272MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = 26eb36ccc7d1f0cb80cdabb0ac8b5d99
273MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 = 886c6775af22370257122f8b16207e6d
274MD5_PPM_444_ISLOW_SKIP1_6 = 5606f86874cf26b8fcee1117a0a436a6
275MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = db87dc7ce26bcdc7a6b56239ce2b9d6c
276MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 = cb57b32bd6d03e35432362f7bf184b6d
277MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d
278
279endif
280
281.PHONY: test
282test: tjquicktest tjbittest bittest
283
284tjquicktest: testclean all
285
286if WITH_TURBOJPEG
287if WITH_JAVA
288	$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest
289	$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -bi
290	$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv
291	$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -noyuvpad
292	$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi
293	$(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi -noyuvpad
294endif
295	./tjunittest
296	./tjunittest -alloc
297	./tjunittest -yuv
298	./tjunittest -yuv -alloc
299	./tjunittest -yuv -noyuvpad
300endif
301	echo GREAT SUCCESS!
302
303tjbittest: testclean all
304
305if WITH_TURBOJPEG
306
307MD5_PPM_GRAY_TILE = 89d3ca21213d9d864b50b4e4e7de4ca6
308MD5_PPM_420_8x8_TILE = 847fceab15c5b7b911cb986cf0f71de3
309MD5_PPM_420_16x16_TILE = ca45552a93687e078f7137cc4126a7b0
310MD5_PPM_420_32x32_TILE = d8676f1d6b68df358353bba9844f4a00
311MD5_PPM_420_64x64_TILE = 4e4c1a3d7ea4bace4f868bcbe83b7050
312MD5_PPM_420_128x128_TILE = f24c3429c52265832beab9df72a0ceae
313MD5_PPM_420M_8x8_TILE = bc25320e1f4c31ce2e610e43e9fd173c
314MD5_PPM_420M_TILE = 75ffdf14602258c5c189522af57fa605
315MD5_PPM_422_8x8_TILE = d83dacd9fc73b0a6f10c09acad64eb1e
316MD5_PPM_422_16x16_TILE = 35077fb610d72dd743b1eb0cbcfe10fb
317MD5_PPM_422_32x32_TILE = e6902ed8a449ecc0f0d6f2bf945f65f7
318MD5_PPM_422_64x64_TILE = 2b4502a8f316cedbde1da7bce3d2231e
319MD5_PPM_422_128x128_TILE = f0b5617d578f5e13c8eee215d64d4877
320MD5_PPM_422M_8x8_TILE = 828941d7f41cd6283abd6beffb7fd51d
321MD5_PPM_422M_TILE = e877ae1324c4a280b95376f7f018172f
322MD5_PPM_444_TILE = 7964e41e67cfb8d0a587c0aa4798f9c3
323
324# Test compressing from/decompressing to an arbitrary subregion of a larger
325# image buffer
326	cp $(srcdir)/testimages/testorig.ppm testout_tile.ppm
327	./tjbench testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 >/dev/null 2>&1
328	for i in 8 16 32 64 128; do \
329		md5/md5cmp $(MD5_PPM_GRAY_TILE) testout_tile_GRAY_Q95_$$i\x$$i.ppm; \
330	done
331	md5/md5cmp $(MD5_PPM_420_8x8_TILE) testout_tile_420_Q95_8x8.ppm
332	md5/md5cmp $(MD5_PPM_420_16x16_TILE) testout_tile_420_Q95_16x16.ppm
333	md5/md5cmp $(MD5_PPM_420_32x32_TILE) testout_tile_420_Q95_32x32.ppm
334	md5/md5cmp $(MD5_PPM_420_64x64_TILE) testout_tile_420_Q95_64x64.ppm
335	md5/md5cmp $(MD5_PPM_420_128x128_TILE) testout_tile_420_Q95_128x128.ppm
336	md5/md5cmp $(MD5_PPM_422_8x8_TILE) testout_tile_422_Q95_8x8.ppm
337	md5/md5cmp $(MD5_PPM_422_16x16_TILE) testout_tile_422_Q95_16x16.ppm
338	md5/md5cmp $(MD5_PPM_422_32x32_TILE) testout_tile_422_Q95_32x32.ppm
339	md5/md5cmp $(MD5_PPM_422_64x64_TILE) testout_tile_422_Q95_64x64.ppm
340	md5/md5cmp $(MD5_PPM_422_128x128_TILE) testout_tile_422_Q95_128x128.ppm
341	for i in 8 16 32 64 128; do \
342		md5/md5cmp $(MD5_PPM_444_TILE) testout_tile_444_Q95_$$i\x$$i.ppm; \
343	done
344	rm testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_*
345
346	./tjbench testout_tile.ppm 95 -rgb -fastupsample -quiet -tile -benchtime 0.01 >/dev/null 2>&1
347	md5/md5cmp $(MD5_PPM_420M_8x8_TILE) testout_tile_420_Q95_8x8.ppm
348	for i in 16 32 64 128; do \
349		md5/md5cmp $(MD5_PPM_420M_TILE) testout_tile_420_Q95_$$i\x$$i.ppm; \
350	done
351	md5/md5cmp $(MD5_PPM_422M_8x8_TILE) testout_tile_422_Q95_8x8.ppm
352	for i in 16 32 64 128; do \
353		md5/md5cmp $(MD5_PPM_422M_TILE) testout_tile_422_Q95_$$i\x$$i.ppm; \
354	done
355	rm testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* testout_tile.ppm
356	echo GREAT SUCCESS!
357
358endif
359
360bittest: testclean all
361
362# These tests are carefully crafted to provide full coverage of as many of the
363# underlying algorithms as possible (including all of the SIMD-accelerated
364# ones.)
365
366# CC: null  SAMP: fullsize  FDCT: islow  ENT: huff
367	./cjpeg -rgb -dct int -outfile testout_rgb_islow.jpg $(srcdir)/testimages/testorig.ppm
368	md5/md5cmp $(MD5_JPEG_RGB_ISLOW) testout_rgb_islow.jpg
369# CC: null  SAMP: fullsize  IDCT: islow  ENT: huff
370	./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg
371	md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm
372	rm testout_rgb_islow.ppm
373if WITH_12BIT
374	rm testout_rgb_islow.jpg
375else
376# CC: RGB->RGB565  SAMP: fullsize  IDCT: islow  ENT: huff
377	./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg
378	md5/md5cmp $(MD5_BMP_RGB_ISLOW_565) testout_rgb_islow_565.bmp
379	rm testout_rgb_islow_565.bmp
380# CC: RGB->RGB565 (dithered)  SAMP: fullsize  IDCT: islow  ENT: huff
381	./djpeg -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg
382	md5/md5cmp $(MD5_BMP_RGB_ISLOW_565D) testout_rgb_islow_565D.bmp
383	rm testout_rgb_islow_565D.bmp testout_rgb_islow.jpg
384endif
385
386# CC: RGB->YCC  SAMP: fullsize/h2v1  FDCT: ifast  ENT: 2-pass huff
387	./cjpeg -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm
388	md5/md5cmp $(MD5_JPEG_422_IFAST_OPT) testout_422_ifast_opt.jpg
389# CC: YCC->RGB  SAMP: fullsize/h2v1 fancy  IDCT: ifast  ENT: huff
390	./djpeg -dct fast -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg
391	md5/md5cmp $(MD5_PPM_422_IFAST) testout_422_ifast.ppm
392	rm testout_422_ifast.ppm
393# CC: YCC->RGB  SAMP: h2v1 merged  IDCT: ifast  ENT: huff
394	./djpeg -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg
395	md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm
396	rm testout_422m_ifast.ppm
397if WITH_12BIT
398	rm testout_422_ifast_opt.jpg
399else
400# CC: YCC->RGB565  SAMP: h2v1 merged  IDCT: ifast  ENT: huff
401	./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg
402	md5/md5cmp $(MD5_BMP_422M_IFAST_565) testout_422m_ifast_565.bmp
403	rm testout_422m_ifast_565.bmp
404# CC: YCC->RGB565 (dithered)  SAMP: h2v1 merged  IDCT: ifast  ENT: huff
405	./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg
406	md5/md5cmp $(MD5_BMP_422M_IFAST_565D) testout_422m_ifast_565D.bmp
407	rm testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg
408endif
409
410# CC: RGB->YCC  SAMP: fullsize/h2v2  FDCT: ifast  ENT: prog huff
411	./cjpeg -sample 2x2 -quality 100 -dct fast -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm
412	md5/md5cmp $(MD5_JPEG_420_IFAST_Q100_PROG) testout_420_q100_ifast_prog.jpg
413# CC: YCC->RGB  SAMP: fullsize/h2v2 fancy  IDCT: ifast  ENT: prog huff
414	./djpeg -dct fast -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
415	md5/md5cmp $(MD5_PPM_420_Q100_IFAST) testout_420_q100_ifast.ppm
416	rm testout_420_q100_ifast.ppm
417# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: ifast  ENT: prog huff
418	./djpeg -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
419	md5/md5cmp $(MD5_PPM_420M_Q100_IFAST) testout_420m_q100_ifast.ppm
420	rm testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
421
422# CC: RGB->Gray  SAMP: fullsize  FDCT: islow  ENT: huff
423	./cjpeg -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm
424	md5/md5cmp $(MD5_JPEG_GRAY_ISLOW) testout_gray_islow.jpg
425# CC: Gray->Gray  SAMP: fullsize  IDCT: islow  ENT: huff
426	./djpeg -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg
427	md5/md5cmp $(MD5_PPM_GRAY_ISLOW) testout_gray_islow.ppm
428	rm testout_gray_islow.ppm
429# CC: Gray->RGB  SAMP: fullsize  IDCT: islow  ENT: huff
430	./djpeg -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg
431	md5/md5cmp $(MD5_PPM_GRAY_ISLOW_RGB) testout_gray_islow_rgb.ppm
432	rm testout_gray_islow_rgb.ppm
433if WITH_12BIT
434	rm testout_gray_islow.jpg
435else
436# CC: Gray->RGB565  SAMP: fullsize  IDCT: islow  ENT: huff
437	./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg
438	md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565) testout_gray_islow_565.bmp
439	rm testout_gray_islow_565.bmp
440# CC: Gray->RGB565 (dithered)  SAMP: fullsize  IDCT: islow  ENT: huff
441	./djpeg -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg
442	md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565D) testout_gray_islow_565D.bmp
443	rm testout_gray_islow_565D.bmp testout_gray_islow.jpg
444endif
445
446# CC: RGB->YCC  SAMP: fullsize smooth/h2v2 smooth  FDCT: islow
447# ENT: 2-pass huff
448	./cjpeg -sample 2x2 -smooth 1 -dct int -opt -outfile testout_420s_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm
449	md5/md5cmp $(MD5_JPEG_420S_IFAST_OPT) testout_420s_ifast_opt.jpg
450	rm testout_420s_ifast_opt.jpg
451
452# The output of the floating point tests is not validated by default, because
453# the output differs depending on the type of floating point math used, and
454# this is only deterministic if the DCT/IDCT are implemented using SIMD
455# instructions on a particular platform.  Pass one of the following on the make
456# command line to validate the floating point tests against one of the expected # results:
457#
458# FLOATTEST=sse  validate against the expected results from the libjpeg-turbo
459#                SSE SIMD extensions
460# FLOATTEST=32bit  validate against the expected results from the C code
461#                  when running on a 32-bit FPU (or when SSE is being used for
462#                  floating point math, which is generally the default with
463#                  x86-64 compilers)
464# FLOATTEST=64bit  validate against the exepected results from the C code
465#                  when running on a 64-bit FPU
466
467# CC: RGB->YCC  SAMP: fullsize/int  FDCT: float  ENT: prog huff
468	./cjpeg -sample 3x2 -dct float -prog -outfile testout_3x2_float_prog.jpg $(srcdir)/testimages/testorig.ppm
469	if [ "${FLOATTEST}" = "sse" ]; then \
470		md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_SSE) testout_3x2_float_prog.jpg; \
471	elif [ "${FLOATTEST}" = "32bit" -o "${FLOATTEST}" = "64bit" ]; then \
472		md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_32BIT) testout_3x2_float_prog.jpg; \
473	fi
474# CC: YCC->RGB  SAMP: fullsize/int  IDCT: float  ENT: prog huff
475	./djpeg -dct float -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg
476	if [ "${FLOATTEST}" = "sse" ]; then \
477		md5/md5cmp $(MD5_PPM_3x2_FLOAT_SSE) testout_3x2_float.ppm; \
478	elif [ "${FLOATTEST}" = "32bit" ]; then \
479		md5/md5cmp $(MD5_PPM_3x2_FLOAT_32BIT) testout_3x2_float.ppm; \
480	elif [ "${FLOATTEST}" = "64bit" ]; then \
481		md5/md5cmp $(MD5_PPM_3x2_FLOAT_64BIT) testout_3x2_float.ppm; \
482	fi
483	rm testout_3x2_float.ppm testout_3x2_float_prog.jpg
484
485# CC: RGB->YCC  SAMP: fullsize/int  FDCT: ifast  ENT: prog huff
486	./cjpeg -sample 3x2 -dct fast -prog -outfile testout_3x2_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm
487	md5/md5cmp $(MD5_JPEG_3x2_IFAST_PROG) testout_3x2_ifast_prog.jpg
488# CC: YCC->RGB  SAMP: fullsize/int  IDCT: ifast  ENT: prog huff
489	./djpeg -dct fast -outfile testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg
490	md5/md5cmp $(MD5_PPM_3x2_IFAST) testout_3x2_ifast.ppm
491	rm testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg
492
493if WITH_ARITH_ENC
494# CC: YCC->RGB  SAMP: fullsize/h2v2  FDCT: islow  ENT: arith
495	./cjpeg -dct int -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testorig.ppm
496	md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg
497	rm testout_420_islow_ari.jpg
498	./jpegtran -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testimgint.jpg
499	md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg
500	rm testout_420_islow_ari.jpg
501# CC: YCC->RGB  SAMP: fullsize  FDCT: islow  ENT: prog arith
502	./cjpeg -sample 1x1 -dct int -prog -arithmetic -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm
503	md5/md5cmp $(MD5_JPEG_444_ISLOW_PROGARI) testout_444_islow_progari.jpg
504	rm testout_444_islow_progari.jpg
505endif
506if WITH_ARITH_DEC
507# CC: RGB->YCC  SAMP: h2v2 merged  IDCT: ifast  ENT: arith
508	./djpeg -fast -ppm -outfile testout_420m_ifast_ari.ppm $(srcdir)/testimages/testimgari.jpg
509	md5/md5cmp $(MD5_PPM_420M_IFAST_ARI) testout_420m_ifast_ari.ppm
510	rm testout_420m_ifast_ari.ppm
511	./jpegtran -outfile testout_420_islow.jpg $(srcdir)/testimages/testimgari.jpg
512	md5/md5cmp $(MD5_JPEG_420_ISLOW) testout_420_islow.jpg
513	rm testout_420_islow.jpg
514endif
515
516# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 16x16 islow  ENT: huff
517	./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/$(TESTORIG)
518	md5/md5cmp $(MD5_PPM_420M_ISLOW_2_1) testout_420m_islow_2_1.ppm
519	rm testout_420m_islow_2_1.ppm
520# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 15x15 islow  ENT: huff
521	./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/$(TESTORIG)
522	md5/md5cmp $(MD5_PPM_420M_ISLOW_15_8) testout_420m_islow_15_8.ppm
523	rm testout_420m_islow_15_8.ppm
524# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 13x13 islow  ENT: huff
525	./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/$(TESTORIG)
526	md5/md5cmp $(MD5_PPM_420M_ISLOW_13_8) testout_420m_islow_13_8.ppm
527	rm testout_420m_islow_13_8.ppm
528# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 11x11 islow  ENT: huff
529	./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/$(TESTORIG)
530	md5/md5cmp $(MD5_PPM_420M_ISLOW_11_8) testout_420m_islow_11_8.ppm
531	rm testout_420m_islow_11_8.ppm
532# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 9x9 islow  ENT: huff
533	./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/$(TESTORIG)
534	md5/md5cmp $(MD5_PPM_420M_ISLOW_9_8) testout_420m_islow_9_8.ppm
535	rm testout_420m_islow_9_8.ppm
536# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 7x7 islow/14x14 islow  ENT: huff
537	./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/$(TESTORIG)
538	md5/md5cmp $(MD5_PPM_420M_ISLOW_7_8) testout_420m_islow_7_8.ppm
539	rm testout_420m_islow_7_8.ppm
540# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 6x6 islow/12x12 islow  ENT: huff
541	./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/$(TESTORIG)
542	md5/md5cmp $(MD5_PPM_420M_ISLOW_3_4) testout_420m_islow_3_4.ppm
543	rm testout_420m_islow_3_4.ppm
544# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 5x5 islow/10x10 islow  ENT: huff
545	./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/$(TESTORIG)
546	md5/md5cmp $(MD5_PPM_420M_ISLOW_5_8) testout_420m_islow_5_8.ppm
547	rm testout_420m_islow_5_8.ppm
548# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 4x4 islow/8x8 islow  ENT: huff
549	./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/$(TESTORIG)
550	md5/md5cmp $(MD5_PPM_420M_ISLOW_1_2) testout_420m_islow_1_2.ppm
551	rm testout_420m_islow_1_2.ppm
552# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 3x3 islow/6x6 islow  ENT: huff
553	./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/$(TESTORIG)
554	md5/md5cmp $(MD5_PPM_420M_ISLOW_3_8) testout_420m_islow_3_8.ppm
555	rm testout_420m_islow_3_8.ppm
556# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 2x2 islow/4x4 islow  ENT: huff
557	./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/$(TESTORIG)
558	md5/md5cmp $(MD5_PPM_420M_ISLOW_1_4) testout_420m_islow_1_4.ppm
559	rm testout_420m_islow_1_4.ppm
560# CC: YCC->RGB  SAMP: h2v2 merged  IDCT: 1x1 islow/2x2 islow  ENT: huff
561	./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/$(TESTORIG)
562	md5/md5cmp $(MD5_PPM_420M_ISLOW_1_8) testout_420m_islow_1_8.ppm
563	rm testout_420m_islow_1_8.ppm
564if WITH_12BIT
565else
566# CC: YCC->RGB (dithered)  SAMP: h2v2 fancy  IDCT: islow  ENT: huff
567	./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/$(TESTORIG)
568	md5/md5cmp $(MD5_BMP_420_ISLOW_256) testout_420_islow_256.bmp
569	rm testout_420_islow_256.bmp
570# CC: YCC->RGB565  SAMP: h2v2 fancy  IDCT: islow  ENT: huff
571	./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/$(TESTORIG)
572	md5/md5cmp $(MD5_BMP_420_ISLOW_565) testout_420_islow_565.bmp
573	rm testout_420_islow_565.bmp
574# CC: YCC->RGB565 (dithered)  SAMP: h2v2 fancy  IDCT: islow  ENT: huff
575	./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG)
576	md5/md5cmp $(MD5_BMP_420_ISLOW_565D) testout_420_islow_565D.bmp
577	rm testout_420_islow_565D.bmp
578# CC: YCC->RGB565  SAMP: h2v2 merged  IDCT: islow  ENT: huff
579	./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/$(TESTORIG)
580	md5/md5cmp $(MD5_BMP_420M_ISLOW_565) testout_420m_islow_565.bmp
581	rm testout_420m_islow_565.bmp
582# CC: YCC->RGB565 (dithered)  SAMP: h2v2 merged  IDCT: islow  ENT: huff
583	./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG)
584	md5/md5cmp $(MD5_BMP_420M_ISLOW_565D) testout_420m_islow_565D.bmp
585	rm testout_420m_islow_565D.bmp
586endif
587
588# Partial decode tests.  These tests are designed to cover all of the possible
589# code paths in jpeg_skip_scanlines().
590
591# Context rows: Yes  Intra-iMCU row: Yes  iMCU row prefetch: No   ENT: huff
592	./djpeg -dct int -skip 15,31 -ppm -outfile testout_420_islow_skip15,31.ppm $(srcdir)/testimages/$(TESTORIG)
593	md5/md5cmp $(MD5_PPM_420_ISLOW_SKIP15_31) testout_420_islow_skip15,31.ppm
594	rm testout_420_islow_skip15,31.ppm
595# Context rows: Yes  Intra-iMCU row: No   iMCU row prefetch: Yes  ENT: arith
596if WITH_ARITH_DEC
597	./djpeg -dct int -skip 16,139 -ppm -outfile testout_420_islow_ari_skip16,139.ppm $(srcdir)/testimages/testimgari.jpg
598	md5/md5cmp $(MD5_PPM_420_ISLOW_ARI_SKIP16_139) testout_420_islow_ari_skip16,139.ppm
599	rm testout_420_islow_ari_skip16,139.ppm
600endif
601# Context rows: Yes  Intra-iMCU row: No   iMCU row prefetch: No   ENT: prog huff
602	./cjpeg -dct int -prog -outfile testout_420_islow_prog.jpg $(srcdir)/testimages/testorig.ppm
603	./djpeg -dct int -crop 62x62+71+71 -ppm -outfile testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg
604	md5/md5cmp $(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71) testout_420_islow_prog_crop62x62,71,71.ppm
605	rm -f testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg
606# Context rows: Yes  Intra-iMCU row: No   iMCU row prefetch: No   ENT: arith
607if WITH_ARITH_DEC
608	./djpeg -dct int -crop 53x53+4+4 -ppm -outfile testout_420_islow_ari_crop53x53,4,4.ppm $(srcdir)/testimages/testimgari.jpg
609	md5/md5cmp $(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4) testout_420_islow_ari_crop53x53,4,4.ppm
610	rm -f testout_420_islow_ari_crop53x53,4,4.ppm
611endif
612# Context rows: No   Intra-iMCU row: Yes  ENT: huff
613	./cjpeg -dct int -sample 1x1 -outfile testout_444_islow.jpg $(srcdir)/testimages/testorig.ppm
614	./djpeg -dct int -skip 1,6 -ppm -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg
615	md5/md5cmp $(MD5_PPM_444_ISLOW_SKIP1_6) testout_444_islow_skip1,6.ppm
616	rm testout_444_islow_skip1,6.ppm testout_444_islow.jpg
617# Context rows: No   Intra-iMCU row: No   ENT: prog huff
618	./cjpeg -dct int -prog -sample 1x1 -outfile testout_444_islow_prog.jpg $(srcdir)/testimages/testorig.ppm
619	./djpeg -dct int -crop 98x98+13+13 -ppm -outfile testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg
620	md5/md5cmp $(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13) testout_444_islow_prog_crop98x98,13,13.ppm
621	rm -f testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg
622# Context rows: No   Intra-iMCU row: No   ENT: arith
623if WITH_ARITH_ENC
624	./cjpeg -dct int -arithmetic -sample 1x1 -outfile testout_444_islow_ari.jpg $(srcdir)/testimages/testorig.ppm
625if WITH_ARITH_DEC
626	./djpeg -dct int -crop 37x37+0+0 -ppm -outfile testout_444_islow_ari_crop37x37,0,0.ppm testout_444_islow_ari.jpg
627	md5/md5cmp $(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0) testout_444_islow_ari_crop37x37,0,0.ppm
628	rm -f testout_444_islow_ari_crop37x37,0,0.ppm
629endif
630	rm testout_444_islow_ari.jpg
631endif
632
633	./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/$(TESTORIG)
634	md5/md5cmp $(MD5_JPEG_CROP) testout_crop.jpg
635	rm testout_crop.jpg
636	echo GREAT SUCCESS!
637
638
639testclean:
640	rm -f testout*
641	rm -f *_GRAY_*.bmp
642	rm -f *_GRAY_*.png
643	rm -f *_GRAY_*.ppm
644	rm -f *_GRAY_*.jpg
645	rm -f *_GRAY.yuv
646	rm -f *_420_*.bmp
647	rm -f *_420_*.png
648	rm -f *_420_*.ppm
649	rm -f *_420_*.jpg
650	rm -f *_420.yuv
651	rm -f *_422_*.bmp
652	rm -f *_422_*.png
653	rm -f *_422_*.ppm
654	rm -f *_422_*.jpg
655	rm -f *_422.yuv
656	rm -f *_444_*.bmp
657	rm -f *_444_*.png
658	rm -f *_444_*.ppm
659	rm -f *_444_*.jpg
660	rm -f *_444.yuv
661	rm -f *_440_*.bmp
662	rm -f *_440_*.png
663	rm -f *_440_*.ppm
664	rm -f *_440_*.jpg
665	rm -f *_440.yuv
666	rm -f *_411_*.bmp
667	rm -f *_411_*.png
668	rm -f *_411_*.ppm
669	rm -f *_411_*.jpg
670	rm -f *_411.yuv
671
672
673tjtest:
674	sh ./tjbenchtest
675	sh ./tjbenchtest -alloc
676	sh ./tjbenchtest -yuv
677	sh ./tjbenchtest -yuv -alloc
678if WITH_JAVA
679	sh ./tjbenchtest.java
680	sh ./tjbenchtest.java -yuv
681endif
682
683
684pkgscripts/libjpeg-turbo.spec: pkgscripts/libjpeg-turbo.spec.tmpl
685	cat pkgscripts/libjpeg-turbo.spec.tmpl | sed s@%{__prefix}@$(prefix)@g | \
686		sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \
687		sed s@%{__docdir}@$(docdir)@g | sed s@%{__includedir}@$(includedir)@g | \
688		sed s@%{__libdir}@$(libdir)@g | sed s@%{__mandir}@$(mandir)@g \
689		> pkgscripts/libjpeg-turbo.spec
690
691rpm: all pkgscripts/libjpeg-turbo.spec
692	TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
693	mkdir -p $$TMPDIR/RPMS; \
694	ln -fs `pwd` $$TMPDIR/BUILD; \
695	rm -f ${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \
696	rpmbuild -bb --define "_blddir $$TMPDIR/buildroot"  \
697		--define "_topdir $$TMPDIR" \
698		--target ${RPMARCH} pkgscripts/libjpeg-turbo.spec; \
699	cp $$TMPDIR/RPMS/${RPMARCH}/${PKGNAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm \
700		${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \
701	rm -rf $$TMPDIR
702
703srpm: dist-gzip pkgscripts/libjpeg-turbo.spec
704	TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
705	mkdir -p $$TMPDIR/RPMS; \
706	mkdir -p $$TMPDIR/SRPMS; \
707	mkdir -p $$TMPDIR/BUILD; \
708	mkdir -p $$TMPDIR/SOURCES; \
709	mkdir -p $$TMPDIR/SPECS; \
710	rm -f ${PKGNAME}-${VERSION}.src.rpm; \
711	cp ${PACKAGE_NAME}-${VERSION}.tar.gz $$TMPDIR/SOURCES; \
712	cat pkgscripts/libjpeg-turbo.spec | sed s/%{_blddir}/%{_tmppath}/g \
713		| sed s/#--\>//g \
714		> $$TMPDIR/SPECS/libjpeg-turbo.spec; \
715	rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/libjpeg-turbo.spec; \
716	cp $$TMPDIR/SRPMS/${PKGNAME}-${VERSION}-${BUILD}.src.rpm \
717		${PKGNAME}-${VERSION}.src.rpm; \
718	rm -rf $$TMPDIR
719
720pkgscripts/makedpkg: pkgscripts/makedpkg.tmpl
721	cat pkgscripts/makedpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
722		sed s@%{__docdir}@$(docdir)@g | sed s@%{__libdir}@$(libdir)@g \
723		> pkgscripts/makedpkg
724
725deb: all pkgscripts/makedpkg
726	sh pkgscripts/makedpkg
727
728pkgscripts/uninstall: pkgscripts/uninstall.tmpl
729	cat pkgscripts/uninstall.tmpl | sed s@%{__prefix}@$(prefix)@g | \
730		sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \
731		sed s@%{__includedir}@$(includedir)@g | sed s@%{__libdir}@$(libdir)@g | \
732		sed s@%{__mandir}@$(mandir)@g > pkgscripts/uninstall
733
734pkgscripts/makemacpkg: pkgscripts/makemacpkg.tmpl
735	cat pkgscripts/makemacpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
736		sed s@%{__bindir}@$(bindir)@g | sed s@%{__docdir}@$(docdir)@g | \
737		sed s@%{__libdir}@$(libdir)@g > pkgscripts/makemacpkg
738
739if X86_64
740
741udmg: all pkgscripts/makemacpkg pkgscripts/uninstall
742	sh pkgscripts/makemacpkg -build32 ${BUILDDIR32}
743
744iosdmg: all pkgscripts/makemacpkg pkgscripts/uninstall
745	sh pkgscripts/makemacpkg -build32 ${BUILDDIR32} -buildarmv6 ${BUILDDIRARMV6} -buildarmv7 ${BUILDDIRARMV7} -buildarmv7s ${BUILDDIRARMV7S} -buildarmv8 ${BUILDDIRARMV8} -lipo "${LIPO}"
746
747else
748
749iosdmg: all pkgscripts/makemacpkg pkgscripts/uninstall
750	sh pkgscripts/makemacpkg -buildarmv6 ${BUILDDIRARMV6} -buildarmv7 ${BUILDDIRARMV7} -buildarmv7s ${BUILDDIRARMV7S} -buildarmv8 ${BUILDDIRARMV8} -lipo "${LIPO}"
751
752endif
753
754dmg: all pkgscripts/makemacpkg pkgscripts/uninstall
755	sh pkgscripts/makemacpkg
756
757pkgscripts/makecygwinpkg: pkgscripts/makecygwinpkg.tmpl
758	cat pkgscripts/makecygwinpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
759		sed s@%{__docdir}@$(docdir)@g | sed s@%{__libdir}@$(libdir)@g \
760		> pkgscripts/makecygwinpkg
761
762cygwinpkg: all pkgscripts/makecygwinpkg
763	sh pkgscripts/makecygwinpkg
764