mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 09:33:59 +02:00
* common.mk (main): split from exts and makes main program after
building exts with miniruby, to get rid of overwriting running program. [ruby-core:22339] * Makefile.in, win32/Makefile.sub (RUNCMD, MKMAIN_CMD): macros to run script file. * ext/extmk.rb (parse_args): added --command-output option which creates script file to make main program. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6836882ac6
commit
cb7bc8db56
5 changed files with 59 additions and 5 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
Tue Feb 24 19:01:05 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* common.mk (main): split from exts and makes main program after
|
||||||
|
building exts with miniruby, to get rid of overwriting running
|
||||||
|
program. [ruby-core:22339]
|
||||||
|
|
||||||
|
* Makefile.in, win32/Makefile.sub (RUNCMD, MKMAIN_CMD): macros to
|
||||||
|
run script file.
|
||||||
|
|
||||||
|
* ext/extmk.rb (parse_args): added --command-output option which
|
||||||
|
creates script file to make main program.
|
||||||
|
|
||||||
Tue Feb 24 07:09:50 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Feb 24 07:09:50 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* regex.c (re_compile_pattern): \s should include \v too.
|
* regex.c (re_compile_pattern): \s should include \v too.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
NULLCMD = :
|
NULLCMD = :
|
||||||
|
RUNCMD = $(SHELL)
|
||||||
|
|
||||||
#### Start of system configuration section. ####
|
#### Start of system configuration section. ####
|
||||||
|
|
||||||
|
@ -93,6 +94,8 @@ OBJEXT = @OBJEXT@
|
||||||
MANTYPE = @MANTYPE@
|
MANTYPE = @MANTYPE@
|
||||||
|
|
||||||
INSTALLED_LIST= .installed.list
|
INSTALLED_LIST= .installed.list
|
||||||
|
|
||||||
|
MKMAIN_CMD = mkmain.sh
|
||||||
#### End of variables
|
#### End of variables
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
12
common.mk
12
common.mk
|
@ -80,8 +80,16 @@ TESTWORKDIR = testwork
|
||||||
|
|
||||||
VCS = svn
|
VCS = svn
|
||||||
|
|
||||||
all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
|
all: main
|
||||||
@$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(EXTMK_ARGS)
|
|
||||||
|
main: exts
|
||||||
|
@$(RUNCMD) $(MKMAIN_CMD) MAKE=$(MAKE)
|
||||||
|
|
||||||
|
exts: $(MKMAIN_CMD)
|
||||||
|
|
||||||
|
$(MKMAIN_CMD): $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
|
||||||
|
@$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --command-output=$@ $(EXTMK_ARGS)
|
||||||
|
|
||||||
prog: $(PROGRAM) $(WPROGRAM)
|
prog: $(PROGRAM) $(WPROGRAM)
|
||||||
|
|
||||||
miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(MINIOBJS) $(OBJS) $(DMYEXT)
|
miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(MINIOBJS) $(OBJS) $(DMYEXT)
|
||||||
|
|
34
ext/extmk.rb
34
ext/extmk.rb
|
@ -16,6 +16,7 @@ $extlibs = nil
|
||||||
$extpath = nil
|
$extpath = nil
|
||||||
$ignore = nil
|
$ignore = nil
|
||||||
$message = nil
|
$message = nil
|
||||||
|
$command_output = nil
|
||||||
|
|
||||||
$progname = $0
|
$progname = $0
|
||||||
alias $PROGRAM_NAME $0
|
alias $PROGRAM_NAME $0
|
||||||
|
@ -239,6 +240,7 @@ end
|
||||||
|
|
||||||
def parse_args()
|
def parse_args()
|
||||||
$mflags = []
|
$mflags = []
|
||||||
|
$makeflags = []
|
||||||
|
|
||||||
opts = nil
|
opts = nil
|
||||||
$optparser ||= OptionParser.new do |opts|
|
$optparser ||= OptionParser.new do |opts|
|
||||||
|
@ -268,11 +270,15 @@ def parse_args()
|
||||||
if arg = v.first
|
if arg = v.first
|
||||||
arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
|
arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
|
||||||
end
|
end
|
||||||
|
$makeflags.concat(v.reject {|arg| /\AMINIRUBY=/ =~ arg}.quote)
|
||||||
$mflags.concat(v)
|
$mflags.concat(v)
|
||||||
end
|
end
|
||||||
opts.on('--message [MESSAGE]', String) do |v|
|
opts.on('--message [MESSAGE]', String) do |v|
|
||||||
$message = v
|
$message = v
|
||||||
end
|
end
|
||||||
|
opts.on('--command-output=FILE', String) do |v|
|
||||||
|
$command_output = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
$optparser.parse!(ARGV)
|
$optparser.parse!(ARGV)
|
||||||
|
@ -528,6 +534,7 @@ void Init_ext _((void))\n{\n#$extinit}
|
||||||
puts conf
|
puts conf
|
||||||
$stdout.flush
|
$stdout.flush
|
||||||
$mflags.concat(conf)
|
$mflags.concat(conf)
|
||||||
|
$makeflags.concat(conf)
|
||||||
else
|
else
|
||||||
FileUtils.rm_f(extinit.to_a)
|
FileUtils.rm_f(extinit.to_a)
|
||||||
end
|
end
|
||||||
|
@ -544,9 +551,10 @@ Dir.chdir ".."
|
||||||
unless $destdir.to_s.empty?
|
unless $destdir.to_s.empty?
|
||||||
$mflags.defined?("DESTDIR") or $mflags << "DESTDIR=#{$destdir}"
|
$mflags.defined?("DESTDIR") or $mflags << "DESTDIR=#{$destdir}"
|
||||||
end
|
end
|
||||||
puts "making #{rubies.join(', ')}"
|
message = "making #{rubies.join(', ')}"
|
||||||
$stdout.flush
|
|
||||||
$mflags.concat(rubies)
|
$mflags.concat(rubies)
|
||||||
|
$makeflags.uniq!
|
||||||
|
$makeflags.concat(rubies)
|
||||||
|
|
||||||
if $nmake == ?b
|
if $nmake == ?b
|
||||||
unless (vars = $mflags.grep(/\A\w+=/n)).empty?
|
unless (vars = $mflags.grep(/\A\w+=/n)).empty?
|
||||||
|
@ -560,7 +568,27 @@ if $nmake == ?b
|
||||||
vars.each {|flag| flag.sub!(/\A/, "-D")}
|
vars.each {|flag| flag.sub!(/\A/, "-D")}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
system($make, *sysquote($mflags)) or exit($?.exitstatus)
|
if $command_output
|
||||||
|
message = "echo #{message}"
|
||||||
|
cmd = [$make, *sysquote($makeflags)].join(' ')
|
||||||
|
open($command_output, 'wb') do |f|
|
||||||
|
case $command_output
|
||||||
|
when /\.sh\z/
|
||||||
|
f.puts message, "rm -f $0; exec #{cmd}"
|
||||||
|
when /\.bat\z/
|
||||||
|
["@echo off", message, cmd, "del %0 & exit %ERRORLEVEL%"].each do |s|
|
||||||
|
f.print s, "\r\n"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
f.puts cmd
|
||||||
|
end
|
||||||
|
f.chmod(0755)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts message
|
||||||
|
$stdout.flush
|
||||||
|
system($make, *sysquote($mflags)) or exit($?.exitstatus)
|
||||||
|
end
|
||||||
|
|
||||||
#Local variables:
|
#Local variables:
|
||||||
# mode: ruby
|
# mode: ruby
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
SHELL = $(COMSPEC)
|
SHELL = $(COMSPEC)
|
||||||
|
RUNCMD = $(COMSPEC) /c
|
||||||
MKFILES = Makefile
|
MKFILES = Makefile
|
||||||
NULL = nul
|
NULL = nul
|
||||||
|
|
||||||
|
@ -237,6 +238,8 @@ ASMEXT = asm
|
||||||
|
|
||||||
INSTALLED_LIST= .installed.list
|
INSTALLED_LIST= .installed.list
|
||||||
|
|
||||||
|
MKMAIN_CMD = mkmain.bat
|
||||||
|
|
||||||
!if !defined(WINMAINOBJ)
|
!if !defined(WINMAINOBJ)
|
||||||
WINMAINOBJ = winmain.$(OBJEXT)
|
WINMAINOBJ = winmain.$(OBJEXT)
|
||||||
!endif
|
!endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue