File: Makefile.pkgconfig

package info (click to toggle)
netsurf 3.11-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 87,296 kB
  • sloc: ansic: 403,115; xml: 81,988; cpp: 6,246; perl: 4,605; makefile: 2,907; yacc: 2,246; python: 2,057; sh: 1,500; jsp: 1,156; lex: 623; javascript: 551; ruby: 329; asm: 326; lisp: 151; php: 6
file content (100 lines) | stat: -rw-r--r-- 2,594 bytes parent folder | download | duplicates (6)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# General purpose pkg-config macros

# Determine if a package is available
# 1: Name of variable to assign result into
# 2: Name of package to search for
define pkg_config_package_available
  ifeq ($$(PKGCONFIG),)
    $$(error pkg-config is required to auto-detect package availability)
  endif

  ifeq ($$(shell $$(PKGCONFIG) --exists $(2) && echo yes),yes)
    $(1) := yes
  else
    $(1) := no
  endif

endef

# Retrieve the version of a package
# 1: Name of variable to assign result into
# 2: Name of package to search for
define pkg_config_package_version
  ifeq ($$(PKGCONFIG),)
    $$(error pkg-config is required to auto-detect package version)
  endif

  $(1) := $$(shell $$(PKGCONFIG) --modversion $(2))

endef

# Test the presence of a minimum version of a package
# 1: Name of variable to assign result into
# 2: Name of package to search for
# 3: Lowest accepted version number
define pkg_config_package_min_version
  ifeq ($$(PKGCONFIG),)
    $$(error pkg-config is required to auto-detect package version)
  endif

  ifeq ($$(shell $$(PKGCONFIG) --atleast-version=$(3) $(2) && echo yes),yes)
     $(1) := yes
  else
     $(1) := no
  endif

endef

# Test the presence of a minimum version of a package
# 1: Name of variable to assign result into
# 2: Name of package to search for
# 3: Lowest accepted version number
# 4: Highest accepted version number
define pkg_config_package_compare_version
  ifeq ($$(PKGCONFIG),)
    $$(error pkg-config is required to auto-detect package version)
  endif

  ifeq ($$(shell $$(PKGCONFIG) --atleast-version=$(3) $(2) && echo yes),yes)
     ifeq ($$(shell $$(PKGCONFIG) --max-version=$(4) $(2) && echo yes),yes)
       $(1) := yes
     else
       $(1) := no
     endif
  else
     $(1) := no
  endif

endef

# Add package to compiler/linker flags
# 1: Name of package to add details of
# 2: CFLAGS variable to extend, or none
# 3: LDFLAGS variable to extend, or none
define pkg_config_package_add_flags
  ifeq ($$(PKGCONFIG),)
    $$(error pkg-config is required to auto-detect package version)
  endif

  ifneq ($(2),)
    $(2) := $$($(2)) $$(shell $$(PKGCONFIG) --cflags $(1))
  endif

  ifneq ($(3),)
    $(3) := $$($(3)) $$(shell $$(PKGCONFIG) --libs $(1))
  endif

endef

# Obtain the value of a pkg-config variable
# 1: Name of variable to assign result into
# 2: Name of package to search for
# 3: Name of pkg-config variable to retrieve
define pkg_config_get_variable
  ifeq ($$(PKGCONFIG),)
    $$(error pkg-config is required to auto-detect package version)
  endif

  $(1) := $$(shell $$(PKGCONFIG) --variable=$(3) $(2))

endef