aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTsukasa OI <research_trasio@irq.a4lg.com>2021-12-16 01:59:00 +0900
committerTsukasa OI <research_trasio@irq.a4lg.com>2021-12-16 02:14:40 +0900
commitcfbb07ab4a9ff5f2a6502fd2c061df9ac0bd103f (patch)
tree20aeed7ae2e7e19d27f5a98f408a8ef7e39cab2b /Makefile
parent922aa58a5f5cb5008db236d9c21375a27197a038 (diff)
downloadriscv-opcodes-cfbb07ab4a9ff5f2a6502fd2c061df9ac0bd103f.zip
riscv-opcodes-cfbb07ab4a9ff5f2a6502fd2c061df9ac0bd103f.tar.gz
riscv-opcodes-cfbb07ab4a9ff5f2a6502fd2c061df9ac0bd103f.tar.bz2
Make intermediate header file
Instead of making (and depending on) multiple header files in external repositories, this commit makes single intermediate file and copies it to external directories on install. This will... * Reduce CPU time (only slightly, though). * Enable making header file *without* cloning and destroying external repositories (`make encoding.out.h`). * Ensure that latest encoding.h is generated and copied on install, even after fresh checkout on an external source tree.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 481a274..693ae05 100644
--- a/Makefile
+++ b/Makefile
@@ -4,17 +4,19 @@ ISASIM_H := ../riscv-isa-sim/riscv/encoding.h
PK_H := ../riscv-pk/machine/encoding.h
ENV_H := ../riscv-tests/env/encoding.h
OPENOCD_H := ../riscv-openocd/src/target/riscv/encoding.h
+INSTALL_HEADER_FILES := $(ISASIM_H) $(PK_H) $(ENV_H) $(OPENOCD_H)
ALL_REAL_ILEN32_OPCODES := opcodes-rv32i opcodes-rv64i opcodes-rv32m opcodes-rv64m opcodes-rv32a opcodes-rv64a opcodes-rv32h opcodes-rv64h opcodes-rv32f opcodes-rv64f opcodes-rv32d opcodes-rv64d opcodes-rv32q opcodes-rv64q opcodes-rv32b opcodes-rv64b opcodes-system opcodes-svinval opcodes-rv32zfh opcodes-rv32d-zfh opcodes-rv32q-zfh opcodes-rv64zfh opcodes-rvk opcodes-rv32k opcodes-rv64k opcodes-zicbo
ALL_REAL_OPCODES := $(ALL_REAL_ILEN32_OPCODES) opcodes-rvc opcodes-rv32c opcodes-rv64c opcodes-custom opcodes-rvv opcodes-rvp
ALL_OPCODES := opcodes-pseudo $(ALL_REAL_OPCODES) opcodes-rvv-pseudo
-install: $(ISASIM_H) $(PK_H) $(ENV_H) $(OPENOCD_H) inst.chisel instr-table.tex priv-instr-table.tex
+install: encoding.out.h inst.chisel instr-table.tex priv-instr-table.tex
+ set -e; for FILE in $(INSTALL_HEADER_FILES); do cp -f encoding.out.h $$FILE; done
-$(ISASIM_H) $(PK_H) $(ENV_H) $(OPENOCD_H): $(ALL_OPCODES) parse_opcodes encoding.h
+encoding.out.h: $(ALL_OPCODES) parse_opcodes encoding.h
echo "/*" > $@
- echo " * This file is auto-generated by running 'make $@' in" >> $@
+ echo " * This file is auto-generated by running make in" >> $@
echo " * https://github.com/riscv/riscv-opcodes (`git log -1 --format="format:%h"`)" >> $@
echo " */" >> $@
echo >> $@