summaryrefslogtreecommitdiff
path: root/mk/tools/imake.mk
blob: 497b15a46fce09b0b74631ea5f2def34a5c349d0 (plain)
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
# $NetBSD: imake.mk,v 1.4 2005/05/09 01:11:58 jlam Exp $
#
# This Makefile fragment handles packages that need imake and xmkmf
# to build X11-related packages.  The correct imake and xmkmf tools
# are placed under ${TOOLS_DIRS}/bin, so that they may be invoked by
# their bare names.  The tools are chosen based on which type of X11
# distribution pkgsrc will be using, e.g. X11_TYPE.
#
# Variables defined by this file are:
#
#	IMAKE		path to imake tool + any imake-specific args
#	XMKMF_CMD	path to xmkmf tool + any xmkmf-specific args
#	XMKMF		command to create all Makefiles from Imakefiles,
#			usually "xmkmf -a".
#
# Optional variables that may be defined by the package are:
#
#	IMAKEOPTS	Options to pass to imake
#	XMKMF_FLAGS	Options to pass to xmkmf
#
# If they are non-empty, then a wrapper script will be created instead
# of a symlink for the corresponding tool.
#
# A platform/${OPSYS}.mk file may note that additional tools are
# required when using imake by setting _IMAKE_TOOLS to the appropriate
# value, e.g. _IMAKE_TOOLS+=gmake to use GNU make to build packages
# that use imake.
#
# This file is included by mk/tools/replace.mk and follows the same
# rules as for other replacement tools.
#

# Continue to allow USE_IMAKE until packages have been taught to use the
# new syntax.
#
.if defined(USE_IMAKE)
USE_TOOLS+=	imake
.endif

# Skip the processing at the end of replace.mk.  If we need to use
# imake, then we always want the clause below to trigger.
#
_TOOLS_USE_PKGSRC.imake=	yes

.if !defined(TOOLS_IGNORE.imake) && !empty(USE_TOOLS:Mimake)
.  if !empty(PKGPATH:Mx11/imake) || !empty(PKGPATH:Mx11/xorg-imake)
MAKEFLAGS+=			TOOLS_IGNORE.imake=
.  else
#
# If we're using xpkgwedge, then we need to invoke the special xmkmf
# script that will find imake config files in both ${PREFIX} and in
# ${X11BASE}.
#
.    if !empty(USE_XPKGWEDGE:M[yY][eE][sS])
TOOLS_REAL_CMD.xmkmf?=		${X11PREFIX}/bin/pkgxmkmf
.    endif
#
# Depending on which X11_TYPE we're using, depend on the correct package
# to pull in imake and xmkmf.
#
.    if defined(X11_TYPE) && (${X11_TYPE} == "XFree86")
TOOLS_DEPENDS.imake?=		imake>=4.4.0:../../x11/imake
TOOLS_REAL_CMD.imake=		${X11PREFIX}/${X11ROOT_PREFIX}/bin/imake
TOOLS_REAL_CMD.xmkmf=		${X11PREFIX}/${X11ROOT_PREFIX}/bin/xmkmf
.    elif defined(X11_TYPE) && (${X11_TYPE} == "xorg")
TOOLS_DEPENDS.imake?=		xorg-imake>=6.8:../../x11/xorg-imake
TOOLS_REAL_CMD.imake=		${X11PREFIX}/${X11ROOT_PREFIX}/bin/imake
TOOLS_REAL_CMD.xmkmf=		${X11PREFIX}/${X11ROOT_PREFIX}/bin/xmkmf
.    else # ${X11_TYPE} == "native"
TOOLS_REAL_CMD.imake=		${X11BASE}/bin/imake
TOOLS_REAL_CMD.xmkmf=		${X11BASE}/bin/xmkmf
.    endif
TOOLS_REAL_ARGS.imake=		${IMAKEOPTS}
TOOLS_REAL_ARGS.xmkmf=		${XMKMF_FLAGS}
#
# Add any extra tools that may be required when using imake, e.g. gmake.
#
USE_TOOLS+=			${_IMAKE_TOOLS:Nimake}
#
# Define IMAKE and XMKMF_CMD and create wrappers/symlinks corresponding
# to imake and xmkmf.
#
TOOLS_CREATE+=			imake xmkmf
${_TOOLS_VARNAME.imake}=	${TOOLS_REAL_CMD.imake} ${TOOLS_REAL_ARGS.imake}
${_TOOLS_VARNAME.xmkmf}=	${TOOLS_REAL_CMD.xmkmf} ${TOOLS_REAL_ARGS.xmkmf}
XMKMF=				${${_TOOLS_VARNAME.xmkmf}} -a
.  endif
.endif