1## Copyright (c) 2001
2## The gtkmm development team.
3##
4## **** Common rules for inclusion in Makefile.am ****
5## Included from something/src/Makefile.am
6##
7## Used variable:	Example content:
8##
9## sublib_name		= gdkmm
10## sublib_namespace     = Gdk
11
12## files_defs		= gdk.defs gdk_pixbuf.defs
13
14
15tools_dir	= $(top_srcdir)/tools
16tools_dir_m4= $(top_srcdir)/tools/m4
17tools_dir_pm= $(top_srcdir)/tools/pm
18
19gensrc_destdir = $(srcdir)/../$(sublib_name)
20stamp_dir = $(srcdir)/.stamps
21
22include $(top_srcdir)/tools/Makefile_list_of_sources.am_fragment
23tools_m4	= $(files_tools_m4:%.m4=$(tools_dir_m4)/%.m4)
24# tools_pm	= $(files_tools_pm:%.pm=$(tools_dir_pm)/%.pm)
25
26include $(srcdir)/Makefile_list_of_hg.am_fragment
27files_ccg	= $(files_hg:%.hg=%.ccg)
28files_h		= $(files_hg:%.hg=$(gensrc_destdir)/%.h)
29files_cc	= $(files_hg:%.hg=$(gensrc_destdir)/%.cc)
30files_stamp	= $(files_hg:%.hg=$(stamp_dir)/stamp-%)
31
32#Installed gmmproc stuff, from glibmm:
33gmmproc_path = $(GMM_PROC)
34gmmproc_dir = $(GMM_PROCDIR)
35
36# We use our own m4 and pm files as well as the ones installed by gtkmm:
37# Our override m4 include seems to need to be before the default one.
38gmmproc_args	= -I $(tools_dir_m4) --defs $(srcdir)
39run_gmmproc	= $(gmmproc_path) $(gmmproc_args)
40
41gen_wrap_init_path = $(gmmproc_dir)/generate_wrap_init.pl
42gen_wrap_init_args = --namespace=Gnome --namespace=$(sublib_namespace) --parent_dir=$(sublib_parentdir)
43run_gen_wrap_init  = $(gen_wrap_init_path) $(gen_wrap_init_args)
44
45EXTRA_DIST	= Makefile_list_of_hg.am_fragment \
46		  $(files_defs) $(files_hg) $(files_ccg)
47
48
49$(stamp_dir)/stamp-%: %.hg %.ccg $(tools_m4) $(files_defs)
50	$(run_gmmproc) $(notdir $*) $(srcdir) $(gensrc_destdir)
51	@echo 'timestamp' > $@
52
53sublib_srcdir		= $(srcdir)/../src
54files_hg_with_path	= $(patsubst %.hg,$(sublib_srcdir)/%.hg,$(files_hg))
55
56$(gensrc_destdir)/wrap_init.cc: $(gen_wrap_init_path) $(files_hg_with_path)
57	$(run_gen_wrap_init) $(files_hg:%.hg=$(srcdir)/%.hg) >$@
58
59create-stamp-dir:
60	@(test -d $(stamp_dir) || mkdir $(stamp_dir))
61
62if MAINTAINER_MODE
63all-local: create-stamp-dir $(files_stamp) $(gensrc_destdir)/wrap_init.cc
64endif
65
66maintainer-clean-local:
67	rm -rf $(stamp_dir)
68