-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (48 loc) · 2.29 KB
/
Makefile
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
.PHONY: help
help:
@echo ' '
@echo 'Makefile for riscv doc '
@echo ' '
@echo 'Usage: '
@echo ' make help show help '
@echo ' '
@echo ' make git-clone clone source '
@echo ' make builder builder image '
@echo ' make build-tool-chain tool chain image '
@echo ' make build build all '
@echo ' '
@echo ' '
BUILDER := mingz2013/riscv-gnu-toolchain-builder
TOOL := mingz2013/riscv-gnu-toolchain
BASEDIR=$(CURDIR)
RISCV := $(BASEDIR)/bin/riscv
RISCV-SRC := $(BASEDIR)/src/riscv-gnu-toolchain
RISCV-IN := /opt/riscv
RISCV-SRC-IN := /riscv-gnu-toolchain
RISCV-BUILD-DIR = $(RISCV-SRC)/build
DOCKER-BUILDER-RUN := docker run --rm -i -t -v${RISCV}:${RISCV-IN} -v${RISCV-SRC}:${RISCV-SRC-IN} ${BUILDER}
.PHONY: git-clone
git-clone:
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain ${RISCV-SRC}
#git clone https://github.com/riscv/riscv-gnu-toolchain ${RISCV-SRC}
#cd ${RISCV-SRC} && git submodule update --init --recursive
.PHONY: builder
builder:
docker build ./builder -t ${BUILDER}
docker push ${BUILDER}
.PHONY: build-make-multilib
build-make-multilib:
${DOCKER-BUILDER-RUN} ${RISCV-SRC-IN}/configure --prefix=${RISCV-IN} --enable-multilib
${DOCKER-BUILDER-RUN} make
${DOCKER-BUILDER-RUN} make linux
#${DOCKER-BUILDER-RUN} make report-newlib
#rm -r ${RISCV-BUILD-DIR}
.PHONY: tool-chain
tool-chain:
docker build ./bin -t ${TOOL}
docker push ${TOOL}
.PHONY: build-hello
build-hello:
docker run --rm -v $(BASEDIR)/app:/app -w /app ${TOOL} /riscv/bin/riscv64-unknown-elf-gcc -o hello hello.c
.PHONY: build
build: git-clone builder build-make-multilib tool-chain build-hello