Now that we know what sources are needed to build a given library, we need

the rules how to build those sources.  Generate makefiles defining ${COPTS},
${CPPFLAGS}, and ${SRCS} (== template).

Note that ${CPPFLAGS} is actually dfined as _CPPFLAGS like
	_CPPFLAGS.tmp___gcc_bcmp.c=-DL__gcc_bcmp
and used to generate wrapper files (e.g. tmp___gcc_bcmp.c).  Otherwise it's
automagically passed to ${CC} by bsd.*.mk.
This commit is contained in:
uebayasi 2009-11-30 09:50:59 +00:00
parent b0c0987db9
commit d3180e0c9b
1 changed files with 41 additions and 2 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# $NetBSD: mknative-gcc,v 1.37 2009/11/30 09:33:36 uebayasi Exp $ # $NetBSD: mknative-gcc,v 1.38 2009/11/30 09:50:59 uebayasi Exp $
# #
# Shell script for generating all the constants needed for a native # Shell script for generating all the constants needed for a native
# platform build of src/gnu/dist/gcc. # platform build of src/gnu/dist/gcc.
@ -236,6 +236,40 @@ get_libgcc_gen_srcs () {
sed -e 's,^, ,; s,$, \\,' sed -e 's,^, ,; s,$, \\,'
} }
_lookup_objs () {
local _obj=$1; local _key=$2
eval grep \^$_obj\\\ \$_TOP/\${libgcc_db_objs_${_key}} | cut -f2
}
get_libgcc_gen_srcs_tmpsrcs () {
cut -f1 $_TOP/${libgcc_db_objs_libs} | \
while read _obj; do
printf 'SRCS.tmp_%s=%s\n' \
"$( _lookup_objs $_obj srcs )" \
"$( _lookup_objs $_obj tmpsrcs )"
done | \
sed -e 's,\$(\(.*\)),${G_\1},'
}
get_libgcc_gen_srcs_cppflags () {
cut -f1 $_TOP/${libgcc_db_objs_libs} | \
while read _obj; do
printf '_CPPFLAGS.tmp_%s=%s\n' \
"$( _lookup_objs $_obj srcs )" \
"$( _lookup_objs $_obj cppflags | xargs )"
done
}
get_libgcc_gen_srcs_copts () {
cut -f1 $_TOP/${libgcc_db_objs_libs} | \
while read _obj; do
printf 'COPTS.tmp_%s=%s\n' \
"$( _lookup_objs $_obj srcs )" \
"$( _lookup_objs $_obj copts | xargs )"
done
}
get_libgcc_new_generate () { get_libgcc_new_generate () {
for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do
for _tmp in tmpsrcs tmpfpsrcs tmpasmsrcs; do for _tmp in tmpsrcs tmpfpsrcs tmpasmsrcs; do
@ -246,6 +280,11 @@ get_libgcc_new_generate () {
get_libgcc_gen_srcs $_lib | \ get_libgcc_gen_srcs $_lib | \
write_mk ${_machine_arch_subdir}/${_lib%.*}.srcs.mk write_mk ${_machine_arch_subdir}/${_lib%.*}.srcs.mk
done done
for _arg in tmpsrcs cppflags copts; do
eval get_libgcc_gen_srcs_${_arg} | \
eval writefile \$libgcc_srcs_mk_${_arg}
done
} }
##### #####
@ -268,7 +307,7 @@ get_libgcc_new () {
get_libgcc_new_analyze get_libgcc_new_analyze
libgcc_srcs_mk=${_machine_arch_subdir}/srcs.mk libgcc_srcs_mk=${_machine_arch_subdir}/srcs.mk
libgcc_srcs_mk_tmpsrc=${_machine_arch_subdir}/srcs.tmpsrc.mk libgcc_srcs_mk_tmpsrcs=${_machine_arch_subdir}/srcs.tmpsrcs.mk
libgcc_srcs_mk_cppflags=${_machine_arch_subdir}/srcs.cppflags.mk libgcc_srcs_mk_cppflags=${_machine_arch_subdir}/srcs.cppflags.mk
libgcc_srcs_mk_copts=${_machine_arch_subdir}/srcs.copts.mk libgcc_srcs_mk_copts=${_machine_arch_subdir}/srcs.copts.mk