|
Packit |
371ed6 |
## Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/>
|
|
Packit |
371ed6 |
##
|
|
Packit |
371ed6 |
## This file is part of mm-common.
|
|
Packit |
371ed6 |
##
|
|
Packit |
371ed6 |
## mm-common is free software: you can redistribute it and/or modify
|
|
Packit |
371ed6 |
## it under the terms of the GNU General Public License as published
|
|
Packit |
371ed6 |
## by the Free Software Foundation, either version 2 of the License,
|
|
Packit |
371ed6 |
## or (at your option) any later version.
|
|
Packit |
371ed6 |
##
|
|
Packit |
371ed6 |
## mm-common is distributed in the hope that it will be useful,
|
|
Packit |
371ed6 |
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
371ed6 |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
371ed6 |
## GNU General Public License for more details.
|
|
Packit |
371ed6 |
##
|
|
Packit |
371ed6 |
## You should have received a copy of the GNU General Public License
|
|
Packit |
371ed6 |
## along with mm-common. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
## Parameters: binding_name, wrap_init_flags
|
|
Packit |
371ed6 |
## Overrides: codegen_srcdir, codegen_m4_srcdir, binding_outputdir,
|
|
Packit |
371ed6 |
## gmmproc, gen_wrap_init, gmmproc_flags
|
|
Packit |
371ed6 |
## Files: files_codegen_m4, files_defs, files_hg, files_ccg
|
|
Packit |
371ed6 |
## Output: dist_noinst_DATA, gmmproc_dependencies, other_built_sources,
|
|
Packit |
371ed6 |
## MAINTAINERCLEANFILES
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Location of the module's gmmproc support files.
|
|
Packit |
371ed6 |
codegen_srcdir ?= $(top_srcdir)/codegen
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Location of the module's gmmproc M4 files,
|
|
Packit |
371ed6 |
# and of any extra m4 files from installed modules,
|
|
Packit |
371ed6 |
# such as from gtkmm rather than just glibmm.
|
|
Packit |
371ed6 |
# Use, for instance, this in configure.ac:
|
|
Packit |
371ed6 |
# MM_PKG_CONFIG_SUBST([GMMPROC_EXTRA_M4_DIR], [--variable=gmmprocm4dir gtkmm-3.0])
|
|
Packit |
371ed6 |
codegen_m4_srcdir ?= $(codegen_srcdir)/m4
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Destination directory of the generated source files.
|
|
Packit |
371ed6 |
binding_outputdir ?= $(if $(srcdir:.=),$(dir $(top_srcdir)/$(subdir)),../)$(binding_name)
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Additional built sources not generated by gmmproc.
|
|
Packit |
371ed6 |
other_built_sources = $(binding_outputdir)/wrap_init.cc
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Where to put the stamp files for the gmmproc output.
|
|
Packit |
371ed6 |
binding_stampdir = $(srcdir)/.stamps
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Lists of qualified file names relative to the current directory.
|
|
Packit |
371ed6 |
binding_relfiles_m4 = $(addprefix $(codegen_m4_srcdir)/,$(files_codegen_m4))
|
|
Packit |
371ed6 |
binding_relfiles_hg = $(addprefix $(srcdir)/,$(files_hg))
|
|
Packit |
371ed6 |
binding_stampfiles = $(patsubst %.hg,$(binding_stampdir)/%.stamp,$(files_hg))
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Distributed code generation source files.
|
|
Packit |
371ed6 |
dist_noinst_DATA = $(files_defs) $(files_hg) $(files_ccg)
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Delete stamps on make maintainer-clean. The other generated source
|
|
Packit |
371ed6 |
# files are deleted by the make rules for the output directory.
|
|
Packit |
371ed6 |
MAINTAINERCLEANFILES = $(binding_stampdir)/*.stamp
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Dependencies of the gmmproc code generator targets.
|
|
Packit |
371ed6 |
gmmproc_dependencies = $(binding_relfiles_m4) $(files_defs)
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Default command lines for running the code generators.
|
|
Packit |
371ed6 |
gmmproc ?= $(PERL) -I"$(GMMPROC_DIR)/pm" -- "$(GMMPROC_DIR)/gmmproc"
|
|
Packit |
371ed6 |
gen_wrap_init ?= $(PERL) -- "$(GMMPROC_DIR)/generate_wrap_init.pl"
|
|
Packit |
371ed6 |
codegen_m4_flags = $(addprefix -I , $(codegen_m4_srcdir) $(GMMPROC_EXTRA_M4_DIR))
|
|
Packit |
371ed6 |
gmmproc_flags ?= $(codegen_m4_flags) --defs $(srcdir)
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Automatically created output directories.
|
|
Packit |
371ed6 |
binding_mkdirs = $(binding_stampdir) $(binding_outputdir)/private
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Show names of generated files in silent rules output.
|
|
Packit |
371ed6 |
mm_0_gen = @echo ' GEN $(binding_outputdir)/{$*.cc,$*.h,private/$*_p.h}';
|
|
Packit |
371ed6 |
mm_v_gen = $(if $(filter 0,$(or $(V),$(AM_DEFAULT_VERBOSITY))),$(mm_0_gen))
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Declare the built sources main targets.
|
|
Packit |
371ed6 |
all-local: $(binding_stampfiles) $(other_built_sources)
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Create the output directories if they do not exist already.
|
|
Packit |
371ed6 |
$(binding_mkdirs):
|
|
Packit |
371ed6 |
$(AM_V_at)$(MKDIR_P) $@
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Generate the wrap_init.cc file using generate_wrap_init.pl.
|
|
Packit |
371ed6 |
$(binding_outputdir)/wrap_init.cc: $(binding_relfiles_hg) $(srcdir)/Makefile.in
|
|
Packit |
371ed6 |
$(AM_V_GEN)$(gen_wrap_init) $(wrap_init_flags) $(binding_relfiles_hg) >$@
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Run the gmmproc code generator to produce the C++ binding code.
|
|
Packit |
371ed6 |
$(binding_stampdir)/%.stamp: %.hg %.ccg $(gmmproc_dependencies) | $(binding_mkdirs)
|
|
Packit |
371ed6 |
@: >$@
|
|
Packit |
371ed6 |
$(mm_v_gen)$(gmmproc) $(gmmproc_flags) $* $(srcdir) $(binding_outputdir)
|
|
Packit |
371ed6 |
|
|
Packit |
371ed6 |
# Instruct GNU make to delete the targets of a rule after it failed, in
|
|
Packit |
371ed6 |
# order to avoid the complication of handling that situation manually.
|
|
Packit |
371ed6 |
.DELETE_ON_ERROR:
|