build: Fix usage of %.test again
[platform/upstream/glib.git] / tests / gobject / Makefile.am
1 include $(top_srcdir)/Makefile.decl
2
3 AM_CPPFLAGS =                                   \
4         $(gmodule_INCLUDES)                     \
5         -DGLIB_DISABLE_DEPRECATION_WARNINGS     \
6         $(GLIB_DEBUG_FLAGS)
7
8 libglib = $(top_builddir)/glib/libglib-2.0.la
9 libgthread = $(top_builddir)/gthread/libgthread-2.0.la
10 libgmodule = $(top_builddir)/gmodule/libgmodule-2.0.la
11 libgobject = $(top_builddir)/gobject/libgobject-2.0.la
12
13
14 # libtool dependency tracking seems broken.  this is currently
15 # required to get the tests to dynamic link against the in-tree
16 # libglib instead of the system one
17 libgobject += $(libglib)
18
19 ########################################################################
20
21 noinst_LTLIBRARIES = libtestgobject.la
22
23 libtestgobject_la_SOURCES =     \
24         testcommon.h            \
25         testmarshal.h           \
26         testmarshal.c           \
27         testmodule.c            \
28         testmodule.h
29
30 if CROSS_COMPILING
31   glib_genmarshal=$(GLIB_GENMARSHAL)
32 else
33   glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal
34 endif
35
36 testmarshal.h: stamp-testmarshal.h
37         @true
38 stamp-testmarshal.h: @REBUILD@ testmarshal.list $(glib_genmarshal)
39         $(AM_V_GEN) $(glib_genmarshal) --prefix=test_marshal $(srcdir)/testmarshal.list --header >> xgen-gmh \
40         && (cmp -s xgen-gmh testmarshal.h 2>/dev/null || cp xgen-gmh testmarshal.h) \
41         && rm -f xgen-gmh xgen-gmh~ \
42         && echo timestamp > $@
43 testmarshal.c: @REBUILD@ testmarshal.h testmarshal.list $(glib_genmarshal)
44         $(AM_V_GEN) (echo "#include \"testmarshal.h\""; $(glib_genmarshal) --prefix=test_marshal $(srcdir)/testmarshal.list --body) >> xgen-gmc \
45         && cp xgen-gmc testmarshal.c \
46         && rm -f xgen-gmc xgen-gmc~
47
48 BUILT_SOURCES = testmarshal.h testmarshal.c
49 CLEANFILES = stamp-testmarshal.h
50
51 ########################################################################
52
53 LDADD = libtestgobject.la $(libgobject)
54
55 test_programs =                                 \
56         deftype                                 \
57         gvalue-test                             \
58         paramspec-test                          \
59         accumulator                             \
60         defaultiface                            \
61         dynamictype                             \
62         override                                \
63         singleton                               \
64         references
65
66 performance_programs =                          \
67         performance                             \
68         performance-threaded
69
70 performance_LDADD = $(libgobject) $(libgthread)
71 performance_threaded_LDADD = $(libgobject) $(libgthread)
72 check_PROGRAMS = $(test_programs)
73 noinst_PROGRAMS = $(performance_programs)
74
75 TESTS = $(test_programs) $(performance_programs)
76 TESTS_ENVIRONMENT = srcdir=$(srcdir) \
77         LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \
78         MALLOC_CHECK_=2 \
79         MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
80
81 if BUILDOPT_INSTALL_TESTS
82 insttestdir = $(pkglibexecdir)/installed-tests
83 insttest_PROGRAMS = $(test_programs)
84
85 testmetadir = $(datadir)/installed-tests/$(PACKAGE)
86 testmeta_DATA = $(test_programs:=.test)
87
88 %.test: %$(EXEEXT) Makefile
89         $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
90          echo 'Type=session' >> $@.tmp; \
91          echo 'Exec=env G_TEST_DATA=$(pkglibexecdir)/installed-tests $(pkglibexecdir)/installed-tests/$<' >> $@.tmp; \
92          mv $@.tmp $@)
93 endif
94
95 ########################################################################
96
97 EXTRA_DIST +=             \
98         testmarshal.list
99
100 BUILT_EXTRA_DIST =                              \
101         testmarshal.h                           \
102         testmarshal.c
103
104 dist-hook: $(BUILT_EXTRA_DIST)
105         files='$(BUILT_EXTRA_DIST)';                            \
106         for f in $$files; do                                    \
107           if test -f $$f; then d=.; else d=$(srcdir); fi;       \
108           cp $$d/$$f $(distdir) || exit 1; done
109
110 distclean-local:
111         if test $(srcdir) = .; then :; else     \
112             rm -f $(BUILT_EXTRA_DIST);          \
113         fi
114
115