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 .if !defined(_INCLUDE_BSD_DF_GCC_MK)
11 _INCLUDE_BSD_DF_GCC_MK= yes
12
13 .include "${PORTSDIR}/Mk/bsd.default-versions.mk"
14
15 .undef PORT_COMPILER
16 .undef BASE_COMPILER
17
18 .if ${USE_GCC} == 4.8 || ${USE_GCC} == 4.9
19 PORT_COMPILER=${USE_GCC}
20 .else
21 .  if ${USE_GCC:M6*}
22 PORT_COMPILER=6
23 .  else
24 .    if ${USE_GCC:tu} == NOT5 || ${USE_GCC:tu} == DEFAULT_NOT5
25 PORT_COMPILER=${LANG_GCC_IS}
26 .    else
27 BASE_COMPILER=gcc50
28 .    endif
29 .  endif
30 .endif
31
32 .if defined (PORT_COMPILER)
33
34 USE_BINUTILS=           yes
35 V:=                     ${PORT_COMPILER:S/.//}
36 X:=                     ${PORT_COMPILER:S/.//:S/-devel//}
37 .  if "${PORT_COMPILER}" == "${LANG_GCC_IS}"
38 BUILD_DEPENDS+=         gcc${X}:lang/gcc
39 RUN_DEPENDS+=           gcc${X}:lang/gcc
40 .  else
41 BUILD_DEPENDS+=         gcc${X}:lang/gcc${V}
42 RUN_DEPENDS+=           gcc${X}:lang/gcc${V}
43 .  endif
44 _GCC_RUNTIME:=          ${LOCALBASE}/lib/gcc${V}
45
46 CC:=                    gcc${X}
47 CXX:=                   g++${X}
48 CPP:=                   cpp${X}
49 CFLAGS+=                -Wl,-rpath=${_GCC_RUNTIME}
50 CXXFLAGS+=              -Wl,-rpath=${_GCC_RUNTIME}
51 LDFLAGS+=               -Wl,-rpath=${_GCC_RUNTIME} -L${_GCC_RUNTIME}
52
53 .else   # v--  DRAGONFLY BASE COMPILERS --v
54
55 CC:=                    gcc
56 CXX:=                   g++
57 CPP:=                   cpp
58 CONFIGURE_ENV+=         CCVER=${BASE_COMPILER}
59 MAKE_ENV+=              CCVER=${BASE_COMPILER}
60
61 .endif
62
63
64 test-gcc:
65         @echo USE_GCC=${USE_GCC}
66 .if defined(IGNORE)
67         @echo "IGNORE: ${IGNORE}"
68 .else
69         @echo CC=${CC}
70         @echo CXX=${CXX}
71         @echo CPP=${CPP}
72         @echo CFLAGS=\"${CFLAGS}\"
73         @echo CXXFLAGS=\"${CXXFLAGS}\"
74         @echo LDFLAGS=\"${LDFLAGS}\"
75         @echo CONFIGURE_ENV=${CONFIGURE_ENV}
76         @echo MAKE_ENV=${MAKE_ENV}
77         @echo "BUILD_DEPENDS=${BUILD_DEPENDS}"
78         @echo "RUN_DEPENDS=${RUN_DEPENDS}"
79 .endif
80
81 .endif