Skip to content

Commit ab4bb44

Browse files
committed
BENCHRUBY more controllable from Makefile
`make benchmark` stuff moved from common.mk to Makefile.in to separate windows specific configurations. Since cmd.exe does not support command-line substitution, utilize ruby.exe's argv wildcard expansion. Since nmake holds command name macros using backslash path separators, properly convert them to avoid confusing the benchmark driver.
1 parent 60cf859 commit ab4bb44

4 files changed

Lines changed: 38 additions & 9 deletions

File tree

common.mk

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,18 +1385,11 @@ bisect: PHONY
13851385
bisect-ruby: PHONY
13861386
$(tooldir)/bisect.sh ruby $(srcdir)
13871387

1388-
COMPARE_RUBY = $(BASERUBY)
1389-
BENCH_RUBY = $(RUNRUBY)
1390-
BENCH_OPTS = --output=markdown --output-compare -v
1391-
ITEM =
1392-
ARGS = $$(find $(srcdir)/benchmark -maxdepth 1 -name '$(ITEM)' -o -name '*$(ITEM)*.yml' -o -name '*$(ITEM)*.rb' | sort)
1393-
OPTS =
1394-
13951388
# See benchmark/README.md for details.
13961389
benchmark: miniruby$(EXEEXT) update-benchmark-driver PHONY
13971390
$(BASERUBY) -rrubygems -I$(srcdir)/benchmark/lib $(srcdir)/benchmark/benchmark-driver/exe/benchmark-driver \
1398-
--executables="compare-ruby::$(COMPARE_RUBY) -I$(EXTOUT)/common --disable-gem" \
1399-
--executables="built-ruby::$(BENCH_RUBY) --disable-gem" \
1391+
--executables="compare-ruby::$(compare_ruby) -I$(EXTOUT)/common --disable-gem" \
1392+
--executables="built-ruby::$(bench_ruby) --disable-gem" \
14001393
$(BENCH_OPTS) $(ARGS) $(OPTS)
14011394

14021395
run.gdb:

cygwin/GNUmakefile.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ endif
4343

4444
WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT)
4545

46+
ifeq ($(target_os),mingw32)
47+
compare_ruby := $$(shell cygpath -ma $(firstword $(compare_ruby))) $(wordlist 2, $(words $(compare_ruby)), $(compare_ruby))
48+
endif
49+
4650
include $(srcdir)/template/GNUmakefile.in
4751

4852
SOLIBS := $(DLL_BASE_NAME).res.$(OBJEXT) $(SOLIBS)

template/Makefile.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,16 @@ COROUTINE_H = @X_COROUTINE_H@
182182
COROUTINE_OBJ = $(COROUTINE_H:.h=.$(OBJEXT))
183183
COROUTINE_SRC = @X_COROUTINE_SRC@
184184

185+
COMPARE_RUBY = $(BASERUBY)
186+
BENCH_RUBY = $(RUNRUBY)
187+
BENCH_OPTS = --output=markdown --output-compare -v
188+
ITEM =
189+
ARGS = $$(find $(srcdir)/benchmark -maxdepth 1 -name '$(ITEM)' -o -name '*$(ITEM)*.yml' -o -name '*$(ITEM)*.rb' | sort)
190+
OPTS =
191+
192+
compare_ruby = $(COMPARE_RUBY)
193+
bench_ruby = $(BENCH_RUBY)
194+
185195
#### End of system configuration section. ####
186196

187197
MAJOR= @MAJOR@

win32/Makefile.sub

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,28 @@ STACK = $(STACK),$(STACK_COMMIT)
409409
!endif
410410
ORGLIBPATH = $(LIB)
411411

412+
# benchmark related
413+
COMPARE_RUBY = $(BASERUBY)
414+
BENCH_RUBY = $(RUNRUBY)
415+
BENCH_OPTS = --output=markdown --output-compare -v
416+
!ifdef ITEM
417+
!if exist("$(srcdir)/benchmark/$(ITEM)")
418+
ARGS = $(ARGS) "$(srcdir)/benchmark/$(ITEM)"
419+
!endif
420+
!if [dir /B "$(srcdir:/=\)\benchmark\*$(ITEM:/=\)*.yml" >NUL 2>&1] == 0
421+
ARGS = $(ARGS) "$(srcdir)/benchmark/*$(ITEM)*.yml"
422+
!endif
423+
!if [dir /B "$(srcdir:/=\)\benchmark\*$(ITEM:/=\)*.rb" >NUL 2>&1] == 0
424+
ARGS = $(ARGS) "$(srcdir)/benchmark/*$(ITEM)*.rb"
425+
!endif
426+
!else
427+
ARGS = "$(srcdir)/benchmark/*.yml" "$(srcdir)/benchmark/*.rb"
428+
!endif
429+
OPTS =
430+
431+
compare_ruby = $(COMPARE_RUBY:\=/)
432+
bench_ruby = $(BENCH_RUBY:\=/)
433+
412434
#### End of system configuration section. ####
413435

414436
LIBRUBY_A = $(RUBY_SO_NAME)-static.lib

0 commit comments

Comments
 (0)