summaryrefslogtreecommitdiff
path: root/ext/extmk.rb.nt
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1997-12-09 17:54:56 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:33 +0900
commit66541bbb3630a5c512f8012c52ae777ab83beba5 (patch)
treebe1431b56b485de6cb1da065bb2161551872820d /ext/extmk.rb.nt
parentfb0fe24512d1796f794306768ddac37566e9a209 (diff)
version 1.0-971209v1_0_971209
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-1.0-971209.tar.gz Tue Dec 9 17:54:56 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * version 1.0-971209 * sample/ruby-mode.el (ruby-expr-beg): forgot to handle modifiers. * parse.y (tokadd): token buffer overrun.
Diffstat (limited to 'ext/extmk.rb.nt')
-rw-r--r--ext/extmk.rb.nt74
1 files changed, 59 insertions, 15 deletions
diff --git a/ext/extmk.rb.nt b/ext/extmk.rb.nt
index 33f676a..04b9e40 100644
--- a/ext/extmk.rb.nt
+++ b/ext/extmk.rb.nt
@@ -18,6 +18,8 @@ $lib_cache = {}
$func_cache = {}
$hdr_cache = {}
+$dllopt = '-MD'
+
if File.exist?("config.cache") then
f = open("config.cache", "r")
while f.gets
@@ -47,7 +49,7 @@ def older(file1, file2)
end
LINK = "cl -o conftest -I../.. -Zi -O -I. %s %s conftest.c %s > nul"
-CPP = "cl -E -I../.. -Zi -O -I. %s conftest.c > nul"
+CPP = "cl -E -I../.. -I../../missing -I. -Zi -O %s conftest.c > nul"
def try_link(libs)
system(format(LINK, $CFLAGS, $LDFLAGS, libs))
@@ -201,10 +203,18 @@ VPATH = .
CC = cl
-CFLAGS = %s -I../.. -Zi -O -I. -DNT -MD #$CFLAGS %s
+CFLAGS = %s -I../.. -I../../missing -I. -O -DNT %s #$CFLAGS %s
+
+RUBYLIB = ../../ruby.lib
DLDFLAGS = /DLL
LDSHARED =
-", if $static then "" else "-fpic" end, $defs.join(" ")
+", if $static then "" else "-fpic" end, $dllopt, $defs.join(" ")
+
+ if $force_static
+ print "static\n"
+ else
+ print "non static\n"
+ end
mfile.printf "\
@@ -231,6 +241,8 @@ TARGET = %s.%s
INSTALL = %sginstall -c
+DEFFILE = %s.def
+
all: $(TARGET)
clean:; @rm -f *.obj *.lib *.exp *.pdb *.bak
@@ -238,7 +250,7 @@ clean:; @rm -f *.obj *.lib *.exp *.pdb *.bak
realclean: clean
", target,
- if $static then "obj" else "obj" end, dots
+ if $force_static then "lib" else "dll" end, dots, target
if !$static
mfile.printf "\
@@ -256,18 +268,19 @@ install:;
"
end
- if !$static && "obj" != "obj"
+ if $force_static
mfile.printf "\
$(TARGET): $(OBJS)
- $(LDSHARED) $(DLDFLAGS) -o $(TARGET) $(OBJS) $(LOCAL_LIBS) $(LIBS)
-"
- elsif not File.exist?(target + ".c")
- mfile.printf "\
-$(TARGET): $(OBJS)
-# ld $(DLDFLAGS) -r -o $(TARGET) $(OBJS)
- cl -c $(OBJS)
lib /OUT:$(TARGET) $(OBJS)
"
+ else
+ mfile.printf "\
+$(DEFFILE):
+ echo $(DEFFILE)
+
+$(TARGET): $(OBJS) $(DEFFILE)
+ cl -DLL -o$(TARGET) $(OBJS) $(RUBYLIB) -link /DEF:$(DEFFILE)
+"
end
if File.exist?("depend")
@@ -318,6 +331,11 @@ def extmake(target)
if File.exist?("./Makefile")
if $install
system "nmake install"
+ if File.directory? "./lib"
+ for i in Dir["./lib/*.rb"]
+ system "ginstall -c #{i} /usr/local/lib/ruby/i386-mswin32"
+ end
+ end
elsif $clean
system "nmake clean"
else
@@ -386,15 +404,17 @@ if $extlist.size > 0
#for s,t in $extlist
for s,t in $static_ext
#f = format("%s/%s.obj", s, t)
- f = format("%s/%s.obj", s, s)
+ #f = format("%s/%s.obj", s, s)
+ l = format("%s/%s.lib", s, s)
#print format("%s/%s.obj\n", s, s) ##debug print##
- if File.exist?(f)
+ if File.exist?(l)
$extinit += format("\
\tInit_%s();\n\
\trb_provide(\"%s.o\");\n\
", s, s)
$extobjs += "ext/"
- $extobjs += f
+ #$extobjs += f # *.obj
+ $extobjs += l # *.lib
$extobjs += " "
else
FALSE
@@ -431,6 +451,30 @@ else
end
end
+#template of .def file.
+#LIBRARY kconv.dll
+#CODE LOADONCALL
+#DATA LOADONCALL
+#DESCRIPTION 'win32 kconv.dll'
+#EXPORTS
+#
+# Init_kconv
+def makedef(basename)
+ defname = sprintf("%s.def", basename)
+ f = open(defname, "w")
+ f.printf "\
+LIBRARY %s.dll
+CODE LOADONCALL
+DATA LOADONCALL
+DESCRIPTION 'win32 %s.dll'
+EXPORTS
+
+ Init_%s
+", basename, basename
+ f.close
+
+end
+
#Local variables:
# mode: ruby
#end: