Pullup ticket #2800.
[pkgsrc.git] / mk / fam.buildlink3.mk
1 # $NetBSD: fam.buildlink3.mk,v 1.6 2009/03/15 21:47:44 jmcneill Exp $
2 #
3 # This Makefile fragment is meant to be included by packages that
4 # require a FAM implementation.  fam.buildlink3.mk will:
5 #
6 #       * set FAMBASE to the base directory of the FAM files;
7 #       * set FAM_TYPE to the FAM implementation used.
8 #
9 # There are three variables that can be used to tweak the selection of
10 # the FAM implementation:
11 #
12 # FAM_DEFAULT is a user-settable variable whose value is the default
13 #       FAM implementation to use.
14 #
15 # FAM_ACCEPTED is a package-settable list of FAM implementations that
16 #       may be used by the package.
17 #
18 # FAM_SERVER is a package-settable flag whose value determines whether
19 #       or not the server and library are both required.
20
21 MK_FAM_BUILDLINK3_MK:=  ${MK_FAM_BUILDLINK3_MK}+
22
23 .include "../../mk/bsd.prefs.mk"
24
25 .if !empty(MK_FAM_BUILDLINK3_MK:M+)
26 FAM_DEFAULT?=   fam
27 FAM_ACCEPTED?=  ${_FAM_PKGS}
28
29 # This is an exhaustive list of all of the FAM implementations that may
30 # be used with fam.buildlink3.mk, in order of precedence.
31 #
32 _FAM_PKGS?=     fam gamin
33
34 _FAM_DEFAULT=   ${FAM_DEFAULT}
35 _FAM_ACCEPTED=  ${FAM_ACCEPTED}
36
37 _FAM_TYPE?=     ${_FAM_DEFAULT}
38
39 .  if !empty(_FAM_ACCEPTED:M${_FAM_TYPE})
40 FAM_TYPE=       ${_FAM_TYPE}
41 .  else
42 FAM_TYPE=       none
43 .  endif
44 FAMBASE=        ${BUILDLINK_PREFIX.${FAM_TYPE}}
45
46 BUILD_DEFS+=            FAM_DEFAULT
47 BUILD_DEFS_EFFECTS+=    FAMBASE FAM_TYPE
48 .endif  # MK_FAM_BUILDLINK3_MK
49
50 FAM_SERVER?=    yes
51
52 .if ${FAM_TYPE} == "none"
53 PKG_FAIL_REASON=        \
54         "${_FAM_TYPE} is not an acceptable FAM type for ${PKGNAME}."
55 .elif ${FAM_TYPE} == "fam"
56 .  include "../../sysutils/fam/buildlink3.mk"
57 .elif ${FAM_TYPE} == "gamin"
58 .  include "../../sysutils/libgamin/buildlink3.mk"
59 .  if !empty(FAM_SERVER:M[Yy][Ee][Ss])
60 DEPENDS+=       gamin>=0.1.10nb1:../../sysutils/gamin
61 .  endif
62 .endif