-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.isp
58 lines (42 loc) · 1.42 KB
/
Makefile.isp
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
.PHONY: all
.PHONY: install
.PHONY: clean
.PHONY: rv32
.PHONY: rv64
.PHONY: multilib
ISP_PREFIX ?= $(HOME)/.local/isp/
MULTILIBS_GEN := \
rv32ima-ilp32-- \
rv64imafd-lp64d-- \
rv64imac-lp64--
all:
$(MAKE) -f Makefile.isp multilib
$(MAKE) -f Makefile.isp rv64linux
rv32: BUILD_DIR ?= build32
rv32: CONFIG_FLAGS = --prefix=$(ISP_PREFIX) --with-arch=rv32ima --with-abi=ilp32 --with-cmodel=medlow
rv64: BUILD_DIR ?= build64
rv64: CONFIG_FLAGS = --prefix=$(ISP_PREFIX) --with-arch=rv64imafd --with-abi=lp64d --with-cmodel=medany
rv64linux: BUILD_DIR ?= build64linux
rv64linux:CONFIG_FLAGS = --prefix=$(ISP_PREFIX) --enable-linux --with-arch=rv64imafd --with-abi=lp64d --with-cmodel=medany
multilib: BUILD_DIR ?= build-multilib
multilib: CONFIG_FLAGS = --prefix=$(ISP_PREFIX) --enable-multilib --with-cmodel=medany
install: BUILD_DIR ?= build-multilib
clean: BUILD_DIR ?= build-multilib
rv32: $(BUILD_DIR)/Makefile
$(MAKE) -C $(BUILD_DIR)
rv64: $(BUILD_DIR)/Makefile
$(MAKE) -C $(BUILD_DIR)
multilib: $(BUILD_DIR)/Makefile
cd riscv-gcc/gcc/config/riscv; \
mv t-elf-multilib t-elf-multilib.old; \
./multilib-generator $(MULTILIBS_GEN) > t-elf-multilib
$(MAKE) -C $(BUILD_DIR)
rv64linux: $(BUILD_DIR)/Makefile
$(MAKE) -C $(BUILD_DIR) linux
$(BUILD_DIR)/Makefile:
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR); ../configure $(CONFIG_FLAGS)
install:
$(MAKE) -C $(BUILD_DIR) install
clean:
$(RM) -r $(BUILD_DIR)