a1c0ecfa7b2528de4f8726ead20e2cee9eb17775
[platform/upstream/gobject-introspection.git] / tests / scanner / Makefile.am
1 NULL ?=
2
3 include $(top_srcdir)/common.mk
4 include $(top_srcdir)/Makefile.introspection
5
6 INTROSPECTION_SCANNER_ARGS += --warn-all
7
8 check_LTLIBRARIES = \
9         libsletter.la \
10         libutility.la \
11         libgtkfrob.la \
12         libgettype.la \
13         libregress.la \
14         libwarnlib.la \
15         $(NULL)
16
17 AM_CPPFLAGS = -I$(top_srcdir)/girepository
18 AM_CFLAGS = $(GIO_CFLAGS) $(GOBJECT_CFLAGS) $(GTHREAD_CFLAGS)
19 # -rpath needed to force libtool to build a shared library for a check_LTLIBRARIES
20 # target. See http://lists.gnu.org/archive/html/automake/2005-10/msg00107.html
21 AM_LDFLAGS = -rpath /unused -avoid-version
22 LIBS = $(GOBJECT_LIBS) $(GTHREAD_LIBS)
23
24 libsletter_la_SOURCES = $(srcdir)/sletter.c $(srcdir)/sletter.h
25 libsletter_la_LIBADD = $(GIO_LIBS)
26 libsletter_la_CFLAGS = $(AM_CFLAGS)
27 libsletter_la_LDFLAGS = $(AM_LDFLAGS)
28
29 libutility_la_SOURCES = $(srcdir)/utility.c $(srcdir)/utility.h
30 libgtkfrob_la_SOURCES = $(srcdir)/gtkfrob.c $(srcdir)/gtkfrob.h
31 libregress_la_SOURCES = \
32         $(srcdir)/regress.c $(srcdir)/regress.h \
33         $(srcdir)/annotation.c $(srcdir)/annotation.h \
34         $(srcdir)/foo.c $(srcdir)/foo.h \
35         $(srcdir)/drawable.c $(srcdir)/drawable.h \
36         $(NULL)
37 REGRESS_PRINT_PREVIEW_COMMAND="evince --unlink-tempfile --preview --print-settings %s %f"
38 libregress_la_CPPFLAGS = -DREGRESS_PRINT_PREVIEW_COMMAND=\"$(REGRESS_PRINT_PREVIEW_COMMAND)\" \
39                          -DREGRESS_SOME_CHAR=\'c\'
40 libregress_la_LIBADD = $(GIO_LIBS)
41 if HAVE_CAIRO
42 libregress_la_LIBADD += $(CAIRO_LIBS)
43 endif
44 libwarnlib_la_CFLAGS = $(AM_CFLAGS)
45 libwarnlib_la_SOURCES = $(srcdir)/warnlib.c $(srcdir)/warnlib.h
46 libwarnlib_la_LIBADD = $(GIO_LIBS)
47 libwarnlib_la_LDFLAGS = -export-symbols-regex '^warnlib_' -no-undefined
48 libgettype_la_SOURCES = $(srcdir)/gettype.c $(srcdir)/gettype.h
49
50 testsdir = $(datadir)/gobject-introspection-1.0/tests
51 tests_DATA = $(libregress_la_SOURCES) $(libwarnlib_la_SOURCES) $(libutility_la_SOURCES)
52
53 if !HAVE_CAIRO
54 libregress_la_CPPFLAGS += -D_GI_DISABLE_CAIRO
55 endif
56 libregress_la_CFLAGS = $(AM_CFLAGS)
57 if HAVE_CAIRO
58 libregress_la_CFLAGS += $(CAIRO_CFLAGS)
59 endif
60 libregress_la_LDFLAGS = $(AM_LDFLAGS)
61
62
63 if OS_WIN32
64 AM_LDFLAGS += -no-undefined
65 endif
66
67 # .gir --[scanner]-> .typelib
68 GIRS =
69 TYPELIBS = $(GIRS:.gir=.typelib)
70 CHECKGIRS = $(GIRS:.gir=.gir.check)
71 EXPECTEDGIRS = $(GIRS:.gir=-expected.gir)
72 INTROSPECTION_GIRS = $(GIRS)
73 CLEANFILES = $(TYPELIBS) $(GIRS)
74 EXTRA_DIST = $(EXPECTEDGIRS)
75
76 SLetter-1.0.gir: $(top_builddir)/Gio-2.0.gir libsletter.la
77 SLetter_1_0_gir_LIBS = libsletter.la
78 SLetter_1_0_gir_INCLUDES = Gio-2.0
79 SLetter_1_0_gir_FILES = $(libsletter_la_SOURCES)
80 SLetter_1_0_gir_SCANNERFLAGS = --identifier-prefix=S --c-include="sletter.h" --warn-error
81 GIRS += SLetter-1.0.gir
82
83 Regress-1.0.gir: $(top_builddir)/Gio-2.0.gir Utility-1.0.gir libregress.la
84 Regress_1_0_gir_LIBS = libregress.la
85 Regress_1_0_gir_CFLAGS = $(libregress_la_CPPFLAGS) $(libregress_la_CFLAGS) -include "glib.h"
86 Regress_1_0_gir_INCLUDES = Gio-2.0 Utility-1.0
87 if HAVE_CAIRO
88 Regress_1_0_gir_INCLUDES += cairo-1.0 
89 endif
90 Regress_1_0_gir_FILES = $(libregress_la_SOURCES)
91 Regress_1_0_gir_SCANNERFLAGS = --c-include="regress.h" --warn-error
92 GIRS += Regress-1.0.gir
93
94 WarnLib-1.0.gir: $(top_builddir)/Gio-2.0.gir libwarnlib.la
95 WarnLib_1_0_gir_LIBS = libwarnlib.la
96 WarnLib_1_0_gir_INCLUDES = Gio-2.0
97 WarnLib_1_0_gir_FILES = $(libwarnlib_la_SOURCES)
98 WarnLib_1_0_gir_SCANNERFLAGS = --c-include="warnlib.h" --symbol-prefix=warnlib_
99 GIRS += WarnLib-1.0.gir
100
101 Utility-1.0.gir: libutility.la
102 Utility_1_0_gir_PACKAGES = gobject-2.0
103 Utility_1_0_gir_LIBS = libutility.la
104 Utility_1_0_gir_INCLUDES = GObject-2.0
105 Utility_1_0_gir_FILES = $(libutility_la_SOURCES)
106 Utility_1_0_gir_SCANNERFLAGS = --c-include="utility.h" --warn-error
107 GIRS += Utility-1.0.gir
108
109 # This one tests different --namespace and --strip-prefix
110 GtkFrob-1.0.gir: libgtkfrob.la
111 GtkFrob_1_0_gir_PACKAGES = gobject-2.0
112 GtkFrob_1_0_gir_LIBS = libgtkfrob.la
113 GtkFrob_1_0_gir_INCLUDES = GObject-2.0
114 GtkFrob_1_0_gir_FILES = $(libgtkfrob_la_SOURCES)
115 GtkFrob_1_0_gir_SCANNERFLAGS = --identifier-prefix=Gtk --symbol-prefix=gtk_frob --warn-error
116 GIRS += GtkFrob-1.0.gir
117
118 # This tests that functions called _get_type are only matched if they have no
119 # arguments and return GType
120 GetType-1.0.gir: libgettype.la
121 GetType_1_0_gir_PACKAGES = gobject-2.0
122 GetType_1_0_gir_LIBS = libgettype.la
123 GetType_1_0_gir_INCLUDES = GObject-2.0
124 GetType_1_0_gir_FILES = $(libgettype_la_SOURCES)
125 GetType_1_0_gir_SCANNERFLAGS = --c-include="gettype.h" --identifier-prefix=GetType --symbol-prefix=gettype
126 GIRS += GetType-1.0.gir
127
128 if !OS_WIN32
129 check_PROGRAMS = barapp
130
131 barapp_SOURCES = $(srcdir)/barapp.c $(srcdir)/barapp.h
132 barapp_LDADD = $(top_builddir)/libgirepository-1.0.la
133 barapp_LDFLAGS = -export-dynamic
134
135 Bar-1.0.gir: barapp
136 Bar_1_0_gir_PACKAGES = gobject-2.0
137 Bar_1_0_gir_PROGRAM = ./barapp
138 Bar_1_0_gir_INCLUDES = GObject-2.0
139 Bar_1_0_gir_FILES = $(barapp_SOURCES)
140 Bar_1_0_gir_SCANNERFLAGS = --accept-unprefixed
141 GIRS += Bar-1.0.gir
142 endif
143
144 EXTRA_DIST += headeronly.h
145 CLEANFILES += Headeronly-1.0.gir
146
147 Headeronly-1.0.gir: headeronly.h
148         $(AM_V_GEN) $(INTROSPECTION_SCANNER) $(INTROSPECTION_SCANNER_ARGS) --warn-all --warn-error --reparse-validate --namespace=Headeronly --nsversion=1.0 --header-only --output=$@ $<
149
150 %.gir.check: %.gir
151         @diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo "  TEST  $*.gir"
152
153 if BUILD_DOCTOOL
154 DOCGIRS = Regress-1.0.gir
155 CHECKDOCS = $(DOCGIRS:.gir=-C.page.check) $(DOCGIRS:.gir=-Python.page.check) $(DOCGIRS:.gir=-Gjs.page.check) $(DOCGIRS:.gir=-sections.txt.page.check)
156 MALLARD_DIRS = $(DOCGIRS:.gir=-C) $(DOCGIRS:.gir=-Python) $(DOCGIRS:.gir=-Gjs)
157 MALLARD_CLEAN = $(DOCGIRS:.gir=-C)/* $(DOCGIRS:.gir=-Python)/* $(DOCGIRS:.gir=-Gjs)/*
158 EXPECTED_MALLARD_DIRS = $(MALLARD_DIRS:=-expected)
159 CLEANFILES += $(MALLARD_CLEAN)
160
161 %-C: %.gir
162         $(AM_V_GEN)rm -rf $(builddir)/$*-C
163         $(AM_V_at)$(INTROSPECTION_DOCTOOL) $(INTROSPECTION_DOCTOOL_ARGS) --language C $*.gir -o $(builddir)/$*-C/
164
165 %-Python: %.gir
166         $(AM_V_GEN)rm -rf $(builddir)/$*-Python
167         $(AM_V_at)$(INTROSPECTION_DOCTOOL) $(INTROSPECTION_DOCTOOL_ARGS) --language Python $*.gir -o $(builddir)/$*-Python/
168
169 %-Gjs: %.gir
170         $(AM_V_GEN)rm -rf $(builddir)/$*-Gjs
171         $(AM_V_at)$(INTROSPECTION_DOCTOOL) $(INTROSPECTION_DOCTOOL_ARGS) --language Gjs $*.gir -o $(builddir)/$*-Gjs/
172
173 %-sections.txt: %.gir
174         $(AM_V_GEN)$(INTROSPECTION_DOCTOOL) $(INTROSPECTION_DOCTOOL_ARGS) --write-sections-file $*.gir -o $@
175
176 %-C.page.check: %-C
177         @diff -r -u -w -B -U 10 $(srcdir)/$*-C-expected $(builddir)/$*-C && echo "  TEST  $*-C"
178
179 %-Python.page.check: %-Python
180         @diff -r -u -w -B -U 10 $(srcdir)/$*-Python-expected $(builddir)/$*-Python && echo "  TEST  $*-Python"
181
182 %-Gjs.page.check: %-Gjs
183         @diff -r -u -w -B -U 10 $(srcdir)/$*-Gjs-expected $(builddir)/$*-Gjs && echo "  TEST  $*-Gjs"
184
185 %-sections.txt.page.check: %-sections.txt
186         @diff -u -w -B -U 10 $(srcdir)/$*-sections-expected.txt $*-sections.txt && echo "  TEST  $*-C"
187
188 else
189 CHECKDOCS =
190 endif
191
192 check-local: Headeronly-1.0.gir $(CHECKGIRS) $(CHECKDOCS) $(TYPELIBS)
193
194 EXTRA_DIST += \
195         annotationparser/README                                 \
196         annotationparser/test_parser.py                         \
197         annotationparser/test_patterns.py                       \
198         annotationparser/tests.xsd                              \
199         annotationparser/gi/annotation_allow_none.xml           \
200         annotationparser/gi/annotation_array.xml                \
201         annotationparser/gi/annotation_attributes.xml           \
202         annotationparser/gi/annotation_closure.xml              \
203         annotationparser/gi/annotation_constructor.xml          \
204         annotationparser/gi/annotation_destroy.xml              \
205         annotationparser/gi/annotation_element_type.xml         \
206         annotationparser/gi/annotation_foreign.xml              \
207         annotationparser/gi/annotation_get_value_func.xml       \
208         annotationparser/gi/annotation_in.xml                   \
209         annotationparser/gi/annotation_in_out.xml               \
210         annotationparser/gi/annotation_method.xml               \
211         annotationparser/gi/annotation_out.xml                  \
212         annotationparser/gi/annotation_ref_func.xml             \
213         annotationparser/gi/annotation_rename_to.xml            \
214         annotationparser/gi/annotation_scope.xml                \
215         annotationparser/gi/annotation_set_value_func.xml       \
216         annotationparser/gi/annotation_skip.xml                 \
217         annotationparser/gi/annotation_transfer.xml             \
218         annotationparser/gi/annotation_type.xml                 \
219         annotationparser/gi/annotation_unref_func.xml           \
220         annotationparser/gi/annotation_value.xml                \
221         annotationparser/gi/annotation_virtual.xml              \
222         annotationparser/gi/annotations.xml                     \
223         annotationparser/gi/identifier.xml                      \
224         annotationparser/gi/identifier_section.xml              \
225         annotationparser/gi/identifier_symbol.xml               \
226         annotationparser/gi/parameter.xml                       \
227         annotationparser/gi/parameter_varargs.xml               \
228         annotationparser/gi/syntax.xml                          \
229         annotationparser/gi/syntax_indentation.xml              \
230         annotationparser/gi/syntax_multiline_annotations.xml    \
231         annotationparser/gi/syntax_nested_tags.xml              \
232         annotationparser/gi/syntax_paragraph_breaks.xml         \
233         annotationparser/gi/syntax_whitespace.xml               \
234         annotationparser/gi/tag.xml                             \
235         annotationparser/gi/tag_deprecated.xml                  \
236         annotationparser/gi/tag_description.xml                 \
237         annotationparser/gi/tag_returns.xml                     \
238         annotationparser/gi/tag_since.xml                       \
239         annotationparser/gi/tag_stability.xml                   \
240         annotationparser/gtkdoc/gobject/gtypes.h.xml            \
241         annotationparser/gtkdoc/gobject/gtypes.c.xml            \
242         annotationparser/gtkdoc/gobject/giface.h.xml            \
243         annotationparser/gtkdoc/gobject/giface.c.xml            \
244         annotationparser/gtkdoc/fail/tester.h.xml               \
245         annotationparser/gtkdoc/fail/tester.c.xml               \
246         annotationparser/gtkdoc/empty/tester.c.xml              \
247         annotationparser/gtkdoc/bugs/tester.h.xml               \
248         annotationparser/gtkdoc/bugs/tester.c.xml               \
249         annotationparser/gtkdoc/annotations/tester.h.xml        \
250         annotationparser/gtkdoc/annotations/tester.c.xml        \
251         annotationparser/gtkdoc/gobject/gobject.h.xml           \
252         annotationparser/gtkdoc/gobject/gobject.c.xml           \
253         Regress-1.0-C-expected                                  \
254         Regress-1.0-Gjs-expected                                \
255         Regress-1.0-Python-expected                             \
256         Regress-1.0-sections-expected.txt                       \
257         $(NULL)