summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-21 15:42:10 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-21 15:42:10 +0000
commita36b7eea8a62142ebbbd1f64d3fe52b12c3affa1 (patch)
treed3e0374390eafd02408318b4a3e2813ddbef6b2e /lib
parentd0527b05d87cb62b50dc9757266caf1a3a830486 (diff)
* lib/mkmf.rb (create_makefile): accept pure ruby libraries.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb42
1 files changed, 24 insertions, 18 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 0dcd32bc56..e61a1e83e6 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -365,7 +365,7 @@ def message(*s)
end
def checking_for(m)
- f = caller[0][/in \`(.*)\'$/, 1] and f << ": "
+ f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim
m = "checking for #{m}... "
message m
Logging::message "#{f}#{m}\n"
@@ -579,7 +579,7 @@ ruby_version = #{Config::CONFIG['ruby_version']}
RUBY = #{$ruby}
RM = $(RUBY) -rftools -e "File::rm_f(*ARGV.map do|x|Dir[x]end.flatten.uniq)"
MAKEDIRS = $(RUBY) -r ftools -e 'File::makedirs(*ARGV)'
-INSTALL_PROG = $(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555, true)'
+INSTALL_PROG = $(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0755, true)'
INSTALL_DATA = $(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0644, true)'
#### End of system configuration section. ####
@@ -613,9 +613,23 @@ def create_makefile(target, srcprefix = nil)
srcprefix ||= '$(srcdir)'
Config::expand(srcdir = srcprefix.dup)
+ unless $objs then
+ $objs = []
+ for f in Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
+ $objs.push(File.basename(f, ".*") << "." << $OBJEXT)
+ end
+ else
+ for i in $objs
+ i.sub!(/\.o\z/, ".#{$OBJEXT}")
+ end
+ end
+ $objs = $objs.join(" ")
+
+ target = nil if $objs == ""
+
cleanfiles = []
distcleanfiles = []
- if EXPORT_PREFIX
+ if target and EXPORT_PREFIX
origdef = target + '.def'
deffile = EXPORT_PREFIX + origdef
unless File.exist? deffile
@@ -644,18 +658,7 @@ def create_makefile(target, srcprefix = nil)
libpath = libpathflag(libpath)
- unless $objs then
- $objs = []
- for f in Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
- $objs.push(File.basename(f, ".*") << "." << $OBJEXT)
- end
- else
- for i in $objs
- i.sub!(/\.o\z/, ".#{$OBJEXT}")
- end
- end
- $objs = $objs.join(" ")
-
+ dllib = target ? "$(TARGET).#{$static ? $LIBEXT : CONFIG['DLEXT']}" : ""
mfile = open("Makefile", "wb")
mfile.print configuration(srcdir)
mfile.print %{
@@ -670,7 +673,7 @@ LOCAL_LIBS = #{$LOCAL_LIBS}
LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS}
OBJS = #{$objs}
TARGET = #{target}
-DLLIB = $(TARGET).#{$static ? $LIBEXT : CONFIG['DLEXT']}
+DLLIB = #{dllib}
}
if $extmk
mfile.print %{
@@ -689,11 +692,11 @@ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
CLEANLIBS = "$(TARGET).{lib,exp,il?,tds,map}" $(DLLIB)
CLEANOBJS = "*.{#{$OBJEXT},#{$LIBEXT},s[ol],pdb,bak}"
-all: $(DLLIB)
+all: #{target ? "$(DLLIB)" : "Makefile"}
}
mfile.print CLEANINGS
dirs = []
- unless $static
+ if not $static and target
dirs << (dir = "$(RUBYARCHDIR)")
mfile.print("install: #{dir}\n")
f = "$(DLLIB)"
@@ -723,6 +726,8 @@ all: $(DLLIB)
mfile.print "\nsite-install: install\n\n"
+ return unless target
+
mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n"
mfile.print "\n"
@@ -763,6 +768,7 @@ all: $(DLLIB)
end
end
end
+ensure
mfile.close
end