summaryrefslogtreecommitdiff
path: root/mk/cwrappers.mk
blob: 4e3492c2d2a902349c9ece8a81896d28142e195e (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
# $NetBSD: cwrappers.mk,v 1.8 2014/11/27 20:33:32 joerg Exp $
#
# This Makefile fragment implements integration of pkgtools/cwrappers.

BUILD_DEPENDS+=		cwrappers>=20100308:../../pkgtools/cwrappers

CWRAPPERS_SRC_DIR=	${PREFIX}/libexec/cwrappers
CWRAPPERS_BIN_DIR=	${WRKDIR}/.cwrapper/bin
CWRAPPERS_CONFIG_DIR=	${WRKDIR}/.cwrapper/config
CONFIGURE_ENV+=		WRAPPER_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
MAKE_ENV+=		WRAPPER_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
ALL_ENV+=		WRAPPER_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}

CWRAPPERS_CONFIG.as=		as
CWRAPPERS_CONFIG.cc=		cc
CWRAPPERS_CONFIG.cxx=		c++
CWRAPPERS_CONFIG.cpp=		cpp
CWRAPPERS_CONFIG.f77=		f77
CWRAPPERS_CONFIG.imake=		imake
CWRAPPERS_CONFIG.ld=		ld
CWRAPPERS_CONFIG.libtool=	libtool
CWRAPPERS_CONFIG.shlibtool=	shlibtool

CWRAPPERS_ALIASES.as=		as
CWRAPPERS_ALIASES.cc=		cc gcc clang
CWRAPPERS_ALIASES.cxx=		c++ g++ CC cxx clang++
CWRAPPERS_ALIASES.cpp=		cpp clang-cpp
CWRAPPERS_ALIASES.f77=		f77 g77
CWRAPPERS_ALIASES.imake=	imake
CWRAPPERS_ALIASES.ld=		ld
CWRAPPERS_ALIASES.libtool=	libtool
CWRAPPERS_ALIASES.shlibtool=	shlibtool

CWRAPPERS_WRAPPEE.as=	${AS:Ufalse}
CWRAPPERS_WRAPPEE.cxx=	${CXX:Ufalse}
CWRAPPERS_WRAPPEE.cc=	${CC:Ufalse}
CWRAPPERS_WRAPPEE.cpp=	${CPP:Ufalse}
CWRAPPERS_WRAPPEE.f77=	${F77:Ufalse}
CWRAPPERS_WRAPPEE.imake=	${IMAKE:Ufalse}
CWRAPPERS_WRAPPEE.ld=	${LD:Ufalse}
CWRAPPERS_WRAPPEE.libtool=	${PREFIX}/bin/libtool
CWRAPPERS_WRAPPEE.shlibtool=	${PREFIX}/bin/shlibtool

.if defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake)
CWRAPPERS_TRANSFORM.imake+=	I:${PREFIX}/lib/X11/config:${PREFIX}/lib/X11/config
.endif

.PHONY: generate-cwrappers

do-wrapper: generate-cwrappers

generate-cwrappers:
	${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${CWRAPPERS_BIN_DIR}
.for wrappee in as cxx cc cpp f77 imake ld libtool shlibtool
	${RUN}echo worklog=${WRKLOG:Q} > ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
	${RUN}echo wrksrc=${WRKSRC:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
	${RUN}case ${wrappee} in *libtool) ;; *) echo path=${_PATH_ORIG:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}};; esac
	${RUN}echo exec=${CWRAPPERS_WRAPPEE.${wrappee}:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
.  for cmd in ${WRAPPER_REORDER_CMDS}
	${RUN}echo reorder=${cmd:S/^reorder://:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
.  endfor
.  for cmd in ${CWRAPPERS_TRANSFORM.${wrappee}} ${_CWRAPPERS_TRANSFORM}
	${RUN}echo transform=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
.  endfor
.  for cmd in ${CWRAPPERS_APPEND.${wrappee}:U}
	${RUN}echo append=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
.  endfor
.  for cmd in ${_CWRAPPERS_UNWRAP}
	${RUN}echo unwrap=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
.  endfor
.  for alias in ${CWRAPPERS_ALIASES.${wrappee}}
	${RUN}ln -s ${CWRAPPERS_SRC_DIR}/${CWRAPPERS_CONFIG.${wrappee}}-wrapper ${CWRAPPERS_BIN_DIR}/${alias}
.  endfor
.endfor

.if defined(USE_LIBTOOL)
_LIBTOOL=		${CWRAPPERS_BIN_DIR}/libtool
_SHLIBTOOL=		${CWRAPPERS_BIN_DIR}/shlibtool
.endif
PREPEND_PATH+=		${CWRAPPERS_BIN_DIR}