]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - lfs/binutils
Merge branch 'master' of ssh://ms@git.ipfire.org/pub/git/ipfire-3.x
[people/amarx/ipfire-3.x.git] / lfs / binutils
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
5 # #
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. #
10 # #
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. #
15 # #
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/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 PKG_NAME = binutils
28 VER = 2.18
29
30 THISAPP = $(PKG_NAME)-$(VER)
31 DL_FILE = $(THISAPP).tar.bz2
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33
34 ifeq "$(STAGE)" "toolchain"
35 ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)"
36 TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-pass$(PASS)
37 else
38 TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-cross
39 endif
40 else
41 TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
42 endif
43
44 ###############################################################################
45 # Top-level Rules
46 ###############################################################################
47
48 objects = $(DL_FILE) $(THISAPP)-configure-1.patch \
49 $(THISAPP)-uClibc-1.patch \
50 $(THISAPP)-ld_makefile.patch
51
52 install : $(TARGET)
53
54 download : $(objects)
55
56 $(objects) :
57 @$(LOAD)
58
59 ###############################################################################
60 # Installation Details
61 ###############################################################################
62
63 $(TARGET) :
64 @$(PREBUILD)
65 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
66 -mkdir -v $(DIR_SRC)/binutils-build
67 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-configure-1.patch
68
69 ifeq "$(STAGE)" "toolchain"
70 ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)"
71 #
72 # Normal build
73 #
74
75 ifeq "$(PASS)" "1"
76 ifeq "$(MACHINE)" "$(MACHINE_REAL)"
77 cd $(DIR_SRC)/binutils-build && CC="gcc -B/usr/bin/" ../$(THISAPP)/configure \
78 --prefix=$(TOOLS_DIR) \
79 --disable-nls \
80 --disable-werror
81 cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
82 cd $(DIR_SRC)/binutils-build && make install
83 cd $(DIR_SRC)/binutils-build && make -C ld clean
84 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=$(TOOLS_DIR)/lib
85 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin
86 else
87 #
88 # Cross build
89 #
90 cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure \
91 --prefix=$(TOOLS_DIR) \
92 --build=${IFS_HOST} \
93 --host=${IFS_TARGET} \
94 --target=${IFS_TARGET} \
95 --disable-nls \
96 --enable-shared \
97 --disable-multilib
98 cd $(DIR_SRC)/binutils-build && make configure-host
99 cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
100 cd $(DIR_SRC)/binutils-build && make install
101 endif
102 endif
103
104 ifeq "$(PASS)" "2"
105 cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure \
106 --prefix=$(TOOLS_DIR) \
107 --disable-nls \
108 --with-lib-path=$(TOOLS_DIR)/lib
109 cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
110 cd $(DIR_SRC)/binutils-build && make install
111
112 cd $(DIR_SRC)/binutils-build && make -C ld clean
113 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib
114 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin
115 endif
116
117 else
118 #
119 # Cross build
120 #
121
122 cd $(DIR_SRC)/binutils-build && AR=ar AS=as ../$(THISAPP)/configure \
123 --prefix=$(CTOOLS_DIR) \
124 --host=${IFS_HOST} \
125 --target=${IFS_TARGET} \
126 --with-lib-path=$(TOOLS_DIR)/lib \
127 --disable-nls \
128 --enable-shared \
129 --disable-multilib
130 cd $(DIR_SRC)/binutils-build && make configure-host
131 cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
132 cd $(DIR_SRC)/binutils-build && make install
133
134 -mkdir -p $(TOOLS_DIR)/include
135 cp -fv $(DIR_APP)/include/libiberty.h $(TOOLS_DIR)/include
136 endif
137 endif
138
139 ifeq "$(STAGE)" "base"
140 cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure --prefix=/usr \
141 --enable-shared
142 cd $(DIR_SRC)/binutils-build && make tooldir=/usr $(PARALLELISMFLAGS)
143 cd $(DIR_SRC)/binutils-build && make tooldir=/usr install
144
145 cp -fv ../$(THISAPP)/include/libiberty.h /usr/include
146 endif
147
148 ifeq "$(STAGE)" "installer"
149 cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure \
150 --target=$(UCLIBC_TARGET) \
151 --prefix=$(UCLIBC_DIR) \
152 --with-sysroot=$(UCLIBC_SYSROOT_DIR) \
153 --disable-multilib \
154 --disable-werror \
155 --disable-nls
156 cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
157 cd $(DIR_SRC)/binutils-build && make install
158
159 for t in ar as ld strip; do \
160 ln -sfv $(UCLIBC_DIR)/bin/$(UCLIBC_TARGET)-$${t} \
161 $(UCLIBC_CC_CORE_STATIC_DIR)/$(UCLIBC_TARGET)/bin/$${t}; \
162 ln -sfv $(UCLIBC_DIR)/bin/$(UCLIBC_TARGET)-$${t} \
163 $(UCLIBC_CC_CORE_STATIC_DIR)/bin/$(UCLIBC_TARGET)-$${t}; \
164 done
165 endif
166
167 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
168 @$(POSTBUILD)