fix gen-gitestoffsets invocation with builddir != srcdir
[gnome.gobject-introspection] / tests / offsets / Makefile.am
1 BUILT_SOURCES =
2 CLEANFILES =
3 EXTRA_DIST =
4
5 check_LTLIBRARIES =
6 check_PROGRAMS =
7
8 SCANNER = $(top_srcdir)/tools/g-ir-scanner
9 SCANNER_PYTHONPATH = $(top_builddir):$(top_srcdir):$$PYTHONPATH
10 SCANNER_LIBS = \
11         $(top_srcdir)/giscanner/*.py \
12         $(top_builddir)/giscanner/libgiscanner.la
13
14 ############################################################
15
16 check_LTLIBRARIES += liboffsets.la
17
18 liboffsets_la_SOURCES = \
19         offsets.h       \
20         offsets.c
21 liboffsets_la_CPPFLAGS = $(GIREPO_CFLAGS)
22 # dummy rpath to get built dynamically (huh?)
23 liboffsets_la_LDFLAGS = -module -avoid-version -rpath $(libdir)
24
25 offsets-1.0.gir: liboffsets.la offsets.h $(SCANNER) $(SCANNER_LIBS) Makefile
26         PYTHONPATH=$(SCANNER_PYTHONPATH) $(CHECK_DEBUG) $(SCANNER) -v \
27         --add-include-path=$(top_builddir)/gir --add-include-path=. \
28         --library=offsets \
29         --namespace=offsets \
30         --nsversion=1.0 \
31         --pkg gobject-2.0 \
32         $(srcdir)/offsets.h $(srcdir)/offsets.c \
33          --output $@
34
35 %.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
36         $(top_builddir)/tools/g-ir-compiler --includedir=. --includedir=$(top_builddir)/gir $< -o $@
37
38 CLEANFILES += offsets-1.0.gir offsets-1.0.typelib
39
40 ############################################################
41
42 check_PROGRAMS += gitestoffsets
43
44 nodist_gitestoffsets_SOURCES = gitestoffsets.c
45 gitestoffsets_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
46 gitestoffsets_LDADD = $(top_builddir)/girepository/libgirepository.la $(GIREPO_LIBS)
47
48 gitestoffsets.c: gen-gitestoffsets offsets.h
49         $(PYTHON) $(srcdir)/gen-gitestoffsets $(srcdir)/offsets.h > $@ || ( rm -f $@ && false )
50
51 EXTRA_DIST += gen-gitestoffsets
52 BUILT_SOURCES += gitestoffsets.c
53 CLEANFILES += gitestoffsets.c
54
55 ############################################################
56
57 check-local: offsets-1.0.typelib
58         LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir) GI_TYPELIB_PATH=$(builddir) \
59           $(builddir)/gitestoffsets$(EXEEXT) offsets.compiled offsets.introspected
60         diff -u offsets.compiled offsets.introspected
61
62 CLEANFILES += offsets.compiled offsets.introspected