-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
148 lines (113 loc) · 3.44 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
PACKAGE = test-capture
VERSION = 0.0.5
abs_top_srcdir = $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
VPATH += $(abs_top_srcdir)
PKGCONFIG = pkg-config
PKG_LIBPNG = libpng
INSTALL = install
INSTALL_PROG = ${INSTALL} -p -m 0755
MKDIR_P = ${INSTALL} -d -m 0755
XZ = xz
TAR = tar
TAR_FLAGS = --owner root --group root --mode a+rX,go-w
PKCONFIG_FLAGS = $(patsubst -%,--%,$(filter -static,${LDFLAGS}))
PNG_CPPFLAGS = $(shell ${PKGCONFIG} --cflags ${PKG_LIBPNG})
PNG_LIBS = $(shell ${PKGCONFIG} ${PKCONFIG_FLAGS} --libs ${PKG_LIBPNG})
JPEG_CPPFLAGS =
JPEG_LIBS = -ljpeg
IMG_ROWS = 256
IMG_COLS = 256
PERF_CNT = 1000
AM_CPPFLAGS = \
${PNG_CPPFLAGS} \
${JPEG_CPPFLAGS} \
AM_CFLAGS = -std=gnu99
CFLAGS = -g3 -O3 -Wall -W -Werror -Wno-unused-parameter
LDLIBS = \
${PNG_LIBS} \
${JPEG_LIBS} \
_yuv422_SOURCES = \
yuv422rgb888.h \
yuv422rgb888.c \
yuv422rgb888_generic.inc.c \
yuv422rgb888_neon.inc.c \
SOURCES = \
capture.c \
capture.h \
filter-jpg.c \
filter-jpg_samp.inc.h \
filter-png.c \
util.c \
${_yuv422_SOURCES}
TESTSUITE_RUN_FILTER_SOURCES = \
testsuite/run-filter.c \
util.c \
filter-jpg.c \
filter-jpg_samp.inc.h \
filter-png.c \
${_yuv422_SOURCES}
TESTSUITE_YUV2RGB_PERF_SOURCES = \
testsuite/yuv2rgb-perf.c \
util.c \
${_yuv422_SOURCES}
TEST_SOURCES = \
testsuite/gen-img \
${TESTSUITE_RUN_FILTER_SOURCES} \
$(TESTSUITE_YUV2RGB_PERF_SOURCES)
TEST_PROGRAMS = \
testsuite/run-filter \
testsuite/yuv2rgb-perf
TEST_IMAGES = blue green red white
_test_gen_images = \
$(addprefix testsuite/, \
$(addsuffix .ycbcr,$(TEST_IMAGES)) \
$(addsuffix .yuv,$(TEST_IMAGES)))
_test_inp_images = \
${_test_gen_images}
_test_out_images = \
$(addsuffix .png,${_test_inp_images}) \
$(addsuffix .jpg,${_test_inp_images})
TEST_GEN_DATA = \
$(_test_out_images)
build_c = \
$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) $(filter %.c,$(filter-out %.inc.c,$^)) -o $@ $(LDLIBS)
all: capture tests
capture: ${SOURCES}
$(call build_c)
testsuite/run-filter: ${TESTSUITE_RUN_FILTER_SOURCES} Makefile | testsuite/.dirstamp
$(call build_c)
testsuite/yuv2rgb-perf: ${TESTSUITE_YUV2RGB_PERF_SOURCES} Makefile | testsuite/.dirstamp
$(call build_c)
tests: ${TEST_PROGRAMS} ${_test_out_images} .perf-data
testsuite/.dirstamp:
mkdir -p ${@D}
@touch $@
$(_test_gen_images): testsuite/.gen-images.stamp
testsuite/.gen-images.stamp: testsuite/gen-img Makefile | testsuite/.dirstamp
bash $< ${IMG_COLS} ${IMG_ROWS} ${@D}
@touch $@
.perf-data: testsuite/yuv2rgb-perf testsuite/red.yuv testsuite/green.yuv testsuite/blue.yuv testsuite/white.yuv
cat $(filter %.yuv,$^) | ${QEMU} $(abspath $<) ${IMG_COLS} $$(( ${IMG_ROWS} * 4 )) 8 ${PERF_CNT} 3>/dev/null
_gen_img = \
$(QEMU) $(abspath $<) $1 ${IMG_COLS} ${IMG_ROWS} 8 $$(( ${IMG_COLS}*2 )) <$* 3>[email protected]
$(filter %.png,${_test_out_images}):%.png: testsuite/run-filter %
@rm -f [email protected]
$(call _gen_img,png)
@mv [email protected] $@
$(filter %.jpg,${_test_out_images}):%.jpg: testsuite/run-filter %
@rm -f [email protected]
$(call _gen_img,jpg)
@mv [email protected] $@
clean:
rm -f ${TEST_GEN_DATA} ${_test_inp_images} testsuite/.*stamp
rm -f ${TEST_PROGRAMS} capture
-rmdir testsuite
install: capture
${MKDIR_P} ${DESTDIR}${bindir}
${INSTALL_PROG} -p capture ${DESTDIR}${bindir}/test-capture
dist: ${PACKAGE}-${VERSION}.tar.xz
%.tar.xz: %.tar
@rm -f $@
${XZ} -c $< > $@
${PACKAGE}-${VERSION}.tar: Makefile ${SOURCES} ${TEST_SOURCES}
${TAR} cf $@ ${TAR_FLAGS} --transform 's!^!${PACKAGE}-${VERSION}/!' $(sort $^)