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