summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2017-08-09 13:42:59 -0400
committerHans Rosenfeld <hans.rosenfeld@joyent.com>2018-02-12 11:56:22 +0100
commitc08555783b53af86d5998de8a9ea7c58d83d75c9 (patch)
treecd4d5f8c1fa7db3186dca0a627d5c44ee90ea873
parent6c19201566ac520f0d4eef6ed2f70bf9a4815eae (diff)
downloadillumos-joyent-c08555783b53af86d5998de8a9ea7c58d83d75c9.tar.gz
8571 Makefile.master should not trust $PATH
Reviewed by: Andy Stormont <astormont@racktopsystems.com> Approved by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
-rw-r--r--usr/src/Makefile.master10
-rw-r--r--usr/src/tools/Makefile17
-rw-r--r--usr/src/tools/cw/Makefile3
-rw-r--r--usr/src/tools/install.bin/Makefile7
4 files changed, 28 insertions, 9 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index da65c79fc4..4eef93e0a8 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -134,11 +134,19 @@ ELFEXTRACT= $(ONBLD_TOOLS)/bin/$(MACH)/elfextract
MBH_PATCH= $(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
BTXLD= $(ONBLD_TOOLS)/bin/$(MACH)/btxld
VTFONTCVT= $(ONBLD_TOOLS)/bin/$(MACH)/vtfontcvt
+# echo(1) and true(1) are specified without absolute paths, so that the shell
+# spawned by make(1) may use the built-in versions. This is minimally
+# problematic, as the shell spawned by make(1) is known and under control, the
+# only risk being if the shell falls back to $PATH.
+#
+# We specifically want an echo(1) that does interpolation of escape sequences,
+# which ksh93, /bin/sh, and bash will all provide.
ECHO= echo
-INS= install
TRUE= true
+INS= $(ONBLD_TOOLS)/bin/$(MACH)/install
SYMLINK= /usr/bin/ln -s
LN= /usr/bin/ln
+MKDIR= /usr/bin/mkdir
CHMOD= /usr/bin/chmod
MV= /usr/bin/mv -f
RM= /usr/bin/rm -f
diff --git a/usr/src/tools/Makefile b/usr/src/tools/Makefile
index f2d7fcafb9..096b570b2c 100644
--- a/usr/src/tools/Makefile
+++ b/usr/src/tools/Makefile
@@ -28,11 +28,16 @@
include ../Makefile.master
-# Bootstrap problem --
-# 'cw' must be built before anything else can be built.
-
+# Bootstrap problem: 'cw' must be built before anything else can be built.
+# 'install.bin' should be built next, being the 'install' target dependency
+# for everything else.
+#
+# Because of somewhat cyclic dependency between them, both cw and install.bin
+# override the way we install binaries in their Makefiles.
BOOT_SUBDIRS= \
- cw
+ cw \
+ .WAIT \
+ install.bin
COMMON_SUBDIRS= \
codereview \
@@ -41,7 +46,6 @@ COMMON_SUBDIRS= \
ctf \
env \
findunref \
- install.bin \
lintdump \
make \
ndrgen \
@@ -147,8 +151,9 @@ $(SUBDIRS) $(CLOSED_SUBDIRS): $(BOOT_SUBDIRS)
$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
@cd $@; pwd; $(MAKE) $(TARGET)
+# Assume we don't have the install.bin available yet
$(ROOTDIRS):
- $(INS.dir)
+ $(MKDIR) -p -m $(DIRMODE) $@
$(ROOTONBLDLIBPY): $(ROOTDIRS)
$(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
diff --git a/usr/src/tools/cw/Makefile b/usr/src/tools/cw/Makefile
index 5350851c1a..6c9057a6ff 100644
--- a/usr/src/tools/cw/Makefile
+++ b/usr/src/tools/cw/Makefile
@@ -54,6 +54,9 @@ CPPFLAGS += -DDEFAULT_GPLUSPLUS_DIR='"$(GCC_ROOT)/bin"'
$(ROOTONBLDMAN1ONBLDFILES) := FILEMODE= 644
+# Assume we don't have the install.bin available yet
+INS.file= $(RM) $@; $(CP) $< $(@D); $(CHMOD) $(FILEMODE) $@
+
.KEEP_STATE:
all: $(PROG) $(MAN1ONBLDFILES)
diff --git a/usr/src/tools/install.bin/Makefile b/usr/src/tools/install.bin/Makefile
index 216e79e63e..6f20638a56 100644
--- a/usr/src/tools/install.bin/Makefile
+++ b/usr/src/tools/install.bin/Makefile
@@ -18,11 +18,11 @@
#
# CDDL HEADER END
#
+
+#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# tools/install.bin/Makefile
-#
PROG= install.bin
OBJS= $(PROG).o stdusers.o
@@ -36,6 +36,9 @@ CPPFLAGS += -I../protocmp
LDLIBS += -lgen
CLEANFILES += $(OBJS)
+# Assume we don't have the install.bin available yet
+INS.file= $(RM) $@; $(CP) $< $(@D); $(CHMOD) $(FILEMODE) $@
+
.KEEP_STATE:
all: $(PROG)