Remove building with NOCRYPTO option
[minix3.git] / tools / gcc / Makefile
blobcdc74e2f6b85687703816018c174ff7e28c08498
1 # $NetBSD: Makefile,v 1.74 2015/01/16 20:10:26 christos Exp $
3 .include <bsd.own.mk>
5 GCC_LANGUAGES=c c++ objc
6 MODULE= gcc4
8 GCCDIST= ${.CURDIR}/../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/dist
9 GNUHOSTDIST= ${GCCDIST}
11 .if ${HAVE_GCC} == 48
12 CC_FOR_BUILD= ${HOST_CXX:Q}
13 LIB_INTL=
14 .elif ${HAVE_GCC} == 45
15 UNWIND_H=unwind.h
16 MKNATIVE= ${.CURDIR}/mknative-gcc.old
17 .endif
19 # Defaults
20 CC_FOR_BUILD?= ${HOST_CC:Q}
21 LIB_INTL?= "LIBS=-lintl"
22 MKNATIVE?= ${.CURDIR}/mknative-gcc
24 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64"
25 MULTILIB_ARGS= --enable-multilib
26 .else
27 MULTILIB_ARGS= --disable-multilib
28 .endif
30 .if ${MKSOFTFLOAT} != "no" && ${MACHINE_CPU} != "m68k" \
31 && ${MACHINE_CPU} != "or1k"
32 SOFTFLOAT_ARGS= -with-float=soft
33 .endif
35 .include "gcc-version.mk"
37 COMMON_CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} \
38 --enable-long-long \
39 --enable-threads \
40 --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html \
41 --with-pkgversion="NetBSD ${NETBSD_GCC_VERSION}" \
42 --with-system-zlib \
43 --enable-__cxa_atexit \
44 # MINIX: --enable-libstdcxx-threads
46 .if defined(__MINIX)
47 COMMON_CONFIGURE_ARGS+= \
48 --disable-libssp \
49 --enable-visibility \
50 --disable-threads \
51 --disable-tls
53 CONFIGURE_ENV+= gcc_cv_ld_hidden=yes
55 .if ${HOST_OSTYPE:C/\-.*//} == "Minix"
56 CONFIGURE_ENV+= LDFLAGS=-lm
57 .endif # ${HOST_OSTYPE:C/\-.*//} == "Minix"
59 .endif # defined(__MINIX)
61 .if defined(GCC_CONFIG_ARCH.${MACHINE_ARCH})
62 COMMON_CONFIGURE_ARGS+= --with-arch=${GCC_CONFIG_ARCH.${MACHINE_ARCH}}
63 .endif
64 .if defined(GCC_CONFIG_TUNE.${MACHINE_ARCH})
65 COMMON_CONFIGURE_ARGS+= --with-tune=${GCC_CONFIG_TUNE.${MACHINE_ARCH}}
66 .endif
68 .if ${HAVE_GCC} == 48
69 COMMON_CONFIGURE_ARGS+= --enable-libstdcxx-time=rt --enable-lto
70 .endif
72 CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
73 CONFIGURE_ARGS+= \
74 --with-sysroot=${DESTDIR} \
75 --with-mpc=${TOOLDIR} \
76 --with-mpfr=${TOOLDIR} \
77 --with-gmp=${TOOLDIR} \
78 --disable-nls \
79 ${MULTILIB_ARGS} \
80 ${SOFTFLOAT_ARGS} \
81 --program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
82 --enable-languages="${GCC_LANGUAGES}"
84 GCC_CPPFLAGS= -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0 \
85 -DTARGET_SYSTEM_ROOT_RELOCATABLE
87 MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \
88 LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= \
89 EXTRA_PARTS= CPPFLAGS=${GCC_CPPFLAGS:Q} \
90 AR=${HOST_AR:Q} RANLIB=${HOST_RANLIB:Q}
92 CONFIGURE_ENV+= gcc_cv_libc_provides_ssp=yes \
93 gcc_cv_as_sparc_gotdata_op=no
95 ALL_TARGET= all-gcc
96 INSTALL_TARGET= install-gcc
98 .include "${.CURDIR}/../Makefile.gmakehost"
99 BUILD_MAKE=${TOOL_GMAKE}
102 # mknative-gcc specific stuff
105 MKNATIVE_CONFIG_TARGET_LIBS=
107 .if ${HAVE_GCC} == 48
108 MKNATIVE_CONFIG_TARGET_LIBS+= configure-target-libgcc
109 MKNATIVE_CONFIG_TARGET_LIBS+= configure-target-libgomp
110 MKNATIVE_TARGET= gcc48
111 .elif ${HAVE_GCC} == 45
112 MKNATIVE_CONFIG_TARGET_LIBS+= configure-target-libgomp
113 MKNATIVE_TARGET= gcc45
114 .endif
116 MKNATIVE_CONFIG_TARGET_LIBS+= \
117 configure-target-libstdc++-v3 \
118 configure-target-libobjc
120 BINENV= /usr/bin/env -i
123 MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*} \
124 CC_FOR_BUILD=${CC_FOR_BUILD:Q} \
125 CXX_FOR_BUILD=${HOST_CXX:Q} \
126 CFLAGS_FOR_BUILD="-I${TOOLDIR}/include" \
127 CC=${CC:Q}' '${CCADDFLAGS:Q} \
128 CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
129 CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
130 CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
131 AS=${AS:Q} AWK=${TOOL_AWK:Q} LD=${LD:Q} \
132 MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
133 NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \
134 XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
135 ${LIB_INTL} \
136 ac_cv_prog_cc_cross=yes \
137 ac_cv_func_strcoll_works=yes \
138 ac_cv_func_elf_getshstrndx=no \
139 gcc_cv_func_printf_ptr=yes \
140 gcc_cv_libc_provides_ssp=yes \
141 gdb_cv_printf_has_long_double=yes \
142 gdb_cv_printf_has_long_long=yes \
143 gdb_cv_scanf_has_long_double=yes \
144 gcc_cv_as_sparc_gotdata_op=no
146 CXXADDFLAGS= --sysroot=${DESTDIR}
147 CCADDFLAGS= --sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
149 # NEWCONFIGDIR can be set to a read-write location of the source tree
150 # in case the version being used is not.
151 NEWCONFIGDIR?= ${.CURDIR}/../..
153 bootstrap-libgcc: .configure_done
154 @echo 'Creating files needed for libgcc by a native bootstrap build.'
155 (cd ${.OBJDIR}/build && ${BUILD_COMMAND} configure-target-libgcc)
156 @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} lib${MKNATIVE_TARGET}-bootstrap \
157 ${.OBJDIR}/build ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
158 ${MACHINE_GNU_PLATFORM} ${DESTDIR} ${TOOLDIR}
160 .if ${HAVE_GCC} == "48"
161 bootstrap-libstdc++: .configure_done
162 @echo 'Creating files needed for libstdc++ by a native bootstrap build.'
163 (cd ${.OBJDIR}/build && ${BUILD_COMMAND} configure-target-libstdc++-v3)
164 @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} libstdc++-bootstrap \
165 ${.OBJDIR}/build ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
166 ${MACHINE_GNU_PLATFORM} ${DESTDIR} ${TOOLDIR}
167 .endif
169 native-gcc: .native/.configure_done
170 @echo 'Extracting GNU GCC configury for a native toolchain.'
171 @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
172 ${.OBJDIR}/.native ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
173 ${MACHINE_GNU_PLATFORM} ${DESTDIR} ${TOOLDIR}
175 NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
176 MPC= ${NETBSDSRCDIR}/external/lgpl3/mpc
177 MPFR= ${NETBSDSRCDIR}/external/lgpl3/mpfr
178 GMP= ${NETBSDSRCDIR}/external/lgpl3/gmp
179 MPCOBJ!= cd ${MPC}/lib/libmpc && ${PRINTOBJDIR}
180 MPFROBJ!= cd ${MPFR}/lib/libmpfr && ${PRINTOBJDIR}
181 GMPOBJ!= cd ${GMP}/lib/libgmp && ${PRINTOBJDIR}
183 GMP_MACHINE_ARCH?= ${MACHINE_ARCH:S/earmv4/arm/:C/armv[5-7]/arm/}
185 NATIVE_CONFIGURE_ARGS+= \
186 --with-mpc-lib=${MPCOBJ} \
187 --with-mpfr-lib=${MPFROBJ} \
188 --with-gmp-lib=${GMPOBJ} \
189 --with-mpc-include=${MPC}/dist/src \
190 --with-mpfr-include=${MPFR}/dist/src \
191 --with-gmp-include=${GMP}/lib/libgmp/arch/${GMP_MACHINE_ARCH}
193 .if !defined(__MINIX)
194 .if ${MACHINE_ARCH} != "vax"
195 NATIVE_CONFIGURE_ARGS+= --enable-tls
196 .endif
197 .endif # !defined(__MINIX)
198 .if !empty(MACHINE_ARCH:Mearm*)
199 NATIVE_CONFIGURE_ARGS+= --enable-initfini-array
200 .endif
202 .if ${MACHINE_ARCH} == "m68000"
203 NATIVE_CONFIGURE_ARGS+= --disable-shared
204 .endif
206 NATIVE_CONFIGURE_ARGS+= \
207 --disable-multilib \
208 --disable-symvers \
209 --disable-libstdcxx-pch \
210 --build=`${GCCDIST}/config.guess` \
211 --host=${MACHINE_GNU_PLATFORM} \
212 --with-sysroot=${DESTDIR}
213 MKENV_BUILD_MAKE=cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE}
215 .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
216 mkdir .native 2>/dev/null || true
217 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
218 (cd .native && ${MKNATIVE_ENV} \
219 ${HOST_SH} ${GNUHOSTDIST}/configure \
220 ${NATIVE_CONFIGURE_ARGS}) && \
221 (${MKENV_BUILD_MAKE} all-build-libiberty) && \
222 ([ "${HAVE_GCC}" = "48" ] && \
223 (${MKENV_BUILD_MAKE} all-libcpp) && \
224 (${MKENV_BUILD_MAKE} all-libbacktrace) && \
225 (${MKENV_BUILD_MAKE} all-libdecnumber) || true)
226 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
227 (${MKENV_BUILD_MAKE} configure-gcc configure-libcpp) && \
228 (${MKENV_BUILD_MAKE} configure-libiberty) && \
229 (${MKENV_BUILD_MAKE} configure-libdecnumber)
230 # edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
231 (cd .native && mv Makefile Makefile.config && \
232 ${TOOL_SED} -e 's/\(maybe-all-gcc:\) all-gcc/\1/' \
233 -e 's/\(maybe-all-target-libgcc:\) all-target-libgcc/\1/' \
234 < Makefile.config > Makefile)
235 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
236 (cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h)
237 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
238 (cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h ${UNWIND_H})
239 (cd .native && touch gcc/cc1obj gcc/cc1plus gcc/f771 gcc/libgcc.a gcc/libgcc_s.so)
240 .for _lib in ${MKNATIVE_CONFIG_TARGET_LIBS}
241 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
242 (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} \
243 ${_lib} \
244 ALL_GCC_C= ALL_GCC_CXX= \
245 CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
246 CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
247 RAW_CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
248 CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
249 ac_cv_prog_cc_cross=yes) && \
250 true
251 .endfor
252 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
253 (cd .native/${MACHINE_GNU_PLATFORM}/libstdc++-v3/include && \
254 ${MKNATIVE_ENV} ${BUILD_MAKE} \
255 CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
256 CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
257 CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
258 all-local) && \
259 true
260 .if 0
261 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
262 (cd .native/${MACHINE_GNU_PLATFORM}/libiberty && \
263 ${MKNATIVE_ENV} ${BUILD_MAKE} needed-list)
264 .endif
265 @touch $@
267 clean: clean.native
268 clean.native:
269 -rm -r -f .native