@@ -29,10 +29,29 @@ endif
29
29
endif
30
30
31
31
32
- SHLIB_LINK =$(TCL_LIB_SPEC )
33
32
ifneq ($(PORTNAME ) , win32)
34
- SHLIB_LINK +=$(TCL_LIBS ) -lc
35
- endif
33
+
34
+ SHLIB_LINK =$(TCL_LIB_SPEC ) $(TCL_LIBS ) -lc
35
+
36
+ else # win32
37
+
38
+ # Tcl on win32 ships with import libraries only for Microsoft Visual C++,
39
+ # which are not compatible with mingw gcc. Therefore we need to build a
40
+ # new import library to link with.
41
+
42
+ tclwithver =$(subst -l,,$(filter -l% ,$(TCL_LIB_SPEC ) ) )
43
+ TCLDLL =$(subst -L,,$(filter -L% ,$(TCL_LIB_SPEC ) ) ) /$(tclwithver ) .dll
44
+
45
+ OBJS += lib$(tclwithver ) .a
46
+
47
+ lib$(tclwithver ) .a :$(tclwithver ) .def
48
+ dlltool --dllname$(tclwithver ) .dll --def$(tclwithver ) .def --output-lib lib$(tclwithver ) .a
49
+
50
+ $(tclwithver ) .def :$(TCLDLL )
51
+ pexports$^ > $@
52
+
53
+ endif # win32
54
+
36
55
37
56
NAME = pltcl
38
57
@@ -96,4 +115,7 @@ endif # TCL_SHARED_BUILD = 0
96
115
clean distclean maintainer-clean : clean-lib
97
116
rm -f$(OBJS )
98
117
rm -rf$(pg_regress_clean_files )
118
+ ifeq ($(PORTNAME ) , win32)
119
+ rm -f $(tclwithver).def
120
+ endif
99
121
$(MAKE) -C modules $@