From: Andreas Jaeger Date: Sun, 13 May 2001 17:41:27 +0000 (+0000) Subject: fix the command string and command proc pointers X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8668dbcbcff997fe962c2efc6b10ba6b1216dfdf;p=thirdparty%2Flibtool.git fix the command string and command proc pointers --- diff --git a/exe/ltmain.mk b/exe/ltmain.mk index f434d7bab..beb73c8a1 100644 --- a/exe/ltmain.mk +++ b/exe/ltmain.mk @@ -15,7 +15,7 @@ ltmain : $(OBJ) $(CC) -o ltmain $(OBJ) -lopts clean : - rm -f lt*.o ltmain $(GENED) *~ + rm -rf .libs lt*.o ltmain libtool $(GENED) *~ ltmain.in : $(TXTTPL) ltstr.def autogen -T ltmain.tpl -l ltmacros.tpl ltstr.def @@ -36,3 +36,6 @@ ltopts.o : ltopts.c $(CC) -c -o ltopts.o -I/usr/local/include ltopts.c gen : ltmain.in ltstr.c ltopts.c + +libtool : ltmain + ./ltmain --mode=link $(CC) -o $@ $(OBJ) -lopts diff --git a/exe/ltopts.def b/exe/ltopts.def index 1a6ef93cb..d07776c1b 100644 --- a/exe/ltopts.def +++ b/exe/ltopts.def @@ -58,18 +58,16 @@ flag = { descrip = "ltmain's operational mode"; /* - * BEWARE: these *must* enumerate to the values #define-d in the - * lt_*.def files!! + * Extract the keyword list from the defined list of modes. + * This comes from that definition file. This ensures that + * the ordering is the same, too. It omits 'base'. */ - keyword = /* 0 -> UNDEFINED */ - clean, /* 1 */ - compile, /* 2 */ - execute, /* 3 */ - finish, /* 4 */ - install, /* 5 */ - link, /* 6 */ - uninstall, /* 7 */ - echo; /* 8 */ +#shell + echo keyword = + egrep -i '^[ ]*str-name' ltstr.def | \ + sed '/base/d;s/.*=//;s/;.*/,/;$s/,/;/' +#endshell + doc = "This enumerates all of the libtool operational modes.\n" "If this option is not specified, then this program tries to infer\n" diff --git a/exe/ltstr.def b/exe/ltstr.def index 7a9b85d35..25caa6b6a 100644 --- a/exe/ltstr.def +++ b/exe/ltstr.def @@ -1,15 +1,11 @@ AutoGen Definitions ltmain.tpl; -#define BASE_STRING 0 - -string[0] = { +string = { str-name = base; }; -#define CLEAN_STRING 1 - -string[CLEAN_STRING] = { +string = { str-name = clean; explain = " is the name of the program to use to delete files associated with @@ -21,9 +17,7 @@ or program, all the files associated with it are deleted. Otherwise, only the file itself is deleted using .\n"; }; -#define COMPILE_STRING 2 - -string[COMPILE_STRING] = { +string = { str-name = compile; call-proc = emitCompile; @@ -41,9 +35,7 @@ source file name in the list and then substituting the C source code suffix `.c' with the library object suffix, `.lo'.\n"; }; -#define EXECUTE_STRING 3 - -string[EXECUTE_STRING] = { +string = { str-name = execute; call-proc = emitExecute; @@ -59,9 +51,7 @@ required library directories are added to the library path.\n Then, is executed, with `...' as arguments.\n"; }; -#define FINISH_STRING 4 - -string[FINISH_STRING] = { +string = { str-name = finish; explain = " Complete the installation of libtool libraries.\n @@ -71,9 +61,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"; }; -#define INSTALL_STRING 5 - -string[INSTALL_STRING] = { +string = { str-name = install; explain = " Install executables or libraries.\n @@ -83,9 +71,7 @@ It should be either the `install' or `cp' program.\n (only BSD-compatible install options are recognized).\n"; }; -#define LINK_STRING 6 - -string[LINK_STRING] = { +string = { str-name = link; explain = " Link object files or libraries together to form another library, @@ -129,17 +115,13 @@ If OUTPUT-FILE ends in `.lo' or `.${objext}', then a reloadable object file is created, otherwise an executable program is created.\n"; }; -#define UNINSTALL_STRING 7 - -string[UNINSTALL_STRING] = { +string = { str-name = uninstall; use_explain = clean; use_cmd = clean; }; -#define ECHO_STRING 8 - -string[ECHO_STRING] = { +string = { str-name = echo; explain = " This is a reimplementation of the echo command. diff --git a/exe/ltstr.tpl b/exe/ltstr.tpl index e0f48f6ea..cd7528e8b 100644 --- a/exe/ltstr.tpl +++ b/exe/ltstr.tpl @@ -55,9 +55,14 @@ ELSE not h suffix =] #include "[=(. hdr-name)=]" [= -(define tpl-name "") =][= +(define tpl-name "") +(define cmd-list "") +(define proc-list "") +(define Cmd-Name "") =][= -FOR string +FOR string =][= + + (set! Cmd-Name (string-capitalize! (get "str_name"))) =] /* @@ -68,7 +73,7 @@ FOR string IF (exist? "explain") =] -tSCC zExplain[=(string-capitalize! (get "str_name"))=][ [= +tSCC zExplain[=(. Cmd-Name)=][ [= (+ 1 (len "explain")) =] ] = [=(kr-string (get "explain"))=];[= ENDIF =][= @@ -79,13 +84,20 @@ tSCC zExplain[=(string-capitalize! (get "str_name"))=][ [= IF (exist? "explain") =] [= ENDIF =] -tSCC z[= (string-capitalize! (get "str_name")) =]Cmd[] =[= +tSCC z[= (. Cmd-Name) =]Cmd[] =[= (out-push-new ".lt.sh") =][= INCLUDE (. tpl-name) =][= (out-pop) - (kr-string (shell "cat .lt.sh ; rm -f .lt.sh")) =]; + (set! cmd-list (string-append cmd-list "z" Cmd-Name "Cmd\n")) + (kr-string (shell "cat .lt.sh ; rm -f .lt.sh")) + =]; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */[= + ELIF (exist? "use_cmd") =][= + (set! cmd-list (string-append cmd-list "z" + (string-capitalize! (get "use_cmd")) "Cmd\n")) =][= + ELSE =][= + (set! cmd-list (string-append cmd-list "(tCC*)NULL\n" )) =][= ENDIF =][= ENDFOR =][= @@ -112,17 +124,8 @@ ENDIF =]; [=IF (== (suffix) "h")=]extern [= ENDIF=]tCC* apz_mode_cmd[ MODE_CT ][= -IF (== (suffix) "c") =] = {[= - - FOR string , =] - [= - IF (exist? "use_cmd") - =]z[=(string-capitalize! (get "use_cmd"))=]Cmd[= - ELIF (exist? "text") - =]z[=(string-capitalize! (get "str_name"))=]Cmd[= - ELSE =](tCC*)NULL[= - ENDIF =][= - ENDFOR =] +IF (== (suffix) "c") =] = { +[=(shellf "columns -I4 -S, <<_EOF_\n%s_EOF_" cmd-list) =] }[= ENDIF =]; @@ -131,11 +134,7 @@ ENDIF =]; IF (== (suffix) "c") =] = {[= FOR string , =] - [= - IF (or (exist? "use_cmd") (exist? "text")) - =][=?% call-proc "%s" emitScript=][= - ELSE =](emitScriptProc*)NULL[= - ENDIF =][= + [=?% call-proc "%s" emitScript=][= ENDFOR =] };[=