]>
Commit | Line | Data |
---|---|---|
cd1a2927 MT |
1 | # Makefile for to build gcc for uClibc |
2 | # | |
3 | # Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org> | |
4 | # | |
5 | # This program is free software; you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation; either version 2 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | # General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program; if not, write to the Free Software | |
17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | # | |
19 | ||
20 | ############################################################# | |
21 | # | |
22 | # EDIT this stuff to suit your system and preferences | |
23 | # | |
24 | # Use := when possible to get precomputation, thereby | |
25 | # speeding up the build process. | |
26 | # | |
27 | ############################################################# | |
28 | ||
29 | # What sortof target system shall we compile this for? | |
1d4ec104 | 30 | ARCH:=$(MACHINE) |
cd1a2927 MT |
31 | #ARCH:=arm |
32 | #ARCH:=mips | |
33 | #ARCH:=mipsel | |
34 | # Possible issues remaining with powerpc and soft float. | |
35 | #ARCH:=powerpc | |
36 | #ARCH:=sh4 | |
37 | # Busybox link failing due to needing libgcc functions that are statics. | |
38 | #ARCH:=cris | |
39 | ||
40 | # The following currently fail to build since no shared lib support. | |
41 | #ARCH:=sh64 | |
42 | #ARCH:=m68k | |
43 | #ARCH:=v850 | |
44 | #ARCH:=sparc | |
45 | #ARCH:=whatever | |
46 | ||
47 | # Enable this to use the uClibc daily snapshot instead of a released | |
48 | # version. Daily snapshots may contain new features and bugfixes. Or | |
49 | # they may not even compile at all, depending on what Erik is doing... | |
50 | USE_UCLIBC_SNAPSHOT:=false | |
51 | ||
52 | # Enable this to use the busybox daily snapshot instead of a released | |
53 | # version. Daily snapshots may contain new features and bugfixes. Or | |
54 | # they may not even compile at all.... | |
55 | USE_BUSYBOX_SNAPSHOT:=true | |
56 | ||
57 | # Enable large file (files > 2 GB) support | |
58 | BUILD_WITH_LARGEFILE:=true | |
59 | ||
60 | # Command used to download source code | |
61 | WGET:=wget --passive-ftp | |
62 | ||
63 | # Soft floating point options. | |
64 | # Notes: | |
65 | # Currently builds with gcc 3.3 for i386, arm, mips, mipsel. | |
66 | # Only tested with multilib enabled. | |
67 | # For i386, long double is the same as double (64 bits). While this | |
68 | # is unusual for x86, it seemed the best approach considering the | |
69 | # limitations in the gcc floating point emulation library. | |
70 | # For arm, soft float uses the usual libfloat routines. | |
71 | # The uClibc built will support _only_ applications compiled with the | |
72 | # -msoft-float flag. To avoid CFLAGS problems, you may want to use | |
73 | # scripts similar to those in the build*/staging_dir/bin directory. | |
74 | # (Un)comment the appropriate line below. | |
75 | #SOFT_FLOAT:=true | |
76 | SOFT_FLOAT:=false | |
77 | ||
78 | # Any additional gcc options you may want to include.... | |
79 | EXTRA_GCC_CONFIG_OPTIONS:= | |
80 | ||
81 | # Enable the following if you want locale/gettext/i18n support. | |
82 | # NOTE! Currently the pregnerated locale stuff only works for x86! | |
83 | #ENABLE_LOCALE:=true | |
84 | ENABLE_LOCALE:=false | |
85 | ||
86 | # If you want multilib enabled, enable this... | |
87 | MULTILIB:=--enable-multilib | |
88 | ||
89 | # Build/install c++ compiler and libstdc++? | |
90 | INSTALL_LIBSTDCPP:=false | |
91 | ||
92 | # For SMP machines some stuff can be run in parallel | |
93 | JLEVEL=-j3 | |
94 | ||
95 | ############################################################# | |
96 | # | |
97 | # You should probably leave this stuff alone unless you know | |
98 | # what you are doing. | |
99 | # | |
100 | ############################################################# | |
101 | USE_UCLIBC_TOOLCHAIN:=true | |
41921bd9 | 102 | TARGETS:=uclibc-configured binutils gcc3_3 |
cd1a2927 MT |
103 | |
104 | # Optimize toolchain for which type of CPU? | |
105 | # WARNING!!! CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!! | |
106 | OPTIMIZE_FOR_CPU=$(ARCH) | |
107 | ||
108 | ifeq ($(SOFT_FLOAT),true) | |
109 | SOFT_FLOAT_CONFIG_OPTION:=--without-float | |
110 | TARGET_SOFT_FLOAT:=-msoft-float | |
111 | ARCH_FPU_SUFFIX:=_nofpu | |
112 | else | |
113 | SOFT_FLOAT_CONFIG_OPTION:= | |
114 | TARGET_SOFT_FLOAT:= | |
115 | ARCH_FPU_SUFFIX:= | |
116 | endif | |
117 | ||
118 | ifeq ($(ENABLE_LOCALE),true) | |
119 | EXTRA_GCC_CONFIG_OPTIONS += --enable-clocale=gnu | |
120 | endif | |
121 | ||
122 | # WARNING -- uClibc currently disables large file support on cris. | |
123 | ifeq ("$(strip $(ARCH))","cris") | |
124 | BUILD_WITH_LARGEFILE:=false | |
125 | endif | |
126 | ||
127 | ifneq ($(BUILD_WITH_LARGEFILE),true) | |
128 | DISABLE_LARGEFILE= --disable-largefile | |
129 | endif | |
130 | TARGET_OPTIMIZATION=-Os | |
131 | TARGET_DEBUGGING= #-g | |
132 | TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_SOFT_FLOAT) | |
133 | ||
134 | HOSTCC:=gcc | |
135 | SED:=sed -i -e | |
136 | BASE_DIR:=${shell pwd} | |
137 | SOURCE_DIR:=$(BASE_DIR)/sources | |
138 | #DL_DIR:=$(SOURCE_DIR)/dl | |
139 | DL_DIR:=/usr/src/cache | |
140 | PATCH_DIR=$(SOURCE_DIR)/patches | |
141 | #BUILD_DIR=$(BASE_DIR)/toolchain_$(ARCH)$(ARCH_FPU_SUFFIX) | |
142 | BUILD_DIR=/opt/$(ARCH)-uClibc | |
143 | STAGING_DIR=$(BUILD_DIR) | |
144 | TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX) | |
145 | TARGET_PATH=/usr/local/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin | |
146 | #TARGET_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc- | |
1d4ec104 | 147 | TARGET_CROSS=$(STAGING_DIR)/bin/$(ARCH)-linux-uclibc- |
cd1a2927 MT |
148 | TARGET_CC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) |
149 | STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note | |
150 | #STRIP:=/bin/true | |
151 | IMAGE:=$(BASE_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX) | |
1d4ec104 | 152 | GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc |
cd1a2927 | 153 | #KERNEL_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc- |
1d4ec104 | 154 | KERNEL_CROSS=$(STAGING_DIR)/bin/$(ARCH)-linux-uclibc- |
cd1a2927 MT |
155 | HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \ |
156 | -e 's/sparc.*/sparc/' \ | |
157 | -e 's/arm.*/arm/g' \ | |
158 | -e 's/m68k.*/m68k/' \ | |
159 | -e 's/alpha.*/alpha/' \ | |
160 | -e 's/ppc/powerpc/g' \ | |
161 | -e 's/v850.*/v850/g' \ | |
162 | -e 's/sh[234]/sh/' \ | |
163 | -e 's/mips-.*/mips/' \ | |
164 | -e 's/mipsel-.*/mipsel/' \ | |
165 | -e 's/cris.*/cris/' \ | |
166 | -e 's/i[3-9]86/i386/' \ | |
167 | ) | |
168 | GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu | |
169 | TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \ | |
170 | AR=$(TARGET_CROSS)ar \ | |
171 | AS=$(TARGET_CROSS)as \ | |
172 | LD=$(TARGET_CROSS)ld \ | |
173 | NM=$(TARGET_CROSS)nm \ | |
174 | CC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) \ | |
175 | GCC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) \ | |
176 | CXX=$(TARGET_CROSS)g++$(TARGET_SOFT_FLOAT) \ | |
177 | RANLIB=$(TARGET_CROSS)ranlib | |
178 | ifeq ($(ENABLE_LOCALE),true) | |
179 | DISABLE_NLS:= | |
180 | else | |
181 | DISABLE_NLS:=--disable-nls | |
182 | endif | |
183 | ||
184 | ||
185 | all: world | |
186 | ||
187 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) | |
188 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) | |
189 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) | |
190 | ||
191 | world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGETS) | |
192 | ||
193 | .PHONY: all world clean dirclean distclean source $(TARGETS) \ | |
194 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) | |
195 | ||
41921bd9 | 196 | include make/*.mk |
cd1a2927 MT |
197 | |
198 | ############################################################# | |
199 | # | |
200 | # staging and target directories do NOT list these as | |
201 | # dependancies anywhere else | |
202 | # | |
203 | ############################################################# | |
204 | $(DL_DIR): | |
205 | mkdir $(DL_DIR) | |
206 | ||
207 | $(STAGING_DIR): | |
208 | rm -rf $(STAGING_DIR) | |
209 | mkdir -p $(BUILD_DIR) | |
210 | mkdir -p $(TOOL_BUILD_DIR) | |
211 | mkdir -p $(STAGING_DIR)/lib | |
212 | mkdir -p $(STAGING_DIR)/usr | |
213 | # mkdir -p $(STAGING_DIR)/include | |
214 | ln -fs ../lib $(STAGING_DIR)/usr/lib | |
215 | ||
216 | source: $(TARGETS_SOURCE) | |
217 | ||
218 | ############################################################# | |
219 | # | |
220 | # Cleanup and misc junk | |
221 | # | |
222 | ############################################################# | |
223 | clean: $(TARGETS_CLEAN) | |
224 | rm -rf $(STAGING_DIR) $(IMAGE) | |
225 | ||
226 | dirclean: $(TARGETS_DIRCLEAN) | |
227 | rm -rf $(STAGING_DIR) $(IMAGE) | |
228 | ||
229 | distclean: | |
230 | rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) | |
231 | ||
232 | sourceball: | |
233 | rm -rf $(BUILD_DIR) | |
234 | set -e; \ | |
235 | cd ..; \ | |
236 | rm -f buildroot.tar.bz2; \ | |
237 | tar -cvf buildroot.tar buildroot; \ | |
238 | bzip2 -9 buildroot.tar; \ |