about summary refs log tree commit diff
path: root/Src/mkmakemod.sh
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2001-04-19 14:45:41 +0000
committerClint Adams <clint@users.sourceforge.net>2001-04-19 14:45:41 +0000
commita43aa761cdb3fd1051dad474fccf9e500a0d49ea (patch)
tree1035a488b2c17d3314b4cfa08f702ea88c5b46c4 /Src/mkmakemod.sh
parente3ff47f8ee64cbeb48ed032939342bde1ac840bc (diff)
downloadzsh-a43aa761cdb3fd1051dad474fccf9e500a0d49ea.tar.gz
zsh-a43aa761cdb3fd1051dad474fccf9e500a0d49ea.tar.xz
zsh-a43aa761cdb3fd1051dad474fccf9e500a0d49ea.zip
14033: reduce unnecessary library linking for modules and main binary
Diffstat (limited to 'Src/mkmakemod.sh')
-rw-r--r--Src/mkmakemod.sh25
1 files changed, 23 insertions, 2 deletions
diff --git a/Src/mkmakemod.sh b/Src/mkmakemod.sh
index e80e65819..bb1891e2f 100644
--- a/Src/mkmakemod.sh
+++ b/Src/mkmakemod.sh
@@ -27,6 +27,7 @@
 #   autoprefixconds like autoinfixconds, but for prefix condition codes
 #   autoparams      parameters defined by the module, for autoloading
 #   automathfuncs   math functions defined by the module, for autoloading
+#   extralibs       libraries specific to this module (default none)
 #   objects         .o files making up this module (*must* be defined)
 #   proto           .syms files for this module (default generated from $objects)
 #   headers         extra headers for this module (default none)
@@ -190,7 +191,8 @@ if $first_stage; then
 
 	unset name moddeps nozshdep alwayslink hasexport
 	unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
-	unset objects proto headers hdrdeps otherincs
+	unset extralibs objects proto headers hdrdeps otherincs
+	unset EXTRALIBS
 	. $top_srcdir/$the_subdir/${mddname}.mdd
 	q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
 	test -n "${moddeps+set}" || moddeps=
@@ -199,6 +201,24 @@ if $first_stage; then
 	    proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
 
 	dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
+
+	for lib in $extralibs; do
+	case $lib in
+	m) EXTRALIBS="$EXTRALIBS \$(LIBS_M)"
+	;;
+	cap) EXTRALIBS="$EXTRALIBS \$(LIBS_CAP)"
+	;;
+	socket) EXTRALIBS="$EXTRALIBS \$(LIBS_SOCKET)"
+	;;
+	termcap) EXTRALIBS="$EXTRALIBS \$(LIBS_TERMCAP)"
+	;;
+	terminfo) EXTRALIBS="$EXTRALIBS \$(LIBS_TERMINFO)"
+	;;
+	yp) EXTRALIBS="$EXTRALIBS \$(LIBS_YP)"
+	;;
+	esac
+	done
+
 	modhdeps=
 	mododeps=
 	exportdeps=
@@ -302,6 +322,7 @@ if $first_stage; then
 	echo "NXPIMP_${mddname} ="
 	echo "LINKMODS_${mddname} = $mododeps"
 	echo "NOLINKMODS_${mddname} = "
+	echo "EXTRALIBS_${mddname} = $EXTRALIBS"
 	echo
 	echo "proto.${mddname}: \$(EPRO_${mddname})"
 	echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
@@ -328,7 +349,7 @@ if $first_stage; then
 	    echo
 	    echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(@LINKMODS@_${mddname})"
 	    echo '	rm -f $@'
-	    echo "	\$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(@LINKMODS@_${mddname}) \$(LIBS) "
+	    echo "	\$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(@LINKMODS@_${mddname}) $EXTRALIBS \$(LIBS)"
 	    echo
 	fi
 	echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"