blob: 4bf1e7027d1d02c4e5421982b4843c0830adfeaf (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
#######################################################################
#
# Makefile to build a linux hosted PPC cross compiler for
# PPC vxWorks 5.5.1 / Tornado 2.2.1
#
# Note:
# To build the toolchain on newer linux systems,
# we need to temporary install 'sed' and 'bison' to be
# compatible for gcc configure and make scripts.
#
#######################################################################
CWD = $(shell readlink -f .)
ifeq ($(BUILD_NUMBER),)
BUILD_NO=0
else
BUILD_NO=$(BUILD_NUMBER)
endif
VERSION=0.4.1
SRCDIR=$(CWD)/SOURCES
BUILDDIR=$(CWD)/build
#WIND_BASE=$(HOME)/tornado/2.2.1
WIND_USR=$(WIND_BASE)/target
HOST=i686-pc-linux-gnu
GCC_TARGET=powerpc-wrs-vxworks55
MASCH=$(shell uname -m)
INSTDIR=$(CWD)/inst/crossppc
GCC_VERSION=2.95.3
GCC_TARGET_VERSION=2.95.4
LANGUAGES=c,c++
PACKAGE=$(CWD)/vxw55-crossppc-$(GCC_TARGET_VERSION)-$(BUILD_NO)-$(HOST).tar.gz
ifeq ($(WIND_BASE),)
$(error WIND_BASE not specified )
endif
JOBS=-j4
all: prepare mktools binutils xgcc uninsttools pack clean
prepare:
mkdir -p $(BUILDDIR)
mkdir -p $(INSTDIR)
rm -Rf $(CWD)/unpacked
mkdir -p $(CWD)/unpacked/sys-includes
cp -Rvf $(WIND_BASE)/target/h/* $(CWD)/unpacked/sys-includes
cd $(CWD)/unpacked/sys-includes/sys && \
patch -p0 < $(SRCDIR)/fdmatch.patch
cd $(CWD)/unpacked && \
tar -zxf $(SRCDIR)/gcc-2.95.3.tar.gz
cd $(CWD)/unpacked/gcc-$(GCC_VERSION) && \
patch -p1 < $(SRCDIR)/gcc2.95.3-2.95.4vxw55.patch
cd $(CWD)/unpacked && \
tar -zxf $(SRCDIR)/sed-3.02.tar.gz
cd $(CWD)/unpacked && \
tar -zxf $(SRCDIR)/bison-1.28.tar.gz
cd $(CWD)/unpacked && \
tar -zxf $(SRCDIR)/binutils-2.10.1.tar.gz
cd $(CWD)/unpacked/binutils-* && \
patch -p1 < $(SRCDIR)/vx-ppc-binutils-2.10.diff
mktools:
cd $(CWD)/unpacked/sed-* && \
CC="gcc -m32 -std=gnu89" \
CXX="g++ -m32" \
./configure --prefix=$(INSTDIR) && \
make && make install
cd $(CWD)/unpacked/bison-* && \
CC="gcc -m32 -std=gnu89" \
CXX="g++ -m32" \
./configure --prefix=$(INSTDIR) && \
make && make install
uninsttools:
lll:
cd $(CWD)/unpacked/sed-* && \
export PATH=$(PATH):/sbin && \
make uninstall
cd $(CWD)/unpacked/bison-* && \
export PATH=$(PATH):/sbin && \
make uninstall
binutils:
rm -Rf $(BUILDDIR)/binutils
mkdir -p $(BUILDDIR)/binutils
cd $(BUILDDIR)/binutils && \
export PATH=$(INSTDIR)/bin:$(PATH) && \
CC="gcc -m32 -std=gnu89" \
CXX="g++ -m32" \
HOST_LD_FLAGS="-m32" \
$(CWD)/unpacked/binutils-2.10.1/configure \
--build=$(HOST) \
--host=$(HOST) \
--prefix=$(INSTDIR) \
--target=$(GCC_TARGET) \
--with-headers=$(CWD)/unpacked/sys-includes \
--with-libs=$(WIND_BASE)/target/lib
cd $(BUILDDIR)/binutils && \
export PATH=$(INSTDIR)/bin:$(PATH) && \
make $(JOBS) && \
make install
xgcc:
rm -Rf $(BUILDDIR)/gcc
mkdir -p $(BUILDDIR)/gcc
cd $(BUILDDIR)/gcc && \
export WIND_BASE=$(WIND_BASE) && \
export WIND_USR=$(WIND_USR) && \
export PATH=$(INSTDIR)/bin:$(PATH) && \
export YACC="$(INSTDIR)/bin/bison -y" && \
bison --version && \
CC="gcc -m32 -std=gnu89" \
CXX="g++ -m32" \
HOST_LD_FLAGS="-m32" \
$(CWD)/unpacked/gcc-$(GCC_VERSION)/configure \
--build=$(HOST) \
--host=$(HOST) \
--prefix=$(INSTDIR) \
--target=$(GCC_TARGET) \
--with-headers=$(CWD)/unpacked/sys-includes \
--with-libs=$(WIND_BASE)/target/lib \
--enable-languages="$(LANGUAGES)" \
--disable-multilib \
--with-gnu-as --with-gnu-ld
cd $(BUILDDIR)/gcc && \
export WIND_BASE=$(WIND_BASE) && \
export WIND_USR=$(WIND_USR) && \
export PATH=$(INSTDIR)/bin:$(PATH) && \
make $(JOBS) && \
make install
rm -Rf $(INSTDIR)/$(GCC_TARGET)/sys-include
rm -f $(INSTDIR)/bin/powerpc-wrs-vxworks55-gccbug
strip $(INSTDIR)/bin/$(GCC_TARGET)-*
pack:
cd $(INSTDIR) && \
tar -zcf $(PACKAGE) .
clean:
rm -Rf $(BUILDDIR)
rm -Rf $(CWD)/unpacked
#rm -Rf $(CWD)/inst
|