Add files from parent branch HEAD:
[pkgsrc.git] / mk / compiler / hp.mk
1 # $NetBSD: hp.mk,v 1.6 2009/05/30 18:16:26 joerg Exp $
2 #
3 # This is the compiler definition for the HP-UX C/aC++ compilers.
4 #
5
6 .if !defined(COMPILER_HP_MK)
7 COMPILER_HP_MK=         defined
8
9 .include "../../mk/bsd.prefs.mk"
10
11 # LANGUAGES.<compiler> is the list of supported languages by the
12 # compiler.
13 #
14 LANGUAGES.hp=           # empty
15
16 _HP_DIR=                ${WRKDIR}/.hp
17 _HP_VARS=               # empty
18 .if exists(/usr/bin/cc)
19 LANGUAGES.hp+=          c
20 _HP_VARS+=              CC
21 _HP_CC=                 ${_HP_DIR}/cc
22 _ALIASES.CC=            cc
23 CCPATH=                 /usr/bin/cc
24 PKG_CC:=                ${_HP_CC}
25 .endif
26 .if exists(/opt/aCC/bin/aCC)
27 LANGUAGES.hp+=          c++
28 _HP_VARS+=              CXX
29 _HP_CXX=                ${_HP_DIR}/aCC
30 _ALIASES.CXX=           c++
31 CXXPATH=                /opt/aCC/bin/aCC
32 PKG_CXX:=               ${_HP_CXX}
33 .endif
34 _COMPILER_STRIP_VARS+=  ${_HP_VARS}
35
36 .if exists(${CXXPATH}) && !defined(CC_VERSION_STRING)
37 CC_VERSION_STRING!=     ${CXXPATH} -V 2>&1
38 CC_VERSION=             ${CC_VERSION_STRING:S/ /_/Wg}
39 .else
40 CC_VERSION_STRING?=     ${CC_VERSION}
41 CC_VERSION?=            hp
42 .endif
43
44 # Turn ANSI C++ features like namespace std, STL and correct scoping
45 _WRAP_EXTRA_ARGS.CXX+=  -AA -Aa
46
47 # HP comilers pass flags to the linker using "-Wl,".
48 _COMPILER_LD_FLAG=      -Wl,
49
50 # linker syntax for rpath is +b /path1:/path2:...
51 _LINKER_RPATH_FLAG=     +b
52
53 # HP compilers pass rpath directives to the linker using "-Wl,+b,"
54 _COMPILER_RPATH_FLAG=   ${_COMPILER_LD_FLAG}${_LINKER_RPATH_FLAG},
55
56 # _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the
57 # ones requested by the package in USE_LANGUAGES.
58 #
59 _LANGUAGES.hp=          # empty
60 .for _lang_ in ${USE_LANGUAGES}
61 _LANGUAGES.hp+= ${LANGUAGES.hp:M${_lang_}}
62 .endfor
63
64 # Prepend the path to the compiler to the PATH.
65 .if !empty(_LANGUAGES.hp)
66 PREPEND_PATH+=  ${_HP_DIR}/bin
67 .endif
68
69 # Create compiler driver scripts in ${WRKDIR}.
70 .for _var_ in ${_HP_VARS}
71 .  if !target(${_HP_${_var_}})
72 override-tools: ${_HP_${_var_}}
73 ${_HP_${_var_}}:
74         ${RUN}${MKDIR} ${.TARGET:H}
75 .    if !empty(COMPILER_USE_SYMLINKS:M[Yy][Ee][Ss])
76         ${RUN}${RM} -f ${.TARGET}
77         ${RUN}${LN} -s ${${_var_}PATH} ${.TARGET}
78 .    else
79         ${RUN}                                  \
80         (${ECHO} '#!${TOOLS_SHELL}';                                    \
81          ${ECHO} 'exec ${${_var_}PATH} "$$@"';                  \
82         ) > ${.TARGET}
83         ${RUN}${CHMOD} +x ${.TARGET}
84 .    endif
85 .    for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
86         ${RUN}                                  \
87         if [ ! -x "${_alias_}" ]; then                                  \
88                 ${LN} -f -s ${.TARGET} ${_alias_};                      \
89         fi
90 .    endfor
91 .  endif
92 .endfor
93
94 _COMPILER_ABI_FLAG.32=+DD32
95 _COMPILER_ABI_FLAG.64=+DD64
96
97 .endif  # COMPILER_HP_MK