tests: Add the scope for callbacks in expected girs
[gnome.gobject-introspection] / Makefile.introspection
index 9d060d9..9616294 100644 (file)
 
 # Make sure the required variables are set, these should under normal
 # circumstances come from introspection.m4
-$(if $(INTROSPECTION_GIRS),,$(error Need to define INTROSPECTION_GIRS))
 $(if $(INTROSPECTION_SCANNER),,$(error Need to define INTROSPECTION_SCANNER))
 $(if $(INTROSPECTION_COMPILER),,$(error Need to define INTROSPECTION_COMPILER))
 
+# Private functions
+
+## Transform the gir filename to something which can reference through a variable
+## without automake/make complaining, eg Gtk-2.0.gir -> Gtk_2_0_gir
+_gir_name = $(subst -,_,$(subst .,_,$(1)))
+
+# Namespace and Version is either fetched from the gir filename
+# or the _NAMESPACE/_VERSION variable combo
+_gir_namespace = $(or $($(_gir_name)_NAMESPACE),$(firstword $(subst -, ,$(1))))
+_gir_version = $(or $($(_gir_name)_VERSION),$(lastword $(subst -, ,$(1:.gir=))))
+
+# _PROGRAM is an optional variable which needs it's own --program argument
+_gir_program = $(if $($(_gir_name)_PROGRAM),--program=$($(_gir_name)_PROGRAM))
+
+# Variables which provides a list of things
+_gir_libraries = $(foreach lib,$($(_gir_name)_LIBS),--library=$(lib))
+_gir_packages = $(foreach pkg,$($(_gir_name)_PACKAGES),--pkg=$(pkg))
+_gir_includes = $(foreach include,$($(_gir_name)_INCLUDES),--include=$(include))
+
+# Reuse the LIBTOOL variable from by automake if it's set
+_gir_libtool = $(if $(LIBTOOL),--libtool="$(LIBTOOL)")
+
+# Macros for AM_SILENT_RULES prettiness
+_gir_verbosity = $(if $(AM_DEFAULT_VERBOSITY),$(AM_DEFAULT_VERBOSITY),1)
+
+_gir_silent_scanner = $(_gir_silent_scanner_$(V))
+_gir_silent_scanner_ = $(_gir_silent_scanner_$(_gir_verbosity))
+_gir_silent_scanner_0 = @echo "  GISCAN $(1)";
+
+_gir_silent_compiler = $(_gir_silent_compiler_$(V))
+_gir_silent_compiler_ = $(_gir_silent_compiler_$(_gir_verbosity))
+_gir_silent_compiler_0 = @echo "  GICOMP $(1)";
+
 #
 # Creates a GIR by scanning C headers/sources
 # $(1) - Name of the gir file (output)
@@ -70,11 +102,8 @@ $(if $(INTROSPECTION_COMPILER),,$(error Need to define INTROSPECTION_COMPILER))
 #   GLib-2.0, Gtk-2.0. This is needed for all libraries which you depend on that
 #   provides introspection information.
 #
-define introspection-scanner
 
-# Transform the gir filename to something which can reference through a variable
-# without automake/make complaining, eg Gtk-2.0.gir -> Gtk_2_0_gir
-_gir_name = $(subst -,_,$(subst .,_,$(1)))
+define introspection-scanner
 
 # Basic sanity check, to make sure required variables are set
 $(if $($(_gir_name)_FILES),,$(error Need to define $(_gir_name)_FILES))
@@ -82,28 +111,11 @@ $(if $(or $($(_gir_name)_LIBS),
           $($(_gir_name)_PROGRAM)),,
     $(error Need to define $(_gir_name)_LIBS or $(_gir_name)_PROGRAM))
 
-# Namespace and Version is either fetched from the gir filename
-# or the _NAMESPACE/_VERSION variable combo
-_gir_namespace = $(or $($(_gir_name)_NAMESPACE),$(firstword $(subst -, ,$(1))))
-_gir_version = $(or $($(_gir_name)_VERSION),$(lastword $(subst -, ,$(1:.gir=))))
-
-# _PROGRAM is an optional variable which needs it's own --program argument
-_gir_program = $(if $($(_gir_name)_PROGRAM),--program=$($(_gir_name)_PROGRAM))
-
-# Variables which provides a list of things
-_gir_libraries = $(foreach lib,$($(_gir_name)_LIBS),--library=$(lib))
-_gir_packages = $(foreach pkg,$($(_gir_name)_PACKAGES),--pkg=$(pkg))
-_gir_includes = $(foreach include,$($(_gir_name)_INCLUDES),--include=$(include))
-
-# Reuse the LIBTOOL variable from by automake if it's set
-_gir_libtool = $(if $(LIBTOOL),--libtool="$(LIBTOOL)")
-
 # Only dependencies we know are actually filenames goes into _FILES, make
 # sure these are built before running the scanner. Libraries and programs
 # needs to be added manually.
 $(1): $$($(_gir_name)_FILES) $(INTROSPECTION_PARSER)
-    ## Invoke the scanner
-       $(INTROSPECTION_SCANNER) $(INTROSPECTION_SCANNER_ARGS) \
+       $(_gir_silent_scanner) $(INTROSPECTION_SCANNER) $(INTROSPECTION_SCANNER_ARGS) \
          --namespace=$(_gir_namespace) \
          --nsversion=$(_gir_version) \
          $(_gir_libtool) \
@@ -114,7 +126,6 @@ $(1): $$($(_gir_name)_FILES) $(INTROSPECTION_PARSER)
          $($(_gir_name)_SCANNERFLAGS) \
          $($(_gir_name)_CFLAGS) \
          $($(_gir_name)_FILES) \
-         ## Output should go last as it makes it easier to read compilation logs
          --output $(1)
 endef
 
@@ -126,7 +137,7 @@ $(foreach gir,$(INTROSPECTION_GIRS),$(eval $(call introspection-scanner,$(gir)))
 # $(2): typelib filename (output)
 #
 define introspection-compiler
-$(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) --includedir=. $(1) -o $(2)
+$(_gir_silent_compiler) $(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) --includedir=. $(1) -o $(2)
 endef
 
 # Simple rule to compile a typelib.