1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- MAKEFLAGS += -R -r
- CROSS = riscv32-unknown-elf-
- prefix := $(CURDIR)
- target_flags = -fvisibility=hidden -fno-pic -mshorten-memrefs \
- -frename-registers -mdiv -mno-strict-align \
- -ffunction-sections -fdata-sections
- tooldir = riscv-gnu-toolchain
- config = --prefix=$(prefix)/gnu \
- --with-arch=rv32imc --with-abi=ilp32 \
- --with-target-cflags='$(target_flags)' \
- --with-target-cxxflags='$(target_flags)' \
- --with-system-zlib \
- --disable-gdb \
- --enable-multilib --with-multilib-generator='rv32imc-ilp32--'
- _tail = $(wordlist 2,$(words $(1)),$(1))
- _strip_flags = $(if $(1),$(call _strip_flags,$(call _tail,$(1)),$(subst $(word 1,$(1)),,$(2))),$(2))
- strip_flags = $(if $(findstring -,$(word 1,$(2))),$(2),$(call _strip_flags,$(1),$(word 1,$(2))) $(call _tail,$(2)))
- RMAKE = $(MAKE) MAKEFLAGS='$(call strip_flags,r R,$(MAKEFLAGS))'
- export target_configargs := --enable-lite-exit --disable-newlib-register-fini
- export PATH := $(prefix)/gnu/bin:$(PATH)
- all: gnu
- clean:
- rm -rf gnu *.build
- .PHONY: gnu
- gnu:
- [ ! -f ../../.gitmodules ] || \
- git submodule update --init --recursive
- mkdir -p gnu.build
- cd gnu.build && ../$(tooldir)/configure $(config)
- $(RMAKE) -C gnu.build build-binutils
- $(RMAKE) -C gnu.build newlib
|