| @@ -1,89 +1,89 @@ | | | @@ -1,89 +1,89 @@ |
1 | # $NetBSD: cwrappers.mk,v 1.15 2014/11/29 22:20:40 joerg Exp $ | | 1 | # $NetBSD: cwrappers.mk,v 1.16 2014/12/09 12:50:24 joerg Exp $ |
2 | # | | 2 | # |
3 | # This Makefile fragment implements integration of pkgtools/cwrappers. | | 3 | # This Makefile fragment implements integration of pkgtools/cwrappers. |
4 | | | 4 | |
5 | BUILD_DEPENDS+= cwrappers>=20141129:../../pkgtools/cwrappers | | 5 | BUILD_DEPENDS+= cwrappers>=20141129:../../pkgtools/cwrappers |
6 | | | 6 | |
7 | CWRAPPERS_SRC_DIR= ${PREFIX}/libexec/cwrappers | | 7 | CWRAPPERS_SRC_DIR= ${PREFIX}/libexec/cwrappers |
8 | CWRAPPERS_BIN_DIR= ${WRKDIR}/.cwrapper/bin | | 8 | CWRAPPERS_BIN_DIR= ${WRKDIR}/.cwrapper/bin |
9 | CWRAPPERS_CONFIG_DIR= ${WRKDIR}/.cwrapper/config | | 9 | CWRAPPERS_CONFIG_DIR= ${WRKDIR}/.cwrapper/config |
10 | CONFIGURE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} | | 10 | CONFIGURE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} |
11 | MAKE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} | | 11 | MAKE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} |
12 | ALL_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} | | 12 | ALL_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} |
13 | | | 13 | |
14 | # TODO: Fix direct calls to CC and LIBTOOL to provide correct environment. | | 14 | # TODO: Fix direct calls to CC and LIBTOOL to provide correct environment. |
15 | .export CWRAPPERS_CONFIG_DIR | | 15 | .export CWRAPPERS_CONFIG_DIR |
16 | | | 16 | |
17 | CWRAPPERS_CONFIG.as= as | | 17 | CWRAPPERS_CONFIG.as= as |
18 | CWRAPPERS_CONFIG.cc= cc | | 18 | CWRAPPERS_CONFIG.cc= cc |
19 | CWRAPPERS_CONFIG.cxx= c++ | | 19 | CWRAPPERS_CONFIG.cxx= c++ |
20 | CWRAPPERS_CONFIG.cpp= cpp | | 20 | CWRAPPERS_CONFIG.cpp= cpp |
21 | CWRAPPERS_CONFIG.f77= f77 | | 21 | CWRAPPERS_CONFIG.f77= f77 |
22 | CWRAPPERS_CONFIG.imake= imake | | 22 | CWRAPPERS_CONFIG.imake= imake |
23 | CWRAPPERS_CONFIG.ld= ld | | 23 | CWRAPPERS_CONFIG.ld= ld |
24 | CWRAPPERS_CONFIG.libtool= libtool | | 24 | CWRAPPERS_CONFIG.libtool= libtool |
25 | CWRAPPERS_CONFIG.shlibtool= shlibtool | | 25 | CWRAPPERS_CONFIG.shlibtool= shlibtool |
26 | | | 26 | |
27 | CWRAPPERS_ALIASES.as= as | | 27 | CWRAPPERS_ALIASES.as= as |
28 | CWRAPPERS_ALIASES.cc= cc gcc clang | | 28 | CWRAPPERS_ALIASES.cc= cc gcc clang |
29 | CWRAPPERS_ALIASES.cxx= c++ g++ CC cxx clang++ | | 29 | CWRAPPERS_ALIASES.cxx= c++ g++ CC cxx clang++ |
30 | CWRAPPERS_ALIASES.cpp= cpp clang-cpp | | 30 | CWRAPPERS_ALIASES.cpp= cpp clang-cpp |
31 | CWRAPPERS_ALIASES.f77= f77 g77 | | 31 | CWRAPPERS_ALIASES.f77= f77 g77 |
32 | CWRAPPERS_ALIASES.imake= imake | | 32 | CWRAPPERS_ALIASES.imake= imake |
33 | CWRAPPERS_ALIASES.ld= ld | | 33 | CWRAPPERS_ALIASES.ld= ld |
34 | CWRAPPERS_ALIASES.libtool= libtool | | 34 | CWRAPPERS_ALIASES.libtool= libtool |
35 | CWRAPPERS_ALIASES.shlibtool= shlibtool | | 35 | CWRAPPERS_ALIASES.shlibtool= shlibtool |
36 | | | 36 | |
37 | CWRAPPERS_WRAPPEE.as= ${AS:Ufalse} | | 37 | CWRAPPERS_WRAPPEE.as= ${AS:Ufalse} |
38 | CWRAPPERS_WRAPPEE.cxx= ${CXX:Ufalse} | | 38 | CWRAPPERS_WRAPPEE.cxx= ${PKG_CXX:Ufalse} |
39 | CWRAPPERS_WRAPPEE.cc= ${CC:Ufalse} | | 39 | CWRAPPERS_WRAPPEE.cc= ${PKG_CC:Ufalse} |
40 | CWRAPPERS_WRAPPEE.cpp= ${CPP:Ufalse} | | 40 | CWRAPPERS_WRAPPEE.cpp= ${PKG_CPP:Ufalse} |
41 | CWRAPPERS_WRAPPEE.f77= ${F77:Ufalse} | | 41 | CWRAPPERS_WRAPPEE.f77= ${PKG_FC:Ufalse} |
42 | CWRAPPERS_WRAPPEE.imake= ${IMAKE:Ufalse} | | 42 | CWRAPPERS_WRAPPEE.imake= ${IMAKE:Ufalse} |
43 | CWRAPPERS_WRAPPEE.ld= ${LD:Ufalse} | | 43 | CWRAPPERS_WRAPPEE.ld= ${LD:Ufalse} |
44 | CWRAPPERS_WRAPPEE.libtool= ${PKG_LIBTOOL:Ufalse} | | 44 | CWRAPPERS_WRAPPEE.libtool= ${PKG_LIBTOOL:Ufalse} |
45 | CWRAPPERS_WRAPPEE.shlibtool= ${PKG_SHLIBTOOL:Ufalse} | | 45 | CWRAPPERS_WRAPPEE.shlibtool= ${PKG_SHLIBTOOL:Ufalse} |
46 | | | 46 | |
47 | # TODO: Find and fix packages depending on the implicit include path. | | 47 | # TODO: Find and fix packages depending on the implicit include path. |
48 | CWRAPPERS_APPEND.cc+= -I${PREFIX}/include | | 48 | CWRAPPERS_APPEND.cc+= -I${PREFIX}/include |
49 | CWRAPPERS_APPEND.cxx+= -I${PREFIX}/include | | 49 | CWRAPPERS_APPEND.cxx+= -I${PREFIX}/include |
50 | CWRAPPERS_APPEND.cpp+= -I${PREFIX}/include | | 50 | CWRAPPERS_APPEND.cpp+= -I${PREFIX}/include |
51 | | | 51 | |
52 | .if defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake) | | 52 | .if defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake) |
53 | CWRAPPERS_TRANSFORM.imake+= I:${PREFIX}/lib/X11/config:${PREFIX}/lib/X11/config | | 53 | CWRAPPERS_TRANSFORM.imake+= I:${PREFIX}/lib/X11/config:${PREFIX}/lib/X11/config |
54 | .endif | | 54 | .endif |
55 | | | 55 | |
56 | .PHONY: generate-cwrappers | | 56 | .PHONY: generate-cwrappers |
57 | | | 57 | |
58 | do-wrapper: generate-cwrappers | | 58 | do-wrapper: generate-cwrappers |
59 | | | 59 | |
60 | generate-cwrappers: | | 60 | generate-cwrappers: |
61 | ${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${CWRAPPERS_BIN_DIR} | | 61 | ${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${CWRAPPERS_BIN_DIR} |
62 | .for wrappee in as cxx cc cpp f77 imake ld libtool shlibtool | | 62 | .for wrappee in as cxx cc cpp f77 imake ld libtool shlibtool |
63 | ${RUN}echo worklog=${WRKLOG:Q} > ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} | | 63 | ${RUN}echo worklog=${WRKLOG:Q} > ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} |
64 | ${RUN}echo wrksrc=${WRKSRC:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} | | 64 | ${RUN}echo wrksrc=${WRKSRC:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} |
65 | ${RUN}case ${wrappee} in *libtool) ;; *) echo path=${_PATH_ORIG:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}};; esac | | 65 | ${RUN}case ${wrappee} in *libtool) ;; *) echo path=${_PATH_ORIG:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}};; esac |
66 | ${RUN}echo exec_path=${CWRAPPERS_BIN_DIR}/${CWRAPPERS_ALIASES.${wrappee}:[0]} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} | | 66 | ${RUN}echo exec_path=${CWRAPPERS_BIN_DIR}/${CWRAPPERS_ALIASES.${wrappee}:[0]} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} |
67 | ${RUN}echo exec=${CWRAPPERS_WRAPPEE.${wrappee}:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} | | 67 | ${RUN}echo exec=${CWRAPPERS_WRAPPEE.${wrappee}:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} |
68 | . for cmd in ${WRAPPER_REORDER_CMDS} | | 68 | . for cmd in ${WRAPPER_REORDER_CMDS} |
69 | ${RUN}echo reorder=${cmd:S/^reorder://:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} | | 69 | ${RUN}echo reorder=${cmd:S/^reorder://:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} |
70 | . endfor | | 70 | . endfor |
71 | . for cmd in ${CWRAPPERS_TRANSFORM.${wrappee}} ${_CWRAPPERS_TRANSFORM} | | 71 | . for cmd in ${CWRAPPERS_TRANSFORM.${wrappee}} ${_CWRAPPERS_TRANSFORM} |
72 | ${RUN}echo transform=${cmd:u:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} | | 72 | ${RUN}echo transform=${cmd:u:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} |
73 | . endfor | | 73 | . endfor |
74 | . for cmd in ${CWRAPPERS_APPEND.${wrappee}:U} | | 74 | . for cmd in ${CWRAPPERS_APPEND.${wrappee}:U} |
75 | ${RUN}echo append=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} | | 75 | ${RUN}echo append=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} |
76 | . endfor | | 76 | . endfor |
77 | . for cmd in ${_CWRAPPERS_UNWRAP} | | 77 | . for cmd in ${_CWRAPPERS_UNWRAP} |
78 | ${RUN}echo unwrap=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} | | 78 | ${RUN}echo unwrap=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} |
79 | . endfor | | 79 | . endfor |
80 | . for alias in ${CWRAPPERS_ALIASES.${wrappee}} | | 80 | . for alias in ${CWRAPPERS_ALIASES.${wrappee}} |
81 | ${RUN}ln -s ${CWRAPPERS_SRC_DIR}/${CWRAPPERS_CONFIG.${wrappee}}-wrapper ${CWRAPPERS_BIN_DIR}/${alias} | | 81 | ${RUN}ln -s ${CWRAPPERS_SRC_DIR}/${CWRAPPERS_CONFIG.${wrappee}}-wrapper ${CWRAPPERS_BIN_DIR}/${alias} |
82 | . endfor | | 82 | . endfor |
83 | .endfor | | 83 | .endfor |
84 | | | 84 | |
85 | .if defined(USE_LIBTOOL) | | 85 | .if defined(USE_LIBTOOL) |
86 | _LIBTOOL= ${CWRAPPERS_BIN_DIR}/libtool | | 86 | _LIBTOOL= ${CWRAPPERS_BIN_DIR}/libtool |
87 | _SHLIBTOOL= ${CWRAPPERS_BIN_DIR}/shlibtool | | 87 | _SHLIBTOOL= ${CWRAPPERS_BIN_DIR}/shlibtool |
88 | .endif | | 88 | .endif |
89 | PREPEND_PATH+= ${CWRAPPERS_BIN_DIR} | | 89 | PREPEND_PATH+= ${CWRAPPERS_BIN_DIR} |