2015-12-16 00:31:54 -05:00
|
|
|
# frozen_string_literal: false
|
2012-04-17 10:21:18 -04:00
|
|
|
if $mingw or $mswin
|
2015-01-05 10:14:48 -05:00
|
|
|
dlntestlib = "dlntest.#{$LIBEXT}"
|
|
|
|
$LOCAL_LIBS << " #{dlntestlib}"
|
|
|
|
$srcs = ["dlntest.c"]
|
2012-04-17 00:11:17 -04:00
|
|
|
$objs = ["dlntest.o"]
|
2016-09-22 02:35:27 -04:00
|
|
|
testdll = "dlntest.dll"
|
2012-04-28 10:22:25 -04:00
|
|
|
$cleanfiles << testdll
|
2013-04-05 03:46:29 -04:00
|
|
|
$cleanfiles << "dlntest.#{$LIBEXT}"
|
2012-04-17 01:12:53 -04:00
|
|
|
config_string('cleanobjs') {|t| $cleanfiles.concat(t.gsub(/\$\*/, 'dlntest').split)}
|
2012-04-17 00:11:17 -04:00
|
|
|
|
2015-01-05 10:14:48 -05:00
|
|
|
create_makefile("-test-/win32/dln") do |m|
|
|
|
|
m << "\n""DLNTESTLIB = #{dlntestlib}\n"
|
2012-04-17 10:21:18 -04:00
|
|
|
if $mingw
|
2015-01-05 10:14:48 -05:00
|
|
|
m << "\n"
|
2016-09-22 02:35:27 -04:00
|
|
|
m << "dlntest.dll: DEFFILE := $(srcdir)/libdlntest.def\n"
|
|
|
|
m << "dlntest.dll: DLDFLAGS += -Wl,--out-implib,$(DLNTESTLIB)\n"
|
2012-04-17 10:21:18 -04:00
|
|
|
end
|
2015-01-05 10:14:48 -05:00
|
|
|
m
|
|
|
|
end
|
|
|
|
m = File.read("Makefile")
|
|
|
|
m.sub!(/(.*)\$\(DLNTEST_LDSHARED\)$/) do
|
|
|
|
pre = $1
|
|
|
|
link_so = LINK_SO.gsub(/^/) {pre}
|
2012-04-17 00:11:17 -04:00
|
|
|
link_so.sub!(/\$\(LOCAL_LIBS\)/, '')
|
|
|
|
link_so.gsub!(/-\$\(arch\)/, '')
|
|
|
|
link_so.gsub!(/:.so=/, ':.dll=')
|
|
|
|
link_so.sub!(/\$\(OBJS\)/, "libdlntest.#{$OBJEXT}")
|
|
|
|
link_so.sub!(/\$\(DEFFILE\)/, "$(srcdir)/libdlntest.def")
|
2015-01-05 10:14:48 -05:00
|
|
|
link_so
|
|
|
|
end and File.binwrite("Makefile", m)
|
|
|
|
FileUtils.rm_f(RbConfig.expand(testdll.dup))
|
2012-04-17 00:11:17 -04:00
|
|
|
end
|