Skip to content

Commit f13c541

Browse files
committed
Enable the preservation of configuration items
This commit allows configuring the items in advance by executing "make config" and specifying them in a configuration file. Subsequently, run "make" according to the provided configurations. e.g., $ make config ENABLE_SDL=0 $ make
1 parent e2a60b8 commit f13c541

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ include mk/toolchain.mk
44
OUT ?= build
55
BIN := $(OUT)/rv32emu
66

7+
-include $(OUT)/.config
8+
79
CFLAGS = -std=gnu99 -O2 -Wall -Wextra
810
CFLAGS += -Wno-unused-label
911
CFLAGS += -include src/common.h
@@ -120,6 +122,10 @@ $(BIN): $(OBJS)
120122
$(VECHO) " LD\t$@\n"
121123
$(Q)$(CC) -o $@ $^ $(LDFLAGS)
122124

125+
config:
126+
$(Q)echo "$(CFLAGS)" | xargs -n1 | sort | sed -n 's/^RV32_FEATURE/ENABLE/p' > $(OUT)/.config
127+
$(VECHO) "Check the file $(OUT)/.config for configured items.\n"
128+
123129
# Tools
124130
include mk/tools.mk
125131
tool: $(TOOLS_BIN)
@@ -176,5 +182,6 @@ distclean: clean
176182
$(RM) -r $(OUT)/id1
177183
$(RM) *.zip
178184
$(RM) -r $(OUT)/mini-gdbstub
185+
-$(RM) $(OUT)/.config
179186

180187
-include $(deps)

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ The usage and limitations of Doom and Quake demo are listed in [docs/demo.md](do
8080

8181
e.g., run `make ENABLE_EXT_F=0` for the build without floating-point support.
8282

83+
Alternatively, configure the above items in advance by executing `make config` and
84+
specifying them in a configuration file. Subsequently, run `make` according to the provided
85+
configurations. For example, employ the following commands:
86+
```shell
87+
$ make config ENABLE_SDL=0
88+
$ make
89+
```
90+
8391
### RISCOF
8492

8593
[RISCOF](https://github.com/riscv-software-src/riscof) (RISC-V Compatibility Framework) is

0 commit comments

Comments
 (0)