From: Andreas Jaeger Date: Sun, 13 May 2001 02:45:50 +0000 (+0000) Subject: elaboration on the execute example X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e742f23db7d29ade1d9443d61e70fd42e0dec568;p=thirdparty%2Flibtool.git elaboration on the execute example --- diff --git a/exe/lt_base.def b/exe/lt_base.def index b37389e86..cc408586e 100644 --- a/exe/lt_base.def +++ b/exe/lt_base.def @@ -7,6 +7,7 @@ string[0] = { str-name = base; text = <<_END_OF_BASE_TEXT_ +[++ AutoGen5 Template ++] # Global variables. lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" diff --git a/exe/lt_clean.def b/exe/lt_clean.def index 3ac48282b..c9adc9453 100644 --- a/exe/lt_clean.def +++ b/exe/lt_clean.def @@ -24,6 +24,7 @@ or program, all the files associated with it are deleted. Otherwise, only the file itself is deleted using .\n"; text = << _END_EXECUTE_STRING_ +[++ AutoGen5 Template ++] rm="$nonopt" files= rmforce= diff --git a/exe/lt_compile.def b/exe/lt_compile.def index 5e969bae3..77e7f6dd0 100644 --- a/exe/lt_compile.def +++ b/exe/lt_compile.def @@ -21,6 +21,7 @@ source file name in the list and then substituting the C source code suffix `.c' with the library object suffix, `.lo'.\n"; text = << _END_COMPILE_STRING_ +[++ AutoGen5 Template ++] # Get the compilation command and the source file. base_compile= prev= diff --git a/exe/lt_exe.tpl b/exe/lt_exe.tpl deleted file mode 100644 index bfa894b33..000000000 --- a/exe/lt_exe.tpl +++ /dev/null @@ -1,15 +0,0 @@ -[= AutoGen5 Template =] - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - [= test-or-exit test = 'test -z "$cmd"' - msg = "you must specify a COMMAND" =] -[=(shellf "cat > .lttmp.exe <<'END_LTEXE_TEMP' -[+ AutoGen5 Template +] -%s\nEND_LTEXE_TEMP" - (get "string[EXECUTE_STRING].text")) =][= - INCLUDE ".lttmp.exe" =][= - `rm -f .lttmp.exe` =] - ;; diff --git a/exe/lt_execute.def b/exe/lt_execute.def index 1b3c8a314..d699556d5 100644 --- a/exe/lt_execute.def +++ b/exe/lt_execute.def @@ -19,18 +19,19 @@ required library directories are added to the library path.\n Then, is executed, with `...' as arguments.\n"; text = << _END_EXECUTE_STRING_ +[++ AutoGen5 Template ++] # Handle -dlopen flags immediately. for file in $execute_dlfiles; do - [+ test-or-exit test = 'test ! -f "$file"' - msg = "\\`$file' is not a file" +] + [++ test-or-exit test = 'test ! -f "$file"' + msg = "\\`$file' is not a file" ++] dir= case $file in *.la) # Check to see that this really is a libtool archive. - [+ test-or-exit invert = yes + [++ test-or-exit invert = yes test = "sed -e '2q' $file | egrep \"^# Generated by .*$PACKAGE\"" - msg = "\\`$lib' is not a valid libtool archive" +] + msg = "\\`$lib' is not a valid libtool archive" ++] # Read the libtool library. dlname= @@ -52,8 +53,8 @@ Then, is executed, with `...' as arguments.\n"; dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. - [+ test-or-exit test = 'test -f "$dir/$objdir/$dlname"' invert = yes - msg = "cannot find \\`$dlname' in \\`$dir' or \\`$dir/$objdir'" +] + [++ test-or-exit test = 'test -f "$dir/$objdir/$dlname"' invert = yes + msg = "cannot find \\`$dlname' in \\`$dir' or \\`$dir/$objdir'" ++] dir="$dir/$objdir" ;; diff --git a/exe/lt_finish.def b/exe/lt_finish.def index 9b75c1926..60825a2b3 100644 --- a/exe/lt_finish.def +++ b/exe/lt_finish.def @@ -13,6 +13,7 @@ The commands that this mode executes may require superuser privileges. Use the `--dry-run' option if you just want to see what would be executed.\n"; text = << _END_FINISH_STRING_ +[++ AutoGen5 Template ++] libdirs="$nonopt" admincmds= diff --git a/exe/lt_install.def b/exe/lt_install.def index ebfa46c5a..5ee8946f7 100644 --- a/exe/lt_install.def +++ b/exe/lt_install.def @@ -13,6 +13,7 @@ It should be either the `install' or `cp' program.\n (only BSD-compatible install options are recognized).\n"; text = << _END_INSTALL_STRING_ +[++ AutoGen5 Template ++] # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || diff --git a/exe/lt_link.def b/exe/lt_link.def index aab67e295..ac672d6b7 100644 --- a/exe/lt_link.def +++ b/exe/lt_link.def @@ -47,6 +47,7 @@ If OUTPUT-FILE ends in `.lo' or `.${objext}', then a reloadable object file is created, otherwise an executable program is created.\n"; text = << _END_LINK_STRING_ +[++ AutoGen5 Template ++] case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and diff --git a/exe/ltmain.tpl b/exe/ltmain.tpl index 1719d6c06..4120e9bf1 100644 --- a/exe/ltmain.tpl +++ b/exe/ltmain.tpl @@ -1,9 +1,10 @@ [= AutoGen5 Template in=ltmain.in =] [=( dne "# " "# " )=][= -DEFINE test-or-exit =] -if ([=test=]) > /dev/null 2>&1 ; then -[= invert " :\nelse"=] +DEFINE test-or-exit + +=]if ([=test=]) > /dev/null 2>&1 ; then[= + invert " :\nelse"=] $echo "$modename: [=msg=]" 1>&2 $echo "$help" 1>&2 exit 1 @@ -75,7 +76,11 @@ TIMESTAMP="@TIMESTAMP@" default_mode= help="Try \`$progname --help' for more information." -[=string[BASE_STRING].text=] +[= (out-push-new ".lt.tmp") =][= + string[BASE_STRING].text =][= + (out-pop) =][= + INCLUDE ".lt.tmp" =][= + `rm -f .lt.tmp` =] if test "$LTCONFIG_VERSION" != "$VERSION"; then echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 @@ -295,7 +300,10 @@ if test -z "$show_help"; then # libtool compile mode compile) modename="$modename: compile" -[=string[COMPILE_STRING].text=] +[= (out-push-new ".lt.tmp") =][= + string[COMPILE_STRING].text =][= + (out-pop) =][= + INCLUDE ".lt.tmp" =] exit 0 ;; @@ -303,7 +311,10 @@ if test -z "$show_help"; then # libtool link mode link | relink) modename="$modename: link" -[=string[LINK_STRING].text=] +[= (out-push-new ".lt.tmp") =][= + string[LINK_STRING].text =][= + (out-pop) =][= + INCLUDE ".lt.tmp" =] exit 0 ;; @@ -311,7 +322,10 @@ if test -z "$show_help"; then install) modename="$modename: install" -[=string[INSTALL_STRING].text=] +[= (out-push-new ".lt.tmp") =][= + string[INSTALL_STRING].text =][= + (out-pop) =][= + INCLUDE ".lt.tmp" =] exit 0 ;; @@ -319,17 +333,35 @@ if test -z "$show_help"; then # libtool finish mode finish) modename="$modename: finish" -[=string[FINISH_STRING].text=] +[= (out-push-new ".lt.tmp") =][= + string[FINISH_STRING].text =][= + (out-pop) =][= + INCLUDE ".lt.tmp" =] exit 0 ;; # libtool execute mode -[= include "lt_exe.tpl" =] + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + [= test-or-exit test = 'test -z "$cmd"' + msg = "you must specify a COMMAND" =] +[= (out-push-new ".lt.tmp") =][= + string[EXECUTE_STRING].text =][= + (out-pop) =][= + INCLUDE ".lt.tmp" =] + ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" -[=string[CLEAN_STRING].text=] +[= (out-push-new ".lt.tmp") =][= + string[CLEAN_STRING].text =][= + (out-pop) =][= + INCLUDE ".lt.tmp" =][= + `rm -f .lt.tmp` =] exit $exit_status ;; diff --git a/exe/ltstr.tpl b/exe/ltstr.tpl index 523ecc8bc..b82efd512 100644 --- a/exe/ltstr.tpl +++ b/exe/ltstr.tpl @@ -7,6 +7,17 @@ IF (== (suffix) "h") =][= +DEFINE test-or-exit + +=]if ([=test=]) > /dev/null 2>&1 ; then[= + invert " :\nelse"=] + $echo "$modename: [=msg=]" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi[= + +ENDDEF =][= + (define guard (string-append "HDRGRD_" (string-upcase! (string->c-name! (out-name)) ))) (define hdr-name (out-name)) =] @@ -77,20 +88,17 @@ tSCC zExplain[=(string-capitalize! (get "str_name"))=][ [= IF (exist? "text") =][= - IF (== (suffix) "h") =] -#define [=(string-upcase! (get "str_name"))=]_CMD_SIZE [=(+ 1 (len "text"))=] -extern [= - ELSE =] -[= ENDIF -=]tCC z[=(string-capitalize! (get "str_name")) - =]Cmd[ [=(string-upcase! (get "str_name"))=]_CMD_SIZE ][= - IF (== (suffix) "c") =] = -[=(kr-string (get "text"))=][= - ENDIF =];[= - - ENDIF =] -[= - IF (== (suffix) "c") =] + IF (== (suffix) "c") =] +tSCC z[= (string-capitalize! (get "str_name")) =]Cmd[] = +[= (out-push-new ".lt.tpl") =][= + text =][= + (out-pop) + (out-push-new ".lt.xxx") =][= + INCLUDE ".lt.tpl" =][= + (out-pop) + (kr-string (shell "cat .lt.xxx ; rm -f .lt.*")) =][= + ENDIF =]; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */[= ENDIF =][=