summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2013-03-29 17:37:20 +0000
committerRobert Mustacchi <rm@joyent.com>2013-04-03 21:09:27 +0000
commit600f674f095b115b06a857c84f6ac041040b0269 (patch)
tree834eeb877dbe9d83341dbb29e9a4d25957f3df05 /usr/src
parent6a3145c68bcccb33eeaff3d791498aca4a96d87b (diff)
downloadillumos-joyent-600f674f095b115b06a857c84f6ac041040b0269.tar.gz
OS-2094 ON tools should honor $MAKE
OS-2095 cmd/refer Makefile is a bit bogus OS-2096 xref hardcodes its path OS-2097 lex should check $origin for support files OS-2098 yacc should check $origin for support files OS-2099 remove OS-1583 workaround OS-2100 ndmp makefiles need to use $(RPCGEN) OS-2101 Need a way to specify ast binary directory
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/Makefile.master2
-rw-r--r--usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen6
-rw-r--r--usr/src/cmd/refer/Makefile2
-rw-r--r--usr/src/cmd/sgs/lex/common/main.c48
-rw-r--r--usr/src/cmd/sgs/lex/common/once.h12
-rw-r--r--usr/src/cmd/sgs/yacc/common/dextern.h19
-rw-r--r--usr/src/cmd/sgs/yacc/common/y1.c36
-rw-r--r--usr/src/cmd/sgs/yacc/common/y2.c7
-rw-r--r--usr/src/lib/Makefile.astmsg4
-rw-r--r--usr/src/tools/scripts/bldenv.sh4
-rw-r--r--usr/src/tools/scripts/nightly.sh4
-rw-r--r--usr/src/tools/scripts/xref.sh15
12 files changed, 127 insertions, 32 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index 0b8c7b6ea2..e606c7d5b4 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -213,6 +213,8 @@ ELFSIGN= /usr/bin/elfsign
DTRACE= /usr/sbin/dtrace -xnolibs
UNIQ= /usr/bin/uniq
TAR= /usr/bin/tar
+ASTBINDIR= /usr/ast/bin
+MSGCC= $(ASTBINDIR)/msgcc
FILEMODE= 644
DIRMODE= 755
diff --git a/usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen b/usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen
index 8db34d372d..2b82d41938 100644
--- a/usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen
+++ b/usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen
@@ -39,13 +39,13 @@
all: $(NDMP_DIR)/ndmp.h $(NDMP_DIR)/ndmp_xdr.c $(NDMP_DIR)/ndmp_xdr.h
$(NDMP_DIR)/ndmp.h: $(NDMP_DIR)/ndmp.x
- rpcgen -C -h -o $(NDMP_DIR)/ndmp.h $(NDMP_DIR)/ndmp.x
+ $(RPCGEN) -C -h -o $(NDMP_DIR)/ndmp.h $(NDMP_DIR)/ndmp.x
$(NDMP_DIR)/ndmp_xdr.c: $(NDMP_DIR)/ndmp.x
- rpcgen -c -o $(NDMP_DIR)/ndmp_xdr.c $(NDMP_DIR)/ndmp.x
+ $(RPCGEN) -c -o $(NDMP_DIR)/ndmp_xdr.c $(NDMP_DIR)/ndmp.x
$(NDMP_DIR)/ndmp_xdr.h: $(NDMP_DIR)/ndmp.x
- rpcgen -C -h -o $(NDMP_DIR)/ndmp_xdr.h $(NDMP_DIR)/ndmp.x
+ $(RPCGEN) -C -h -o $(NDMP_DIR)/ndmp_xdr.h $(NDMP_DIR)/ndmp.x
rpcclean:
rm -f $(NDMP_DIR)/ndmp.h $(NDMP_DIR)/ndmp_xdr.h $(NDMP_DIR)/ndmp_xdr.c
diff --git a/usr/src/cmd/refer/Makefile b/usr/src/cmd/refer/Makefile
index 4adb63a15d..1bd28a19b7 100644
--- a/usr/src/cmd/refer/Makefile
+++ b/usr/src/cmd/refer/Makefile
@@ -91,7 +91,7 @@ sortbib:= POBJS= sortbib.o
.PARALLEL: $(OBJS)
-all: $(PROG) $(PROG3) $(OTXTS) $(SUBDIRS)
+all: $(PROG) $(PROG3) $(OTXTS)
$(PROG1) $(PROG3): $$(POBJS)
$(LINK.c) -o $@ $(POBJS) $(LDFLAGS) $(LDLIBS)
diff --git a/usr/src/cmd/sgs/lex/common/main.c b/usr/src/cmd/sgs/lex/common/main.c
index 975827996a..bd9d242ffc 100644
--- a/usr/src/cmd/sgs/lex/common/main.c
+++ b/usr/src/cmd/sgs/lex/common/main.c
@@ -28,13 +28,15 @@
/* Copyright 1976, Bell Telephone Laboratories, Inc. */
-#pragma ident "%Z%%M% %I% %E% SMI"
+/* Copyright (c) 2013, joyent, Inc. All rights reserved. */
#include <string.h>
#include "once.h"
#include "sgs.h"
#include <locale.h>
#include <limits.h>
+#include <unistd.h>
+#include <libgen.h>
static wchar_t L_INITIAL[] = {'I', 'N', 'I', 'T', 'I', 'A', 'L', 0};
static void get1core(void);
@@ -46,12 +48,32 @@ static void get3core(void);
static void free3core(void);
#endif
+static int
+lex_construct_path(char *buf, size_t size, const char *file, int type)
+{
+ int ret;
+ char origin[PATH_MAX];
+
+ if (type != 0) {
+ ret = readlink("/proc/self/path/a.out", origin, PATH_MAX - 1);
+ if (ret < 0)
+ error(
+ "lex: failed to read origin from /proc\n");
+ origin[ret] = '\0';
+ return (snprintf(buf, size, "%s/../%s/%s", dirname(origin),
+ NBASE, file));
+ }
+
+ return (snprintf(buf, size, "%s/%s/%s", NPREFIX, NBASE, file));
+}
+
int
main(int argc, char **argv)
{
int i;
int c;
- char *path = NULL;
+ char *path = NULL, *bpath = NULL;
+ char pathbuf[PATH_MAX];
Boolean eoption = 0, woption = 0;
sargv = argv;
@@ -218,15 +240,31 @@ main(int argc, char **argv)
free3core();
#endif
+ /*
+ * Try to find the file relative to $ORIGIN. Note that we don't touch
+ * antyhing related to -Y. In fact, unfortunately it's always been
+ * ignored it seems.
+ */
if (handleeuc) {
if (ratfor)
error("Ratfor is not supported by -w or -e option.");
- path = EUCNAME;
+ bpath = EUCNAME;
}
else
- path = ratfor ? RATNAME : CNAME;
+ bpath = ratfor ? RATNAME : CNAME;
- fother = fopen(path, "r");
+ if (path == NULL) {
+ path = pathbuf;
+ (void) lex_construct_path(pathbuf, sizeof (pathbuf), bpath, 1);
+ fother = fopen(path, "r");
+ if (fother == NULL) {
+ (void) lex_construct_path(pathbuf, sizeof (pathbuf),
+ bpath, 0);
+ fother = fopen(path, "r");
+ }
+ } else {
+ fother = fopen(path, "r");
+ }
if (fother == NULL)
error("Lex driver missing, file %s", path);
while ((i = getc(fother)) != EOF)
diff --git a/usr/src/cmd/sgs/lex/common/once.h b/usr/src/cmd/sgs/lex/common/once.h
index 014ca00b17..9e4b0e5e00 100644
--- a/usr/src/cmd/sgs/lex/common/once.h
+++ b/usr/src/cmd/sgs/lex/common/once.h
@@ -26,11 +26,11 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
+/* Copyright (c) 2013, joyent, Inc. All rights reserved. */
+
#ifndef _ONCE_H
#define _ONCE_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ldefs.h"
/* once.c */
@@ -73,9 +73,11 @@ int peek = '\n'; /* next input character */
CHR *pushptr = pushc;
CHR *slptr = slist;
-#define CNAME "/usr/share/lib/ccs/ncform"
-#define RATNAME "/usr/share/lib/ccs/nrform"
-#define EUCNAME "/usr/share/lib/ccs/nceucform"
+#define NPREFIX "/usr"
+#define NBASE "/share/lib/ccs/"
+#define CNAME "ncform"
+#define RATNAME "nrform"
+#define EUCNAME "nceucform"
int ccount = 1;
int casecount = 1;
diff --git a/usr/src/cmd/sgs/yacc/common/dextern.h b/usr/src/cmd/sgs/yacc/common/dextern.h
index e90aa60468..54b441cac4 100644
--- a/usr/src/cmd/sgs/yacc/common/dextern.h
+++ b/usr/src/cmd/sgs/yacc/common/dextern.h
@@ -26,11 +26,13 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
#ifndef _DEXTERN_H
#define _DEXTERN_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <inttypes.h>
#include <ctype.h>
@@ -42,6 +44,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <wctype.h>
+#include <limits.h>
#ifdef __cplusplus
extern "C" {
@@ -301,6 +304,12 @@ extern int wscmp(const wchar_t *, const wchar_t *);
extern char *parser;
+#ifndef PBUFSIZE
+#define PBUFSIZE PATH_MAX
+#endif
+
+extern char pbuf[PBUFSIZE];
+
/* default settings for a number of macros */
/* name of yacc tempfiles */
@@ -324,7 +333,11 @@ extern char *parser;
#endif
#ifndef PARSER
-#define PARSER "/usr/share/lib/ccs/yaccpar"
+#define PARSER "/share/lib/ccs/yaccpar"
+#endif
+
+#ifndef PARSERPREFIX
+#define PARSERPREFIX "/usr"
#endif
/*
diff --git a/usr/src/cmd/sgs/yacc/common/y1.c b/usr/src/cmd/sgs/yacc/common/y1.c
index 845f82d367..0e67d9047b 100644
--- a/usr/src/cmd/sgs/yacc/common/y1.c
+++ b/usr/src/cmd/sgs/yacc/common/y1.c
@@ -26,7 +26,9 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include "dextern.h"
#include <sys/param.h>
@@ -34,6 +36,7 @@
#include <unistd.h>
#include <locale.h>
#include <stdarg.h> /* For error() */
+#include <libgen.h>
static void mktbls(void);
static void others(void);
@@ -236,6 +239,25 @@ mktbls()
lsetsize = INIT_LSIZE + 1;
}
+static int
+yacc_assemble_path(char *buf, size_t size, const char *file, int type)
+{
+ int ret;
+ char origin[PATH_MAX];
+
+ if (type != 0) {
+ ret = readlink("/proc/self/path/a.out", origin, PATH_MAX - 1);
+ if (ret < 0)
+ error(gettext(
+ "yacc: failed to read origin from /proc\n"));
+ origin[ret] = '\0';
+ return (snprintf(buf, size, "%s/../%s", dirname(origin),
+ file));
+ }
+
+ return (snprintf(buf, size, "%s/%s", PARSERPREFIX, file));
+}
+
/* put out other arrays, copy the parsers */
static void
others()
@@ -244,7 +266,17 @@ others()
int c, i, j;
int tmpline;
- finput = fopen(parser, "r");
+ if (parser == NULL) {
+ parser = pbuf;
+ (void) yacc_assemble_path(pbuf, PBUFSIZE, PARSER, 1);
+ finput = fopen(parser, "r");
+ if (finput == NULL) {
+ (void) yacc_assemble_path(pbuf, PBUFSIZE, PARSER, 0);
+ finput = fopen(parser, "r");
+ }
+ } else {
+ finput = fopen(parser, "r");
+ }
if (finput == NULL)
/*
* TRANSLATION_NOTE -- This is a message from yacc.
diff --git a/usr/src/cmd/sgs/yacc/common/y2.c b/usr/src/cmd/sgs/yacc/common/y2.c
index 3599d40904..ca8dcc61f5 100644
--- a/usr/src/cmd/sgs/yacc/common/y2.c
+++ b/usr/src/cmd/sgs/yacc/common/y2.c
@@ -26,7 +26,9 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include "dextern.h"
#include "sgs.h"
@@ -60,7 +62,8 @@ char *infile; /* input file name */
static int numbval; /* value of an input number */
static int toksize = NAMESIZE;
static wchar_t *tokname; /* input token name */
-char *parser = PARSER; /* location of common parser */
+char *parser = NULL; /* location of common parser */
+char pbuf[PBUFSIZE];
static void finact(void);
static wchar_t *cstash(wchar_t *);
diff --git a/usr/src/lib/Makefile.astmsg b/usr/src/lib/Makefile.astmsg
index 096805e825..ff8202d03a 100644
--- a/usr/src/lib/Makefile.astmsg
+++ b/usr/src/lib/Makefile.astmsg
@@ -47,8 +47,8 @@ MSGLIBNAME= $(LIBRARY:.a=)
ASTMSGCATALOG= $(ROOT)/usr/lib/locale/C/LC_MESSAGES/$(MSGLIBNAME)
$(DO_BUILD_AST_CATALOGS)ASTMSGCC= \
- PATH="/usr/ast/bin/:/bin:/usr/bin" \
- /usr/bin/ksh93 /usr/ast/bin/msgcc >>msgcc.out 2>&1
+ PATH="$(ASTBINDIR):/bin:/usr/bin" \
+ /usr/bin/ksh93 $(MSGCC) >>msgcc.out 2>&1
ASTMSGS= $(OBJECTS:%.o=msgs/%.mso)
diff --git a/usr/src/tools/scripts/bldenv.sh b/usr/src/tools/scripts/bldenv.sh
index 4720b7925e..86ed08d932 100644
--- a/usr/src/tools/scripts/bldenv.sh
+++ b/usr/src/tools/scripts/bldenv.sh
@@ -345,6 +345,10 @@ if [[ "${SUNWSPRO}" != "" ]]; then
export PATH="${SUNWSPRO}/bin:$PATH"
fi
+if [[ -n "${MAKE}" ]]; then
+ export PATH="$(dirname ${MAKE}):$PATH"
+fi
+
if [[ -z "$CLOSED_IS_PRESENT" ]]; then
if [[ -d $SRC/../closed ]]; then
export CLOSED_IS_PRESENT="yes"
diff --git a/usr/src/tools/scripts/nightly.sh b/usr/src/tools/scripts/nightly.sh
index 40d7b9c3f9..cd6a5bcb6a 100644
--- a/usr/src/tools/scripts/nightly.sh
+++ b/usr/src/tools/scripts/nightly.sh
@@ -1508,7 +1508,9 @@ DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
export o_FLAG X_FLAG POUND_SIGN RELEASE_DATE DEV_CM
maketype="distributed"
-MAKE=dmake
+if [ -z "$MAKE" ]; then
+ MAKE=dmake
+fi
# get the dmake version string alone
DMAKE_VERSION=$( $MAKE -v )
DMAKE_VERSION=${DMAKE_VERSION#*: }
diff --git a/usr/src/tools/scripts/xref.sh b/usr/src/tools/scripts/xref.sh
index 78c85bae81..d69a364fda 100644
--- a/usr/src/tools/scripts/xref.sh
+++ b/usr/src/tools/scripts/xref.sh
@@ -28,11 +28,10 @@
ONBLDDIR=$(dirname $(whence $0))
-PATH=/usr/bin:/usr/ccs/bin:${BUILD_TOOLS:-/opt}/teamware/bin:$ONBLDDIR
-export PATH
PROG=`basename $0`
XREFMK=`dirname $0`/xref.mk
XRMAKEFILE=Makefile export XRMAKEFILE
+MAKE="dmake -m serial"
#
# The CSCOPEOPTIONS variable can cause problems if it's set in the environment
@@ -163,7 +162,7 @@ if [ -z "$xrefs" ]; then
# Disable etags if we can't find it.
#
xrefs="cscope ctags"
- make -e -f $XREFMK xref.etags.check 2>/dev/null 1>&2 && \
+ $MAKE -e -f $XREFMK xref.etags.check 2>/dev/null 1>&2 && \
xrefs="$xrefs etags"
else
oldifs=$IFS
@@ -219,7 +218,7 @@ for dir in $dirs; do
# to purge any crud that may be lying around from previous aborted runs.
#
if [ -z "$clobber" ]; then
- make -e -f $XREFMK xref.clean > /dev/null
+ $MAKE -e -f $XREFMK xref.clean > /dev/null
fi
#
@@ -228,7 +227,7 @@ for dir in $dirs; do
if [ -z "$noflg" -a -z "$clobber" ]; then
SECONDS=0
info "$reldir: finding flg-related source files"
- make -e -f $XREFMK xref.flg > /dev/null
+ $MAKE -e -f $XREFMK xref.flg > /dev/null
if [ $? -ne 0 ]; then
warn "$reldir: unable to find flg-related source files"
else
@@ -248,19 +247,19 @@ for dir in $dirs; do
for xref in $xrefs; do
if [ -n "$clobber" ]; then
info "$reldir: clobbering $xref cross-reference"
- make -e -f $XREFMK xref.${xref}.clobber > /dev/null ||
+ $MAKE -e -f $XREFMK xref.${xref}.clobber > /dev/null ||
warn "$reldir: cannot clobber $xref cross-reference"
continue
fi
SECONDS=0
info "$reldir: building $xref cross-reference"
- make -e -f $XREFMK xref.${xref} > /dev/null ||
+ $MAKE -e -f $XREFMK xref.${xref} > /dev/null ||
fail "$reldir: cannot build $xref cross-reference"
timeinfo "$reldir: built $xref cross-reference"
done
- make -e -f $XREFMK xref.clean > /dev/null ||
+ $MAKE -e -f $XREFMK xref.clean > /dev/null ||
warn "$reldir: cannot clean up temporary files"
cd - > /dev/null
done