+# 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)")
+