summaryrefslogtreecommitdiff
path: root/Makefile.vapigen
blob: 7a2ece00a76d9123a320c6878ef1a7f2a6083cf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Makefile for Vala API Generator (vapigen)
# Written by Evan Nemerson
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
#
# Variables:
#
#   VAPIGEN_FILES
#
#     VAPIs to create
#
#   *_DEPS / VAPIGEN_DEPS
#
#       The dependencies. Generally the pkg-config names.
#
#   *_METADATADIRS / VAPIGEN_METADATADIRS
#
#       Directory containing the metadata.
#
#   *_VAPIDIRS / VAPIGEN_VAPIDIRS
#
#       Additional location(s) to search for VAPI dependencies.
#
#   *_GIRDIRS / VAPIGEN_GIRDIRS
#
#       Additional location(s) to search for GIR dependencies.
#
#   *_FILES
#
#       The files which should be used to generate the VAPI.

_vapigen_silent_prefix = $(_vapigen_silent_prefix_$(V))
_vapigen_silent_prefix_ = $(_vapigen_silent_prefix_$(AM_DEFAULT_VERBOSITY))
_vapigen_silent_prefix_0 = @echo " VAPIGEN $(1)";
_vapigen_silent_opts = $(_vapigen_silent_opts_$(V))
_vapigen_silent_opts_ = $(_vapigen_silent_opts_$(AM_DEFAULT_VERBOSITY))
_vapigen_silent_opts_0 = --quiet

_vapi_name = $(subst /,_,$(subst -,_,$(subst .,_,$(1))))

define vapigen
$(1): $$($(_vapi_name)_GIR)
	$(_vapigen_silent_prefix) \
	G_DEBUG='' \
	$(VAPIGEN) $(_vapigen_silent_opts) \
	  --library $(1:.vapi=) \
	  $(foreach _vapi_metadatadir_name,$(if $($(_vapi_name)_METADATADIRS),$($(_vapi_name)_METADATADIRS),$(VAPIGEN_METADATADIRS)),--metadatadir $(_vapi_metadatadir_name)) \
	  $(foreach _vapi_dir_name,$(if $($(_vapi_name)_VAPIDIRS),$($(_vapi_name)_VAPIDIRS),$(VAPIGEN_VAPIDIRS)),--vapidir $(_vapi_dir_name)) \
	  $(foreach _vapi_gir_dir,$(if $($(_vapi_name)_GIRDIRS),$($(_vapi_name)_GIRDIRS),$(VAPIGEN_GIRDIRS)),--girdir $(_vapi_gir_dir)) \
	  $(foreach _vapi_dep_name,$(if $($(_vapi_name)_DEPS),$($(_vapi_name)_DEPS),$(VAPIGEN_DEPS)),--pkg $(_vapi_dep_name)) \
	  $$($(_vapi_name)_FILES) && \
	touch $(1)
endef

$(foreach vapi,$(VAPIGEN_VAPIS),$(eval $(call vapigen,$(vapi))))