Don't use --typelib-xml, use g-ir-generate
[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 = \
4         libannotation.la \
5         libdrawable.la \
6         libfoo.la \
7         libutility.la
8 testlibdir = $(prefix)/unused
9 install-testlibLTLIBRARIES: # prevent it from being installed
10
11 AM_CFLAGS = $(GOBJECT_CFLAGS)
12 AM_LDFLAGS = -module -avoid-version
13 LIBS = $(GOBJECT_LIBS)
14
15 libannotation_la_SOURCES = $(srcdir)/annotation.c $(srcdir)/annotation.h
16 libdrawable_la_SOURCES = $(srcdir)/drawable.c $(srcdir)/drawable.h
17 libfoo_la_SOURCES = $(srcdir)/foo.c $(srcdir)/foo.h
18 libutility_la_SOURCES = $(srcdir)/utility.c $(srcdir)/utility.h
19
20 if OS_WIN32
21 AM_LDFLAGS += -no-undefined
22 endif
23
24 GIRS =
25 SCANNER = $(top_srcdir)/tools/g-ir-scanner
26 SCANNER_LIBS = \
27         $(top_srcdir)/giscanner/*.py \
28         $(top_builddir)/giscanner/libgiscanner.la
29 TYPELIBS = $(GIRS:.gir=.typelib)
30 CHECKGIRS = $(GIRS:.gir=.gir.check)
31 EXPECTEDGIRS = $(GIRS:.gir=-expected.gir)
32 CLEANFILES = $(TYPELIBS)  $(GIRS)
33 BUILT_SOURCES = $(TYPELIBS) $(GIRS)
34 EXTRA_DIST = $(EXPECTEDGIRS)
35
36 annotation-1.0.gir: libannotation.la annotation.c annotation.h utility-1.0.gir $(SCANNER) $(SCANNER_LIBS) Makefile
37         PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
38         --add-include-path=$(top_builddir)/gir --add-include-path=. \
39         --include=GObject-2.0 \
40         --include=utility-1.0 \
41         --library=annotation \
42         --namespace=annotation \
43         --nsversion=1.0 \
44         --pkg gobject-2.0 \
45         $(srcdir)/annotation.h $(srcdir)/annotation.c \
46          --output $@
47 GIRS += annotation-1.0.gir
48
49 drawable-1.0.gir: libdrawable.la drawable.c drawable.h utility-1.0.gir $(SCANNER) $(SCANNER_LIBS) Makefile
50         PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
51         --add-include-path=$(top_builddir)/gir --add-include-path=. \
52         --include=GObject-2.0 \
53         --include=utility-1.0 \
54         --library=drawable \
55         --namespace=drawable \
56         --nsversion=1.0 \
57         --pkg gobject-2.0 \
58         $(srcdir)/drawable.h $(srcdir)/drawable.c \
59          --output $@
60 GIRS += drawable-1.0.gir
61
62 foo-1.0.gir: libfoo.la foo.c foo.h utility-1.0.gir $(SCANNER) $(SCANNER_LIBS) Makefile
63         PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
64         --add-include-path=$(top_builddir)/gir --add-include-path=. \
65         --include=GObject-2.0 \
66         --include=utility-1.0 \
67         --library=foo \
68         --namespace=foo \
69         --nsversion=1.0 \
70         --pkg gobject-2.0 \
71         $(srcdir)/foo.h $(srcdir)/foo.c \
72          --output $@
73 GIRS += foo-1.0.gir
74
75 utility-1.0.gir: libutility.la utility.h $(SCANNER) $(SCANNER_LIBS) Makefile
76         PYTHONPATH=$(top_builddir):$$PYTHONPATH $(CHECK_DEBUG) $(SCANNER) -v \
77         --add-include-path=$(top_builddir)/gir --add-include-path=. \
78         --include=GObject-2.0 \
79         --library=utility \
80         --namespace=utility \
81         --nsversion=1.0 \
82         --pkg gobject-2.0 \
83         $(libutility_la_SOURCES) \
84         --output $@
85 GIRS += utility-1.0.gir
86
87 pre-check:
88         @if test "$(top_builddir)" != "$(top_srcdir)"; then \
89            cp -f $(top_srcdir)/giscanner/*.py $(top_builddir)/giscanner; \
90         fi
91         @echo "Running scanner checks..."
92
93 post-check:
94         @echo "========================"
95         @echo "All scanner tests passed"
96         @echo "========================"
97         @if test "$(top_builddir)" != "$(top_srcdir)"; then \
98            rm -f $(top_builddir)/giscanner/*.py*; \
99         fi
100
101 %.gir.check: %.gir
102         @diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo "* $*.gir"
103
104 %.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
105         $(top_builddir)/tools/g-ir-compiler --includedir=. --includedir=$(top_builddir)/gir $< -o $@
106
107 check-local: pre-check
108 check-local: $(CHECKGIRS) $(TYPELIBS)
109         @for x in $(TYPELIBS); do \
110          echo 1>&2 "$(DEBUG) $(top_builddir)/tools/g-ir-generate --includedir=. $${x} > $${x}.tmp && mv $${x}.tmp $${x}.xml;"; \
111          $(DEBUG) $(top_builddir)/tools/g-ir-generate --includedir=. $${x} > $${x}.tmp && mv $${x}.tmp $${x}.xml; \
112         done
113 CLEANFILES += $(TYPELIBS:.typelib:.typelib.xml)
114
115 check-local: post-check