release.sh changes & fixes
[minix3.git] / tools / gcc / Makefile
blobe0938a33ad33914f84fe3a9951c95966a05be39f
1 # $NetBSD: Makefile,v 1.61 2013/11/28 12:08:57 mrg Exp $
3 .include <bsd.own.mk>
5 GCC_LANGUAGES=c c++ objc
6 MODULE= gcc4
8 .if ${HAVE_GCC} == 45
9 GNUHOSTDIST= ${.CURDIR}/../../external/gpl3/gcc/dist
10 .endif
12 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64"
13 MULTILIB_ARGS= --enable-multilib
14 .else
15 MULTILIB_ARGS= --disable-multilib
16 .endif
18 .if ${MKSOFTFLOAT} != "no" && ${MACHINE_CPU} != "m68k"
19 SOFTFLOAT_ARGS= -with-float=soft
20 .endif
22 COMMON_CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} \
23 --enable-long-long \
24 --enable-threads \
25 --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html \
26 --with-pkgversion="NetBSD nb1 20120916" \
27 --with-system-zlib \
28 --enable-__cxa_atexit
29 .if defined(__MINIX)
30 COMMON_CONFIGURE_ARGS+= \
31 --disable-libssp \
32 --enable-visibility \
33 --disable-threads
35 CONFIGURE_ENV+= gcc_cv_ld_hidden=yes
37 .if ${HOST_OSTYPE:C/\-.*//} == "Minix"
38 CONFIGURE_ENV+= LDFLAGS=-lm
39 .endif # ${HOST_OSTYPE:C/\-.*//} == "Minix"
41 .endif # defined(__MINIX)
43 .if defined(GCC_CONFIG_ARCH.${MACHINE_ARCH})
44 COMMON_CONFIGURE_ARGS+= --with-arch=${GCC_CONFIG_ARCH.${MACHINE_ARCH}}
45 .endif
46 .if defined(GCC_CONFIG_TUNE.${MACHINE_ARCH})
47 COMMON_CONFIGURE_ARGS+= --with-tune=${GCC_CONFIG_TUNE.${MACHINE_ARCH}}
48 .endif
50 CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
51 .if ${HAVE_GCC} >= 45
52 CONFIGURE_ARGS+= \
53 --with-mpc=${TOOLDIR} \
54 --with-mpfr=${TOOLDIR} \
55 --with-gmp=${TOOLDIR}
56 .endif
57 CONFIGURE_ARGS+= \
58 --disable-nls \
59 ${MULTILIB_ARGS} \
60 ${SOFTFLOAT_ARGS} \
61 --program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
62 --enable-languages="${GCC_LANGUAGES}"
64 GCC_CPPFLAGS= -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0 \
65 -DTARGET_SYSTEM_ROOT_RELOCATABLE
67 MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \
68 LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= \
69 EXTRA_PARTS= CPPFLAGS=${GCC_CPPFLAGS:Q} \
70 AR=${HOST_AR:Q} RANLIB=${HOST_RANLIB:Q}
72 CONFIGURE_ENV+= gcc_cv_libc_provides_ssp=yes \
73 gcc_cv_as_sparc_gotdata_op=no
75 ALL_TARGET= all-gcc
76 INSTALL_TARGET= install-gcc
78 .include "${.CURDIR}/../Makefile.gmakehost"
79 BUILD_MAKE=${TOOL_GMAKE}
82 # mknative-gcc specific stuff
84 MKNATIVE_CONFIG_TARGET_LIBS= \
85 configure-target-libstdc++-v3 \
86 configure-target-libobjc
88 .if ${HAVE_GCC} == 45
89 MKNATIVE_TARGET= gcc45
90 MKNATIVE_CONFIG_TARGET_LIBS+= \
91 configure-target-libgomp
92 .else
93 MKNATIVE_TARGET= gcc4
94 .endif
96 BINENV= /usr/bin/env -i
98 MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*} \
99 CC_FOR_BUILD=${HOST_CC:Q} \
100 CC=${CC:Q}' '${CCADDFLAGS:Q} \
101 CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
102 CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
103 CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
104 AS=${AS:Q} AWK=${TOOL_AWK:Q} LD=${LD:Q} \
105 MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
106 NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \
107 XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
108 LIBS=-lintl \
109 ac_cv_prog_cc_cross=yes \
110 ac_cv_func_strcoll_works=yes \
111 ac_cv_func_elf_getshstrndx=no \
112 gcc_cv_func_printf_ptr=yes \
113 gcc_cv_libc_provides_ssp=yes \
114 gdb_cv_printf_has_long_double=yes \
115 gdb_cv_printf_has_long_long=yes \
116 gdb_cv_scanf_has_long_double=yes \
117 gcc_cv_as_sparc_gotdata_op=no
119 .if ${HAVE_GCC} < 45
120 GCCSRCDIR=${.CURDIR}/../../gnu/dist/gcc4
121 .else
122 GCCSRCDIR=${.CURDIR}/../../external/gpl3/gcc/dist
123 .endif
125 CXXADDFLAGS= --sysroot=${DESTDIR}
126 CCADDFLAGS= --sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
128 # NEWCONFIGDIR can be set to a read-write location of the source tree
129 # in case the version being used is not.
130 NEWCONFIGDIR?= ${.CURDIR}/../..
131 MKNATIVE?= ${.CURDIR}/mknative-gcc
133 bootstrap-libgcc: .configure_done
134 @echo 'Creating files needed for libgcc by a native bootstrap build.'
135 @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} lib${MKNATIVE_TARGET} \
136 ${.OBJDIR}/build ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
137 ${MACHINE_GNU_PLATFORM} ${DESTDIR}
139 native-gcc: .native/.configure_done
140 @echo 'Extracting GNU GCC configury for a native toolchain.'
141 @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
142 ${.OBJDIR}/.native ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
143 ${MACHINE_GNU_PLATFORM} ${DESTDIR}
145 NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
146 .if ${HAVE_GCC} >= 45
147 MPC= ${NETBSDSRCDIR}/external/lgpl3/mpc
148 MPFR= ${NETBSDSRCDIR}/external/lgpl3/mpfr
149 GMP= ${NETBSDSRCDIR}/external/lgpl3/gmp
150 MPCOBJ!= cd ${MPC}/lib/libmpc && ${PRINTOBJDIR}
151 MPFROBJ!= cd ${MPFR}/lib/libmpfr && ${PRINTOBJDIR}
152 GMPOBJ!= cd ${GMP}/lib/libgmp && ${PRINTOBJDIR}
154 NATIVE_CONFIGURE_ARGS+= \
155 --with-mpc-lib=${MPCOBJ} \
156 --with-mpfr-lib=${MPFROBJ} \
157 --with-gmp-lib=${GMPOBJ} \
158 --with-mpc-include=${MPC}/dist/src \
159 --with-mpfr-include=${MPFR}/dist \
160 --with-gmp-include=${GMP}/lib/libgmp/arch/${MACHINE_ARCH}
162 . if ${MACHINE_ARCH} != "vax"
163 NATIVE_CONFIGURE_ARGS+= --enable-tls
164 . endif
165 .endif
166 NATIVE_CONFIGURE_ARGS+= \
167 --disable-multilib \
168 --disable-symvers \
169 --disable-libstdcxx-pch \
170 --build=`${GCCSRCDIR}/config.guess` \
171 --host=${MACHINE_GNU_PLATFORM}
173 .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
174 mkdir .native 2>/dev/null || true
175 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
176 (cd .native && ${MKNATIVE_ENV} \
177 ${HOST_SH} ${GNUHOSTDIST}/configure \
178 ${NATIVE_CONFIGURE_ARGS}) && \
179 (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty)
180 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
181 (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp) && \
182 (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty) && \
183 (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libdecnumber)
184 # edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
185 (cd .native && mv Makefile Makefile.config && \
186 ${TOOL_SED} -e 's/\(maybe-all-gcc:\) all-gcc/\1/' \
187 -e 's/\(maybe-all-target-libgcc:\) all-target-libgcc/\1/' \
188 < Makefile.config > Makefile)
189 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
190 (cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h)
191 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
192 (cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h unwind.h)
193 (cd .native && touch gcc/cc1obj gcc/cc1plus gcc/f771 gcc/libgcc.a gcc/libgcc_s.so)
194 .for _lib in ${MKNATIVE_CONFIG_TARGET_LIBS}
195 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
196 (cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} \
197 ${_lib} \
198 ALL_GCC_C= ALL_GCC_CXX= \
199 CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
200 CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
201 RAW_CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
202 CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
203 ac_cv_prog_cc_cross=yes) && \
204 true
205 .endfor
206 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
207 (cd .native/${MACHINE_GNU_PLATFORM}/libstdc++-v3/include && \
208 ${MKNATIVE_ENV} ${BUILD_MAKE} \
209 CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
210 CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
211 CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
212 all-local) && \
213 true
214 .if 0
215 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
216 (cd .native/${MACHINE_GNU_PLATFORM}/libiberty && \
217 ${MKNATIVE_ENV} ${BUILD_MAKE} needed-list)
218 .endif
219 @touch $@
221 clean: clean.native
222 clean.native:
223 -rm -r -f .native