2014-11-27 21:34:55 +01:00
|
|
|
# $NetBSD: cwrappers.mk,v 1.10 2014/11/27 20:34:55 joerg Exp $
|
2014-11-24 01:32:31 +01:00
|
|
|
#
|
|
|
|
# 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
|
2014-11-25 19:25:58 +01:00
|
|
|
CWRAPPERS_ALIASES.cc= cc gcc clang
|
|
|
|
CWRAPPERS_ALIASES.cxx= c++ g++ CC cxx clang++
|
|
|
|
CWRAPPERS_ALIASES.cpp= cpp clang-cpp
|
2014-11-24 01:32:31 +01:00
|
|
|
CWRAPPERS_ALIASES.f77= f77 g77
|
2014-11-25 19:24:32 +01:00
|
|
|
CWRAPPERS_ALIASES.imake= imake
|
2014-11-24 01:32:31 +01:00
|
|
|
CWRAPPERS_ALIASES.ld= ld
|
|
|
|
CWRAPPERS_ALIASES.libtool= libtool
|
|
|
|
CWRAPPERS_ALIASES.shlibtool= shlibtool
|
|
|
|
|
2014-11-27 21:33:58 +01:00
|
|
|
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}
|
2014-11-24 01:32:31 +01:00
|
|
|
CWRAPPERS_WRAPPEE.imake= ${IMAKE:Ufalse}
|
2014-11-27 21:33:58 +01:00
|
|
|
CWRAPPERS_WRAPPEE.ld= ${LD:Ufalse}
|
2014-11-27 21:34:55 +01:00
|
|
|
CWRAPPERS_WRAPPEE.libtool= ${PKG_LIBTOOL:Ufalse}
|
|
|
|
CWRAPPERS_WRAPPEE.shlibtool= ${PKG_SHLIBTOOL:Ufalse}
|
2014-11-24 01:32:31 +01:00
|
|
|
|
2014-11-27 21:33:32 +01:00
|
|
|
.if defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake)
|
|
|
|
CWRAPPERS_TRANSFORM.imake+= I:${PREFIX}/lib/X11/config:${PREFIX}/lib/X11/config
|
|
|
|
.endif
|
|
|
|
|
2014-11-25 19:24:12 +01:00
|
|
|
.PHONY: generate-cwrappers
|
2014-11-24 01:32:31 +01:00
|
|
|
|
2014-11-25 19:24:12 +01:00
|
|
|
do-wrapper: generate-cwrappers
|
2014-11-24 01:32:31 +01:00
|
|
|
|
2014-11-25 19:24:12 +01:00
|
|
|
generate-cwrappers:
|
2014-11-24 01:32:31 +01:00
|
|
|
${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}}
|
2014-11-27 21:31:56 +01:00
|
|
|
. for cmd in ${WRAPPER_REORDER_CMDS}
|
2014-11-24 01:32:31 +01:00
|
|
|
${RUN}echo reorder=${cmd:S/^reorder://:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
|
|
|
|
. endfor
|
2014-11-27 21:33:32 +01:00
|
|
|
. for cmd in ${CWRAPPERS_TRANSFORM.${wrappee}} ${_CWRAPPERS_TRANSFORM}
|
2014-11-24 01:32:31 +01:00
|
|
|
${RUN}echo transform=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
|
|
|
|
. endfor
|
2014-11-27 21:32:41 +01:00
|
|
|
. for cmd in ${CWRAPPERS_APPEND.${wrappee}:U}
|
|
|
|
${RUN}echo append=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
|
|
|
|
. endfor
|
2014-11-24 01:32:31 +01:00
|
|
|
. 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
|
|
|
|
|
2014-11-25 19:23:49 +01:00
|
|
|
.if defined(USE_LIBTOOL)
|
2014-11-24 01:32:31 +01:00
|
|
|
_LIBTOOL= ${CWRAPPERS_BIN_DIR}/libtool
|
|
|
|
_SHLIBTOOL= ${CWRAPPERS_BIN_DIR}/shlibtool
|
2014-11-25 19:23:49 +01:00
|
|
|
.endif
|
2014-11-24 01:32:31 +01:00
|
|
|
PREPEND_PATH+= ${CWRAPPERS_BIN_DIR}
|