Skip to content

Commit

Permalink
ext/rbconfig/sizeof: move to an extension library
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nobu committed Nov 18, 2013
1 parent 3403900 commit 28849ce
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 18 deletions.
16 changes: 8 additions & 8 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ COMMONOBJS = array.$(OBJEXT) \
EXPORTOBJS = $(DLNOBJ) \
localeinit.$(OBJEXT) \
loadpath.$(OBJEXT) \
sizes.$(OBJEXT) \
$(COMMONOBJS)

OBJS = $(EXPORTOBJS) prelude.$(OBJEXT)
Expand Down Expand Up @@ -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)

Expand All @@ -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 < $? > $@
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ext/rbconfig/sizeof/depend
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions ext/rbconfig/sizeof/extconf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$srcs = %w[sizes.c]
create_makefile('rbconfig/sizeof')
1 change: 0 additions & 1 deletion inits.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,5 @@ rb_call_inits(void)
CALL(Complex);
CALL(version);
CALL(vm_trace);
CALL(sizes);
}
#undef CALL
6 changes: 0 additions & 6 deletions miniinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
2 changes: 1 addition & 1 deletion template/sizes.c.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions win32/Makefile.sub
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 28849ce

Please sign in to comment.