Sync Mk with ports
[dports.git] / Mk / bsd.df.gcc.mk
1 # bsd.gcc.df.mk  - Reaction to USE_GCC on DragonFly
2 #
3 # The primary base compiler is used is possible, otherwise the ports default
4 # is used unless there's a hard specification.
5 #
6 # For DragonFly 4.1+, the primary base compiler is gcc50 and for earlier
7 # releases, the primary base compiler is gcc47.  The avoidance of the use of
8 # the alternate compiler is intentional.
9
10 .include "${PORTSDIR}/Mk/bsd.default-versions.mk"
11
12 .undef PORT_COMPILER
13 .undef BASE_COMPILER
14
15 .if ${USE_GCC} == 4.8 || ${USE_GCC} == 4.9
16 PORT_COMPILER=${USE_GCC}
17 .else
18 .  if ${USE_GCC:M6*}
19 PORT_COMPILER=6-devel
20 .  else
21 .    if ${USE_GCC:tu} == NOT5 || ${USE_GCC:tu} == DEFAULT_NOT5
22 PORT_COMPILER=${LANG_GCC_IS}
23 .    else
24 BASE_COMPILER=gcc50
25 .    endif
26 .  endif
27 .endif
28
29 .if defined (PORT_COMPILER)
30
31 USE_BINUTILS=           yes
32 V:=                     ${PORT_COMPILER:S/.//}
33 X:=                     ${PORT_COMPILER:S/.//:S/-devel//}
34 .  if "${PORT_COMPILER}" == "${LANG_GCC_IS}"
35 BUILD_DEPENDS+=         gcc${X}:lang/gcc
36 RUN_DEPENDS+=           gcc${X}:lang/gcc
37 .  else
38 BUILD_DEPENDS+=         gcc${X}:lang/gcc${V}
39 RUN_DEPENDS+=           gcc${X}:lang/gcc${V}
40 .  endif
41 _GCC_RUNTIME:=          ${LOCALBASE}/lib/gcc${V}
42
43 CC:=                    gcc${X}
44 CXX:=                   g++${X}
45 CPP:=                   cpp${X}
46 CFLAGS+=                -Wl,-rpath=${_GCC_RUNTIME}
47 CXXFLAGS+=              -Wl,-rpath=${_GCC_RUNTIME}
48 LDFLAGS+=               -Wl,-rpath=${_GCC_RUNTIME} -L${_GCC_RUNTIME}
49
50 .else   # v--  DRAGONFLY BASE COMPILERS --v
51
52 CC:=                    gcc
53 CXX:=                   g++
54 CPP:=                   cpp
55 CONFIGURE_ENV+=         CCVER=${BASE_COMPILER}
56 MAKE_ENV+=              CCVER=${BASE_COMPILER}
57
58 .endif
59
60
61 test-gcc:
62         @echo USE_GCC=${USE_GCC}
63 .if defined(IGNORE)
64         @echo "IGNORE: ${IGNORE}"
65 .else
66         @echo CC=${CC}
67         @echo CXX=${CXX}
68         @echo CPP=${CPP}
69         @echo CFLAGS=\"${CFLAGS}\"
70         @echo CXXFLAGS=\"${CXXFLAGS}\"
71         @echo LDFLAGS=\"${LDFLAGS}\"
72         @echo CONFIGURE_ENV=${CONFIGURE_ENV}
73         @echo MAKE_ENV=${MAKE_ENV}
74         @echo "BUILD_DEPENDS=${BUILD_DEPENDS}"
75         @echo "RUN_DEPENDS=${RUN_DEPENDS}"
76 .endif