[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib-tool: new option --makefile-name
From: |
Bruno Haible |
Subject: |
gnulib-tool: new option --makefile-name |
Date: |
Mon, 28 Aug 2006 17:19:36 +0200 |
User-agent: |
KMail/1.9.1 |
While doing the coreutils changes, Paul found the answer to the long-standing
question how gnulib-tool could be used without requiring a lib/ directory of
its own and while still maintaining a clear separation between hand-maintained
files and autogenerated files. Namely, rename the gnulib Makefile.am to some
other name and include it from the real Makefile.am.
This patch adds an option --makefile-name that does this.
2006-08-27 Bruno Haible <address@hidden>
* gnulib-tool: New option --makefile-name.
(func_emit_lib_Makefile_am, func_emit_tests_Makefile_am): Use
$makefile_name.
(func_import): Write $makefile_name to the cache file, and read it from
there unless explicitly specified. Use $makefile_name as file name
instead of Makefile.am. Adjust the recommendations accordingly.
*** gnulib-20060823/gnulib-tool.bak 2006-08-27 16:39:17.000000000 +0200
--- gnulib-20060823/gnulib-tool 2006-08-27 17:03:38.000000000 +0200
***************
*** 134,139 ****
--- 134,142 ----
This option can be repeated.
--lgpl Abort if modules aren't available under the LGPL.
Also modify license template from GPL to LGPL.
+ --makefile-name=NAME Name of makefile in automake syntax in the
+ source-base and tests-base directories
+ (default \"Makefile.am\").
--libtool Use libtool rules.
--no-libtool Don't use libtool rules.
--macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
***************
*** 353,358 ****
--- 356,362 ----
# - inctests true if --with-tests was given, blank otherwise
# - avoidlist list of modules to avoid, from --avoid
# - lgpl true if --lgpl was given, blank otherwise
+ # - makefile_name from --makefile-name
# - libtool true if --libtool was given, false if --no-libtool was
# given, blank otherwise
# - macro_prefix from --macro-prefix
***************
*** 374,379 ****
--- 378,384 ----
inctests=
avoidlist=
lgpl=
+ makefile_name=
libtool=
macro_prefix=
do_changelog=:
***************
*** 506,511 ****
--- 511,526 ----
--lgpl )
lgpl=true
shift ;;
+ --makefile-name )
+ shift
+ if test $# = 0; then
+ func_fatal_error "missing argument for --makefile-name"
+ fi
+ makefile_name="$1"
+ shift ;;
+ --makefile-name=* )
+ makefile_name=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
+ shift ;;
--libtool )
libtool=true
shift ;;
***************
*** 562,568 ****
|| test -n "$sourcebase" || test -n "$m4base" \
|| test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
|| test -n "$inctests" || test -n "$avoidlist" || test -n "$lgpl" \
! || test -n "$macro_prefix"; then
echo "gnulib-tool: invalid options for 'update' mode" 1>&2
echo "Try 'gnulib-tool --help' for more information." 1>&2
echo "If you really want to modify the gnulib configuration of your
project," 1>&2
--- 577,583 ----
|| test -n "$sourcebase" || test -n "$m4base" \
|| test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
|| test -n "$inctests" || test -n "$avoidlist" || test -n "$lgpl" \
! || test -n "$makefile_name" || test -n "$macro_prefix"; then
echo "gnulib-tool: invalid options for 'update' mode" 1>&2
echo "Try 'gnulib-tool --help' for more information." 1>&2
echo "If you really want to modify the gnulib configuration of your
project," 1>&2
***************
*** 1013,1018 ****
--- 1028,1034 ----
# - local_gnulib_dir from --local-dir
# - modules list of modules, including dependencies
# - libname library name
+ # - makefile_name from --makefile-name
# - libtool true if libtool will be used, false or blank otherwise
# - actioncmd (optional) command that will reproduce this invocation
func_emit_lib_Makefile_am ()
***************
*** 1096,1102 ****
echo " fi; \\"
echo " done"
echo
! echo "# Makefile.am ends here"
rm -f allsnippets.tmp
}
--- 1112,1118 ----
echo " fi; \\"
echo " done"
echo
! echo "# ${makefile_name-Makefile.am} ends here"
rm -f allsnippets.tmp
}
***************
*** 1106,1111 ****
--- 1122,1128 ----
# - local_gnulib_dir from --local-dir
# - modules list of modules, including dependencies
# - libname library name
+ # - makefile_name from --makefile-name
# - libtool true if libtool will be used, false or blank otherwise
# - sourcebase relative directory containing lib source code
# - m4base relative directory containing autoconf macros
***************
*** 1184,1190 ****
echo " fi; \\"
echo " done"
echo
! echo "# Makefile.am ends here"
rm -f allsnippets.tmp
}
--- 1201,1207 ----
echo " fi; \\"
echo " done"
echo
! echo "# ${makefile_name-Makefile.am} ends here"
rm -f allsnippets.tmp
}
***************
*** 1201,1206 ****
--- 1218,1224 ----
# - inctests true if --with-tests was given, blank otherwise
# - avoidlist list of modules to avoid, from --avoid
# - lgpl true if library's license shall be LGPL, blank otherwise
+ # - makefile_name from --makefile-name
# - libtool true if --libtool was given, false if --no-libtool was
# given, blank otherwise
# - guessed_libtool true if the configure.ac file uses libtool, false
otherwise
***************
*** 1220,1225 ****
--- 1238,1244 ----
cached_testsbase=
cached_libname=
cached_lgpl=
+ cached_makefile_name=
cached_libtool=
cached_macro_prefix=
cached_files=
***************
*** 1256,1261 ****
--- 1275,1283 ----
/gl_LGPL/ {
s,^.*$,cached_lgpl=true,p
}
+ /gl_MAKEFILE_NAME(/ {
+ s,^.*gl_MAKEFILE_NAME([[ ]*\([^])]*\).*$,cached_makefile_name="\1",p
+ }
/gl_LIBTOOL/ {
s,^.*$,cached_libtool=true,p
}
***************
*** 1346,1351 ****
--- 1368,1377 ----
if test -z "$lgpl"; then
lgpl="$cached_lgpl"
fi
+ # The makefile_name defaults to the cached one.
+ if test -z "$makefile_name"; then
+ makefile_name="$cached_makefile_name"
+ fi
# Use libtool if specified either way, or if guessed.
if test -z "$libtool"; then
if test -n "$cached_m4base"; then
***************
*** 1605,1610 ****
--- 1631,1639 ----
if test -n "$lgpl"; then
actioncmd="$actioncmd --lgpl"
fi
+ if test -n "$makefile_name"; then
+ actioncmd="$actioncmd --makefile_name=$makefile_name"
+ fi
if test "$libtool" = true; then
actioncmd="$actioncmd --libtool"
else
***************
*** 1614,1640 ****
actioncmd="$actioncmd `echo $specified_modules`"
# Create lib/Makefile.am.
! func_dest_tmpfilename $sourcebase/Makefile.am
func_emit_lib_Makefile_am > "$tmpfile"
! if test -f "$destdir"/$sourcebase/Makefile.am; then
! if cmp "$destdir"/$sourcebase/Makefile.am "$tmpfile" > /dev/null; then
rm -f "$tmpfile"
else
if $doit; then
! echo "Updating $sourcebase/Makefile.am (backup in
$sourcebase/Makefile.am~)"
! mv -f "$destdir"/$sourcebase/Makefile.am
"$destdir"/$sourcebase/Makefile.am~
! mv -f "$tmpfile" "$destdir"/$sourcebase/Makefile.am
else
! echo "Update $sourcebase/Makefile.am (backup in
$sourcebase/Makefile.am~)"
rm -f "$tmpfile"
fi
fi
else
if $doit; then
! echo "Creating $sourcebase/Makefile.am"
! mv -f "$tmpfile" "$destdir"/$sourcebase/Makefile.am
else
! echo "Create $sourcebase/Makefile.am"
rm -f "$tmpfile"
fi
fi
--- 1643,1670 ----
actioncmd="$actioncmd `echo $specified_modules`"
# Create lib/Makefile.am.
! makefile_am=${makefile_name-Makefile.am}
! func_dest_tmpfilename $sourcebase/$makefile_am
func_emit_lib_Makefile_am > "$tmpfile"
! if test -f "$destdir"/$sourcebase/$makefile_am; then
! if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
rm -f "$tmpfile"
else
if $doit; then
! echo "Updating $sourcebase/$makefile_am (backup in
$sourcebase/$makefile_am~)"
! mv -f "$destdir"/$sourcebase/$makefile_am
"$destdir"/$sourcebase/$makefile_am~
! mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
else
! echo "Update $sourcebase/$makefile_am (backup in
$sourcebase/$makefile_am~)"
rm -f "$tmpfile"
fi
fi
else
if $doit; then
! echo "Creating $sourcebase/$makefile_am"
! mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
else
! echo "Create $sourcebase/$makefile_am"
rm -f "$tmpfile"
fi
fi
***************
*** 1676,1681 ****
--- 1706,1712 ----
echo "gl_TESTS_BASE([$testsbase])"
echo "gl_LIB([$libname])"
test -z "$lgpl" || echo "gl_LGPL"
+ echo "gl_MAKEFILE_NAME([$makefile_name])"
if test "$libtool" = true; then
echo "gl_LIBTOOL"
fi
***************
*** 1814,1840 ****
if test -n "$inctests"; then
# Create tests/Makefile.am.
! func_dest_tmpfilename $testsbase/Makefile.am
func_emit_tests_Makefile_am > "$tmpfile"
! if test -f "$destdir"/$testsbase/Makefile.am; then
! if cmp "$destdir"/$testsbase/Makefile.am "$tmpfile" > /dev/null; then
rm -f "$tmpfile"
else
if $doit; then
! echo "Updating $testsbase/Makefile.am (backup in
$testsbase/Makefile.am~)"
! mv -f "$destdir"/$testsbase/Makefile.am
"$destdir"/$testsbase/Makefile.am~
! mv -f "$tmpfile" "$destdir"/$testsbase/Makefile.am
else
! echo "Update $testsbase/Makefile.am (backup in
$testsbase/Makefile.am~)"
rm -f "$tmpfile"
fi
fi
else
if $doit; then
! echo "Creating $testsbase/Makefile.am"
! mv -f "$tmpfile" "$destdir"/$testsbase/Makefile.am
else
! echo "Create $testsbase/Makefile.am"
rm -f "$tmpfile"
fi
fi
--- 1845,1872 ----
if test -n "$inctests"; then
# Create tests/Makefile.am.
! makefile_am=${makefile_name-Makefile.am}
! func_dest_tmpfilename $testsbase/$makefile_am
func_emit_tests_Makefile_am > "$tmpfile"
! if test -f "$destdir"/$testsbase/$makefile_am; then
! if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev/null; then
rm -f "$tmpfile"
else
if $doit; then
! echo "Updating $testsbase/$makefile_am (backup in
$testsbase/$makefile_am~)"
! mv -f "$destdir"/$testsbase/$makefile_am
"$destdir"/$testsbase/$makefile_am~
! mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
else
! echo "Update $testsbase/$makefile_am (backup in
$testsbase/$makefile_am~)"
rm -f "$tmpfile"
fi
fi
else
if $doit; then
! echo "Creating $testsbase/$makefile_am"
! mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
else
! echo "Create $testsbase/$makefile_am"
rm -f "$tmpfile"
fi
fi
***************
*** 1869,1885 ****
) | sed -e '/^$/d;' -e 's/^/ /'
echo
echo "Don't forget to"
! echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
if test -n "$inctests"; then
! echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in
$configure_ac,"
fi
- sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
- sourcebase_base=`basename "$sourcebase"`
- echo " - mention \"${sourcebase_base}\" in SUBDIRS in
${sourcebase_dir}Makefile.am,"
if test -n "$inctests"; then
! testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
! testsbase_base=`basename "$testsbase"`
! echo " - mention \"${testsbase_base}\" in SUBDIRS in
${testsbase_dir}Makefile.am,"
fi
echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am,"
echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after
AC_PROG_CC,"
--- 1901,1929 ----
) | sed -e '/^$/d;' -e 's/^/ /'
echo
echo "Don't forget to"
! if test "${makefile_name-Makefile.am}" = Makefile.am; then
! echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in
$configure_ac,"
! else
! echo " - \"include $makefile_name\" from within
\"$sourcebase/Makefile.am\","
! fi
if test -n "$inctests"; then
! if test "${makefile_name-Makefile.am}" = Makefile.am; then
! echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in
$configure_ac,"
! else
! echo " - \"include $makefile_name\" from within
\"$testsbase/Makefile.am\","
! fi
! fi
! if test "${makefile_name-Makefile.am}" = Makefile.am; then
! sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
! sourcebase_base=`basename "$sourcebase"`
! echo " - mention \"${sourcebase_base}\" in SUBDIRS in
${sourcebase_dir}Makefile.am,"
fi
if test -n "$inctests"; then
! if test "${makefile_name-Makefile.am}" = Makefile.am; then
! testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
! testsbase_base=`basename "$testsbase"`
! echo " - mention \"${testsbase_base}\" in SUBDIRS in
${testsbase_dir}Makefile.am,"
! fi
fi
echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am,"
echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after
AC_PROG_CC,"
- gnulib-tool: new option --makefile-name,
Bruno Haible <=