1#
2# Copyright (c) 2023, Oracle and/or its affiliates.
3#
4# Permission is hereby granted, free of charge, to any person obtaining a
5# copy of this software and associated documentation files (the "Software"),
6# to deal in the Software without restriction, including without limitation
7# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8# and/or sell copies of the Software, and to permit persons to whom the
9# Software is furnished to do so, subject to the following conditions:
10#
11# The above copyright notice and this permission notice (including the next
12# paragraph) shall be included in all copies or substantial portions of the
13# Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21# DEALINGS IN THE SOFTWARE.
22#
23
24if ENABLE_UNIT_TESTS
25if HAVE_GLIB
26check_PROGRAMS = XpmCreate XpmMisc XpmRead XpmWrite rgb
27
28TESTS=$(check_PROGRAMS)
29
30AM_CFLAGS = $(CWARNFLAGS) $(XPM_CFLAGS) $(GLIB_CFLAGS)
31AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
32LDADD= $(top_builddir)/src/libXpm.la $(GLIB_LIBS)
33
34TESTS_ENVIRONMENT = $(MALLOC_DEBUG_ENV)
35TESTS_ENVIRONMENT += G_TEST_SRCDIR="$(abs_srcdir)"
36TESTS_ENVIRONMENT += G_TEST_BUILDDIR="$(abs_builddir)"
37
38XpmCreate_SOURCES = XpmCreate.c TestAllFiles.h
39XpmMisc_SOURCES = XpmMisc.c
40XpmRead_SOURCES = XpmRead.c TestAllFiles.h
41XpmWrite_SOURCES = XpmWrite.c CompareXpmImage.h TestAllFiles.h
42
43rgb_SOURCES = rgb.c
44rgb_CPPFLAGS = -I$(top_srcdir)/include/X11
45
46LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
47		  $(top_srcdir)/tap-driver.sh
48LOG_COMPILER = $(srcdir)/tap-test
49
50if COMPRESSED_PIXMAPS
51$(check_PROGRAMS): pixmaps/.generated
52
53pixmaps/.generated:
54	-rm -rf pixmaps/good/generated pixmaps/invalid/generated pixmaps/.generated
55	$(MKDIR_P) pixmaps/good/generated pixmaps/invalid/generated \
56	    pixmaps/no-mem/generated
57	cp $(srcdir)/pixmaps/good/*.xpm pixmaps/good/generated
58	gzip -f pixmaps/good/generated/*.xpm
59	cp $(srcdir)/pixmaps/good/*.xpm pixmaps/good/generated
60	compress -f pixmaps/good/generated/*.xpm
61	cp $(srcdir)/pixmaps/invalid/*.xpm pixmaps/invalid/generated
62	gzip -f pixmaps/invalid/generated/*.xpm
63	cp $(srcdir)/pixmaps/invalid/*.xpm pixmaps/invalid/generated
64	compress -f pixmaps/invalid/generated/*.xpm
65	cp $(srcdir)/pixmaps/no-mem/*.xpm pixmaps/no-mem/generated
66	gzip -f pixmaps/no-mem/generated/*.xpm
67	cp $(srcdir)/pixmaps/no-mem/*.xpm pixmaps/no-mem/generated
68	compress -f pixmaps/no-mem/generated/*.xpm
69	touch $@
70
71clean-local:
72	-rm -rf pixmaps/*/generated pixmaps/.generated
73endif COMPRESSED_PIXMAPS
74
75endif HAVE_GLIB
76endif ENABLE_UNIT_TESTS
77
78EXTRA_DIST = \
79	pixmaps/good/BlueCurves.xpm \
80	pixmaps/good/Dimple.xpm \
81	pixmaps/good/Dolphins.xpm \
82	pixmaps/good/Miniweave.xpm \
83	pixmaps/good/Squares.xpm \
84	pixmaps/good/Swirl.xpm \
85	pixmaps/good/Utah-teapot.xpm \
86	pixmaps/good/chromesphere.xpm \
87	pixmaps/good/plaid-v1.xpm \
88	pixmaps/good/plaid-v2.xpm \
89	pixmaps/good/plaid-v3.xpm \
90	pixmaps/good/plaid-lisp.xpm \
91	pixmaps/good/xorg-bw.xpm \
92	pixmaps/good/xorg.xpm \
93	pixmaps/invalid/CVE-2016-10164-poc.xpm.gz.gz.gz \
94	pixmaps/invalid/doom.xpm \
95	pixmaps/invalid/doom2.xpm \
96	pixmaps/invalid/invalid-type.xpm \
97	pixmaps/invalid/no-contents.xpm \
98	pixmaps/invalid/unending-comment-c.xpm \
99	pixmaps/invalid/zero-width.xpm \
100	pixmaps/invalid/zero-width-v1.xpm \
101	pixmaps/no-mem/oversize.xpm \
102	rgb.txt \
103	tap-test
104