Move the drawable parts out of Foo to its own test.
[gnome.gobject-introspection] / tests / scanner / Makefile.am
1 # We need to build a shared library, which can be dlopened
2 # it does not work with noinst_LTLIBRARIES
3 testlib_LTLIBRARIES = libdrawable.la libfoo.la libutility.la
4 testlibdir = $(prefix)/unused
5 install-testlibLTLIBRARIES: # prevent it from being installed
6
7 libdrawable_la_SOURCES = $(srcdir)/drawable.c $(srcdir)/drawable.h
8 libdrawable_la_CFLAGS = $(GOBJECT_CFLAGS)
9 libdrawable_la_LDFLAGS = -module -avoid-version
10 libdrawable_la_LIBADD = $(GOBJECT_LIBS)
11
12 libfoo_la_SOURCES = $(srcdir)/foo.c $(srcdir)/foo-object.h
13 libfoo_la_CFLAGS = $(GOBJECT_CFLAGS)
14 libfoo_la_LDFLAGS = -module -avoid-version
15 libfoo_la_LIBADD = $(GOBJECT_LIBS)
16
17 libutility_la_SOURCES = $(srcdir)/utility.c $(srcdir)/utility.h
18 libutility_la_CFLAGS = $(GOBJECT_CFLAGS)
19 libutility_la_LDFLAGS = -module -avoid-version
20 libutility_la_LIBADD = $(GOBJECT_LIBS)
21
22 CLEANFILES = utility.gir Foo.gir
23 EXTRA_DIST = utility-expected.gir Foo-expected.gir
24
25 SCANNER = $(top_srcdir)/tools/g-ir-scanner
26 SCANNER_LIBS = \
27         $(top_srcdir)/giscanner/*.py \
28         $(top_builddir)/giscanner/libgiscanner.la
29
30 utility.gir: libutility.la utility.h $(SCANNER) $(SCANNER_LIBS)
31         $(CHECK_DEBUG) $(SCANNER) -v \
32         --include=$(top_srcdir)/gir/glib-2.0.gir \
33         --include=$(top_srcdir)/gir/gobject-2.0.gir \
34         --library=libutility.la \
35         --namespace=utility \
36         --pkg gobject-2.0 \
37         $(libutility_la_SOURCES) \
38         --output $@
39
40 Foo.gir: libfoo.la foo-object.h $(SCANNER) $(SCANNER_LIBS)
41         $(CHECK_DEBUG) $(SCANNER) -v \
42         --include=$(top_srcdir)/gir/glib-2.0.gir \
43         --include=$(top_srcdir)/gir/gobject-2.0.gir \
44         --include=$(top_builddir)/tests/scanner/utility.gir \
45         --library=libfoo.la \
46         --namespace=Foo \
47         --pkg gobject-2.0 \
48         $(libfoo_la_SOURCES) \
49          --output $@
50
51 drawable.gir: libdrawable.la drawable.h $(SCANNER) $(SCANNER_LIBS)
52         $(CHECK_DEBUG) $(SCANNER) -v \
53         --include=$(top_srcdir)/gir/glib-2.0.gir \
54         --include=$(top_srcdir)/gir/gobject-2.0.gir \
55         --library=libdrawable.la \
56         --namespace=test \
57         --pkg gobject-2.0 \
58         $(libdrawable_la_SOURCES) \
59          --output $@
60
61 check-%.gir: %.gir
62         @diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo "* $*.gir"
63
64 pre-check:
65         @if test "$(top_builddir)" != "$(top_srcdir)"; then \
66            cp $(top_srcdir)/giscanner/*.py $(top_builddir)/giscanner; \
67         fi
68         @echo "Running scanner checks..."
69
70 check-local: pre-check check-utility.gir check-drawable.gir check-Foo.gir
71         @echo "======================="
72         @echo "All parser tests passed"
73         @echo "======================="
74         @if test "$(top_builddir)" != "$(top_srcdir)"; then \
75            rm -f $(top_builddir)/giscanner/*.py*; \
76         fi
77
78 .PHONY: utility.gir drawable.gir Foo.gir