summaryrefslogtreecommitdiffstats
path: root/instruby.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-26 08:56:01 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-26 08:56:01 +0000
commit9a6862f9fbb929e17c1f37ece839f78c43149a29 (patch)
treea6498b784d9baecd4be08c6da35705c2725942bb /instruby.rb
parente8b5dcdab845e173121f2fce76bcc60adf253e8e (diff)
downloadruby-9a6862f9fbb929e17c1f37ece839f78c43149a29.tar.gz
ruby-9a6862f9fbb929e17c1f37ece839f78c43149a29.tar.xz
ruby-9a6862f9fbb929e17c1f37ece839f78c43149a29.zip
* instruby.rb (parse_args), ext/extmk.rb (parse_args): Detect -n
and emulate a dry run. Use 'make' in case no --make argument is given. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'instruby.rb')
-rw-r--r--instruby.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/instruby.rb b/instruby.rb
index 7833076f6..e69ec072c 100644
--- a/instruby.rb
+++ b/instruby.rb
@@ -18,7 +18,7 @@ def parse_args()
$dryrun = $OPT['n']
$destdir = $OPT['dest-dir'] || ''
- $make = $OPT['make'] || $make
+ $make = $OPT['make'] || $make || 'make'
make_flags = ($OPT['make-flags'] || '').strip
mflags = ($OPT['mflags'] || '').strip
$mantype = $OPT["mantype"]
@@ -34,14 +34,24 @@ def parse_args()
$make, *rest = Shellwords.shellwords($make)
$mflags.unshift(*rest) unless rest.empty?
- $mflags << '-n' if $dryrun
+ def $mflags.set?(flag)
+ # Only nmake puts flags together
+ if $nmake == ?m
+ grep(/^-(?!-).*#{'%c' % flag}/i) { return true }
+ else
+ include?('-%c' % flag)
+ end
+ end
+
+ if $mflags.set?(?n)
+ $dryrun = true
+ else
+ $mflags << '-n' if $dryrun
+ end
$mflags << "DESTDIR=#{$destdir}"
- # Most make implementations put each flag separated in MAKEFLAGS, so
- # we can just search with exact match. Only nmake puts flags
- # together, but nmake does not propagate -k via MAKEFLAGS anyway.
- $continue = $mflags.include?('-k')
+ $continue = $mflags.set?(?k)
end
parse_args()