forked from riscvarchive/riscv-old-gcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
executable file
·160 lines (143 loc) · 3.83 KB
/
Makefile.in
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
INSTALL_DIR := @prefix@
srcdir := $(shell cd @top_srcdir@ && pwd)
BINUTILS_VERSION := 2.21.1
GCC_VERSION := 4.6.1
GLIBC_VERSION := 2.14.1
NEWLIB_VERSION := 1.18.0
LINUX_DIR := $(srcdir)/linux-headers/
MAKE_JOBS := 16
ifndef INSTALL_DIR
busted:
@echo -e "\
You need to set INSTALL_DIR to point to where you want the tools \n\
installed. The best way to do this is to create a 'Makelocal' file\n\
in the current directory and put it in there. Alternatively, specify\n\
it on the command line, like so:\n\
\n\
make INSTALL_DIR=/your/install/path\n\
"; false
newlib: busted
riscv: busted
endif
# Check that we have gawk installed. Set awk=gawk if necessary.
SHELL := /bin/bash
ifeq ($(shell awk --version | grep GNU),)
ifeq ($(shell gawk --version),)
$(error You must have gawk installed on your system!)
else
SHELL := PATH="$(srcdir)/gawkward:$(PATH)" $(SHELL)
endif
endif
newlib: build-gcc-newlib
linux: build-gcc-linux-stage2
build-binutils-newlib:
rm -rf $@
mkdir $@
cd $@ && \
$(srcdir)/binutils-$(BINUTILS_VERSION)/configure \
--target=riscv-elf \
--program-prefix=riscv- \
--prefix=$(INSTALL_DIR) \
--disable-werror \
--enable-shared \
--enable-tls \
--enable-languages=c \
--with-newlib
$(MAKE) -C $@ -j $(MAKE_JOBS)
$(MAKE) -C $@ -j $(MAKE_JOBS) install
build-gcc-newlib-src: build-binutils-newlib
cp -r $(srcdir)/gcc-$(GCC_VERSION) $@
cp -r $(srcdir)/newlib-$(NEWLIB_VERSION)/newlib $@
cp -r $(srcdir)/newlib-$(NEWLIB_VERSION)/libgloss $@
build-gcc-newlib: build-gcc-newlib-src
rm -rf $@
mkdir $@
cd $@ && ../$</configure \
--target=riscv-elf \
--program-prefix=riscv- \
--prefix=$(INSTALL_DIR) \
--disable-shared \
--disable-threads \
--enable-tls \
--enable-languages=c,c++ \
--with-newlib \
--disable-libmudflap \
--disable-libssp \
--disable-libquadmath \
--disable-libgomp \
--disable-nls
$(MAKE) -C $@ -j $(MAKE_JOBS) inhibit-libc=true
$(MAKE) -C $@ -j $(MAKE_JOBS) install
build-binutils-linux:
rm -rf $@
mkdir $@
cd $@ && $(srcdir)/binutils-$(BINUTILS_VERSION)/configure \
--target=riscv-linux \
--prefix=$(INSTALL_DIR) \
--disable-werror \
--enable-tls \
--enable-languages=c \
--with-newlib \
--disable-multilib
$(MAKE) -C $@ -j $(MAKE_JOBS)
$(MAKE) -C $@ -j $(MAKE_JOBS) install
build-gcc-linux-stage1: build-binutils-linux
rm -rf $@
mkdir $@
cd $@ && $(srcdir)/gcc-$(GCC_VERSION)/configure \
--target=riscv-linux \
--prefix=$(INSTALL_DIR) \
--enable-shared \
--disable-threads \
--enable-tls \
--enable-languages=c \
--with-newlib \
--disable-libmudflap \
--disable-libssp \
--disable-libquadmath \
--disable-libgomp \
--disable-nls \
--disable-multilib \
--disable-bootstrap
-$(MAKE) -C $@ -j $(MAKE_JOBS) inhibit-libc=true
$(MAKE) -C $@ -j $(MAKE_JOBS) install
build-glibc-linux: build-gcc-linux-stage1
rm -rf $@
mkdir $@
cd $@ && $(srcdir)/glibc-$(GLIBC_VERSION)/configure \
riscv-linux \
--target=riscv-linux \
--prefix=$(INSTALL_DIR)/riscv-linux \
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes \
--enable-shared \
--enable-__thread \
--disable-multilib \
--enable-add-ons=nptl \
--with-headers=$(LINUX_DIR)/include
$(MAKE) -C $@ -j $(MAKE_JOBS) cross-compiling=yes
$(MAKE) -C $@ -j $(MAKE_JOBS) install cross-compiling=yes
build-gcc-linux-stage2: build-glibc-linux
rm -rf $@
mkdir $@
cd $@ && $(srcdir)/gcc-$(GCC_VERSION)/configure \
--target=riscv-linux \
--prefix=$(INSTALL_DIR) \
--enable-shared \
--disable-threads \
--enable-tls \
--enable-languages=c,c++ \
--disable-libmudflap \
--disable-libssp \
--disable-libquadmath \
--disable-nls \
--disable-multilib \
--disable-bootstrap \
--with-headers=$(LINUX_DIR)/include
$(MAKE) -C $@ -j $(MAKE_JOBS)
$(MAKE) -C $@ -j $(MAKE_JOBS) install
clean:
rm -rf build-*
# the newlib and linux targets perform installation, so this does nothing
install: