From 28849ce257de28993e4786ed102a6f1f0433278e Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 18 Nov 2013 14:19:16 +0000 Subject: [PATCH] ext/rbconfig/sizeof: move to an extension library * common.mk, ext/rbconfig/sizeof: move RbConfig::SIZEOF to an extension library to get rid of annoying nmake VPATH rule. * inits.c (rb_call_inits), miniinit.c (Init_sizes): RbConfig::SIZEOF is no loger built-in. * template/sizes.c.tmpl (Init_sizeof): rename initialization function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- common.mk | 16 ++++++++-------- ext/rbconfig/sizeof/depend | 3 +++ ext/rbconfig/sizeof/extconf.rb | 2 ++ inits.c | 1 - miniinit.c | 6 ------ template/sizes.c.tmpl | 2 +- win32/Makefile.sub | 2 -- 7 files changed, 14 insertions(+), 18 deletions(-) create mode 100644 ext/rbconfig/sizeof/depend create mode 100644 ext/rbconfig/sizeof/extconf.rb diff --git a/common.mk b/common.mk index f8ab233d69..e94c4756ea 100644 --- a/common.mk +++ b/common.mk @@ -102,7 +102,6 @@ COMMONOBJS = array.$(OBJEXT) \ EXPORTOBJS = $(DLNOBJ) \ localeinit.$(OBJEXT) \ loadpath.$(OBJEXT) \ - sizes.$(OBJEXT) \ $(COMMONOBJS) OBJS = $(EXPORTOBJS) prelude.$(OBJEXT) @@ -881,10 +880,10 @@ INSNS2VMOPT = --srcdir="$(srcdir)" {$(VPATH)}vm.inc: $(srcdir)/template/vm.inc.tmpl -srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c {$(VPATH)}id.c {$(VPATH)}sizes.c srcs-ext srcs-enc +srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c {$(VPATH)}id.c srcs-ext srcs-enc EXT_SRCS = $(srcdir)/ext/ripper/ripper.c $(srcdir)/ext/json/parser/parser.c \ - $(srcdir)/ext/dl/callback/callback.c + $(srcdir)/ext/dl/callback/callback.c $(srcdir)/ext/rbconfig/sizeof/sizes.c srcs-ext: $(EXT_SRCS) @@ -908,11 +907,6 @@ id.c: $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.c.tmpl $(srcdir)/defs/ $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ \ $(srcdir)/template/id.c.tmpl -sizes.c: $(srcdir)/tool/generic_erb.rb $(srcdir)/template/sizes.c.tmpl $(srcdir)/configure.in - $(ECHO) generating $@ - $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ \ - $(srcdir)/template/sizes.c.tmpl $(srcdir)/configure.in - node_name.inc: {$(VPATH)}node.h $(ECHO) generating $@ $(Q) $(BASERUBY) -n $(srcdir)/tool/node_name.rb < $? > $@ @@ -978,6 +972,12 @@ $(srcdir)/ext/dl/callback/callback.c: $(srcdir)/ext/dl/callback/mkcallback.rb $( $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \ Q=$(Q) ECHO=$(ECHO) top_srcdir=../.. srcdir=. VPATH=../.. RUBY="$(BASERUBY)" +$(srcdir)/ext/rbconfig/sizeof/sizes.c: $(srcdir)/ext/rbconfig/sizeof/depend \ + $(srcdir)/tool/generic_erb.rb $(srcdir)/template/sizes.c.tmpl $(srcdir)/configure.in + $(ECHO) generating $@ + $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \ + Q=$(Q) ECHO=$(ECHO) top_srcdir=../../.. srcdir=. VPATH=../../.. RUBY="$(BASERUBY)" + ## run: fake miniruby$(EXEEXT) PHONY diff --git a/ext/rbconfig/sizeof/depend b/ext/rbconfig/sizeof/depend new file mode 100644 index 0000000000..360b3386d3 --- /dev/null +++ b/ext/rbconfig/sizeof/depend @@ -0,0 +1,3 @@ +sizes.c: $(top_srcdir)/tool/generic_erb.rb $(top_srcdir)/template/sizes.c.tmpl $(top_srcdir)/configure.in + $(Q) $(RUBY) $(top_srcdir)/tool/generic_erb.rb --output=$@ \ + $(top_srcdir)/template/sizes.c.tmpl $(top_srcdir)/configure.in diff --git a/ext/rbconfig/sizeof/extconf.rb b/ext/rbconfig/sizeof/extconf.rb new file mode 100644 index 0000000000..619b4256f8 --- /dev/null +++ b/ext/rbconfig/sizeof/extconf.rb @@ -0,0 +1,2 @@ +$srcs = %w[sizes.c] +create_makefile('rbconfig/sizeof') diff --git a/inits.c b/inits.c index f6611a010d..fe0aade090 100644 --- a/inits.c +++ b/inits.c @@ -61,6 +61,5 @@ rb_call_inits(void) CALL(Complex); CALL(version); CALL(vm_trace); - CALL(sizes); } #undef CALL diff --git a/miniinit.c b/miniinit.c index 6d285aea64..bc6138a774 100644 --- a/miniinit.c +++ b/miniinit.c @@ -28,9 +28,3 @@ Init_enc_set_filesystem_encoding(void) { return rb_enc_to_index(rb_default_external_encoding()); } - -/* sizes.c */ -void -Init_sizes(void) -{ -} diff --git a/template/sizes.c.tmpl b/template/sizes.c.tmpl index e47eadebb7..ac9964dd5b 100644 --- a/template/sizes.c.tmpl +++ b/template/sizes.c.tmpl @@ -12,7 +12,7 @@ conditions = { } %> void -Init_sizes(void) +Init_sizeof(void) { VALUE s = rb_hash_new(); rb_define_const(rb_define_module("RbConfig"), "SIZEOF", s); diff --git a/win32/Makefile.sub b/win32/Makefile.sub index cd41a3a5df..216fb9dcf3 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -1127,8 +1127,6 @@ probes.h: {$(VPATH)}probes.dmyh $(Q) $(CP) $(srcdir:/=\)\probes.dmyh $(OS_DEST_FILE)\ ) -{$(VPATH)}sizes.c: sizes.c - INSNS = opt_sc.inc optinsn.inc optunifs.inc insns.inc insns_info.inc \ vmtc.inc vm.inc