# Copyright (C) 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is part of the GNU Hurd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The GCC version that we use. gcc_version = 4.2.2 gcc_tarballs = gcc-core-$(gcc_version).tar.bz2 gcc-g++-$(gcc_version).tar.bz2 gcc_snapshot = $(addprefix ftp://ftp.gnu.org/gnu/gcc/gcc-$(gcc_version)/,$(1)) # Patches to apply to GCC's source tree. gcc_patch_files = \ configury.patch \ configury2.patch $(addprefix $(srcdir)/gcc/,$(gcc_tarballs)): $(srcdir)/gcc/%: cd $(srcdir)/gcc/ && \ wget $(call gcc_snapshot, $*) $(srcdir)/gcc/gcc/unpack.stamp: $(addprefix $(srcdir)/gcc/,$(gcc_tarballs)) if test -d $(srcdir)/gcc/gcc/.; then \ echo "Refusing to extract over $(srcdir)/gcc/gcc"; \ exit 1; \ fi for f in $^; do \ ( cd $(srcdir)/gcc/ && \ tar xvj ) \ < "$$f" \ || exit "$$?"; \ done mv $(srcdir)/gcc/gcc-$(gcc_version) $(srcdir)/gcc/gcc touch $@ # Apply any local patches. (Revert any applied older version.) $(addprefix $(srcdir)/gcc/gcc/,$(addsuffix .applied,$(gcc_patch_files))): $(srcdir)/gcc/gcc/unpack.stamp $(addprefix $(srcdir)/gcc/gcc/,$(addsuffix .applied,$(gcc_patch_files))): $(srcdir)/gcc/%.applied: $(srcdir)/% if test -e "$@"; \ then \ ( cd $(srcdir)/gcc/gcc/ && sh /dev/stdin -R ) < $@ && rm -f $@; \ fi ( cd $(srcdir)/gcc/gcc/ && sh /dev/stdin ) < $< cp $< $@ $(srcdir)/gcc/gcc/patch.stamp: $(srcdir)/gcc/gcc/unpack.stamp $(addprefix $(srcdir)/gcc/gcc/,$(addsuffix .applied,$(gcc_patch_files))) cd $(srcdir)/gcc/gcc/ && \ $(fix_config_guess_and_sub) touch $@ gcc/gcc.build/configure.stamp: $(srcdir)/gcc/gcc/patch.stamp binutils/binutils.build/install.stamp rm -rf gcc/gcc.build mkdir -p gcc/gcc.build ( cd gcc/gcc.build && \ case "$(host_alias)" in \ i[34567]86-*-*) \ extra_args=--with-arch=$(word 1,$(subst -, ,$(host_alias))) \ ;; \ esac && \ $(abs_srcdir)/gcc/gcc/configure \ --target=$(host_alias) \ --prefix='$(abs_top_builddir)' \ --with-sysroot='$(SYSROOT)' \ --disable-nls \ --disable-shared \ --disable-threads \ --without-headers \ --with-newlib \ --enable-languages=c \ $$extra_args \ ) touch $@ gcc/gcc.build/build.stamp: gcc/gcc.build/configure.stamp cd gcc/gcc.build/ && \ $(MAKE) all-gcc touch $@ gcc/gcc.build/install.stamp: gcc/gcc.build/build.stamp cd gcc/gcc.build/ && \ $(MAKE) install-gcc touch $@ # libstdc++ libstdc++: gcc/gcc.build/$(host_alias)/libstdc++-v3/install.stamp # While it would be desirable to have the following two target re-ran each # turn, stamp files (to inhibit this) are being created nevertheless, as the # GCC build system doesn't do dependency tracking to external (header) files, # so nothing would be rebuilt anyway. gcc/gcc.build/$(host_alias)/libstdc++-v3/build.stamp: gcc/gcc.build/build.stamp gcc/gcc.build/frob-Makefile-FLAGS_FOR_TARGET cd gcc/gcc.build/ && \ $(MAKE) all-target-libstdc++-v3 touch $@ gcc/gcc.build/$(host_alias)/libstdc++-v3/install.stamp: gcc/gcc.build/$(host_alias)/libstdc++-v3/build.stamp cd gcc/gcc.build/ && \ $(MAKE) install-target-libstdc++-v3 touch $@ # Doing this is needed to teach GCC about where to find the libc headers, etc. # TODO. It also does provoke a bunch of warnings in the libstdc++ compilation. # Someone might want to sort that out... gcc/gcc.build/frob-Makefile-FLAGS_FOR_TARGET: gcc/gcc.build/Makefile sed '/^FLAGS_FOR_TARGET/s%$$% $(USER_CPPFLAGS) $(USER_CFLAGS)%' \ < $^ > $^.new && \ mv $^.new $^ touch $@ #TODO: clean etc.