--- old/usr/src/cmd/make/bin/Makefile	2015-05-20 11:32:37.389704212 -0400
+++ new/usr/src/cmd/make/bin/Makefile	2015-05-20 11:32:37.407357755 -0400
@@ -25,7 +25,6 @@
 	make.o		\
 	misc.o		\
 	nse_printdep.o	\
-	nse.o		\
 	parallel.o	\
 	pmake.o		\
 	read.o		\
--- old/usr/src/cmd/make/bin/depvar.cc	2015-05-20 11:32:37.802884089 -0400
+++ new/usr/src/cmd/make/bin/depvar.cc	2015-05-20 11:32:37.814621617 -0400
@@ -82,38 +82,12 @@
 
 	for (dv = depvar_list; dv != NULL; dv = dv->next) {
 		if (name == dv->name) {
-#ifdef NSE
-			if (dv->cmdline) {
-				nse_dep_cmdmacro(dv->name->string);
-			}
-#endif
 			variant_deps = true;
 			break;
 		}
 	}
 }
 
-#ifdef NSE
-/*
- * The macro `name' has been used in either the argument
- * to a cd before a recursive make.  See if it was
- * defined on the command-line and, if so, complain.
- */
-void
-depvar_rule_macro_used(Name name)
-{
-	Depvar		dv;
-
-	for (dv = depvar_list; dv != NULL; dv = dv->next) {
-		if (name == dv->name) {
-			if (dv->cmdline) {
-				nse_rule_cmdmacro(dv->name->string);
-			}
-			break;
-		}
-	}
-}
-#endif
 
 /*
  * Print the results.  If any of the Dependency Variables
--- old/usr/src/cmd/make/bin/doname.cc	2015-05-20 11:32:38.206227201 -0400
+++ new/usr/src/cmd/make/bin/doname.cc	2015-05-20 11:32:38.219226742 -0400
@@ -342,9 +342,6 @@
 	Boolean			saved_commands_done;
 	Boolean			restart = false;
 	Boolean			save_parallel = parallel;
-#ifdef NSE
-	Boolean			save_readdep;
-#endif
 	Boolean			doing_subtree = false;
 
 	Boolean			recheck_conditionals = false;
@@ -374,9 +371,6 @@
 			}
 		}
 	}
-#ifdef NSE
-        nse_check_file_backquotes(target->string);
-#endif
 #endif
 	/*
 	 * If the target is a constructed one for a "::" target,
@@ -524,14 +518,7 @@
  */
 	if (!target->has_depe_list_expanded)
 	{
-#ifdef NSE
-		save_readdep = reading_dependencies;
-		reading_dependencies= true;
-#endif
 		dynamic_dependencies(target);
-#ifdef NSE
-		reading_dependencies= save_readdep;
-#endif
 	}
 
 /*
@@ -799,10 +786,6 @@
 		if (result != build_failed) {
 			result = run_command(command, 
 					     (Boolean) ((parallel || save_parallel) && !silent));
-#ifdef NSE
-			nse_check_no_deps_no_rule(target,
-				get_prop(target->prop, line_prop), command);
-#endif
 		}
 		switch (result) {
 #ifdef TEAMWARE_MAKE_CMN
@@ -1070,13 +1053,6 @@
 			    (dependency->name->state == build_failed)) {
 				dep_result = (Doname) dependency->name->state;
 			} else {
-#ifdef NSE
-				nse_check_sccs(target->string,
-					       dependency->name->string);
-                                nse_check_derived_src(target,
-	                                       dependency->name->string,
-	                                       line->body.line.command_template);
-#endif
 				dep_result = doname_check(dependency->name,
 							  do_get,
 							  false,
@@ -1585,9 +1561,6 @@
 		/* If dependency name string contains shell wildcards */
 		/* replace the name with the expansion */
 		if (dependency->name->wildcard) {
-#ifdef NSE
-	                nse_wildcard(target->string, dependency->name->string);
-#endif
 			wcb.init(dependency->name);
 			if ((start = (wchar_t *) wschr(wcb.get_string(),
 					   (int) parenleft_char)) != NULL) {
@@ -1985,13 +1958,7 @@
 				               (Boolean) rule->always_exec,
 				               target,
 				               send_mtool_msgs);
-#ifdef NSE
-				nse_did_recursion= false;
-#endif
 				check_state(temp_file_name);
-#ifdef NSE
-				nse_check_cd(line);
-#endif
 			}
 			SEND_MTOOL_MSG(
 				append_job_result_msg(job_result_msg);
--- old/usr/src/cmd/make/bin/globals.cc	2015-05-20 11:32:38.886464155 -0400
+++ new/usr/src/cmd/make/bin/globals.cc	2015-05-20 11:32:38.898478728 -0400
@@ -120,17 +120,6 @@
 	char		*mbs_ptr2;
 	int		mtool_msgs_fd;
 	Boolean		depinfo_already_read = false;
-#ifdef NSE
-        Name		derived_src;
-	Boolean		nse;				/* NSE on */
-        Name            nse_backquote_seen;
-	char		nse_depinfo_lockfile[MAXPATHLEN];
-	Boolean		nse_depinfo_locked;
-        Boolean         nse_did_recursion;
-        Name            nse_shell_var_used;
-        Boolean         nse_watch_vars = false;
-	wchar_t		current_makefile[MAXPATHLEN];
-#endif
 	Boolean		no_action_was_taken = true;	/* true if we've not **
 							** run any command   */
 
--- old/usr/src/cmd/make/bin/implicit.cc	2015-05-20 11:32:39.294459823 -0400
+++ new/usr/src/cmd/make/bin/implicit.cc	2015-05-20 11:32:39.306650189 -0400
@@ -286,10 +286,6 @@
 							       line_prop))) {
 					result = (Doname) source->state;
 				} else {
-#ifdef NSE
-		                        nse_check_derived_src(target, source->string,
-		                         source_suffix->body.suffix.command_template);
-#endif
 #if 0  /* with_squiggle sends false, which is buggy. : djay */
 					result = doname(source,
 							(Boolean) source_suffix->body.
--- old/usr/src/cmd/make/bin/main.cc	2015-05-20 11:32:39.802325456 -0400
+++ new/usr/src/cmd/make/bin/main.cc	2015-05-20 11:32:39.814795962 -0400
@@ -371,10 +371,6 @@
 	make_state_lockfile = NULL;
 	make_state_locked = false;
 
-#ifdef NSE
-	nse_depinfo_lockfile[0] = '\0';
-	nse_depinfo_locked = false; 
-#endif
 
 	/*
 	 * look for last slash char in the path to look at the binary 
@@ -698,15 +694,11 @@
 	}
 
 /*
- *	Make sure SUNPRO_DEPENDENCIES is exported (or not) properly
- *      and NSE_DEP.
+ *	Make sure SUNPRO_DEPENDENCIES is exported (or not) properly.
  */
 	if (keep_state) {
 		maybe_append_prop(sunpro_dependencies, macro_prop)->
 		  body.macro.exported = true;
-#ifdef NSE
-		(void) setenv(NOCATGETS("NSE_DEP"), get_current_path());
-#endif
 	} else {
 		maybe_append_prop(sunpro_dependencies, macro_prop)->
 		  body.macro.exported = false;
@@ -769,9 +761,6 @@
 
 	report_dir_enter_leave(false);
 
-#ifdef NSE
-        exit(nse_exit_status());
-#else
 	if (build_failed_ever_seen) {
 		if (posix) {
 			exit_status = 1;
@@ -780,7 +769,6 @@
 	}
 	exit_status = 0;
 	exit(0);
-#endif
 	/* NOTREACHED */
 }
 
@@ -815,11 +803,6 @@
 cleanup_after_exit(void)
 {
 	Running		rp;
-#ifdef NSE
-	char		push_cmd[NSE_TFS_PUSH_LEN + 3 +
-			         (MAXPATHLEN * MB_LEN_MAX) + 12];
-	char		*active;
-#endif
 
 extern long	getname_bytes_count;
 extern long	getname_names_count;
@@ -960,24 +943,6 @@
 #endif
 #endif
 
-#ifdef NSE
-        /* If running inside an activated environment, push the */
-	/* .nse_depinfo file (if written) */
-	active = getenv(NSE_VARIANT_ENV);
-	if (keep_state &&
-	    (active != NULL) &&
-	    !IS_EQUAL(active, NSE_RT_SOURCE_NAME) &&
-	    !do_not_exec_rule &&
-	    (report_dependencies_level == 0)) {
-		(void) sprintf(push_cmd,
-			       "%s %s/%s",
-			       NSE_TFS_PUSH,
-			       get_current_path(),
-			       NSE_DEPINFO);
-		(void) system(push_cmd);
-	}
-#endif
-
 /*
 #ifdef DISTRIBUTED
     }
@@ -1162,13 +1127,6 @@
 		make_state_lockfile = NULL;
 		make_state_locked = false;
 	}
-#ifdef NSE
-	if ((nse_depinfo_lockfile[0] != '\0') && (nse_depinfo_locked)) {
-		unlink(nse_depinfo_lockfile);
-		nse_depinfo_lockfile[0] = '\0';
-		nse_depinfo_locked = false;
-	}
-#endif
 	/*
 	 * Re-read .make.state file (it might be changed by recursive make)
 	 */
@@ -1700,16 +1658,6 @@
 			debug_level++;
 		}
 		return 0;
-#ifdef NSE
-	case 'E':
-		if (invert_this) {
-			nse = false;
-		} else {
-			nse = true;
-		}
-		nse_init_source_suffixes();
-		return 0;
-#endif
 	case 'e':			 /* Environment override flag */
 		if (invert_this) {
 			env_wins = false;
@@ -2060,7 +2008,6 @@
  *		makefile_type	Set to type of file being read
  *		makeflags	The Name "MAKEFLAGS", used to set macro value
  *		not_auto	dwight
- *		nse		Set if NSE_ENV is in the environment
  *		read_trace_level Checked to se if the reader should trace
  *		report_dependencies If -P is on we do not read .make.state
  *		trace_reader	Set if reader should trace
@@ -2127,11 +2074,6 @@
 /*
  *	Set flag if NSE is active
  */
-#ifdef NSE
-	if (getenv(NOCATGETS("NSE_ENV")) != NULL) {
-		nse = true;
-	}
-#endif
 
 /*
  *	initialize global dependency entry for .NOT_AUTO
@@ -2236,11 +2178,6 @@
 		append_char('d', &makeflags_string);
 		append_char('d', &makeflags_string_posix);
 	}
-#ifdef NSE
-	if (nse) {
-		append_char('E', &makeflags_string);
-	}
-#endif
 	if (env_wins) {
 		append_char('e', &makeflags_string);
 		append_char('e', &makeflags_string_posix);
@@ -3044,25 +2981,17 @@
 		}
 
 		/*
-		 * We ignore SUNPRO_DEPENDENCIES and NSE_DEP. Those
-		 * environment variables are set by make and read by 
-		 * cpp which then writes info to .make.dependency.xxx and 
-		 * .nse_depinfo. When make is invoked by another make 
-		 * (recursive make), we don't want to read this because 
-		 * then the child make will end up writing to the parent 
-		 * directory's .make.state and .nse_depinfo and clobbering
-		 * them. 
+		 * We ignore SUNPRO_DEPENDENCIES. This environment variable is
+		 * set by make and read by cpp which then writes info to
+		 * .make.dependency.xxx.  When make is invoked by another make
+		 * (recursive make), we don't want to read this because then
+		 * the child make will end up writing to the parent
+		 * directory's .make.state and clobbering them.
 		 */
 		MBSTOWCS(wcs_buffer2, NOCATGETS("SUNPRO_DEPENDENCIES"));
 		if (IS_WEQUALN(name, wcs_buffer2, wslen(wcs_buffer2))) {
 			continue;
 		}
-#ifdef NSE
-		MBSTOWCS(wcs_buffer2, NOCATGETS("NSE_DEP"));
-		if (IS_WEQUALN(name, wcs_buffer2, wslen(wcs_buffer2))) {
-			continue;
-		}
-#endif
 
 		macro = GETNAME(name, value - name);
 		maybe_append_prop(macro, macro_prop)->body.macro.exported =
@@ -3076,13 +3005,6 @@
 					    GETNAME(value + 1, FIND_LENGTH),
 					    false, no_daemon, false, debug_level);
 		}
-#ifdef NSE
-                /*
-	         * Must be after the call to setvar() as it sets
-	         * imported to false.
-	         */
-		maybe_append_prop(macro, macro_prop)->body.macro.imported = true;
-#endif
 		val->body.macro.read_only = read_only_saved;
 		if (alloced_tmp_wcs_buffer) {
 			retmem(tmp_wcs_buffer);
@@ -3117,9 +3039,6 @@
 	
 	makefile_type = reading_makefile;
 	recursion_level = 0;
-#ifdef NSE
-	wscpy(current_makefile, makefile->string);
-#endif
 	reading_dependencies = true;
 	b = read_simple_file(makefile, true, true, complain,
 			     must_exist, report_file, false);
@@ -3410,9 +3329,6 @@
 		 * This can happen when there is no makefile and
 		 * only implicit rules are being used.
 		 */
-#ifdef NSE
-		nse_no_makefile(target);
-#endif
 		return;
 	}
 	(void) fprintf(report_file,
--- old/usr/src/cmd/make/bin/misc.cc	2015-05-20 11:32:40.484382108 -0400
+++ new/usr/src/cmd/make/bin/misc.cc	2015-05-20 11:32:40.496170174 -0400
@@ -608,10 +608,6 @@
 	posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
 	MBSTOWCS(wcs_buffer, NOCATGETS(".DEFAULT"));
 	default_rule_name = GETNAME(wcs_buffer, FIND_LENGTH);
-#ifdef NSE
-	MBSTOWCS(wcs_buffer, NOCATGETS(".DERIVED_SRC"));
-        derived_src= GETNAME(wcs_buffer, FIND_LENGTH);
-#endif
 	MBSTOWCS(wcs_buffer, NOCATGETS("$"));
 	dollar = GETNAME(wcs_buffer, FIND_LENGTH);
 	MBSTOWCS(wcs_buffer, NOCATGETS(".DONE"));
@@ -694,9 +690,6 @@
 	posix_name->special_reader = posix_special;
 	built_last_make_run->special_reader = built_last_make_run_special;
 	default_rule_name->special_reader = default_special;
-#ifdef NSE
-        derived_src->special_reader= derived_src_special;
-#endif
 	dot_keep_state->special_reader = keep_state_special;
 	dot_keep_state_file->special_reader = keep_state_file_special;
 	ignore_name->special_reader = ignore_special;
--- old/usr/src/cmd/make/bin/nse.cc	2015-05-20 11:32:40.946334079 -0400
+++ /dev/null	2015-05-20 11:32:40.000000000 -0400
@@ -1,499 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1994 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifdef NSE
-
-/*
- * Included files
- */
-#include <mk/defs.h>
-#include <mksh/macro.h>		/* expand_value() */
-#include <mksh/misc.h>		/* get_prop() */
-
-/*
- * This file does some extra checking on behalf of the NSE.
- * It does some stuff that is analogous to lint in that it
- * looks for things which may be legal but that give the NSE
- * trouble.  Currently it looks for:
- *	1) recursion by cd'ing to a directory specified by a 
- *	   make variable that is defined from the shell environment.
- *	2) recursion by cd'ing to a directory specified by a
- *         make variable that has backquotes in it.
- *	3) recursion to another makefile in the same directory.
- *	4) a dependency upon an SCCS file (SCCS/s.*)
- *	5) backquotes in a file name
- *	6) a make variable being defined on the command-line that
- *	   ends up affecting dependencies
- *	7) wildcards (*[) in dependencies
- *	8) recursion to the same directory
- *	9) potential source files on the left-hand-side so
- *	   that they appear as derived files
- *
- * Things it should look for:
- *	1) makefiles that are symlinks (why are these a problem?)
- */
-
-#define TARG_SUFX	"/usr/nse/lib/nse_targ.sufx"
-
-typedef	struct _Nse_suffix	*Nse_suffix, Nse_suffix_rec;
-struct _Nse_suffix {
-	wchar_t			*suffix;	/* The suffix */
-	struct _Nse_suffix	*next;		/* Linked list */
-};
-static Nse_suffix	sufx_hdr;
-static int		our_exit_status;
-
-static void		nse_warning(void);
-static Boolean		nse_gettoken(wchar_t **, wchar_t *);
-
-/*
- * Given a command that has just recursed to a sub make
- * try to determine if it cd'ed to a directory that was
- * defined by a make variable imported from the shell
- * environment or a variable with backquotes in it.
- * This routine will find something like:
- *	cd $(DIR); $(MAKE)
- * where DIR is imported from the shell environment.
- * However it well not find:
- *	CD = cd
- *		$(CD) $(DIR); $(MAKE)
- * or
- *	CD = cd $(DIR)
- *		$(CD); $(MAKE)
- *
- * This routine also checks for recursion to the same
- * directory.
- */
-void
-nse_check_cd(Property prop)
-{
-	wchar_t		tok[512];
-	wchar_t		*p;
-	wchar_t		*our_template;
-	int		len;
-	Boolean		cd;
-	String_rec	string;
-	Name		name;
-	Name		target;
-	struct	Line	*line;
-	struct	Recursive *r;
-	Property	recurse;
-	wchar_t		strbuf[STRING_BUFFER_LENGTH];
-	wchar_t		tmpbuf[STRING_BUFFER_LENGTH];
-
-#ifdef LTEST
-	printf("In nse_check_cd, nse = %d, nse_did_recursion = %d\n", nse, nse_did_recursion);
-#endif
-	if (!nse_did_recursion || !nse) {
-#ifdef LTEST
-		printf ("returning,  nse = %d,  nse_did_recursion = %d\n", nse, nse_did_recursion);
-#endif
-		return;
-	}
-	line = &prop->body.line;
-#ifdef LTEST
-	printf("string = %s\n", line->command_template->command_line->string_mb);
-#endif
-
-	wscpy(tmpbuf, line->command_template->command_line->string);
-	our_template = tmpbuf;
-	cd = false;
-	while (nse_gettoken(&our_template, tok)) {
-#ifdef LTEST
-		printf("in gettoken loop\n");
-#endif
-		if (IS_WEQUAL(tok, (wchar_t *) "cd")) {
-			cd = true;
-		} else if (cd && tok[0] == '$') {
-			nse_backquote_seen = NULL;
-			nse_shell_var_used = NULL;
-			nse_watch_vars = true;
-			INIT_STRING_FROM_STACK(string, strbuf);
-			name = GETNAME(tok, FIND_LENGTH);
-			expand_value(name, &string, false);
-			nse_watch_vars = false;
-
-#ifdef LTEST
-			printf("cd = %d, tok = $\n", cd);
-#endif
-			/*
-			 * Try to trim tok to just
-			 * the variable.
-			 */
-			if (nse_shell_var_used != NULL) {
-				nse_warning();
-				fprintf(stderr, "\tMake invoked recursively by cd'ing to a directory\n\tdefined by the shell environment variable %s\n\tCommand line: %s\n",
-				    nse_shell_var_used->string_mb,
-				    line->command_template->command_line->string_mb);
-			}
-			if (nse_backquote_seen != NULL) {
-				nse_warning();
-				fprintf(stderr, "\tMake invoked recursively by cd'ing to a directory\n\tdefined by a variable (%s) with backquotes in it\n\tCommand line: %s\n",
-				    nse_backquote_seen->string_mb,
-				    line->command_template->command_line->string_mb);
-			}
-			cd = false;
-		} else if (cd && nse_backquotes(tok)) {
-			nse_warning();
-			fprintf(stderr, "\tMake invoked recursively by cd'ing to a directory\n\tspecified by a command in backquotes\n\tCommand line: %s\n",
-			    line->command_template->command_line->string_mb);
-			cd = false;
-		} else {
-			cd = false;
-		}
-	}
-
-	/*
-	 * Now check for recursion to ".".
-	 */
-	if (primary_makefile != NULL) {
-		target = prop->body.line.target;
-		recurse = get_prop(target->prop, recursive_prop);
-		while (recurse != NULL) {
-			r = &recurse->body.recursive;
-			if (IS_WEQUAL(r->directory->string, (wchar_t *) ".") &&
-			    !IS_WEQUAL(r->makefiles->name->string, 
-                            primary_makefile->string)) {
-				nse_warning();
-				fprintf(stderr, "\tRecursion to makefile `%s' in the same directory\n\tCommand line: %s\n",
-				    r->makefiles->name->string_mb,
-				    line->command_template->command_line->string_mb);
-			}
-			recurse = get_prop(recurse->next, recursive_prop);
-		}
-	}
-}
-
-/*
- * Print an NSE make warning line.
- * If the -P flag was given then consider this a fatal
- * error, otherwise, just a warning.
- */
-static void
-nse_warning(void)
-{
-	if (report_dependencies_level > 0) {
-		our_exit_status = 1;
-	}
-	if (primary_makefile != NULL) {
-		fprintf(stderr, "make: NSE warning from makefile %s/%s:\n",
-			get_current_path(), primary_makefile->string_mb);
-	} else {
-		fprintf(stderr, "make: NSE warning from directory %s:\n",
-			get_current_path());
-	}
-}
-
-/*
- * Get the next whitespace delimited token pointed to by *cp.
- * Return it in tok.
- */
-static Boolean
-nse_gettoken(wchar_t **cp, wchar_t *tok)
-{
-	wchar_t		*to;
-	wchar_t		*p;
-
-	p = *cp;
-	while (*p && iswspace(*p)) {
-		p++;
-	}
-	if (*p == '\0') {
-		return false;
-	}
-	to = tok;
-	while (*p && !iswspace(*p)) {
-		*to++ = *p++;
-	}
-	if (*p == '\0') {
-		return false;
-	}
-	*to = '\0';
-	*cp = p;
-	return true;
-}
-
-/*
- * Given a dependency and a target, see if the dependency
- * is an SCCS file.  Check for the last component of its name
- * beginning with "s." and the component before that being "SCCS".
- * The NSE does not consider a source file to be derived from
- * an SCCS file.
- */
-void
-nse_check_sccs(wchar_t *targ, wchar_t *dep)
-{
-	wchar_t		*slash;
-	wchar_t		*p;
-
-	if (!nse) {
-		return;
-	}
-	slash = wsrchr(dep, (int) slash_char); 
-	if (slash == NULL) {
-		return;
-	}
-	if (slash[1] != 's' || slash[2] != '.') {
-		return;
-	}
-
-	/*
-	 * Find the next to last filename component.
-	 */
-	for (p = slash - 1; p >= dep; p--) {
-		if (*p == '/') {
-			break;
-		}
-	}
-	p++;
-	MBSTOWCS(wcs_buffer, "SCCS/");
-	if (IS_WEQUALN(p, wcs_buffer, wslen(wcs_buffer))) {
-		nse_warning();
-		WCSTOMBS(mbs_buffer, targ);
-		WCSTOMBS(mbs_buffer2, dep);
-		fprintf(stderr, "\tFile `%s' depends upon SCCS file `%s'\n",
-			mbs_buffer, mbs_buffer2);
-	}
-	return;
-}
-
-/*
- * Given a filename check to see if it has 2 backquotes in it.
- * Complain about this because the shell expands the backquotes
- * but make does not so the files always appear to be out of date.
- */
-void
-nse_check_file_backquotes(wchar_t *file)
-{
-	if (!nse) {
-		return;
-	}
-	if (nse_backquotes(file)) {
-		nse_warning();
-		WCSTOMBS(mbs_buffer, file);
-		fprintf(stderr, "\tFilename \"%s\" has backquotes in it\n",
-			mbs_buffer);
-	}
-}
-
-/*
- * Return true if the string has two backquotes in it.
- */
-Boolean
-nse_backquotes(wchar_t *str)
-{
-	wchar_t		*bq;
-
-	bq = wschr(str, (int) backquote_char);
-	if (bq) {
-		bq = wschr(&bq[1], (int) backquote_char);
-		if (bq) {
-			return true;
-		}
-	}
-	return false;
-}
-
-/*
- * A macro that was defined on the command-line was found to affect the
- * set of dependencies.  The NSE "target explode" will not know about
- * this and will not get the same set of dependencies.
- */
-void
-nse_dep_cmdmacro(wchar_t *macro)
-{
-	if (!nse) {
-		return;
-	}
-	nse_warning();
-	WCSTOMBS(mbs_buffer, macro);
-	fprintf(stderr, "\tVariable `%s' is defined on the command-line and\n\taffects dependencies\n",
-		mbs_buffer);
-}
-
-/*
- * A macro that was defined on the command-line was found to
- * be part of the argument to a cd before a recursive make.
- * This make cause the make to recurse to different places
- * depending upon how it is invoked.
- */
-void
-nse_rule_cmdmacro(wchar_t *macro)
-{
-	if (!nse) {
-		return;
-	}
-	nse_warning();
-	WCSTOMBS(mbs_buffer, macro);
-	fprintf(stderr, "\tMake invoked recursively by cd'ing to a directory\n\tspecified by a variable (%s) defined on the command-line\n",
-		mbs_buffer);
-}
-
-/*
- * A dependency has been found with a wildcard in it.
- * This causes the NSE problems because the set of dependencies
- * can change without changing the Makefile.
- */
-void
-nse_wildcard(wchar_t *targ, wchar_t *dep)
-{
-	if (!nse) {
-		return;
-	}
-	nse_warning();
-	WCSTOMBS(mbs_buffer, targ);
-	WCSTOMBS(mbs_buffer2, dep);
-	fprintf(stderr, "\tFile `%s' has a wildcard in dependency `%s'\n",
-		mbs_buffer, mbs_buffer2);
-}
-
-/*
- * Read in the list of suffixes that are interpreted as source
- * files.
- */
-void
-nse_init_source_suffixes(void)
-{
-	FILE		*fp;
-	wchar_t		suffix[100];
-	Nse_suffix	sufx;
-	Nse_suffix	*bpatch;
-
-	fp = fopen(TARG_SUFX, "r");
-	if (fp == NULL) {
-		return;
-	}
-	bpatch = &sufx_hdr;
-	while (fscanf(fp, "%s %*s", suffix) == 1) {
-		sufx = ALLOC(Nse_suffix);  
-		sufx->suffix = wscpy(ALLOC_WC(wslen(suffix) + 1), suffix);
-		sufx->next = NULL;
-		*bpatch = sufx;
-		bpatch = &sufx->next;
-	}
-	fclose(fp);
-}
-
-/*
- * Check if a derived file (something with a dependency) appears
- * to be a source file (by its suffix) but has no rule to build it.
- * If so, complain.
- *
- * This generally arises from the old-style of make-depend that
- * produces:
- *	foo.c:	foo.h
- */
-void
-nse_check_derived_src(Name target, wchar_t *dep, Cmd_line command_template)
-{
-	Nse_suffix	sufx;
-	wchar_t		*suffix;
-	wchar_t		*depsufx;
-
-	if (!nse) {
-		return;
-	}
-	if (target->stat.is_derived_src) {
-		return;
-	}
-	if (command_template != NULL) {
-		return;
-	}
-	suffix = wsrchr(target->string, (int) period_char ); 
-	if (suffix != NULL) {
-		for (sufx = sufx_hdr; sufx != NULL; sufx = sufx->next) {
-			if (IS_WEQUAL(sufx->suffix, suffix)) {
-				nse_warning();
-				WCSTOMBS(mbs_buffer, dep);
-				fprintf(stderr, "\tProbable source file `%s' appears as a derived file\n\tas it depends upon file `%s', but there is\n\tno rule to build it\n",
-					target->string_mb, mbs_buffer);
-				break;
-			}
-		}
-	}
-}
-
-/*
- * See if a target is a potential source file and has no
- * dependencies and no rule but shows up on the right-hand
- * side.  This tends to occur from old "make depend" output.
- */
-void
-nse_check_no_deps_no_rule(Name target, Property line, Property command)
-{
-	Nse_suffix	sufx;
-	wchar_t		*suffix;
-
-	if (!nse) {
-		return;
-	}
-	if (target->stat.is_derived_src) {
-		return;
-	}
-	if (line != NULL && line->body.line.dependencies != NULL) {
-		return;
-	}
-	if (command->body.line.sccs_command) {
-		return;
-	}
-	suffix = wsrchr(target->string, (int) period_char); 
-	if (suffix != NULL) {
-		for (sufx = sufx_hdr; sufx != NULL; sufx = sufx->next) {
-			if (IS_WEQUAL(sufx->suffix, suffix)) {
-				if (command->body.line.command_template == NULL) {
-					nse_warning();
-					fprintf(stderr, "\tProbable source file `%s' appears as a derived file because\n\tit is on the left-hand side, but it has no dependencies and\n\tno rule to build it\n",
-						target->string_mb);
-				}
-			}
-		}
-	} 
-} 
-
-/*
- * Detected a situation where a recursive make derived a file
- * without using a makefile.
- */
-void
-nse_no_makefile(Name target)
-{
-	if (!nse) {
-		return;
-	}
-	nse_warning();
-	fprintf(stderr, "Recursive make to derive %s did not use a makefile\n",
-		target->string_mb);
-}
-
-/*
- * Return the NSE exit status.
- * If the -P flag was given then a warning is considered fatal
- */
-int
-nse_exit_status(void)
-{
-	return our_exit_status;
-}
-#endif
--- old/usr/src/cmd/make/bin/nse_printdep.cc	2015-05-20 11:32:41.126083143 -0400
+++ new/usr/src/cmd/make/bin/nse_printdep.cc	2015-05-20 11:32:41.143745980 -0400
@@ -167,9 +167,6 @@
 	 * files and are not the result of sccs get.
 	 */
 	if (should_print_dep(line)) {
-#ifdef NSE
-		nse_check_no_deps_no_rule(target, line, line);
-#endif
 		if ((report_dependencies_level == 2) ||
 		    (report_dependencies_level == 4)) {
 			if (is_out_of_date(line)) {
--- old/usr/src/cmd/make/bin/read.cc	2015-05-20 11:32:42.273530284 -0400
+++ new/usr/src/cmd/make/bin/read.cc	2015-05-20 11:32:42.285758558 -0400
@@ -116,12 +116,6 @@
 
 	wchar_t * wcb = get_wstring(makefile_name->string_mb);
 
-#ifdef NSE
-	if (report_file){
-		wscpy(previous_current_makefile, current_makefile);
-		wscpy(current_makefile, wcb);
-	}
-#endif 
 	if (max_include_depth++ >= 40) {
 		fatal(catgets(catd, 1, 66, "Too many nested include statements"));
 	}
@@ -407,11 +401,6 @@
 		(void) printf(catgets(catd, 1, 74, ">>>>>>>>>>>>>>>> End of makefile %s\n"),
 			      makefile_name->string_mb);
 	}
-#ifdef NSE
-	if (report_file && (previous_current_makefile[0] != NULL)) {
-		wscpy(current_makefile, previous_current_makefile);
-	}
-#endif
 	if(file_being_read) {
 		retmem(file_being_read);
 	}
--- old/usr/src/cmd/make/bin/read2.cc	2015-05-20 11:32:42.876180770 -0400
+++ new/usr/src/cmd/make/bin/read2.cc	2015-05-20 11:32:42.888444289 -0400
@@ -586,9 +586,6 @@
 	/* Check if this is a .RECURSIVE line */
 	if ((depes->used >= 3) &&
 	    (depes->names[0] == recursive_name)) {
-#ifdef NSE
-                nse_did_recursion= true;
-#endif
 		target->has_recursive_dependency = true;
 		depes->names[0] = NULL;
 		recursive_state = 0;
@@ -886,10 +883,6 @@
 				if (automatic) {
 					dp->built = false;
 					depe->stat.is_file = true;
-#ifdef NSE
-				        depe->has_parent= true;
-				        depe->is_target= true;
-#endif
 				}
 			}
 			dp->stale = false;
@@ -904,18 +897,11 @@
 	dp->stale = false;
 	dp->built = false;
 	depe->stat.is_file = true;
-#ifdef NSE
-        depe->has_parent= true;
-        depe->is_target= true;
-#endif
 
 	if ((makefile_type == reading_makefile) &&
 	    (line != NULL) &&
 	    (line->body.line.target != NULL)) {
 		line->body.line.target->has_regular_dependency = true;
-#ifdef NSE
-                line->body.line.target->is_target= true;
-#endif
 	}
 }
 
@@ -1197,18 +1183,6 @@
 		}
 		break;
 
-#ifdef NSE
-	case derived_src_special:
-		for (; depes != NULL; depes= depes->next)
-			for (n= 0; n < depes->used; n++) {
-				if (trace_reader)
-					(void)printf("%s:\t%s\n",
-					precious->string_mb,
-					depes->names[n]->string_mb);
-				depes->names[n]->stat.is_derived_src= true;
-			};
-	        break;
-#endif
 
 	case ignore_special:
 		if ((depes->used != 0) &&(!posix)){
--- old/usr/src/cmd/make/bin/rep.cc	2015-05-20 11:32:43.417935071 -0400
+++ new/usr/src/cmd/make/bin/rep.cc	2015-05-20 11:32:43.429929914 -0400
@@ -312,136 +312,6 @@
 	}
 }
 
-#ifdef NSE
-/*
- *	report_recursive_done()
- *
- *	Write the .nse_depinfo file.
- *
- *	Parameters:
- *
- *	Static variables used:
- *		recursive_list	The list of targets
- *		changed		Written if report set changed
- *
- *	Global variables used:
- *		recursive_name	The Name ".RECURSIVE", compared against
- */
-void
-report_recursive_done(void)
-{
-	char		*search_dir;
-	char		nse_depinfo[MAXPATHLEN];
-	char		tmpfile[MAXPATHLEN];
-	FILE		*ofp;
-	FILE		*ifp;
-	wchar_t		*space;
-	wchar_t		*data;
-	wchar_t		*line;
-	wchar_t		*bigger_line;
-	int		line_size, line_index;
-	int		lock_err;
-	Recursive_make	rp;
-
-	if (changed == false) {
-		return;
-	}
-
-	search_dir = getenv(NOCATGETS("NSE_DEP"));
-	if (search_dir == NULL) {
-		return;
-	}
-	(void) sprintf(nse_depinfo, "%s/%s", search_dir, NSE_DEPINFO);
-	(void) sprintf(tmpfile, "%s.%d", nse_depinfo, getpid());
-	ofp = fopen(tmpfile, "w");
-	if (ofp == NULL) {
-		(void) fprintf(stderr,
-			       catgets(catd, 1, 116, "Cannot open `%s' for writing\n"),
-			       tmpfile);
-		return;
-	}
-	(void) sprintf(nse_depinfo_lockfile, 
-		       "%s/%s", search_dir, NSE_DEPINFO_LOCK);
-	if (lock_err = file_lock(nse_depinfo, 
-				 nse_depinfo_lockfile, 
-				 (int *) &nse_depinfo_locked, 0)) {
-		(void) fprintf(stderr,
-			       catgets(catd, 1, 117, "writing .RECURSIVE lines to %s\n"),
-			       tmpfile);
-		(void) fprintf(stderr,
-			       catgets(catd, 1, 118, "To recover, merge .nse_depinfo.%d with .nse_depinfo\n"),
-			       getpid(),
-			       catgets(catd, 1, 119, "with .nse_depinfo"));
-	}
-
-	if (nse_depinfo_locked) {
-		ifp = fopen(nse_depinfo, "r");
-		if (ifp != NULL) {
-			/*
-			 * Copy all the non-.RECURSIVE lines from 
-			 * the old file to the new one.
-			 */
-			line_size = MAXPATHLEN;
-			line_index = line_size - 1;
-			line = ALLOC_WC(line_size);
-			while (fgetws(line, line_size, ifp) != NULL) {
-				while (wslen(line) == line_index) {
-					if (line[wslen(line) - 1] == '\n') {
-						continue;
-					}
-					bigger_line = ALLOC_WC(2 * line_size);
-					wscpy(bigger_line, line);
-					retmem(line);
-					line = bigger_line;
-					if (fgetws(&line[line_index], 
-						  line_size, ifp) == NULL)
-					  continue;
-					line_index = 2 * line_index;
-					line_size = 2 * line_size;
-				}
-
-				space = wschr(line, (int) space_char);
-				if (space != NULL && 
-				    IS_WEQUALN(&space[1],
-					      recursive_name->string,
-					      (int) recursive_name->hash.length)) {
-					continue;
-				}
-				WCSTOMBS(mbs_buffer, line);
-				(void) fprintf(ofp, "%s", mbs_buffer);
-			}
-			(void) fclose(ifp);
-		}
-	}
-
-	/*
-	 * Write out the .RECURSIVE lines.
-	 */
-	for (rp = recursive_list; rp != NULL; rp = rp->next) {
-		if (rp->removed) {
-			continue;
-		}
-		if (rp->newline != NULL) {
-			data = rp->newline;
-		} else {
-			data = rp->oldline;
-		}
-		if (data != NULL) {
-			WCSTOMBS(mbs_buffer, data);
-			(void) fprintf(ofp, "%s\n", mbs_buffer);
-		}
-	}
-	(void) fclose(ofp);
-
-	if (nse_depinfo_locked) {
-		(void) rename(tmpfile, nse_depinfo);
-		(void) unlink(nse_depinfo_lockfile);
-		nse_depinfo_locked = false;
-		nse_depinfo_lockfile[0] = '\0';
-		(void) chmod(nse_depinfo, 0666);
-	}
-}
-#endif // NSE
 
 /* gather_recursive_deps()
  *
--- old/usr/src/cmd/make/bin/state.cc	2015-05-20 11:32:43.971753159 -0400
+++ new/usr/src/cmd/make/bin/state.cc	2015-05-20 11:32:43.983599534 -0400
@@ -118,11 +118,7 @@
  */
 
 void
-#ifdef NSE
-write_state_file(int report_recursive, Boolean exiting)
-#else
 write_state_file(int, Boolean exiting)
-#endif
 {
 	register FILE		*fd;
 	int			lock_err;
@@ -198,11 +194,6 @@
 		      make_state_tempfile,
 		      errmsg(lock_err));
 	}
-#ifdef NSE
-	if (nse) {
-		(void) fchmod(fileno(fd), 0666); 
-	}
-#endif
 	/*
 	 * Set a trap for failed writes. If a write fails, the routine
 	 * will try saving the .make.state file under another name in /tmp.
@@ -398,11 +389,6 @@
 		make_state_lockfile = NULL;
 		make_state_locked = false;
 	}
-#ifdef NSE
-	if (report_recursive) {
-		report_recursive_done();
-	}
-#endif
 }
 
 /*
--- old/usr/src/cmd/make/include/mk/defs.h	2015-05-20 11:32:44.402237615 -0400
+++ new/usr/src/cmd/make/include/mk/defs.h	2015-05-20 11:32:44.414296514 -0400
@@ -450,35 +450,5 @@
 #define DEPINFO_FMT_VERSION "VERS2$"
 #define VER_LEN strlen(DEPINFO_FMT_VERSION)
 
-#ifdef NSE
-
-/*
- *  NSE version for depinfo format
- */
-extern Boolean		nse;
-extern Name		nse_backquote_seen;
-extern Boolean		nse_did_recursion;
-extern Name		nse_shell_var_used;
-extern Boolean		nse_watch_vars;
-extern wchar_t		current_makefile[MAXPATHLEN];
-extern Boolean		nse_depinfo_locked;
-extern char		nse_depinfo_lockfile[MAXPATHLEN];
-extern Name		derived_src;
-
-extern void		depvar_dep_macro_used(Name);
-extern void		depvar_rule_macro_used(Name);
-extern Boolean		nse_backquotes(wchar_t *);
-extern void		nse_check_cd(Property);
-extern void		nse_check_derived_src(Name, wchar_t *, Cmd_line);
-extern void		nse_check_file_backquotes(wchar_t *);
-extern void		nse_check_no_deps_no_rule(Name, Property, Property);
-extern void		nse_check_sccs(wchar_t *, wchar_t *);
-extern void		nse_dep_cmdmacro(wchar_t *);
-extern int		nse_exit_status(void);
-extern void		nse_init_source_suffixes(void);
-extern void		nse_no_makefile(Name);
-extern void		nse_rule_cmdmacro(wchar_t *);
-extern void		nse_wildcard(wchar_t *, wchar_t *);
-#endif
 
 #endif
--- old/usr/src/cmd/make/include/mksh/defs.h	2015-05-20 11:32:44.905620019 -0400
+++ new/usr/src/cmd/make/include/mksh/defs.h	2015-05-20 11:32:44.917417172 -0400
@@ -334,9 +334,6 @@
 	no_special,
 	built_last_make_run_special,
 	default_special,
-#ifdef NSE
-	derived_src_special,
-#endif
 	get_posix_special,
 	get_special,
 	ignore_special,
@@ -418,9 +415,6 @@
 	* Name "ABC" get one macro prop
 	*/
 	struct _Name		*value;
-#ifdef NSE
-	Boolean                 imported:1;
-#endif
 	Boolean			exported:1;
 	Boolean			read_only:1;
 	/*
@@ -462,9 +456,6 @@
 		Boolean			is_dir:1;
 		Boolean			is_sym_link:1;
 		Boolean			is_precious:1;
-#ifdef NSE
-                Boolean                 is_derived_src:1;
-#endif
 		enum sccs_stat		has_sccs:2;
 	}                       stat;
 	/*
--- old/usr/src/cmd/make/include/vroot/report.h	2015-05-20 11:32:45.366028489 -0400
+++ new/usr/src/cmd/make/include/vroot/report.h	2015-05-20 11:32:45.377873337 -0400
@@ -32,23 +32,17 @@
 extern char	*get_target_being_reported_for(void);
 extern void	report_dependency(const char *name);
 extern int	file_lock(char *name, char *lockname, int *file_locked, int timeout);
-#ifdef NSE
-extern char	*setenv(char *name, char *value);
-#endif
 
 #define SUNPRO_DEPENDENCIES "SUNPRO_DEPENDENCIES"
 #define LD 	"LD"
 #define COMP 	"COMP"
 
-/* the following definitions define the interface between make and
- * NSE - the two systems must track each other.
+/*
+ * These relate to Sun's ancient source control system that predated TeamWare,
+ * named NSE.  They appear to be used regardless of its presence, however, and
+ * so linger.
  */
 #define NSE_DEPINFO 		".nse_depinfo"
 #define NSE_DEPINFO_LOCK 	".nse_depinfo.lock"
-#define NSE_DEP_ENV 		"NSE_DEP"
-#define NSE_TFS_PUSH 		"/usr/nse/bin/tfs_push"
-#define NSE_TFS_PUSH_LEN 	8
-#define NSE_VARIANT_ENV 	"NSE_VARIANT"
-#define NSE_RT_SOURCE_NAME 	"Shared_Source"
 
 #endif
--- old/usr/src/cmd/make/lib/mksh/macro.cc	2015-05-20 11:32:45.763954595 -0400
+++ new/usr/src/cmd/make/lib/mksh/macro.cc	2015-05-20 11:32:45.776670865 -0400
@@ -46,11 +46,7 @@
  * File table of contents
  */
 static void	add_macro_to_global_list(Name macro_to_add);
-#ifdef NSE
-static void	expand_value_with_daemon(Name name, register Property macro, register String destination, Boolean cmd);
-#else
 static void	expand_value_with_daemon(Name, register Property macro, register String destination, Boolean cmd);
-#endif
 
 static void	init_arch_macros(void);
 static void	init_mach_macros(void);
@@ -629,18 +625,6 @@
 	}
 	/* Get the macro value. */
 	macro = get_prop(name->prop, macro_prop);
-#ifdef NSE
-        if (nse_watch_vars && nse && macro != NULL) {
-                if (macro->body.macro.imported) {
-                        nse_shell_var_used= name;
-		}
-                if (macro->body.macro.value != NULL){
-	              if (nse_backquotes(macro->body.macro.value->string)) {
-	                       nse_backquote_seen= name;
-		      }
-	       }
-	}
-#endif
 	if ((macro != NULL) && macro->body.macro.is_conditional) {
 		conditional_macro_used = true;
 		/*
@@ -921,9 +905,6 @@
 	FILE		*pipe;
 	Name		value;
 	int		set_host, set_target;
-#ifdef NSE
-	Property	macro;
-#endif
 	const char	*mach_command = NOCATGETS("/bin/mach");
 
 	set_host = (get_prop(host_arch->prop, macro_prop) == NULL);
@@ -946,19 +927,12 @@
 
 		value = GETNAME(result_string.buffer.start, wslen(result_string.buffer.start));
 
-#ifdef NSE
-	        macro = setvar_daemon(host_arch, value, false, no_daemon, true, 0);
-	        macro->body.macro.imported= true;
-	        macro = setvar_daemon(target_arch, value, false, no_daemon, true, 0);
-	        macro->body.macro.imported= true;
-#else
 		if (set_host) {
 			(void) setvar_daemon(host_arch, value, false, no_daemon, true, 0);
 		}
 		if (set_target) {
 			(void) setvar_daemon(target_arch, value, false, no_daemon, true, 0);
 		}
-#endif
 	}
 }
 
@@ -1032,33 +1006,10 @@
  *	Global variables used:
  */
 static void
-#ifdef NSE
-expand_value_with_daemon(Name name, register Property macro, register String destination, Boolean cmd)
-#else
 expand_value_with_daemon(Name, register Property macro, register String destination, Boolean cmd)
-#endif
 {
 	register Chain		chain;
 
-#ifdef NSE
-        if (reading_dependencies) {
-                /*
-                 * Processing the dependencies themselves
-                 */
-                depvar_dep_macro_used(name);
-	} else {
-                /*
-	         * Processing the rules for the targets
-	         * the nse_watch_vars flags chokes off most
-	         * checks.  it is true only when processing
-	         * the output from a recursive make run
-	         * which is all we are interested in here.
-	         */
-	         if (nse_watch_vars) {
-	                depvar_rule_macro_used(name);
-		}
-	 }
-#endif
 
 	switch (macro->body.macro.daemon) {
 	case no_daemon:
@@ -1136,9 +1087,6 @@
 	wchar_t			*val_string = (wchar_t*)NULL;
 	Wstring			wcb;
 
-#ifdef NSE
-        macro->body.macro.imported = false;
-#endif
 
 	if ((makefile_type != reading_nothing) &&
 	    macro->body.macro.read_only) {
