Fix non-portable sed commands generating insn_list.h
authorAlbert Ou <aou@eecs.berkeley.edu>
Fri, 11 Sep 2015 00:01:59 +0000 (17:01 -0700)
committerAlbert Ou <aou@eecs.berkeley.edu>
Fri, 11 Sep 2015 00:01:59 +0000 (17:01 -0700)
riscv/riscv.mk.in

index f35f200c18ae41ccee84cbea6b6199645d86464b..6ddba1d659f0f5c4273e662c143a64180d6c8f81 100644 (file)
@@ -251,7 +251,9 @@ icache.h: mmu.h
        mv $@.tmp $@
 
 insn_list.h: $(src_dir)/riscv/riscv.mk.in
-       echo $(riscv_insn_list) | sed 's/\s\+\|$$/\n/g' | sed '/^$$/d' | sed 's/\./_/g' | sed 's/\(.*\)/DEFINE_INSN(\1)/' > $@.tmp
+       for insn in $(foreach insn,$(riscv_insn_list),$(subst .,_,$(insn))) ; do \
+               printf 'DEFINE_INSN(%s)\n' "$${insn}" ; \
+       done > $@.tmp
        mv $@.tmp $@
 
 $(riscv_gen_srcs): %.cc: insns/%.h insn_template.cc