Add files from parent branch HEAD:
[pkgsrc.git] / mk / motif.buildlink3.mk
1 # $NetBSD: motif.buildlink3.mk,v 1.12 2008/09/10 16:01:52 joerg Exp $
2 #
3 # Package-settable variables:
4 #
5 # MOTIFBASE
6 #       choose the Motif-2.0 installation at the named location.
7 #
8 # MOTIF_TYPE
9 #       choose a specific Motif-2.0 package.
10 #
11 # Result variables:
12 #
13 # MOTIFBASE
14 #       The chosen Motif installation.
15 #
16 # MOTIF_TYPE
17 #       The chosen Motif package.
18
19 .if !defined(MOTIF_BUILDLINK3_MK)
20 MOTIF_BUILDLINK3_MK=    # defined
21
22 .include "../../mk/bsd.prefs.mk"
23
24 BUILD_DEFS+=                    MOTIF_TYPE MOTIFBASE
25
26 #
27 # If /usr/dt is a valid Motif-2.0 installation, then use it.  Otherwise,
28 # check to see if a pkgsrc Motif-2.0 is installed and valid, then use it.
29 # Otherwise, if ${X11BASE} is valid, then use it.  Otherwise, use the
30 # Motif-2.0 specified by ${MOTIF_TYPE_DEFAULT}.
31 #
32 .if exists(/usr/dt/include/Xm/Xm.h) && \
33       exists(/usr/dt/include/Xm/Gadget.h)
34 _MOTIF_TYPE=            dt
35 .elif exists(${X11BASE}/lib/X11/config/OpenMotif.tmpl) || \
36         exists(${LOCALBASE}/lib/X11/config/OpenMotif.tmpl)
37 _MOTIF_TYPE=            openmotif
38 .elif exists(${X11BASE}/lib/X11/config/LessTif.tmpl) || \
39         exists(${LOCALBASE}/lib/X11/config/LessTif.tmpl)
40 _MOTIF_TYPE=            lesstif
41 .elif exists(${X11BASE}/include/Xm.h) && \
42         exists(${X11BASE}/include/Xm/Gadget.h)
43 _MOTIF_TYPE=            none
44 .else
45 _MOTIF_TYPE=            ${MOTIF_TYPE_DEFAULT}
46 .endif
47
48 # If MOTIF_TYPE is set, then let that override the Motif-discovery just
49 # performed.  We only recognize the tested strings as proper values for
50 # MOTIF_TYPE.
51 #
52 .if defined(MOTIF_TYPE)
53 .  if (${MOTIF_TYPE} == "dt") || \
54         (${MOTIF_TYPE} == "lesstif") || \
55         (${MOTIF_TYPE} == "openmotif")
56 _MOTIF_TYPE=            ${MOTIF_TYPE}
57 .  endif
58 .endif
59
60 #
61 # If MOTIFBASE is set, then let that override all other Motif-2.0
62 # discovery just performed.
63 #
64 .if defined(MOTIFBASE)
65 _MOTIF_TYPE=            none
66 _MOTIFBASE=             ${MOTIFBASE}
67 .else
68 .  if ${_MOTIF_TYPE} == "dt"
69 _MOTIFBASE=             /usr/dt
70 .  elif ${_MOTIF_TYPE} == "none"
71 _MOTIFBASE=             ${X11BASE}
72 .  endif
73 .endif
74
75 .if ${_MOTIF_TYPE} == "openmotif"
76 .  include "../../x11/openmotif/buildlink3.mk"
77 _MOTIFBASE=             ${BUILDLINK_PREFIX.openmotif}
78 .elif ${_MOTIF_TYPE} == "lesstif"
79 .  include "../../x11/lesstif/buildlink3.mk"
80 _MOTIFBASE=             ${BUILDLINK_PREFIX.lesstif}
81 .else
82 #
83 # Link the pre-existing Motif libraries and headers in ${_MOTIFBASE} into
84 # ${BUILDLINK_DIR}.
85 #
86 BUILDLINK_PREFIX.motif= ${_MOTIFBASE}
87
88 .include "../../mk/x11.buildlink3.mk"
89 .endif
90
91 .if !defined(MOTIFBASE)
92 MOTIF_TYPE:=            ${_MOTIF_TYPE}
93 MOTIFBASE=              ${_MOTIFBASE}
94 .endif
95
96
97 MAKE_ENV+=              MOTIFLIB=${MOTIFLIB:Q}
98 MAKE_ENV+=              MOTIFBASE=${_MOTIFBASE:Q}
99 CPPFLAGS+=              -I${_MOTIFBASE}/include
100 LDFLAGS+=               -L${_MOTIFBASE}/lib
101 LDFLAGS+=               ${COMPILER_RPATH_FLAG}${_MOTIFBASE}/lib
102 MOTIFLIB?=              ${COMPILER_RPATH_FLAG}${_MOTIFBASE}/lib \
103                         -L${_MOTIFBASE}/lib -lXm -lXp
104
105 .endif  # MOTIF_BUILDLINK3_MK