summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzesimir Nowak <qdlacz@gmail.com>2012-07-02 22:55:56 +0200
committerKrzesimir Nowak <qdlacz@gmail.com>2012-07-09 22:27:10 +0200
commitad6997640d58733f0e378f2ef14d32d01a9091d4 (patch)
treea35532b4db82f46b6c8a8bc9c0db2d13916fac3c
parent1553ebe1d99082dea2512dcb10aebd237ed53432 (diff)
downloadmm-common-ad6997640d58733f0e378f2ef14d32d01a9091d4.tar.gz
Adapt to refactored gmmproc.
* build/generate-binding.am: Some of the variables are not needed anymore (like the one involving m4), but some other had to be added (like include paths for perl or type info files).
-rw-r--r--build/generate-binding.am91
1 files changed, 48 insertions, 43 deletions
diff --git a/build/generate-binding.am b/build/generate-binding.am
index fe9886d..36e561d 100644
--- a/build/generate-binding.am
+++ b/build/generate-binding.am
@@ -1,4 +1,5 @@
## Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/>
+## Copyright (c) 2012 Krzesimir Nowak <qdlacz@gmail.com>
##
## This file is part of mm-common.
##
@@ -15,76 +16,80 @@
## You should have received a copy of the GNU General Public License
## along with mm-common. If not, see <http://www.gnu.org/licenses/>.
-## Parameters: binding_name, wrap_init_flags
-## Overrides: codegen_srcdir, codegen_m4_srcdir, binding_outputdir,
-## gmmproc, gen_wrap_init, gmmproc_flags
-## Files: files_codegen_m4, files_defs, files_hg, files_ccg
-## Output: dist_noinst_DATA, gmmproc_dependencies, other_built_sources,
-## MAINTAINERCLEANFILES
+## Parameters: binding_name, wrap_init_namespace
+## Overrides: codegen_proc_srcdir, binding_outputdir,
+## gmmproc_script, gmmproc_includes,
+## gmmproc_perl_includes, gmmproc_extra_dependencies
+## Files: files_codegen_proc, files_hg, files_ccg
+## Output: dist_noinst_DATA, gmmproc_dependencies,
+## other_built_sources, MAINTAINERCLEANFILES
-# Location of the module's gmmproc support files.
-codegen_srcdir ?= $(top_srcdir)/codegen
+# Location of the module's proc files.
+codegen_proc_srcdir ?= $(top_srcdir)/codegen/proc
-# Location of the module's gmmproc M4 files,
-# and of any extra m4 files from installed modules,
-# such as from gtkmm rather than just glibmm.
-# Use, for instance, this in configure.ac:
-# MM_PKG_CONFIG_SUBST([GMMPROC_EXTRA_M4_DIR], [--variable=gmmprocm4dir gtkmm-3.0])
-codegen_m4_srcdir ?= $(codegen_srcdir)/m4
+# Location of the module's generated proc files.
+codegen_proc_builddir = $(patsubst $(top_srcdir)/%,$(top_builddir)/%,$(codegen_proc_srcdir))
# Destination directory of the generated source files.
-binding_outputdir ?= $(if $(srcdir:.=),$(dir $(top_srcdir)/$(subdir)),../)$(binding_name)
+binding_outputdir ?= $(builddir)/../$(binding_name)
# Additional built sources not generated by gmmproc.
-other_built_sources = $(binding_outputdir)/wrap_init.cc
+# Currently none, but some might be added by users of this file.
+other_built_sources =
# Where to put the stamp files for the gmmproc output.
-binding_stampdir = $(srcdir)/.stamps
+binding_stampfile = $(builddir)/.proc-stamp
# Lists of qualified file names relative to the current directory.
-binding_relfiles_m4 = $(addprefix $(codegen_m4_srcdir)/,$(files_codegen_m4))
-binding_relfiles_hg = $(addprefix $(srcdir)/,$(files_hg))
-binding_stampfiles = $(patsubst %.hg,$(binding_stampdir)/%.stamp,$(files_hg))
+binding_relfiles_proc = $(addprefix $(codegen_proc_srcdir)/,$(files_codegen_proc))
+
+# List of bases passed to gmmproc.
+bases = $(files_hg:.hg=)
+
+# A type info file generated by gmmproc.
+gen_proc_file = $(codegen_proc_builddir)/type_info_$(binding_name)_generated
# Distributed code generation source files.
-dist_noinst_DATA = $(files_defs) $(files_hg) $(files_ccg)
+dist_noinst_DATA = $(files_hg) $(files_ccg) $(gen_proc_file)
-# Delete stamps on make maintainer-clean. The other generated source
+# Delete stamps on make maintainer-clean. The other generated source
# files are deleted by the make rules for the output directory.
-MAINTAINERCLEANFILES = $(binding_stampdir)/*.stamp
+MAINTAINERCLEANFILES = $(binding_stampfile) $(gen_proc_file)
+
+# Overridable gmmproc dependencies.
+gmmproc_extra_dependencies ?=
# Dependencies of the gmmproc code generator targets.
-gmmproc_dependencies = $(binding_relfiles_m4) $(files_defs)
+gmmproc_dependencies = $(binding_relfiles_proc) $(gmmproc_extra_dependencies)
# Default command lines for running the code generators.
-gmmproc ?= $(PERL) -I"$(GMMPROC_DIR)/pm" -- "$(GMMPROC_DIR)/gmmproc"
-gen_wrap_init ?= $(PERL) -- "$(GMMPROC_DIR)/generate_wrap_init.pl"
-codegen_m4_flags = $(addprefix -I , $(codegen_m4_srcdir) $(GMMPROC_EXTRA_M4_DIR))
-gmmproc_flags ?= $(codegen_m4_flags) --defs $(srcdir)
+gmmproc_perl_includes ?= -I"$(GMMPROC_DIR)/pm" $(GMMPROC_EXTRA_PM_DIRS)
+gmmproc_includes ?= $(addprefix --include ,$(codegen_proc_srcdir) $(codegen_proc_builddir)) $(GMMPROC_EXTRA_PROC_DIRS)
+gmmproc_script ?= "$(GMMPROC_DIR)/gmmproc"
+gmmproc = $(PERL) $(gmmproc_perl_includes) -- $(gmmproc_script)
# Automatically created output directories.
-binding_mkdirs = $(binding_stampdir) $(binding_outputdir)/private
+binding_mkdirs = $(binding_outputdir)/private
-# Show names of generated files in silent rules output.
-mm_0_gen = @echo ' GEN $(binding_outputdir)/{$*.cc,$*.h,private/$*_p.h}';
-mm_v_gen = $(if $(filter 0,$(or $(V),$(AM_DEFAULT_VERBOSITY))),$(mm_0_gen))
+$(gen_proc_file): $(binding_stampfile)
# Declare the built sources main targets.
-all-local: $(binding_stampfiles) $(other_built_sources)
+all-local: $(binding_stampfile) $(other_built_sources)
# Create the output directories if they do not exist already.
$(binding_mkdirs):
$(AM_V_at)$(MKDIR_P) $@
-# Generate the wrap_init.cc file using generate_wrap_init.pl.
-$(binding_outputdir)/wrap_init.cc: $(binding_relfiles_hg) $(srcdir)/Makefile.in
- $(AM_V_GEN)$(gen_wrap_init) $(wrap_init_flags) $(binding_relfiles_hg) >$@
-
# Run the gmmproc code generator to produce the C++ binding code.
-$(binding_stampdir)/%.stamp: %.hg %.ccg $(gmmproc_dependencies) | $(binding_mkdirs)
- @: >$@
- $(mm_v_gen)$(gmmproc) $(gmmproc_flags) $* $(srcdir) $(binding_outputdir)
-
-# Instruct GNU make to delete the targets of a rule after it failed, in
-# order to avoid the complication of handling that situation manually.
+# The "$(binding_mkdirs)" after | means to ignore timestamp of the
+# directories (files). In case of directories their timestamp changes
+# with every change in any file inside and thus that would cause
+# useless reexecution of this rule.
+$(binding_stampfile): $(files_hg) $(files_ccg) $(gmmproc_dependencies) | $(binding_mkdirs)
+ $(gmmproc) --source $(srcdir) --destination $(binding_outputdir) --mm-module $(binding_name) --wrap-init-namespace $(wrap_init_namespace) $(gmmproc_includes) $(bases)
+ @: touch "$(binding_stampfile)"
+
+# Instruct GNU make to delete the targets of a rule after it failed,
+# in order to avoid the complication of handling that situation
+# manually.
.DELETE_ON_ERROR: