1 # $NetBSD: Makefile,v 1.52 2012/09/18 07:05:15 skrll Exp $
10 GCC_LANGUAGES
=c c
++ objc
14 MKNATIVE_CONFIG_TARGET_LIBS
= \
15 configure-target-libstdc
++-v3 \
16 configure-target-libobjc
19 MKNATIVE_TARGET
= gcc45
20 GNUHOSTDIST
= ${.CURDIR
}/..
/..
/external
/gpl3
/gcc
/dist
21 MKNATIVE_CONFIG_TARGET_LIBS
+= \
22 configure-target-libgomp
27 BINENV
= /usr
/bin
/env
-i
31 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "sparc64"
32 MULTILIB_ARGS
= --enable-multilib
34 MULTILIB_ARGS
= --disable-multilib
37 .if
${MKSOFTFLOAT} != "no"
38 SOFTFLOAT_ARGS
= -with-float
=soft
41 # LSC FIXME We are not using the correct target ATM, so overrides for now...
42 COMMON_CONFIGURE_ARGS
= --target
=${MACHINE_GNU_PLATFORM} \
45 --disable-visibility \
49 --with-bugurl
=http
://www.NetBSD.org
/Misc
/send-pr.html \
50 --with-pkgversion
="NetBSD nb1 20120916" \
52 ${VAX_CONFIGURE_ARGS} \
54 .if defined
(GCC_CONFIG_ARCH.
${MACHINE_ARCH})
55 COMMON_CONFIGURE_ARGS
+= --with-arch
=${GCC_CONFIG_ARCH.
${MACHINE_ARCH}}
57 .if defined
(GCC_CONFIG_TUNE.
${MACHINE_ARCH})
58 COMMON_CONFIGURE_ARGS
+= --with-tune
=${GCC_CONFIG_TUNE.
${MACHINE_ARCH}}
61 CONFIGURE_ARGS
= ${COMMON_CONFIGURE_ARGS}
64 --with-mpc
=${TOOLDIR} \
65 --with-mpfr
=${TOOLDIR} \
72 --program-transform-name
="s,^,${MACHINE_GNU_PLATFORM}-," \
73 --enable-languages
="${GCC_LANGUAGES}"
75 GCC_CPPFLAGS
= -DNETBSD_TOOLS
-DTARGET_SYSTEM_ROOT
=0 \
76 -DTARGET_SYSTEM_ROOT_RELOCATABLE
78 .if
${HOST_OSTYPE
:C
/\
-.
*//} == "Minix"
79 GCC_CPPFLAGS
+= -D_NETBSD_SOURCE
-D_POSIX_SOURCE
-D_COMPAT_MINIX
80 CONFIGURE_ENV
+= LDFLAGS
=-lm
83 MAKE_ARGS
= MACHINE
= MAKEINFO
=${TOOL_MAKEINFO
:Q
} \
84 LIBGCC
= LIBGCC1
= LIBGCC1_TEST
= LIBGCC2
= INSTALL_LIBGCC
= \
85 EXTRA_PARTS
= CPPFLAGS
=${GCC_CPPFLAGS
:Q
} \
86 AR
=${HOST_AR
:Q
} RANLIB
=${HOST_RANLIB
:Q
}
88 CONFIGURE_ENV
+= gcc_cv_libc_provides_ssp
=yes \
89 gcc_cv_as_sparc_gotdata_op
=no
91 MKNATIVE_ENV
= ${BINENV} ${CONFIGURE_ENV
:NC
*:NLD
*} \
92 CC_FOR_BUILD
=${HOST_CC
:Q
} \
93 CC
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
94 CXX
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
95 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
96 CFLAGS
= CPPFLAGS
= CXXFLAGS
= LDFLAGS
= \
97 AS
=${AS
:Q
} AWK
=${TOOL_AWK
:Q
} LD
=${LD
:Q
} \
98 MSGFMT
=${TOOLDIR}/bin
/${_TOOL_PREFIX}msgfmt \
99 NM
=${NM
:Q
} OBJDUMP
=${OBJDUMP
:Q
} \
100 XGETTEXT
=${TOOLDIR}/bin
/${_TOOL_PREFIX}xgettext \
102 ac_cv_prog_cc_cross
=yes \
103 ac_cv_func_strcoll_works
=yes \
104 ac_cv_func_elf_getshstrndx
=no \
105 gcc_cv_func_printf_ptr
=yes \
106 gcc_cv_libc_provides_ssp
=yes \
107 gdb_cv_printf_has_long_double
=yes \
108 gdb_cv_printf_has_long_long
=yes \
109 gdb_cv_scanf_has_long_double
=yes \
110 gcc_cv_as_sparc_gotdata_op
=no
113 INSTALL_TARGET
= install-gcc
115 .
include "${.CURDIR}/../Makefile.gmakehost"
116 BUILD_MAKE
=${TOOL_GMAKE}
119 # mknative-gcc specific stuff
123 GCCSRCDIR
=${.CURDIR
}/..
/..
/gnu
/dist/gcc4
125 GCCSRCDIR
=${.CURDIR
}/..
/..
/external
/gpl3
/gcc
/dist
128 CXXADDFLAGS
= --sysroot
=${DESTDIR}
129 CCADDFLAGS
= --sysroot
=${DESTDIR} -L
${DESTDIR}/lib
-L
${DESTDIR}/usr
/lib
-B
${DESTDIR}/usr
/lib
/ -I
${.OBJDIR
}/.native
/gcc
/include
131 NEWCONFIGDIR?
= ${.CURDIR
}/..
/..
132 MKNATIVE?
= ${.CURDIR
}/mknative-gcc
134 bootstrap-libgcc
: .configure_done
135 @echo
'Creating files needed for libgcc by a native bootstrap build.'
136 @MAKE
=${BUILD_MAKE
:Q
} ${HOST_SH} ${MKNATIVE} lib
${MKNATIVE_TARGET} \
137 ${.OBJDIR
}/build
${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \
140 native-gcc
: .native
/.configure_done
141 @echo
'Extracting GNU GCC configury for a native toolchain.'
142 @MAKE
=${BUILD_MAKE
:Q
} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
143 ${.OBJDIR
}/.native
${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \
146 NATIVE_CONFIGURE_ARGS
= ${COMMON_CONFIGURE_ARGS}
147 .if
${HAVE_GCC} >= 45
148 NATIVE_CONFIGURE_ARGS
+= \
149 --with-mpc
=${DESTDIR}/usr \
150 --with-mpfr
=${DESTDIR}/usr \
151 --with-gmp
=${DESTDIR}/usr
153 . if
${MACHINE_ARCH} != "vax"
154 NATIVE_CONFIGURE_ARGS
+= --enable-tls
157 NATIVE_CONFIGURE_ARGS
+= \
160 --disable-libstdcxx-pch \
161 --build
=`${GCCSRCDIR}/config.guess` \
162 --host
=${MACHINE_GNU_PLATFORM}
164 .native
/.configure_done
: ${_GNU_CFGSRC} ${.CURDIR
}/Makefile
165 mkdir .native
2>/dev
/null || true
166 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
167 (cd .native
&& ${MKNATIVE_ENV} \
168 ${HOST_SH} ${GNUHOSTDIST}/configure \
169 ${NATIVE_CONFIGURE_ARGS}) && \
170 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty
)
171 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
172 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp
) && \
173 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty
) && \
174 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libdecnumber
)
175 # edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
176 (cd .native
&& mv Makefile Makefile.config
&& \
177 ${TOOL_SED} -e
's/\(maybe-all-gcc:\) all-gcc/\1/' \
178 -e
's/\(maybe-all-target-libgcc:\) all-target-libgcc/\1/' \
179 < Makefile.config
> Makefile
)
180 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
181 (cd .native
/gcc
&& ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h
)
182 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
183 (cd .native
/gcc
&& ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h unwind.h
)
184 (cd .native
&& touch gcc
/cc1obj gcc
/cc1plus gcc
/f771 gcc
/libgcc.a gcc
/libgcc_s.so
)
185 .for _lib in
${MKNATIVE_CONFIG_TARGET_LIBS}
186 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
187 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} \
189 ALL_GCC_C
= ALL_GCC_CXX
= \
190 CC_FOR_TARGET
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
191 CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
192 RAW_CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
193 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
194 ac_cv_prog_cc_cross
=yes
) && \
197 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
198 (cd .native
/${MACHINE_GNU_PLATFORM}/libstdc
++-v3
/include && \
199 ${MKNATIVE_ENV} ${BUILD_MAKE} \
200 CC_FOR_TARGET
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
201 CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
202 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
206 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
207 (cd .native
/${MACHINE_GNU_PLATFORM}/libiberty
&& \
208 ${MKNATIVE_ENV} ${BUILD_MAKE} needed-list
)