--- a/gtk/Makefile.am	2014-02-01 11:34:44.000000000 +0400
+++ b/gtk/Makefile.am	2014-02-22 23:24:13.645800000 +0400
@@ -35,7 +35,7 @@
 pkginclude_HEADERS = pygtk.h
 
 # linker flags
-common_ldflags = -module -avoid-version
+common_ldflags = -module -avoid-version $(PYTHON_LIBS) -shrext $(PYTHON_SO)
 if PLATFORM_WIN32
 common_ldflags += -no-undefined
 endif
@@ -310,8 +310,8 @@
 	@:
 
 
-all: $(pygtkexec_LTLIBRARIES:.la=.so) $(pkgpyexec_LTLIBRARIES:.la=.so)
+all: $(pygtkexec_LTLIBRARIES:.la=$(PYTHON_SO)) $(pkgpyexec_LTLIBRARIES:.la=$(PYTHON_SO))
 clean-local:
-	rm -f $(pygtkexec_LTLIBRARIES:.la=.so) $(pkgpyexec_LTLIBRARIES:.la=.so)
-.la.so:
-	$(LN_S) .libs/$@ $@ || true
+	rm -f $(pygtkexec_LTLIBRARIES:.la=$(PYTHON_SO)) $(pkgpyexec_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
+	$(LN_S) -f .libs/$@ $@
--- a/Makefile.am	2014-02-01 11:34:44.000000000 +0400
+++ b/Makefile.am	2014-02-22 23:24:13.645800000 +0400
@@ -56,7 +56,7 @@
 pkgpyexec_LTLIBRARIES =
 
 # linker flags
-common_ldflags = -module -avoid-version
+common_ldflags = -module -avoid-version $(PYTHON_LIBS) -shrext $(PYTHON_SO)
 if PLATFORM_WIN32
 common_ldflags += -no-undefined
 endif
@@ -173,8 +173,8 @@
 	fi
 
 
-all: $(pkgpyexec_LTLIBRARIES:.la=.so)
+all: $(pkgpyexec_LTLIBRARIES:.la=$(PYTHON_SO))
 clean-local:
-	rm -f $(pkgpyexec_LTLIBRARIES:.la=.so)
-.la.so:
-	$(LN_S) .libs/$@ $@ || true
+	rm -f $(pkgpyexec_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
+	$(LN_S) -f .libs/$@ $@
