ranlib
Chris Bertin
chris at cetia.UUCP
Mon Aug 7 20:18:50 AEST 1989
> In article <1920 at prune.bbn.com> I wrote that the builtin table of contents
> (TOC) stuff makes building large libraries take too long.
>
> It would be much more effective if I could NOT build the TOC until the
> end. I used to agree that having ranlib as a separate command was a real
> crock, but then I had to use the SysV-oid version of ar...
> /r$
I modified ar.c, ages ago, to recognize the environment variable 'RANLIB'.
If this variable is set to 'noauto', the TOC update is not done. With the
same modification, if you link ar to ranlib, it will do the TOC update only.
I thought the environment variable approach was more portable than adding
a flag, since it would just be ignored if ar did not know about it. I compile
everything large with:
AR="RANLIB=noauto ar"
and then do the following when I need to use the libraries:
@[ -z "`type ranlib`" ] || ranlib xyz.a
Here is a context diff of the changes.
---------------------------------------------------------------------------
*** /tmp/geta19136 Mon Aug 7 11:03:07 1989
--- /tmp/getb19136 Mon Aug 7 11:03:07 1989
***************
*** 131,138 ****
int (*comfun)();
-
main(argc, argv)
int argc;
char **argv;
--- 131,140 ----
int (*comfun)();
+ int quick;
+ char *rl = "ranlib";
+ extern char *getenv();
main(argc, argv)
int argc;
char **argv;
***************
*** 143,148 ****
--- 145,163 ----
for (i = 0; signum[i]; i++)
if (signal(signum[i], SIG_IGN) != SIG_IGN)
signal(signum[i], sigdone);
+ if (!strcmp(cp = *argv, rl) ||
+ ((cp = strrchr(*argv, '/')) && !strcmp(cp+1, rl))) {
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s lib\n", cp);
+ exit(1);
+ }
+ arnam = argv[1];
+ mksymtab();
+ done(0);
+ }
+ if ((cp = getenv("RANLIB")) != NULL &&
+ (!strcmp(cp, "noauto") || !strcmp(cp, "NOAUTO")))
+ quick++;
if (argc < 3)
usage();
cp = argv[1];
***************
*** 224,230 ****
update = (flg['d' - 'a'] | flg['q' - 'a'] | flg['m' - 'a'] |
flg['r' - 'a'] | flg['u' - 'a'] | flg['s' - 'a']);
(*comfun)();
! if (update) /* make archive symbol table */
mksymtab();
done(notfound());
}
--- 239,245 ----
update = (flg['d' - 'a'] | flg['q' - 'a'] | flg['m' - 'a'] |
flg['r' - 'a'] | flg['u' - 'a'] | flg['s' - 'a']);
(*comfun)();
! if (update && !quick) /* make archive symbol table */
mksymtab();
done(notfound());
}
---------------------------------------------------------------------------
--
Chris Bertin | -- CETIA -- 150, Av Marcelin Berthelot, Z.I. Toulon-Est
+33(94)212005 | 83088 Toulon Cedex, France
| inria!cetia!chris
#! r
More information about the Comp.unix.questions
mailing list