-
Notifications
You must be signed in to change notification settings - Fork 3
/
gen-gir.mk
54 lines (45 loc) · 1.81 KB
/
gen-gir.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
extra-gen += gir typelib
extra-flags += GIR_NAMESPACE GIR_VERSION GIR_SCANFLAGS
extra-flags += GIR_INCLUDES GIR_CFLAGS GIR_LIB
extra-flags += INTROSPECTION_COMPILER_ARGS
ifeq ($(INTROSPECTION_SCANNER),)
$(error INTROSPECTION_SCANNER is not set)
endif
ifeq ($(INTROSPECTION_COMPILER),)
$(error INTROSPECTION_COMPILER is not set)
endif
define gir_rule
$(OUTDIR)$(1): GIR_NAMESPACE = $(call getvar,$(1),GIR_NAMESPACE)
$(OUTDIR)$(1): GIR_SCANFLAGS = $(call getvar,$(1),GIR_SCANFLAGS)
$(OUTDIR)$(1): GIR_VERSION = $(call getvar,$(1),GIR_VERSION)
$(OUTDIR)$(1): GIR_INCLUDES = $(call getvar,$(1),GIR_INCLUDES)
$(OUTDIR)$(1): GIR_CFLAGS = $(call getvar,$(1),GIR_CFLAGS)
$(OUTDIR)$(1): GIR_LIB = $(call getvar,$(1),GIR_LIB)
$(OUTDIR)$(1): CMD = --namespace $$(GIR_NAMESPACE) \
--nsversion $$(GIR_VERSION) \
--libtool '$$(LIBTOOL)' \
--library $$(GIR_LIB) \
$$(addprefix --include=,$$(GIR_INCLUDES)) \
$$(GIR_SCANFLAGS) \
--cflags-begin $$(GIR_CFLAGS) --cflags-end
$(OUTDIR)$(1): $(call getsrc,$(1))
$(OUTDIR)$(1): $(OUTDIR)$(call getcmdfile,$(1))
endef
define gir_recipe
$(addprefix $(OUTDIR),$(1)):
$$(call printcmd,GISCAN,$$@)
$$(Q)LDFLAGS="$$(GEANY_LIBS)" CC=gcc \
$(INTROSPECTION_SCANNER) $(if $(Q),--quiet) $$(CMD) $$^ --output $$@
endef
define typelib_rule
$(OUTDIR)$(1): INTROSPECTION_COMPILER_ARGS = $(call getvar,$(1),INTROSPECTION_COMPILER_ARGS)
$(OUTDIR)$(1): CMD = $$(INTROSPECTION_COMPILER_ARGS)
$(OUTDIR)$(1): $(call getsrc,$(1))
$(OUTDIR)$(1): $(OUTDIR)$(call getcmdfile,$(1))
endef
define typelib_recipe
$(addprefix $(OUTDIR),$(1)):
$$(call printcmd,GICOMP,$$@)
$$(Q)$$(INTROSPECTION_COMPILER) $$(INTROSPECTION_COMPILER_ARGS) $$< -o $$@
endef
typelib-suffix := .gir