-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgen-vala.mk
35 lines (29 loc) · 1.03 KB
/
gen-vala.mk
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
extra-gen += vala
extra-flags += VALAFLAGS FAST_VAPI
define vala_rule
cleanfiles += $(addprefix $(OUTDIR),$(1:.c=.vapi))
$(OUTDIR)$(1): FAPI = $(addprefix $(OUTDIR),$(call getvar,$(1),FAST_VAPI))
$(OUTDIR)$(1): VALAFLAGS = $(call getvar,$(1),VALAFLAGS)
$(OUTDIR)$(1): CMD = $(addprefix --directory=,$(OUTDIR)) $$(VALAFLAGS)
$(OUTDIR)$(1): $(call getsrc,$(1))
$(OUTDIR)$(1): $(addprefix $(OUTDIR),$(call getvar,$(1),FAST_VAPI))
$(OUTDIR)$(1): $(filter %.vapi,$(call getsrc,$(1)))
$(OUTDIR)$(1): $(OUTDIR)$(call getcmdfile,$(1))
endef
define vala_recipe
# an extra recipe to generate "fast vapi" files for --use-fast-vapi
$(OUTDIR)%.vapi: %.vala
$$(call printcmd,GEN,$$@)
$$(AT)mkdir -p $$(@D)
$$(Q)$(VALAC) --fast-vapi=$$@ $$<
$$(AT)touch $$@
$(addprefix $(OUTDIR),$(1)):
$$(call printcmd,VALAC,$$@)
$$(AT)mkdir -p $$(@D)
$$(Q)$$(VALAC) $$(CMD) -C $$(filter %.vala,$$^) \
$$(addprefix --use-fast-vapi=,$$(filter $$(FAPI),$$^)) \
$$(filter-out $$(FAPI),$$(filter %.vapi,$$^))
$$(AT)touch $$@
endef
vala-suffix := .vala
.SUFFIXES: vala vapi