build: Use Makefile.introspection

Whenever possible, instead of writing our own rules for generating GIR
files and typelibs.
This commit is contained in:
Emmanuele Bassi 2010-09-03 11:09:57 +01:00
parent f7854dd90f
commit 710c7aed40
4 changed files with 85 additions and 110 deletions

View File

@ -315,8 +315,12 @@ nodist_clutter_HEADERS = \
DISTCLEANFILES += clutter-version.h DISTCLEANFILES += clutter-version.h
EXTRA_DIST += clutter-version.h.in EXTRA_DIST += clutter-version.h.in
# these are the gir files we generate
BUILT_GIRSOURCES = BUILT_GIRSOURCES =
# these are the gir files we scan
INTROSPECTION_GIRS =
if LOCAL_JSON_GLIB if LOCAL_JSON_GLIB
json_gir_include=--include-uninstalled=$(top_builddir)/clutter/json/ClutterJson-@CLUTTER_API_VERSION@.gir json_gir_include=--include-uninstalled=$(top_builddir)/clutter/json/ClutterJson-@CLUTTER_API_VERSION@.gir
@ -332,38 +336,25 @@ else
json_gir_include=--include=Json-1.0 json_gir_include=--include=Json-1.0
endif # LOCAL_JSON_GLIB endif # LOCAL_JSON_GLIB
-include $(INTROSPECTION_MAKEFILE)
if HAVE_INTROSPECTION if HAVE_INTROSPECTION
# We can't reference the list of COGL header files, since they are in a INTROSPECTION_GIRS += Clutter-@CLUTTER_API_VERSION@.gir
# subdir Makefile.am, so just extract them from cogl.h instead. The doc
# comments for COGL are in the headers, so we don't need the source files.
Clutter-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la Clutter-@CLUTTER_API_VERSION@.gir: libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la Makefile
$(QUIET_SCAN)$(INTROSPECTION_SCANNER) \
$(INTROSPECTION_SCANNER_ARGS) \
--quiet \
--namespace Clutter --nsversion=@CLUTTER_API_VERSION@ \
--pkg-export clutter-1.0 \
--warn-all \
$(INCLUDES) \
$(AM_CPPFLAGS) \
--c-include='clutter/clutter.h' \
--pkg-export=clutter-1.0 \
--include=GL-1.0 \
--include=GObject-2.0 \
--include=Atk-1.0 \
--include=Pango-1.0 \
--include=PangoCairo-1.0 \
--include-uninstalled=$(top_builddir)/clutter/cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir \
$(json_gir_include) \
--library=libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la \
--libtool="$(top_builddir)/libtool" \
--output $@ \
$(clutter_HEADERS) \
$(nodist_clutter_HEADERS) \
$(source_c) \
$(built_source_c)
BUILT_GIRSOURCES += Clutter-@CLUTTER_API_VERSION@.gir Clutter_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Clutter
Clutter_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
Clutter_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
Clutter_@CLUTTER_API_VERSION_AM@_gir_FILES = $(clutter_HEADERS) $(nodist_clutter_HEADERS) $(source_c) $(built_source_c)
Clutter_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS)
Clutter_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 Atk-1.0 Pango-1.0 PangoCairo-1.0
Clutter_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
--warn-all \
--c-include='clutter/clutter.h' \
--pkg-export clutter-1.0 \
$(json_gir_include) \
--include-uninstalled=$(top_builddir)/clutter/cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir
# ClutterJson.gir and Cogl.gir are used included into Clutter.gir, so need # ClutterJson.gir and Cogl.gir are used included into Clutter.gir, so need
# to be built before the typelib is generated # to be built before the typelib is generated
@ -386,45 +377,31 @@ BUILT_GIRSOURCES += Cogl-@CLUTTER_API_VERSION@.gir
# for Cogl and ClutterJson. # for Cogl and ClutterJson.
cally_sources=$(top_srcdir)/clutter/cally/*.h $(top_srcdir)/clutter/cally/*.c cally_sources=$(top_srcdir)/clutter/cally/*.h $(top_srcdir)/clutter/cally/*.c
cally_introspection_files=$(filter-out %-private.h, $(cally_sources)) cally_introspection_files=$(filter-out %-private.h, $(cally_sources))
Cally-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) Clutter-@CLUTTER_API_VERSION@.gir
$(QUIET_SCAN)$(INTROSPECTION_SCANNER) \
$(INTROSPECTION_SCANNER_ARGS) \
--quiet \
--namespace Cally --nsversion=@CLUTTER_API_VERSION@ \
$(INCLUDES) \
$(AM_CPPFLAGS) \
--c-include='cally/cally.h' \
--include=Pango-1.0 \
$(json_gir_include) \
--include-uninstalled=$(top_builddir)/clutter/cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir \
--include-uninstalled=$(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir \
--library=libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la \
--libtool="$(top_builddir)/libtool" \
--output $@ \
$(cally_introspection_files)
BUILT_GIRSOURCES += Cally-@CLUTTER_API_VERSION@.gir Cally-@CLUTTER_API_VERSION@.gir: Clutter-@CLUTTER_API_VERSION@.gir Makefile
Cally-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir Cally_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Cally
Cally_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
Cally_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
Cally_@CLUTTER_API_VERSION_AM@_gir_FILES = $(cally_introspection_files)
Cally_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS)
Cally_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
--warn-all \
--c-include='cally/cally.h' \
--add-include-path $(top_builddir)/clutter \
--include-uninstalled $(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir
INTROSPECTION_GIRS += Cally-@CLUTTER_API_VERSION@.gir
# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to # INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix. # install anything - we need to install inside our prefix.
girdir = $(datadir)/gir-1.0 girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES) dist_gir_DATA = $(BUILT_GIRSOURCES) $(INTROSPECTION_GIRS)
typelibsdir = $(libdir)/girepository-1.0/ typelibsdir = $(libdir)/girepository-1.0/
typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) $(INTROSPECTION_GIRS:.gir=.typelib)
typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) CLEANFILES += $(dist_gir_DATA) $(typelibs_DATA)
%.typelib: %.gir $(INTROSPECTION_COMPILER)
$(QUIET_COMP) \
LD_LIBRARY_PATH=.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \
$(INTROSPECTION_COMPILER) \
--includedir=$(srcdir) \
--includedir=. \
$(INTROSPECTION_COMPILER_ARGS) $< -o $(@F)
CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
endif # HAVE_INTROSPECTION endif # HAVE_INTROSPECTION
gcov_sources = $(source_c) gcov_sources = $(source_c)

View File

@ -235,26 +235,26 @@ coglincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
coglinclude_HEADERS = $(cogl_headers) coglinclude_HEADERS = $(cogl_headers)
nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.h nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.h
if HAVE_INTROSPECTION -include $(INTROSPECTION_MAKEFILE)
Cogl-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) libclutter-cogl.la
$(QUIET_SCAN)$(INTROSPECTION_SCANNER) \
$(INTROSPECTION_SCANNER_ARGS) \
--quiet \
--namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \
$(INCLUDES) \
$(AM_CPPFLAGS) \
--c-include='cogl/cogl.h' \
--include=GL-1.0 \
--include=GObject-2.0 \
--library=libclutter-cogl.la \
--libtool="$(top_builddir)/libtool" \
--output $@ \
$(cogl_headers) cogl-enum-types.h
BUILT_GIRSOURCES = Cogl-@CLUTTER_API_VERSION@.gir INTROSPECTION_GIRS =
if HAVE_INTROSPECTION
Cogl-@CLUTTER_API_VERSION@.gir: libclutter-cogl.la Makefile
Cogl_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Cogl
Cogl_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
Cogl_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-cogl.la
Cogl_@CLUTTER_API_VERSION_AM@_gir_FILES = $(cogl_headers) cogl-enum-types.h
Cogl_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS)
Cogl_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0
Cogl_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h'
INTROSPECTION_GIRS += Cogl-@CLUTTER_API_VERSION@.gir
girdir = $(datadir)/gir-1.0 girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES) dist_gir_DATA = $(INTROSPECTION_GIRS)
CLEANFILES += $(BUILT_GIRSOURCES) CLEANFILES += $(INTROSPECTION_GIRS)
endif endif

View File

@ -20,9 +20,6 @@ source_h_priv = \
noinst_LTLIBRARIES = libclutter-json.la noinst_LTLIBRARIES = libclutter-json.la
libclutter_json_la_SOURCES = $(source_c) $(source_h) $(source_h_priv)
libclutter_json_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS)
INCLUDES = \ INCLUDES = \
-I$(top_srcdir) \ -I$(top_srcdir) \
-DG_DISABLE_SINGLE_INCLUDES \ -DG_DISABLE_SINGLE_INCLUDES \
@ -31,32 +28,40 @@ INCLUDES = \
-DJSON_COMPILATION -DJSON_COMPILATION
AM_CFLAGS = $(MAINTAINER_CFLAGS) AM_CFLAGS = $(MAINTAINER_CFLAGS)
AM_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS)
clutterjsondir = $(includedir)/clutter-@CLUTTER_API_VERSION@/clutter/json clutterjsondir = $(includedir)/clutter-@CLUTTER_API_VERSION@/clutter/json
clutterjson_HEADERS = $(source_h) clutterjson_HEADERS = $(source_h)
libclutter_json_la_SOURCES = $(source_c) $(source_h) $(source_h_priv)
noinst_DATA = noinst_DATA =
CLEANFILES = CLEANFILES =
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
if HAVE_INTROSPECTION if HAVE_INTROSPECTION
BUILT_GIRSOURCES = BUILT_GIRSOURCES =
ClutterJson-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-json.la ClutterJson-@CLUTTER_API_VERSION@.gir: libclutter-json.la Makefile
$(QUIET_SCAN)$(INTROSPECTION_SCANNER) \
$(INTROSPECTION_SCANNER_ARGS) \
--quiet \
--namespace ClutterJson --nsversion=@CLUTTER_API_VERSION@ \
$(INCLUDES) \
--include=GObject-2.0 \
--library=libclutter-json.la \
--libtool="$(top_builddir)/libtool" \
--output $@ \
$(clutterjson_HEADERS) \
$(source_c)
BUILT_GIRSOURCES += ClutterJson-@CLUTTER_API_VERSION@.gir ClutterJson_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = ClutterJson
ClutterJson_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
ClutterJson_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-json.la
ClutterJson_@CLUTTER_API_VERSION_AM@_gir_FILES = $(clutterjson_HEADERS) $(source_c)
ClutterJson_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS)
ClutterJson_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GObject-2.0
ClutterJson_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
--warn-all \
--identifier-prefix=Json \
--symbol-prefix=json
noinst_DATA += $(BUILT_GIRSOURCES) INTROSPECTION_GIRS += ClutterJson-@CLUTTER_API_VERSION@.gir
girdir = $(datadir)/gir-1.0
dist_gir_DATA = $(INTROSPECTION_GIRS)
CLEANFILES += $(BUILT_GIRSOURCES)
endif endif

View File

@ -62,20 +62,13 @@ AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define dist-bzip2 check-news]
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
CLUTTER_MAJOR_VERSION=clutter_major_version AC_SUBST([CLUTTER_MAJOR_VERSION], [clutter_major_version])
CLUTTER_MINOR_VERSION=clutter_minor_version AC_SUBST([CLUTTER_MINOR_VERSION], [clutter_minor_version])
CLUTTER_MICRO_VERSION=clutter_micro_version AC_SUBST([CLUTTER_MICRO_VERSION], [clutter_micro_version])
CLUTTER_VERSION=clutter_version AC_SUBST([CLUTTER_VERSION], [clutter_version])
CLUTTER_API_VERSION=clutter_api_version AC_SUBST([CLUTTER_API_VERSION], [clutter_api_version])
CLUTTER_MAJORMINOR=clutter_major_version.clutter_minor_version AC_SUBST([CLUTTER_API_VERSION_AM], [$CLUTTER_MAJOR_VERSION\_0])
CLUTTER_RELEASE_STATUS=clutter_release_status AC_SUBST([CLUTTER_RELEASE_STATUS], [clutter_release_status])
AC_SUBST(CLUTTER_MAJOR_VERSION)
AC_SUBST(CLUTTER_MINOR_VERSION)
AC_SUBST(CLUTTER_MICRO_VERSION)
AC_SUBST(CLUTTER_VERSION)
AC_SUBST(CLUTTER_API_VERSION)
AC_SUBST(CLUTTER_MAJORMINOR)
AC_SUBST(CLUTTER_RELEASE_STATUS)
m4_define([lt_current], [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)]) m4_define([lt_current], [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)])
m4_define([lt_revision], [clutter_interface_age]) m4_define([lt_revision], [clutter_interface_age])
@ -88,7 +81,6 @@ CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"
AC_SUBST(CLUTTER_LT_VERSION) AC_SUBST(CLUTTER_LT_VERSION)
AC_SUBST(CLUTTER_LT_LDFLAGS) AC_SUBST(CLUTTER_LT_LDFLAGS)
AC_SUBST(CLUTTER_LINK_FLAGS)
dnl ======================================================================== dnl ========================================================================
@ -121,6 +113,7 @@ AC_TRY_LINK([], [int main (void) { return 0; }],
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
]) ])
LDFLAGS="${clutter_LDFLAGS}" LDFLAGS="${clutter_LDFLAGS}"
AC_SUBST(CLUTTER_LINK_FLAGS)
dnl ======================================================================== dnl ========================================================================