summaryrefslogtreecommitdiff
path: root/doc/HOWTO.OSX
blob: 326cb7008a2526bee9b5a33b5d65d264baccabc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Followed: http://wiki.osdev.org/How_to_develop_on_Mac_OS_X

brew uninstall binutils
lynx ftp://ftp.gnu.org/gnu/binutils/
lynx ftp://ftp.gnu.org/gnu/gcc/
tar zxvf binutils-2.28.tar.gz 
tar zxvf gcc-6.3.0.tar.gz 
cd gcc-6.3.0
contrib/download_prerequisites 
brew install gcc
export CC=/usr/local/bin/gcc-6
export CXX=/usr/local/bin/g++-6 
export CPP=/usr/local/bin/cpp-6 
export LD=/usr/local/bin/gcc-6 
export PREFIX="$HOME/opt/cross"
export TARGET=i486-elf
export PATH="$PREFIX/bin:$PATH"
mkdir src
mv binutils-2.28* src
mv gcc-6.3.0* src
cd src/
mkdir build-binutils
cd build-binutils
../binutils-2.28/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make
make install
which -- $TARGET-as || echo $TARGET-as is not in the PATH
mkdir build-gcc
cd build-gcc
../gcc-6.3.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc

make CC=~/opt/cross/bin/i486-elf-gcc LD=~/opt/cross/bin/i486-elf-ld