Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/xlint Add parsing of the CC env variable, and ...



details:   https://anonhg.NetBSD.org/src/rev/447fc838ee92
branches:  trunk
changeset: 483969:447fc838ee92
user:      garbled <garbled%NetBSD.org@localhost>
date:      Wed Mar 22 01:09:34 2000 +0000

description:
Add parsing of the CC env variable, and a -Bpath flag (for /usr/libexec)
so cross-building of lint libraries can be made possible.  Tested
building a powerpc libc via make build on an alpha.

diffstat:

 usr.bin/xlint/xlint/lint.1  |  14 +++++++++++++-
 usr.bin/xlint/xlint/xlint.c |  43 ++++++++++++++++++++++++++++++++-----------
 2 files changed, 45 insertions(+), 12 deletions(-)

diffs (156 lines):

diff -r 0caaf3675173 -r 447fc838ee92 usr.bin/xlint/xlint/lint.1
--- a/usr.bin/xlint/xlint/lint.1        Wed Mar 22 01:03:33 2000 +0000
+++ b/usr.bin/xlint/xlint/lint.1        Wed Mar 22 01:09:34 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: lint.1,v 1.10 1999/03/22 18:16:47 garbled Exp $
+.\"    $NetBSD: lint.1,v 1.11 2000/03/22 01:09:34 garbled Exp $
 .\"
 .\" Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
 .\" Copyright (c) 1994, 1995 Jochen Pohl
@@ -66,6 +66,9 @@
 .Bk -words
 .Op Fl o Ar outputfile
 .Ek
+.Bk -words
+.Op Fl B Ar directory
+.Ek
 .Ar
 .Nm lint
 .Op Fl abceghprvzHFV
@@ -87,6 +90,9 @@
 .Bk -words
 .Op Fl d Ar directory
 .Ek
+.Bk -words
+.Op Fl B Ar directory
+.Ek
 .Ar
 .Sh DESCRIPTION
 .Nm
@@ -304,6 +310,9 @@
 Do not complain about structures that are never defined
 (for example, using a structure pointer without knowing
 its contents).
+.It Fl B Ns Ar path
+Path to use when looking for the lint1 and lint2 binaries. Defualts to
+.Pa /usr/libexec .
 .It Fl C Ns Ar library
 Create a
 .Nm
@@ -524,6 +533,9 @@
 .It Ev TMPDIR
 usually the path for temporary files can be redefined by setting
 this environment variable.
+.It Ev CC
+Location of the C compiler program.  Defaults to
+.Pa /usr/bin/cc .
 .El
 .Sh FILES
 .Bl -tag -width /usr/libdata/lint/llib-lc.ln -compact
diff -r 0caaf3675173 -r 447fc838ee92 usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Wed Mar 22 01:03:33 2000 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Wed Mar 22 01:09:34 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xlint.c,v 1.16 1999/09/09 09:34:25 kleink Exp $        */
+/*     $NetBSD: xlint.c,v 1.17 2000/03/22 01:09:34 garbled Exp $       */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: xlint.c,v 1.16 1999/09/09 09:34:25 kleink Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.17 2000/03/22 01:09:34 garbled Exp $");
 #endif
 
 #include <sys/param.h>
@@ -98,8 +98,10 @@
 /* search path for libraries */
 static char    **libsrchpath;
 
+static  char   *libexec_path;
+
 /* flags */
-static int     iflag, oflag, Cflag, sflag, tflag, Fflag, dflag;
+static int     iflag, oflag, Cflag, sflag, tflag, Fflag, dflag, Bflag;
 
 /* print the commands executed to run the stages of compilation */
 static int     Vflag;
@@ -290,7 +292,7 @@
     "\t[-Idirectory] [-Ldirectory] [-llibrary] [-ooutputfile] file ...\n");
        (void)fprintf(stderr,
     "       %s [-abceghprvzHF] [-s|-t] -Clibrary [-Dname[=def]]\n", __progname);
-       (void)fprintf(stderr, "\t[-Idirectory] [-Uname] file ...\n");
+       (void)fprintf(stderr, "\t[-Idirectory] [-Uname] [-Bpath] file ...\n");
        terminate(-1);
 }
 
@@ -364,7 +366,7 @@
                argv += optind;
                optind = 0;
 
-               c = getopt(argc, argv, "abcd:eghil:no:prstuvxzC:D:FHI:L:U:V");
+               c = getopt(argc, argv, "abcd:eghil:no:prstuvxzB:C:D:FHI:L:U:V");
 
                switch (c) {
 
@@ -483,6 +485,11 @@
                        appcstrg(&l2flags, "-H");
                        break;
 
+               case 'B':
+                       Bflag = 1;
+                       libexec_path = xstrdup(optarg);
+                       break;
+
                case 'V':
                        Vflag = 1;
                        break;
@@ -594,8 +601,12 @@
 
        /* run cc */
 
-       path = xmalloc(strlen(PATH_USRBIN) + sizeof ("/cc"));
-       (void)sprintf(path, "%s/cc", PATH_USRBIN);
+       if (getenv("CC") == NULL) {
+               path = xmalloc(strlen(PATH_USRBIN) + sizeof ("/cc"));
+               (void)sprintf(path, "%s/cc", PATH_USRBIN);
+       } else {
+               path = strdup(getenv("CC"));
+       }
 
        appcstrg(&args, path);
        applst(&args, cflags);
@@ -618,8 +629,13 @@
 
        /* run lint1 */
 
-       path = xmalloc(strlen(PATH_LIBEXEC) + sizeof ("/lint1"));
-       (void)sprintf(path, "%s/lint1", PATH_LIBEXEC);
+       if (!Bflag) {
+               path = xmalloc(strlen(PATH_LIBEXEC) + sizeof ("/lint1"));
+               (void)sprintf(path, "%s/lint1", PATH_LIBEXEC);
+       } else {
+               path = xmalloc(strlen(libexec_path) + sizeof ("/lint1"));
+               (void)sprintf(path, "%s/lint1", libexec_path);
+       }
 
        appcstrg(&args, path);
        applst(&args, l1flags);
@@ -746,8 +762,13 @@
 
        args = xcalloc(1, sizeof (char *));
 
-       path = xmalloc(strlen(PATH_LIBEXEC) + sizeof ("/lint2"));
-       (void)sprintf(path, "%s/lint2", PATH_LIBEXEC);
+       if (!Bflag) {
+               path = xmalloc(strlen(PATH_LIBEXEC) + sizeof ("/lint2"));
+               (void)sprintf(path, "%s/lint2", PATH_LIBEXEC);
+       } else {
+               path = xmalloc(strlen(libexec_path) + sizeof ("/lint2"));
+               (void)sprintf(path, "%s/lint2", libexec_path);
+       }               
        
        appcstrg(&args, path);
        applst(&args, l2flags);



Home | Main Index | Thread Index | Old Index