1 # $NetBSD: Makefile,v 1.50 2012/01/10 12:27:54 skrll Exp $
5 HAVE_GCC
= 45 # On Minix
7 GCC_LANGUAGES
=c c
++ objc
10 MKNATIVE_CONFIG_TARGET_LIBS
= \
11 configure-target-libiberty \
12 configure-target-libstdc
++-v3 \
13 configure-target-libobjc \
14 configure-target-libgcc
17 MKNATIVE_TARGET
= gcc45
18 GNUHOSTDIST
= ${.CURDIR
}/..
/..
/external
/gpl3
/gcc
/dist
19 MKNATIVE_CONFIG_TARGET_LIBS
+= \
20 configure-target-libgomp
25 BINENV
= /usr
/bin
/env
-i
29 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "sparc64"
30 MULTILIB_ARGS
= --enable-multilib
32 MULTILIB_ARGS
= --disable-multilib
35 .if
${MKSOFTFLOAT} != "no"
36 SOFTFLOAT_ARGS
= -with-float
=soft
39 COMMON_CONFIGURE_ARGS
= --target
=${MACHINE_GNU_PLATFORM} \
42 --with-bugurl
=http
://www.NetBSD.org
/Misc
/send-pr.html \
43 --with-pkgversion
="NetBSD nb2 20111202" \
44 ${VAX_CONFIGURE_ARGS} \
45 --enable-__cxa_atexit \
46 --target
=${MACHINE_ARCH}-elf-minix \
48 --disable-visibility \
49 --enable-__cxa_atexit \
52 .if defined
(GCC_CONFIG_ARCH.
${MACHINE_ARCH})
53 COMMON_CONFIGURE_ARGS
+= --with-arch
=${GCC_CONFIG_ARCH.
${MACHINE_ARCH}}
55 .if defined
(GCC_CONFIG_TUNE.
${MACHINE_ARCH})
56 COMMON_CONFIGURE_ARGS
+= --with-tune
=${GCC_CONFIG_TUNE.
${MACHINE_ARCH}}
59 CONFIGURE_ARGS
= ${COMMON_CONFIGURE_ARGS}
62 --with-mpc
=${TOOLDIR} \
63 --with-mpfr
=${TOOLDIR} \
70 --program-transform-name
="s,^,${MACHINE_GNU_PLATFORM}-," \
73 GCC_CPPFLAGS
= -DNETBSD_TOOLS
-DTARGET_SYSTEM_ROOT
=0 \
74 -DTARGET_SYSTEM_ROOT_RELOCATABLE
76 MAKE_ARGS
= MACHINE
= MAKEINFO
=${TOOL_MAKEINFO
:Q
} \
77 LIBGCC
= LIBGCC1
= LIBGCC1_TEST
= LIBGCC2
= INSTALL_LIBGCC
= \
78 EXTRA_PARTS
= CPPFLAGS
=${GCC_CPPFLAGS
:Q
} \
79 AR
=${HOST_AR
:Q
} RANLIB
=${HOST_RANLIB
:Q
}
81 CONFIGURE_ENV
+= gcc_cv_libc_provides_ssp
=yes \
82 gcc_cv_as_sparc_gotdata_op
=no
84 MKNATIVE_ENV
= ${BINENV} ${CONFIGURE_ENV
:NC
*:NLD
*} \
85 CC_FOR_BUILD
=${HOST_CC
:Q
} \
86 CC
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
87 CXX
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
88 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
89 CFLAGS
= CPPFLAGS
= CXXFLAGS
= LDFLAGS
= \
90 AS
=${AS
:Q
} AWK
=${TOOL_AWK
:Q
} LD
=${LD
:Q
} \
91 MSGFMT
=${TOOLDIR}/bin
/${_TOOL_PREFIX}msgfmt \
92 NM
=${NM
:Q
} OBJDUMP
=${OBJDUMP
:Q
} \
93 XGETTEXT
=${TOOLDIR}/bin
/${_TOOL_PREFIX}xgettext \
95 ac_cv_prog_cc_cross
=yes \
96 ac_cv_func_strcoll_works
=yes \
97 ac_cv_func_elf_getshstrndx
=no \
98 gcc_cv_func_printf_ptr
=yes \
99 gcc_cv_libc_provides_ssp
=yes \
100 gdb_cv_printf_has_long_double
=yes \
101 gdb_cv_printf_has_long_long
=yes \
102 gdb_cv_scanf_has_long_double
=yes \
103 gcc_cv_as_sparc_gotdata_op
=no
106 INSTALL_TARGET
= install-gcc
108 .
include "${.CURDIR}/../Makefile.gmakehost"
109 BUILD_MAKE
=${TOOL_GMAKE}
112 # mknative-gcc specific stuff
116 GCCSRCDIR
=${.CURDIR
}/..
/..
/gnu
/dist/gcc4
118 GCCSRCDIR
=${.CURDIR
}/..
/..
/external
/gpl3
/gcc
/dist
121 CXXADDFLAGS
= --sysroot
=${DESTDIR}
122 CCADDFLAGS
= --sysroot
=${DESTDIR} -L
${DESTDIR}/lib
-L
${DESTDIR}/usr
/lib
-B
${DESTDIR}/usr
/lib
/ -I
${.OBJDIR
}/.native
/gcc
/include
124 NEWCONFIGDIR?
= ${.CURDIR
}/..
/..
125 MKNATIVE?
= ${.CURDIR
}/mknative-gcc
127 bootstrap-libgcc
: .configure_done
128 @echo
'Creating files needed for libgcc by a native bootstrap build.'
129 @MAKE
=${BUILD_MAKE
:Q
} ${HOST_SH} ${MKNATIVE} lib
${MKNATIVE_TARGET} \
130 ${.OBJDIR
}/build
${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \
133 native-gcc
: .native
/.configure_done
134 @echo
'Extracting GNU GCC configury for a native toolchain.'
135 @MAKE
=${BUILD_MAKE
:Q
} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
136 ${.OBJDIR
}/.native
${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \
139 NATIVE_CONFIGURE_ARGS
= ${COMMON_CONFIGURE_ARGS}
140 .if
${HAVE_GCC} >= 45
141 NATIVE_CONFIGURE_ARGS
+= \
142 --with-mpc
=${DESTDIR}/usr \
143 --with-mpfr
=${DESTDIR}/usr \
144 --with-gmp
=${DESTDIR}/usr
146 . if
${MACHINE_ARCH} != "vax"
147 NATIVE_CONFIGURE_ARGS
+= --enable-tls
150 NATIVE_CONFIGURE_ARGS
+= \
153 --disable-libstdcxx-pch \
154 --build
=`${GCCSRCDIR}/config.guess` \
155 --host
=${MACHINE_GNU_PLATFORM}
157 .native
/.configure_done
: ${_GNU_CFGSRC} ${.CURDIR
}/Makefile
158 mkdir .native
2>/dev
/null || true
159 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
160 (cd .native
&& ${MKNATIVE_ENV} \
161 ${HOST_SH} ${GNUHOSTDIST}/configure \
162 ${NATIVE_CONFIGURE_ARGS}) && \
163 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty
)
164 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
165 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp
) && \
166 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty
) && \
167 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libdecnumber
)
168 # edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
169 (cd .native
&& mv Makefile Makefile.config
&& \
170 ${TOOL_SED} -e
's/\(maybe-all-gcc:\) all-gcc/\1/' \
171 -e
's/\(maybe-all-target-libgcc:\) all-target-libgcc/\1/' \
172 < Makefile.config
> Makefile
)
173 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
174 (cd .native
/gcc
&& ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h
)
175 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
176 (cd .native
/gcc
&& ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h unwind.h
)
177 (cd .native
&& touch gcc
/cc1obj gcc
/cc1plus gcc
/f771 gcc
/libgcc.a gcc
/libgcc_s.so
)
178 .for _lib in
${MKNATIVE_CONFIG_TARGET_LIBS}
179 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
180 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} \
182 ALL_GCC_C
= ALL_GCC_CXX
= \
183 CC_FOR_TARGET
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
184 CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
185 RAW_CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
186 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
187 ac_cv_prog_cc_cross
=yes
) && \
190 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
191 (cd .native
/${MACHINE_GNU_PLATFORM}/libstdc
++-v3
/include && \
192 ${MKNATIVE_ENV} ${BUILD_MAKE} \
193 CC_FOR_TARGET
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
194 CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
195 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
199 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
200 (cd .native
/${MACHINE_GNU_PLATFORM}/libiberty
&& \
201 ${MKNATIVE_ENV} ${BUILD_MAKE} needed-list
)