[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
factor out .lo generation
From: |
Ralf Wildenhues |
Subject: |
factor out .lo generation |
Date: |
Wed, 19 Apr 2006 18:45:10 +0200 |
User-agent: |
Mutt/1.5.11 |
As a prerequisite of fixing the reloadable object stuff, let's factor
out .lo file generation.
OK to apply this to HEAD?
Cheers,
Ralf
* libltdl/config/ltmain.m4sh (func_write_libtool_object):
New function, factored out from..
(func_mode_compile): .. here. Call it to generate the libtool
object file (the `.lo' file) in one step.
Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.41
diff -u -r1.41 ltmain.m4sh
--- libltdl/config/ltmain.m4sh 20 Mar 2006 20:40:07 -0000 1.41
+++ libltdl/config/ltmain.m4sh 11 Apr 2006 23:06:17 -0000
@@ -1136,6 +1136,44 @@
}
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+ write_libobj=${1}
+ if test "$build_libtool_libs" = yes; then
+ write_lobj=\'${2}\'
+ else
+ write_lobj=none
+ fi
+
+ if test "$build_old_libs" = yes; then
+ write_oldobj=\'${3}\'
+ else
+ write_oldobj=none
+ fi
+
+ $opt_dry_run || {
+ cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+ mv -f "${write_libobj}T" "${write_libobj}"
+ }
+}
+
# func_mode_compile arg...
func_mode_compile ()
{
@@ -1385,18 +1423,6 @@
$opt_dry_run || $RM "$libobj" "${libobj}T"
- # Create a libtool object file (analogous to a ".la" file),
- # but don't create it if we're doing a dry run.
- $opt_dry_run || cat > ${libobj}T <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
-
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
# Without this assignment, base_compile gets emptied.
@@ -1447,23 +1473,10 @@
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
- # Append the name of the PIC object to the libtool object file.
- $opt_dry_run || cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
suppress_output=' >/dev/null 2>&1'
fi
- else
- # No PIC object so indicate it doesn't exist in the libtool
- # object file.
- $opt_dry_run || cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
fi
# Only build a position-dependent object if we build old libraries.
@@ -1509,26 +1522,10 @@
func_show_eval '$MV "$output_obj" "$obj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
-
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- $opt_dry_run || cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
-
-EOF
- else
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- $opt_dry_run || cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
-
-EOF
fi
$opt_dry_run || {
- $MV "${libobj}T" "${libobj}"
+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
# Unlock the critical section if it was locked
if test "$need_locks" != no; then
- factor out .lo generation,
Ralf Wildenhues <=