Remove duplicate typelib installation rules
[gnome.gobject-introspection] / gir / Makefile.am
1 include $(top_srcdir)/common.mk
2
3 CHECKGIRS =
4 BUILT_GIRSOURCES = 
5 CLEANFILES =
6 EXTRA_DIST = 
7
8 BASE_GIRSOURCES =               \
9         cairo-1.0.gir           \
10         fontconfig-2.0.gir      \
11         freetype2-2.0.gir       \
12         GL-1.0.gir              \
13         libxml2-2.0.gir         \
14         xft-2.0.gir             \
15         xlib-2.0.gir            \
16         xfixes-4.0.gir
17 EXTRA_DIST += $(BASE_GIRSOURCES)
18
19 # glib
20 GLIB_INCLUDEDIR=`pkg-config --variable=includedir glib-2.0`/glib-2.0
21 GLIB_LIBDIR=`pkg-config --variable=libdir glib-2.0`
22
23 if OS_WIN32
24 GLIB_LIBRARY=libglib-2.0-0
25 else
26 GLIB_LIBRARY=glib-2.0
27 endif
28
29 GLib-2.0.gir: $(SCANNER_BIN) $(SCANNER_LIBS) Makefile glib-2.0.c
30         $(SCANNER) \
31             --namespace GLib --nsversion=2.0 \
32             --noclosure \
33             --output $@ \
34             --strip-prefix=g \
35             --libtool="$(SHAVE_SAVED_LIBTOOL)" \
36             --c-include="glib.h" \
37             --library=$(GLIB_LIBRARY) \
38             --pkg glib-2.0 \
39             $(CPPFLAGS) \
40             -I$(GLIB_INCLUDEDIR) \
41             -I$(GLIB_LIBDIR)/glib-2.0/include \
42             -DGETTEXT_PACKAGE=Dummy \
43             -D__G_I18N_LIB_H__ \
44             $(GLIB_LIBDIR)/glib-2.0/include/glibconfig.h \
45             $(srcdir)/glib-2.0.c \
46             $(GLIB_INCLUDEDIR)/glib/*.h
47         $(SCANNER) $(SCANNER_ARGS) \
48             --xpath-assertions=$(srcdir)/GLib-2.0.xpath GLib-2.0.gir
49 BUILT_GIRSOURCES += GLib-2.0.gir
50 EXTRA_DIST += glib-2.0.c GLib-2.0.xpath
51
52 # gobject
53 GOBJECT_INCLUDEDIR=`pkg-config --variable=includedir gobject-2.0`/glib-2.0
54 GOBJECT_LIBDIR=`pkg-config --variable=libdir gobject-2.0`
55
56 if OS_WIN32
57 GOBJECT_LIBRARY=libgobject-2.0-0
58 else
59 GOBJECT_LIBRARY=gobject-2.0
60 endif
61
62 GObject-2.0.gir: GLib-2.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) Makefile
63         $(SCANNER) \
64             --namespace GObject --nsversion=2.0 \
65             --noclosure \
66             --output $@ \
67             --strip-prefix=g \
68             --libtool="$(SHAVE_SAVED_LIBTOOL)" \
69             --c-include="glib-object.h" \
70             --include=GLib-2.0 \
71             --library=$(GOBJECT_LIBRARY) \
72             -I$(GOBJECT_INCLUDEDIR) \
73             -I$(GOBJECT_LIBDIR)/glib-2.0/include \
74             -DGOBJECT_COMPILATION \
75             --pkg gobject-2.0 \
76             $(srcdir)/gobject-2.0.c \
77             $(GLIB_INCLUDEDIR)/gobject/*.h
78         $(SCANNER) $(SCANNER_ARGS) \
79             --xpath-assertions=$(srcdir)/GObject-2.0.xpath GObject-2.0.gir
80 BUILT_GIRSOURCES += GObject-2.0.gir
81 EXTRA_DIST += GObject-2.0.xpath
82
83 # gmodule
84 GMODULE_INCLUDEDIR=`pkg-config --variable=includedir gmodule-2.0`/glib-2.0
85 GMODULE_LIBDIR=`pkg-config --variable=libdir gmodule-2.0`
86
87 if OS_WIN32
88 GMODULE_LIBRARY=libgmodule-2.0-0
89 else
90 GMODULE_LIBRARY=gmodule-2.0
91 endif
92
93 GModule-2.0.gir: GLib-2.0.gir $(SCANNER_BIN) $(SCANNER_LIBS)
94         $(SCANNER) \
95             --namespace GModule --nsversion=2.0 \
96             --add-include-path=. \
97             --noclosure \
98             --output $@ \
99             --strip-prefix=g \
100             --libtool="$(SHAVE_SAVED_LIBTOOL)" \
101             --c-include="gmodule.h" \
102             --include=GLib-2.0 \
103             --library=$(GMODULE_LIBRARY) \
104             -I$(GMODULE_INCLUDEDIR) \
105             -I$(GMODULE_LIBDIR)/glib-2.0/include \
106             --pkg gmodule-2.0 \
107             $(GLIB_INCLUDEDIR)/gmodule.h
108 BUILT_GIRSOURCES += GModule-2.0.gir
109
110 # gio
111 GIO_INCLUDEDIR=`pkg-config --variable=includedir gio-2.0`/glib-2.0
112 GIO_LIBDIR=`pkg-config --variable=libdir gio-2.0`
113
114 if OS_WIN32
115 GIO_LIBRARY=libgio-2.0-0
116 else
117 GIO_LIBRARY=gio-2.0
118 endif
119
120 if HAVE_GIO_UNIX
121 GIO_UNIX_HDRS=`pkg-config --variable=includedir gio-unix-2.0`/gio-unix-2.0/gio/*.h
122 else
123 GIO_UNIX_HDRS=
124 endif
125
126 Gio-2.0.gir: GObject-2.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) Makefile $(srcdir)/gio-2.0.c
127         $(SCANNER) \
128             --namespace Gio --nsversion=2.0 \
129             --add-include-path=. \
130             --noclosure \
131             --output $@ \
132             --strip-prefix=g \
133                 --libtool="$(SHAVE_SAVED_LIBTOOL)" \
134                 --c-include="gio/gio.h" \
135                 --include=GObject-2.0 \
136             --library=$(GIO_LIBRARY) \
137             -I$(GIO_INCLUDEDIR) \
138             -I$(GIO_LIBDIR)/glib-2.0/include \
139             -DGIO_COMPILATION \
140         --pkg gio-2.0 \
141             $(srcdir)/gio-2.0.c \
142             $(GLIB_INCLUDEDIR)/gio/*.h \
143             $(GIO_UNIX_HDRS)
144 BUILT_GIRSOURCES += Gio-2.0.gir
145 EXTRA_DIST += gio-2.0.c
146
147 # girepository
148 GIREPOSITORY_FILES = \
149         $(top_srcdir)/girepository/girepository.c \
150         $(top_srcdir)/girepository/girepository.h
151
152 GIRepository-2.0.gir: GObject-2.0.gir $(SCANNER_BIN) $(SCANNER_LIBS) $(GIREPOSITORY_FILES)
153         $(SCANNER) \
154             --namespace GIRepository --nsversion=2.0 \
155             --noclosure \
156             --output $@ \
157             --strip-prefix=g \
158                 --libtool="$(SHAVE_SAVED_LIBTOOL)" \
159                 --c-include="girepository.h" \
160                 --include=GObject-2.0 \
161             --library=girepository-1.0 \
162             -I$(srcdir)/girepository \
163                 --pkg glib-2.0 \
164                 --pkg gobject-2.0 \
165             $(GIREPOSITORY_FILES)
166 BUILT_GIRSOURCES += GIRepository-2.0.gir
167
168 LT_CURRENT = 1
169 LT_REVISION = 0
170 LT_AGE = 0
171 LT_VERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
172 TYPELIB_VERSION = $(LT_CURRENT).0
173
174 lib_LTLIBRARIES = libgirepository-everything-1.0.la
175
176 libgirepository_everything_1_0_la_SOURCES = $(srcdir)/everything.c $(srcdir)/everything.h
177 libgirepository_everything_1_0_la_CFLAGS = $(GOBJECT_CFLAGS)
178 libgirepository_everything_1_0_la_LDFLAGS = -version-info $(LT_VERSION)
179 libgirepository_everything_1_0_la_LIBADD = $(GOBJECT_LIBS)
180
181 if OS_WIN32
182 libgirepository_everything_1_0_la_LDFLAGS += -no-undefined
183 endif
184
185 Everything-$(TYPELIB_VERSION).gir: libgirepository-everything-1.0.la everything.c everything.h $(SCANNER_BIN) $(SCANNER_LIBS)
186         $(CHECK_DEBUG) $(SCANNER) \
187         --include=GObject-2.0 \
188         --libtool="$(SHAVE_SAVED_LIBTOOL)" \
189         --library=girepository-everything-1.0 \
190         --namespace=Everything --nsversion=$(TYPELIB_VERSION) \
191         --pkg gobject-2.0 \
192         $(srcdir)/everything.h $(srcdir)/everything.c \
193         --output $@
194 BUILT_GIRSOURCES += Everything-$(TYPELIB_VERSION).gir
195 CHECKGIRS += Everything-$(TYPELIB_VERSION)-expected.gir
196
197 # Generic rules
198 CLEANFILES += $(BUILT_GIRSOURCES)
199
200 GIRSOURCES =                    \
201         $(BASE_GIRSOURCES)      \
202         $(BUILT_GIRSOURCES)
203
204 girdir = $(datadir)/gir-1.0
205 dist_gir_DATA = $(GIRSOURCES)
206
207 %.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT)
208         LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}:$(top_builddir)/girepository/.libs $(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $@
209
210 typelibsdir = $(libdir)/girepository-1.0
211 typelibs_DATA = $(GIRSOURCES:.gir=.typelib)
212
213 CLEANFILES += $(typelibs_DATA)
214
215 %.gir.check: %.gir
216         @diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo "  TEST  $*.gir"
217
218 check-local: $(CHECKGIRS)
219
220 # Check that typelib -> gir -> typelib transformation is lossless.
221 # Comparing gir files is relatively fragile (whitespace, attribute default
222 # values, etc.) but the typelibs should identical as long as the gir files are
223 # semantically equivalent.
224
225 %.test.gir: %.typelib $(top_builddir)/tools/g-ir-generate$(EXEEXT)
226         $(DEBUG) $(top_builddir)/tools/g-ir-generate$(EXEEXT) --includedir=. $< -o $@
227
228 testlib-%: %.test.gir $(top_builddir)/tools/g-ir-generate$(EXEEXT)
229         $(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $*.test.typelib
230         cmp $*.typelib $*.test.typelib && rm $*.test.typelib
231
232 testgir-%: %.test.gir
233         diff -u $*.gir $< && rm $<
234
235 CLEANFILES += $(typelibs_DATA:%.typelib=%.test.gir)
236 CLEANFILES += $(typelibs_DATA:%.typelib=%.test.typelib)
237
238 #check-local: $(typelibs_DATA:%.typelib=testlib-%)
239 check-gir: $(typelibs_DATA:%.typelib=testgir-%)