1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2018 IPFire Team <info@ipfire.org> #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 ###############################################################################
21 ###############################################################################
23 ###############################################################################
29 THISAPP = cleanup-toolchain
31 ifeq "$(TOOLCHAIN)" "1"
32 TARGET = $(DIR_INFO)/$(THISAPP)-tools
34 TARGET = $(DIR_INFO)/$(THISAPP)
39 ###############################################################################
41 ###############################################################################
53 ###############################################################################
54 # Installation Details
55 ###############################################################################
57 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
60 ifeq "$(TOOLCHAIN)" "1"
61 # Remove the first cross compiler which is not needed anymore.
62 find $(TOOLS_DIR)/ -name "$(CROSSTARGET)*" | xargs rm -rfv
64 # Remove man and info pages.
65 rm -rfv $(TOOLS_DIR)/{,share}/{info,man}
67 # Fix ownership of the toolchain.
68 chown -R root:root $(TOOLS_DIR)/
70 # Update/create linker cache.
71 $(TOOLS_DIR)/sbin/ldconfig
73 # Set a marker when the toolchain was successfully built
74 touch $(TOOLS_DIR)/.toolchain-successful
76 mv -v $(TOOLS_DIR)/bin/{ld,ld-old}
77 mv -v $(TOOLS_DIR)/$(BUILDTARGET)/bin/{ld,ld-old}
78 mv -v $(TOOLS_DIR)/bin/{ld-new,ld}
79 ln -sv $(TOOLS_DIR)/bin/ld $(TOOLS_DIR)/$(BUILDTARGET)/bin/ld
81 gcc -dumpspecs | sed \
82 -e 's@$(TOOLS_DIR)@@g' \
83 -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
84 -e '/\*cpp:/{n;s@$$@ -isystem /usr/include@}' > \
85 $$(dirname $$(gcc -print-libgcc-file-name))/specs