1 # $NetBSD: Makefile,v 1.33 2009/12/23 20:15:21 mrg Exp $
5 GCC_LANGUAGES
=c c
++ objc
8 MKNATIVE_CONFIG_TARGET_LIBS
=
9 BINENV
= /usr
/bin
/env
-i
13 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "sparc64"
14 MULTILIB_ARGS
= --enable-multilib
16 MULTILIB_ARGS
= --disable-multilib
19 COMMON_CONFIGURE_ARGS
= --target
=${MACHINE_GNU_PLATFORM} \
22 ${VAX_CONFIGURE_ARGS} \
24 .if defined
(GCC_CONFIG_ARCH.
${MACHINE_ARCH})
25 COMMON_CONFIGURE_ARGS
+= --with-arch
=${GCC_CONFIG_ARCH.
${MACHINE_ARCH}}
27 .if defined
(GCC_CONFIG_TUNE.
${MACHINE_ARCH})
28 COMMON_CONFIGURE_ARGS
+= --with-tune
=${GCC_CONFIG_TUNE.
${MACHINE_ARCH}}
31 CONFIGURE_ARGS
= ${COMMON_CONFIGURE_ARGS} \
34 --program-transform-name
="s,^,${MACHINE_GNU_PLATFORM}-," \
35 --enable-languages
="${GCC_LANGUAGES}"
37 MAKE_ARGS
= MACHINE
= MAKEINFO
=${TOOL_MAKEINFO
:Q
} \
38 LIBGCC
= LIBGCC1
= LIBGCC1_TEST
= LIBGCC2
= INSTALL_LIBGCC
= \
39 EXTRA_PARTS
= CPPFLAGS
=-DNETBSD_TOOLS \
40 AR
=${HOST_AR
:Q
} RANLIB
=${HOST_RANLIB
:Q
}
42 CONFIGURE_ENV
+= gcc_cv_libc_provides_ssp
=yes
44 MKNATIVE_ENV
= ${BINENV} ${CONFIGURE_ENV
:NC
*:NLD
*} \
45 CC_FOR_BUILD
=${HOST_CC
:Q
} \
46 CC
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
47 CXX
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
48 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
49 CFLAGS
= CPPFLAGS
= CXXFLAGS
= LDFLAGS
= \
50 AS
=${AS
:Q
} AWK
=${TOOL_AWK
:Q
} LD
=${LD
:Q
} \
51 MSGFMT
=${TOOLDIR}/bin
/${_TOOL_PREFIX}msgfmt \
52 NM
=${NM
:Q
} OBJDUMP
=${OBJDUMP
:Q
} \
53 XGETTEXT
=${TOOLDIR}/bin
/${_TOOL_PREFIX}xgettext \
55 ac_cv_prog_cc_cross
=yes \
56 ac_cv_func_strcoll_works
=yes \
57 gcc_cv_func_printf_ptr
=yes \
58 gcc_cv_libc_provides_ssp
=yes \
59 gdb_cv_printf_has_long_double
=yes \
60 gdb_cv_printf_has_long_long
=yes \
61 gdb_cv_scanf_has_long_double
=yes
64 INSTALL_TARGET
= install-gcc
66 .
include "${.CURDIR}/../Makefile.gmakehost"
67 BUILD_MAKE
=${TOOL_GMAKE}
69 CXXADDFLAGS
= ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr
/include/g
++
70 CCADDFLAGS
= ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr
/include -L
${DESTDIR}/lib
-L
${DESTDIR}/usr
/lib
-B
${DESTDIR}/usr
/lib
/
72 NEWCONFIGDIR?
= ${.CURDIR
}/..
/..
73 MKNATIVE?
= ${.CURDIR
}/mknative-gcc
75 bootstrap-libgcc
: .configure_done
76 @echo
'Creating files needed for libgcc by a native bootstrap build.'
77 @MAKE
=${BUILD_MAKE
:Q
} ${HOST_SH} ${MKNATIVE} lib
${MODULE} \
78 ${.OBJDIR
}/build
${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
80 native-gcc
: .native
/.configure_done
81 @echo
'Extracting GNU GCC configury for a native toolchain.'
82 @MAKE
=${BUILD_MAKE
:Q
} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
83 ${.OBJDIR
}/.native
${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
85 NATIVE_CONFIGURE_ARGS
= ${COMMON_CONFIGURE_ARGS} \
88 --build
=`${.CURDIR}/../../gnu/dist/${MODULE}/config.guess` \
89 --host
=${MACHINE_GNU_PLATFORM}
91 .native
/.configure_done
: ${_GNU_CFGSRC} ${.CURDIR
}/Makefile
92 mkdir .native
2>/dev
/null || true
93 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
94 (cd .native
&& ${MKNATIVE_ENV} \
95 ${HOST_SH} ${GNUHOSTDIST}/configure \
96 ${NATIVE_CONFIGURE_ARGS}) && \
97 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty
)
99 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
100 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp
) && \
101 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty
)
102 # edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
103 (cd .native
&& mv Makefile Makefile.config
&& \
104 ${TOOL_SED} -e
's/\(maybe-all-gcc:\) all-gcc/\1/' \
105 < Makefile.config
> Makefile
) && \
106 (cd .native
/gcc
&& ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h
)
108 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
109 (cd .native
&& ${MKNATIVE_ENV} ${BUILD_MAKE} all-libiberty
) && \
110 (cd .native
/gcc
&& ${MKNATIVE_ENV} ${BUILD_MAKE} tree-check.h config.h
)
112 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
113 (cd .native
&& touch gcc
/cc1obj gcc
/cc1plus gcc
/f771 gcc
/libgcc.a gcc
/libgcc_s.so
&& \
114 ${MKNATIVE_ENV} ${BUILD_MAKE} configure-target-libiberty \
115 ${MKNATIVE_CONFIG_TARGET_LIBS} configure-target-libobjc \
116 configure-target-libstdc
++-v3 \
117 ALL_GCC_C
= ALL_GCC_CXX
= \
118 CC_FOR_TARGET
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
119 CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
120 RAW_CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
121 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
122 ac_cv_prog_cc_cross
=yes
) && \
124 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
125 (cd .native
/${MACHINE_GNU_PLATFORM}/libstdc
++-v3
/include && \
126 ${MKNATIVE_ENV} ${BUILD_MAKE} \
127 CC_FOR_TARGET
=${CC
:Q
}' '${CCADDFLAGS
:Q
} \
128 CXX_FOR_TARGET
=${CXX
:Q
}' '${CCADDFLAGS
:Q
}' '${CXXADDFLAGS
:Q
} \
129 CPP
=${CPP
:Q
}' '-I
${DESTDIR}/usr
/include \
132 PATH
=${TOOLDIR}/bin
:$$PATH; export PATH
; \
133 (cd .native
/${MACHINE_GNU_PLATFORM}/libiberty
&& \
134 ${MKNATIVE_ENV} ${BUILD_MAKE} needed-list
)