#
# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Shared variables for standard unix utilties on all platforms.
#
# Assumes Platform.gmk has been included before this file.
#
# These input UTILS_* variables can be defined at anytime, ideally once.
# Unix Commands: Normally /bin/, /usr/bin/. or C:/mksnt/mksnt/
# UTILS_COMMAND_PATH
# /usr/bin/
# UTILS_USR_BIN_PATH
# /usr/ccs/bin/ (sccs, m4, lex, yacc, as, ar, strip, mcs)
# UTILS_CCS_BIN_PATH
# Dev Tools: zip, unzip, etc that we may have special versions of
# UTILS_DEVTOOL_PATH
#
# WARNING: This file cannot assume that any of these utilties are available
# to be run via their variable names defined here.
# The paths inside the UTILS_* variables may not be defined yet.
#
# Note: There is no guarantee that all these exist on all platforms.
# Some only make sense for one platform, but are harmless.
#
ifeq ($(PLATFORM),linux)
UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH)
UTILS_USR_BIN_PATH=$(USRBIN_PATH)
UTILS_CCS_BIN_PATH=$(USRBIN_PATH)
UTILS_DEVTOOL_PATH=$(USRBIN_PATH)
endif
ifeq ($(PLATFORM),solaris)
UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH)
UTILS_USR_BIN_PATH=$(UNIXCOMMAND_PATH)
UTILS_CCS_BIN_PATH=$(UNIXCCS_PATH)
UTILS_DEVTOOL_PATH=$(DEVTOOLS_PATH)
endif
ifeq ($(PLATFORM),windows)
UTILS_COMMAND_PATH=$(UNIXCOMMAND_PATH)
UTILS_USR_BIN_PATH=$(UNIXCOMMAND_PATH)
UTILS_CCS_BIN_PATH=$(UNIXCOMMAND_PATH)
UTILS_DEVTOOL_PATH=$(DEVTOOLS_PATH)
endif
# Utilities
ADB = $(UTILS_COMMAND_PATH)adb
AR = $(UTILS_CCS_BIN_PATH)ar
AS = $(UTILS_CCS_BIN_PATH)as
BASENAME = $(UTILS_COMMAND_PATH)basename
BZIP2 = $(UTILS_COMMAND_PATH)bzip2
CAT = $(UTILS_COMMAND_PATH)cat
CHMOD = $(UTILS_COMMAND_PATH)chmod
CMP = $(UTILS_USR_BIN_PATH)cmp
COMM = $(UTILS_USR_BIN_PATH)comm
COMPRESS = $(UTILS_USR_BIN_PATH)compress
CP = $(UTILS_COMMAND_PATH)cp
CPIO = $(UTILS_COMMAND_PATH)cpio
CUT = $(UTILS_USR_BIN_PATH)cut
DATE = $(UTILS_COMMAND_PATH)date
DF = $(UTILS_COMMAND_PATH)df
DIFF = $(UTILS_USR_BIN_PATH)diff
DIRNAME = $(UTILS_USR_BIN_PATH)dirname
ECHO = $(UTILS_COMMAND_PATH)echo
EGREP = $(UTILS_COMMAND_PATH)egrep
EXPR = $(UTILS_USR_BIN_PATH)expr
FILE = $(UTILS_USR_BIN_PATH)file
FIND = $(UTILS_USR_BIN_PATH)find
FMT = $(UTILS_COMMAND_PATH)fmt
GDB = $(UTILS_USR_BIN_PATH)gdb
GREP = $(UTILS_COMMAND_PATH)grep
GUNZIP = $(UTILS_COMMAND_PATH)gunzip
HEAD = $(UTILS_USR_BIN_PATH)head
ID = $(UTILS_COMMAND_PATH)id
ISAINFO = $(UTILS_COMMAND_PATH)isainfo
KSH = $(UTILS_COMMAND_PATH)ksh
LD = $(UTILS_CCS_BIN_PATH)ld
LEX = $(UTILS_CCS_BIN_PATH)lex
LN = $(UTILS_COMMAND_PATH)ln
LS = $(UTILS_COMMAND_PATH)ls
MCS = $(UTILS_CCS_BIN_PATH)mcs
M4 = $(UTILS_CCS_BIN_PATH)m4
MKDIR = $(UTILS_COMMAND_PATH)mkdir
MKSINFO = $(UTILS_COMMAND_PATH)mksinfo
MSGFMT = $(UTILS_USR_BIN_PATH)msgfmt
MV = $(UTILS_COMMAND_PATH)mv
NAWK = $(UTILS_USR_BIN_PATH)nawk
NM = $(UTILS_CCS_BIN_PATH)nm
PKGMK = $(UTILS_COMMAND_PATH)pkgmk
PRINTF = $(UTILS_USR_BIN_PATH)printf
PWD = $(UTILS_COMMAND_PATH)pwd
RC = $(UTILS_COMMAND_PATH)rc
RMDIR = $(UTILS_COMMAND_PATH)rmdir
RPM = $(UTILS_COMMAND_PATH)rpm
RPMBUILD = $(UTILS_COMMAND_PATH)rpmbuild
SCCS = $(UTILS_CCS_BIN_PATH)sccs
SED = $(UTILS_COMMAND_PATH)sed
SH = $(UTILS_COMMAND_PATH)sh
SHOWREV = $(UTILS_USR_BIN_PATH)showrev
SORT = $(UTILS_COMMAND_PATH)sort
STRIP = $(UTILS_CCS_BIN_PATH)strip
TAIL = $(UTILS_USR_BIN_PATH)tail
TAR = $(UTILS_COMMAND_PATH)tar
TEST = $(UTILS_USR_BIN_PATH)test
TOUCH = $(UTILS_COMMAND_PATH)touch
TR = $(UTILS_USR_BIN_PATH)tr
TRUE = $(UTILS_COMMAND_PATH)true
UNAME = $(UTILS_COMMAND_PATH)uname
UNIQ = $(UTILS_USR_BIN_PATH)uniq
UNZIP = $(UTILS_USR_BIN_PATH)unzip
UNZIPSFX = $(UTILS_DEVTOOL_PATH)unzipsfx
WC = $(UTILS_USR_BIN_PATH)wc
WHICH = $(UTILS_USR_BIN_PATH)which
YACC = $(UTILS_CCS_BIN_PATH)yacc
ZIPEXE = $(UTILS_DEVTOOL_PATH)zip
# Special cases
#RM is defined by GNU Make as 'rm -f'
CD = cd # intrinsic unix command
# Windows specific
ifeq ($(PLATFORM),windows)
ifdef USING_CYGWIN
# Intrinsic unix command, with backslash-escaped character interpretation
ECHO = $(UNIXCOMMAND_PATH)echo -e
ZIPEXE = $(UNIXCOMMAND_PATH)zip
UNZIP = $(UNIXCOMMAND_PATH)unzip
# Some CYGWIN nawk versions require BINMODE=w for proper '\r' interpretation
NAWK = $(UNIXCOMMAND_PATH)awk -v BINMODE=w
else
ZIPEXE = $(UTILS_DEVTOOL_PATH)zip
UNZIP = $(UTILS_DEVTOOL_PATH)unzip
NAWK = $(UNIXCOMMAND_PATH)awk
endif
# Re-define some utilities
LEX =# override GNU Make intrinsic: no lex on windows
SHA1SUM = $(UNIXCOMMAND_PATH)openssl sha1
endif
# Linux specific
ifeq ($(PLATFORM),linux)
# A few redefines
# Allows for builds on Debian GNU Linux, basename is in a different place
BASENAME=$(firstword $(wildcard $(UTILS_COMMAND_PATH)basename) \
$(wildcard $(UTILS_USR_BIN_PATH)basename))
# RPM 4 has replaced "rpm -b" with an entirely new utility "rpmbuild".
# Also, some distribution (Ubuntu, Debian, others?) place the rpm command
# itself in /usr/bin rather than it's traditional home in /bin.
RPM=$(firstword $(wildcard $(UTILS_COMMAND_PATH)rpm) \
$(wildcard $(UTILS_USR_BIN_PATH)rpm))
RPMBUILD=$(firstword $(wildcard $(UTILS_COMMAND_PATH)rpmbuild) \
$(wildcard $(UTILS_USR_BIN_PATH)rpmbuild) \
$(wildcard $(UTILS_COMMAND_PATH)rpm) \
$(wildcard $(UTILS_USR_BIN_PATH)rpm))
# Most Linux distros have "sort" in /bin. Ubuntu, Debian and perhaps
# others have it in /usr/bin.
SORT=$(firstword $(wildcard $(UTILS_COMMAND_PATH)sort) \
$(wildcard $(UTILS_USR_BIN_PATH)sort))
NAWK = $(USRBIN_PATH)gawk
# Intrinsic unix command, with backslash-escaped character interpretation
ECHO = /bin/echo -e
# These are really in UTILS_USR_BIN_PATH on Linux (only sccs is not)
AR = $(UTILS_USR_BIN_PATH)ar
AS = $(UTILS_USR_BIN_PATH)as
LD = $(UTILS_USR_BIN_PATH)ld
LEX = $(UTILS_USR_BIN_PATH)lex
MCS = $(UTILS_USR_BIN_PATH)mcs
M4 = $(UTILS_USR_BIN_PATH)m4
NM = $(UTILS_USR_BIN_PATH)nm
STRIP = $(UTILS_USR_BIN_PATH)strip
YACC = $(UTILS_USR_BIN_PATH)yacc
endif
# Solaris specific
ifeq ($(PLATFORM),solaris)
# Intrinsic unix command, with backslash-escaped character interpretation
# (not using -e will cause build failure when using /bin/bash)
# (using -e breaks something else)
ECHO = /usr/bin/echo
endif