From 20971799f26c6466f63ab179ce2d3384155b9760 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 8 Nov 2019 16:24:24 +0900 Subject: [PATCH] Renamed `load_*.inc` as `*.rbinc` to utilize a suffix rule --- ast.c | 2 +- common.mk | 30 ++++++++++++------------------ gc.c | 2 +- io.c | 2 +- tool/mk_builtin_loader.rb | 4 ++-- vm_trace.c | 2 +- 6 files changed, 18 insertions(+), 24 deletions(-) diff --git a/ast.c b/ast.c index 21ea11ed46..236560b094 100644 --- a/ast.c +++ b/ast.c @@ -681,7 +681,7 @@ ast_node_inspect(rb_execution_context_t *ec, VALUE self) return str; } -#include "load_ast.inc" +#include "ast.rbinc" void Init_ast(void) diff --git a/common.mk b/common.mk index 70416e9753..fcb0a91477 100644 --- a/common.mk +++ b/common.mk @@ -4,7 +4,7 @@ bin: $(PROGRAM) $(WPROGRAM) lib: $(LIBRUBY) dll: $(LIBRUBY_SO) -.SUFFIXES: .inc .h .c .y .i .$(ASMEXT) .$(DTRACE_EXT) +.SUFFIXES: .rbinc .rb .inc .h .c .y .i .$(ASMEXT) .$(DTRACE_EXT) # V=0 quiet, V=1 verbose. other values don't work. V = 0 @@ -614,7 +614,7 @@ clean-rubyspec: clean-spec distclean: distclean-ext distclean-enc distclean-golf distclean-docs distclean-extout distclean-local distclean-platform distclean-spec distclean-local:: clean-local - $(Q)$(RM) $(MKFILES) yasmdata.rb *.inc $(PRELUDES) + $(Q)$(RM) $(MKFILES) yasmdata.rb *.inc $(PRELUDES) *.rbinc $(Q)$(RM) config.cache config.status config.status.lineno $(Q)$(RM) *~ *.bak *.stackdump core *.core gmon.out $(PREP) -$(Q)$(RMALL) $(srcdir)/autom4te.cache @@ -1094,22 +1094,16 @@ preludes: {$(VPATH)}prelude.c preludes: {$(VPATH)}miniprelude.c preludes: {$(srcdir)}golf_prelude.c -BUILTIN_RB_SRCS = $(srcdir)/trace_point.rb $(srcdir)/ast.rb $(srcdir)/io.rb +BUILTIN_RB_SRCS = {$(VPATH)}trace_point.rb {$(VPATH)}ast.rb {$(VPATH)}io.rb +BUILTIN_RB_INCS = $(BUILTIN_RB_SRCS:.rb=.rbinc) + +.rb.rbinc: + $(Q) $(BASERUBY) $(srcdir)/tool/mk_builtin_loader.rb $< builtin_binary.inc: $(PREP) $(BUILTIN_RB_SRCS) $(srcdir)/tool/mk_builtin_binary.rb $(Q) $(MINIRUBY) $(srcdir)/tool/mk_builtin_binary.rb -load_trace_point.inc: $(srcdir)/trace_point.rb $(srcdir)/tool/mk_builtin_loader.rb - $(Q) $(BASERUBY) $(srcdir)/tool/mk_builtin_loader.rb $(srcdir)/trace_point.rb - -load_ast.inc: $(srcdir)/ast.rb $(srcdir)/tool/mk_builtin_loader.rb - $(Q) $(BASERUBY) $(srcdir)/tool/mk_builtin_loader.rb $(srcdir)/ast.rb - -load_io.inc: $(srcdir)/io.rb $(srcdir)/tool/mk_builtin_loader.rb - $(Q) $(BASERUBY) $(srcdir)/tool/mk_builtin_loader.rb $(srcdir)/io.rb - -load_gc.inc: $(srcdir)/gc.rb $(srcdir)/tool/mk_builtin_loader.rb - $(Q) $(BASERUBY) $(srcdir)/tool/mk_builtin_loader.rb $(srcdir)/gc.rb +$(BUILTIN_RB_INCS): $(top_srcdir)/tool/mk_builtin_loader.rb $(srcdir)/revision.h: $(Q)$(gnumake:yes=#) $(RM) $(@F) @@ -1598,7 +1592,7 @@ ast.$(OBJEXT): {$(VPATH)}id.h ast.$(OBJEXT): {$(VPATH)}intern.h ast.$(OBJEXT): {$(VPATH)}internal.h ast.$(OBJEXT): {$(VPATH)}iseq.h -ast.$(OBJEXT): {$(VPATH)}load_ast.inc +ast.$(OBJEXT): {$(VPATH)}ast.rbinc ast.$(OBJEXT): {$(VPATH)}method.h ast.$(OBJEXT): {$(VPATH)}missing.h ast.$(OBJEXT): {$(VPATH)}node.h @@ -2108,7 +2102,7 @@ gc.$(OBJEXT): {$(VPATH)}id_table.h gc.$(OBJEXT): {$(VPATH)}intern.h gc.$(OBJEXT): {$(VPATH)}internal.h gc.$(OBJEXT): {$(VPATH)}io.h -gc.$(OBJEXT): {$(VPATH)}load_gc.inc +gc.$(OBJEXT): {$(VPATH)}gc.rbinc gc.$(OBJEXT): {$(VPATH)}method.h gc.$(OBJEXT): {$(VPATH)}missing.h gc.$(OBJEXT): {$(VPATH)}mjit.h @@ -2236,7 +2230,7 @@ io.$(OBJEXT): {$(VPATH)}intern.h io.$(OBJEXT): {$(VPATH)}internal.h io.$(OBJEXT): {$(VPATH)}io.c io.$(OBJEXT): {$(VPATH)}io.h -io.$(OBJEXT): {$(VPATH)}load_io.inc +io.$(OBJEXT): {$(VPATH)}io.rbinc io.$(OBJEXT): {$(VPATH)}method.h io.$(OBJEXT): {$(VPATH)}missing.h io.$(OBJEXT): {$(VPATH)}node.h @@ -3419,7 +3413,7 @@ vm_trace.$(OBJEXT): {$(VPATH)}intern.h vm_trace.$(OBJEXT): {$(VPATH)}internal.h vm_trace.$(OBJEXT): {$(VPATH)}io.h vm_trace.$(OBJEXT): {$(VPATH)}iseq.h -vm_trace.$(OBJEXT): {$(VPATH)}load_trace_point.inc +vm_trace.$(OBJEXT): {$(VPATH)}trace_point.rbinc vm_trace.$(OBJEXT): {$(VPATH)}method.h vm_trace.$(OBJEXT): {$(VPATH)}missing.h vm_trace.$(OBJEXT): {$(VPATH)}mjit.h diff --git a/gc.c b/gc.c index 06d9fee5d0..7fd80a3607 100644 --- a/gc.c +++ b/gc.c @@ -11801,7 +11801,7 @@ rb_gcdebug_remove_stress_to_class(int argc, VALUE *argv, VALUE self) * See also GC.count, GC.malloc_allocated_size and GC.malloc_allocations */ -#include "load_gc.inc" +#include "gc.rbinc" void Init_GC(void) diff --git a/io.c b/io.c index ada3300645..5de39775db 100644 --- a/io.c +++ b/io.c @@ -13523,7 +13523,7 @@ Init_IO(void) sym_wait_writable = ID2SYM(rb_intern("wait_writable")); } -#include "load_io.inc" +#include "io.rbinc" void Init_IO_nonblock(void) diff --git a/tool/mk_builtin_loader.rb b/tool/mk_builtin_loader.rb index dafab79fd0..aa8e46d5c5 100644 --- a/tool/mk_builtin_loader.rb +++ b/tool/mk_builtin_loader.rb @@ -26,12 +26,12 @@ def collect_builtin iseq_ary, bs } end # ruby mk_builtin_loader.rb TARGET_FILE.rb -# #=> generate load_TARGET_FILE.inc +# #=> generate TARGET_FILE.rbinc # def mk_builtin_header file base = File.basename(file, '.rb') - ofile = File.join("load_#{base}.inc") + ofile = "#{base}.rbinc" collect_builtin(RubyVM::InstructionSequence.compile_file(file, false).to_a, bs = {}) diff --git a/vm_trace.c b/vm_trace.c index 1cb5fd0036..9a604814c6 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -1511,7 +1511,7 @@ tracepoint_stat_s(rb_execution_context_t *ec, VALUE self) return stat; } -#include "load_trace_point.inc" +#include "trace_point.rbinc" /* This function is called from inits.c */ void