Excise shave in favor of automake 1.11 silent rules
[gnome.gobject-introspection] / tests / scanner / Makefile.am
1 include $(top_srcdir)/common.mk
2
3 # We need to build a shared library, which can be dlopened
4 # it does not work with noinst_LTLIBRARIES
5 testlib_LTLIBRARIES = \
6         libannotation.la \
7         libdrawable.la \
8         libfoo.la \
9         libutility.la \
10         libgtkfrob.la
11 testlibdir = $(prefix)/unused
12 install-testlibLTLIBRARIES: # prevent it from being installed
13
14 AM_CPPFLAGS = -I$(top_srcdir)/girepository
15 AM_CFLAGS = $(GOBJECT_CFLAGS) $(GTHREAD_CFLAGS)
16 AM_LDFLAGS = -avoid-version
17 LIBS = $(GOBJECT_LIBS) $(GTHREAD_LIBS)
18
19 libannotation_la_SOURCES = $(srcdir)/annotation.c $(srcdir)/annotation.h
20 libdrawable_la_SOURCES = $(srcdir)/drawable.c $(srcdir)/drawable.h
21 libfoo_la_SOURCES = $(srcdir)/foo.c $(srcdir)/foo.h
22 libutility_la_SOURCES = $(srcdir)/utility.c $(srcdir)/utility.h
23 libgtkfrob_la_SOURCES = $(srcdir)/gtkfrob.c $(srcdir)/gtkfrob.h
24
25 if OS_WIN32
26 AM_LDFLAGS += -no-undefined
27 endif
28
29 # .gir --[scanner]-> .typelib --[generate]-> .tgir
30 GIRS =
31 TYPELIBS = $(GIRS:.gir=.typelib)
32 CHECKGIRS = $(GIRS:.gir=.gir.check)
33 EXPECTEDGIRS = $(GIRS:.gir=-expected.gir)
34 TGIRS = $(GIRS:.gir=.tgir)
35 CHECKTGIRS = $(GIRS:.gir=.tgir.check)
36 EXPECTEDTGIRS = $(GIRS:.gir=-expected.tgir)
37 CLEANFILES = $(TYPELIBS)  $(GIRS)
38 BUILT_SOURCES = $(TYPELIBS) $(GIRS) $(TGIRS)
39 EXTRA_DIST = $(EXPECTEDGIRS) $(EXPECTEDTGIRS)
40
41 annotation-1.0.gir: libannotation.la annotation.c annotation.h utility-1.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
42          $(CHECK_DEBUG) $(SCANNER) \
43         --include=GObject-2.0 \
44         --include=utility-1.0 \
45         --libtool="$(LIBTOOL)" \
46         --library=annotation \
47         --namespace=annotation \
48         --nsversion=1.0 \
49         --pkg gobject-2.0 \
50         $(srcdir)/annotation.h $(srcdir)/annotation.c \
51          --output $@
52 GIRS += annotation-1.0.gir
53
54 drawable-1.0.gir: libdrawable.la drawable.c drawable.h utility-1.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
55         $(CHECK_DEBUG) $(SCANNER) \
56         --include=GObject-2.0 \
57         --include=utility-1.0 \
58         --libtool="$(LIBTOOL)" \
59         --library=drawable \
60         --namespace=drawable \
61         --nsversion=1.0 \
62         --pkg gobject-2.0 \
63         $(srcdir)/drawable.h $(srcdir)/drawable.c \
64          --output $@
65 GIRS += drawable-1.0.gir
66
67 foo-1.0.gir: libfoo.la foo.c foo.h utility-1.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
68         $(CHECK_DEBUG) $(SCANNER) \
69         --include=GObject-2.0 \
70         --include=utility-1.0 \
71         --c-include="foo.h" \
72         --libtool="$(LIBTOOL)" \
73         --library=foo \
74         --namespace=foo \
75         --nsversion=1.0 \
76         --pkg gobject-2.0 \
77         $(srcdir)/foo.h $(srcdir)/foo.c \
78          --output $@
79 GIRS += foo-1.0.gir
80
81 utility-1.0.gir: libutility.la utility.h $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
82         $(CHECK_DEBUG) $(SCANNER) \
83         --include=GObject-2.0 \
84         --libtool="$(LIBTOOL)" \
85         --library=utility \
86         --namespace=utility \
87         --nsversion=1.0 \
88         --pkg gobject-2.0 \
89         $(libutility_la_SOURCES) \
90         --output $@
91 GIRS += utility-1.0.gir
92
93 # This one tests different --namespace and --strip-prefix
94 GtkFrob-1.0.gir: libgtkfrob.la gtkfrob.h $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
95         $(CHECK_DEBUG) $(SCANNER) \
96         --include=GObject-2.0 \
97         --libtool="$(LIBTOOL)" \
98         --library=gtkfrob \
99         --namespace=GtkFrob \
100         --strip-prefix=Gtk \
101         --nsversion=1.0 \
102         --pkg gobject-2.0 \
103         $(libgtkfrob_la_SOURCES) \
104         --output $@
105 GIRS += GtkFrob-1.0.gir
106
107 noinst_PROGRAMS = barapp
108
109 barapp_SOURCES = $(srcdir)/barapp.c $(srcdir)/barapp.h
110 barapp_LDADD = $(top_builddir)/girepository/libgirepository-1.0.la
111 barapp_LDFLAGS = -export-dynamic
112 BarApp-1.0.gir: barapp $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
113         LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}:$(top_builddir)/girepository/.libs $(SCANNER) \
114         --include=GObject-2.0 \
115         --libtool="$(LIBTOOL)" \
116         --program=./barapp \
117         --namespace=BarApp \
118         --strip-prefix=Bar \
119         --nsversion=1.0 \
120         --pkg gobject-2.0 \
121         $(barapp_SOURCES) \
122         --output $@
123 GIRS += BarApp-1.0.gir
124
125 pre-check:
126         @if test "$(top_builddir)" != "$(top_srcdir)"; then \
127            cp -f $(top_srcdir)/giscanner/*.py $(top_builddir)/giscanner; \
128         fi
129
130 post-check:
131         @echo "========================"
132         @echo "All scanner tests passed"
133         @echo "========================"
134         @if test "$(top_builddir)" != "$(top_srcdir)"; then \
135            rm -f $(top_builddir)/giscanner/*.py*; \
136         fi
137
138 %.gir.check: %.gir
139         @diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo "  TEST  $*.gir"
140
141 # stop %.typelib rule from building %-expected.tgir (via %-expected.typelib)
142 %-expected.typelib:
143         @true
144
145 %.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
146         LD_LIBRARY_PATH=$(top_builddir)/girepository/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} $(top_builddir)/tools/g-ir-compiler --includedir=. --includedir=$(top_builddir)/gir $< -o $@
147
148 %.tgir: %.typelib $(top_builddir)/tools/g-ir-generate$(EXEEXT) Makefile
149         LD_LIBRARY_PATH=$(top_builddir)/girepository/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} $(top_builddir)/tools/g-ir-generate --includedir=. --includedir=$(top_builddir)/gir $< -o $@
150
151 %.tgir.check: %.tgir
152         @diff -u -U 10 $(srcdir)/$*-expected.tgir $*.tgir; \
153         if test "$$?" = "0"; then \
154             echo "  TEST  $*.tgir"; \
155             rm -f $*.tgir; \
156         else \
157             exit 1; \
158         fi
159
160 distclean-local:
161         @if test "$(top_builddir)" != "$(top_srcdir)"; then \
162             rm -f $(top_builddir)/tests/scanner/*.tgir; \
163         fi
164
165 check-local: pre-check
166 check-local: $(CHECKGIRS) $(CHECKTGIRS) $(TYPELIBS)
167
168 check-local: post-check