[7u]: help on jdk/make/common/shared/Defs-windows.gmk
Francis ANDRE
francis.andre.kampbell at orange.fr
Wed Nov 20 20:11:47 UTC 2013
Erik
>>How are you invoking the build to cause this error? Are you explicitly
setting ALT_OUTPUTDIR?
I am invoking just: make sanity without explicitly setting ALT_OUTPUTDIR.
What is the path to your workspace?
FrancisANDRE at idefix /cygdrive/Z/JDK/jdk7u
$ hg path
default = http://hg.openjdk.java.net/jdk7u/jdk7u
FrancisANDRE at idefix /cygdrive/Z/JDK/jdk7u
$ hg root
/cygdrive/Z/JDK/jdk7u
I extracted the relevant commands from the
jdk/make/common/shared/Defs-windows.gmk into the joined test.mk file
if one runs make -f test.mk with $(if $(word 2,$1) at line 72, one gets
$ make -f test.mk
*OUTPUTDIR=./build/windows-i586**
**ABS_OUTPUTDIR=*
ALT_HOTSPOT_IMPORT_PATH=Z:/JDK/jdk7u/build/windows-i586/hotspot/import
_HOTSPOT_IMPORT_PATH2=
_HOTSPOT_IMPORT_PATH3=
HOTSPOT_IMPORT_PATH=Z:/JDK/jdk7u/build/windows-i586/hotspot/import
SYSTEMROOT=C:WINDOWS
xSYSTEMROOT=C:/WINDOWS
_system_root=C:/WINDOWS
FOO=Z:/JDK/jdk7u/build/windows-i586
BAR=C:/WINDOWS
if one runs make -f test.mk with $(if $(word 1,$1) at line 72, one gets
$ make -f test.mk
*OUTPUTDIR=./build/windows-i586**
**ABS_OUTPUTDIR=Z:/JDK/jdk7u/build/WINDOW~1*
ALT_HOTSPOT_IMPORT_PATH=Z:/JDK/jdk7u/build/windows-i586/hotspot/import
_HOTSPOT_IMPORT_PATH2=
_HOTSPOT_IMPORT_PATH3=
HOTSPOT_IMPORT_PATH=Z:/JDK/jdk7u/build/WINDOW~1/hotspot/import
SYSTEMROOT=C:WINDOWS
xSYSTEMROOT=C:/WINDOWS
_system_root=C:/WINDOWS
FOO=Z:/JDK/jdk7u/build/WINDOW~1
BAR=C:/WINDOWS
in both case, OUTPUTDIR is a relative path as "./build/windows-i586", but only
the second computes properly the ABS_OUTPUTDIR as "Z:/JDK/jdk7u/build/WINDOW~1".
In the first case, ABS_OUTPUTDIR is empty with leads to the error "ERROR:
Trouble with the absolute path for OUTPUTDIR"
Le 20/11/2013 10:47, Erik Joelsson a écrit :
> The way I understand it $(if $(word 2,$1) is a check for whitespace in the
> input parameter. It's an optimization to avoid executing cygpath when it's not
> needed. The MixedPath macro cannot be used if the path contains a space. It
> also doesn't convert to an absolute path, just replacing cygwin specific paths
> with driveletter paths. The unfortunate effect of this is that FullPath
> behaves differently depending on if the path contains a space.
>
> How are you invoking the build to cause this error? Are you explicitly setting
> ALT_OUTPUTDIR? What is the path to your workspace?
>
> /Erik
>
> On 2013-11-15 18:37, Francis ANDRE wrote:
>> Hi
>>
>> I am trying to fix the following error
>>
>> $ make sanity
>> jdk/make/common/shared/Defs.gmk:563: *** "ERROR: Trouble with the absolute
>> path for OUTPUTDIR './bui
>> ld/windows-i586'". Stop.
>>
>> and found the following code in jdk/make/common/shared/Defs-windows.gmk, line
>> 109
>>
>> define FullPath
>> $(if $(word 2,$1),$(shell $(CYGPATH_CMD) $1 2> $(DEV_NULL)),$(call
>> MixedPath,$(realpath $(subst ",,$1))))
>> endef
>>
>> Can someone explain me what use case is covered by the $(word 2,$1) in the
>> previous statement?
>>
>> The error "ERROR: Trouble with the absolute path for OUTPUTDIR" can be fixed
>> by replacing $(word 2,$1) by $(word 1,$1) but I cannot find a usage for the
>> $(word 2,$1)
>>
>> Francis
>
>
-------------- next part --------------
CYGWIN_HOME := C:/Cygwin
DEV_NULL = /dev/null
CYGPATH_CMD = cygpath -a -s -m
define PwdPath
$(shell cd $1 2> $(DEV_NULL) && pwd)
endef
define AbsPwdPathCheck
$(shell cd .. 2> $(DEV_NULL) && cd $1 2> $(DEV_NULL) && pwd)
endef
# Checks an ALT value for spaces (should be one word),
# warns and returns Check_ALT_$1 if spaces
define AltCheckSpaces
$(if $(word 2,$($1)),$(warning "WARNING: Value of $1 contains a space: '$($1)', check or set ALT_$1")Check_ALT_$1,$($1))
endef
# Checks an ALT value for empty, warns and returns Check_ALT_$1 if empty
define AltCheckValue
$(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, check or set ALT_$1")Check_ALT_$1)
endef
# Checks any value for empty, warns and returns $2 if empty
define CheckValue
$(if $($1),$($1),$(warning "WARNING: Value of $1 cannot be empty, will use '$2'")$2)
endef
# Prefix for a utility prefix path, if empty leave alone, otherwise end with a /
define PrefixPath
$(if $1,$(subst //,/,$1/),)
endef
define DirExists
$(shell if [ -d "$1" ]; then echo "$1"; elif [ -d "$2" ]; then echo "$2"; else echo "$3"; fi)
endef
# Select a directory if it exists, or the alternate 2, or the alternate 3, or the alternate 4
define DirExists4
$(shell \
if [ -d "$1" ]; then \
echo "$1"; \
elif [ -d "$2" ]; then \
echo "$2"; \
elif [ -d "$3" ]; then \
echo "$3"; \
else \
echo "$4"; \
fi)
endef
define ToUpper
$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,\
$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,\
$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,\
$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,\
$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
endef
# All possible drive letters
drives=a b c d e f g h i j k l m n o p q r s t u v w x y z
#drives=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
# Convert /cygdrive/ paths to the mixed style without an exec of cygpath
# Must be a path with no spaces. /cygdrive/letter is always lowercase
# and letter:/ is always uppercase coming from cygpath.
define MixedPath
$(patsubst /%,$(CYGWIN_HOME)/%,$(sort $(filter-out /cygdrive/%,$(foreach drive,$(drives),$(patsubst /cygdrive/$(drive)/%,$(call ToUpper,$(drive)):/%,$1)))))
endef
# Use FullPath to get C:/ style non-spaces path. Never ends with a /!
# We assume cygpath is available in the search path
# NOTE: Use of 'pwd' with CYGWIN will not get you a mixed style path!
define FullPath
$(if $(word 1,$1),$(shell $(CYGPATH_CMD) $1 2> $(DEV_NULL)),$(call MixedPath,$(realpath -m $(subst ",,$1))))
endef
define OptFullPath
$(shell if [ "$1" != "" -a -d "$1" ]; then $(CYGPATH_CMD) "$1" 2> $(DEV_NULL); else echo "$1"; fi)
endef
OUTPUTDIR=./build/windows-i586
ALT_HOTSPOT_IMPORT_PATH=Z:/JDK/jdk7u/build/windows-i586/hotspot/import
ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
ifdef SYSTEMROOT
xSYSTEMROOT :="$(subst \,/,$(SYSTEMROOT))"
_system_root :=$(call FullPath,$(xSYSTEMROOT))
else
ifdef SystemRoot
xSYSTEMROOT :="$(subst \,/,$(SystemRoot))"
_system_root :=$(call FullPath,$(xSYSTEMROOT))
else
ifdef WINDIR
xWINDIR :="$(subst \,/,$(WINDIR))"
_system_root :=$(call FullPath,$(xWINDIR))
else
ifdef windir
xWINDIR :="$(subst \,/,$(windir))"
_system_root :=$(call FullPath,$(xWINDIR))
endif
endif
endif
endif
# HOTSPOT_IMPORT_PATH: location of hotspot pre-built files
ifdef ALT_HOTSPOT_IMPORT_PATH
HOTSPOT_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_IMPORT_PATH))
else
# Default locations include the current $OUTPUTDIR, RE Promotions,
# and a JDK. Please be aware the JDK does not include a Kernel VM.
_HOTSPOT_IMPORT_PATH1 := $(OUTPUTDIR)/hotspot/import
_HOTSPOT_IMPORT_PATH2 := $(PROMOTED_BUILD_DISTDIR)/hotspot/import
_HOTSPOT_IMPORT_PATH3 := $(JDK_IMPORT_PATH)
HOTSPOT_IMPORT_PATH := $(call DirExists,$(_HOTSPOT_IMPORT_PATH1),$(_HOTSPOT_IMPORT_PATH2),$(_HOTSPOT_IMPORT_PATH3))
endif
HOTSPOT_IMPORT_PATH:=$(call AltCheckSpaces,HOTSPOT_IMPORT_PATH)
HOTSPOT_IMPORT_PATH:=$(call AltCheckValue,HOTSPOT_IMPORT_PATH)
FOO:=$(call FullPath,/cygdrive/z/JDK/jdk7u/build/windows-i586)
BAR:=$(call FullPath,"C:/WINDOWS")
all:
@echo "OUTPUTDIR="$(OUTPUTDIR)
@echo "ABS_OUTPUTDIR="$(ABS_OUTPUTDIR)
@echo "ALT_HOTSPOT_IMPORT_PATH="$(ALT_HOTSPOT_IMPORT_PATH)
@echo "_HOTSPOT_IMPORT_PATH2="$(_HOTSPOT_IMPORT_PATH2)
@echo "_HOTSPOT_IMPORT_PATH3="$(_HOTSPOT_IMPORT_PATH3)
@echo "HOTSPOT_IMPORT_PATH="$(HOTSPOT_IMPORT_PATH)
@echo "SYSTEMROOT="$(SYSTEMROOT)
@echo "xSYSTEMROOT="$(xSYSTEMROOT)
@echo "_system_root="$(_system_root)
@echo "FOO="$(FOO)
@echo "BAR="$(BAR)
More information about the build-dev
mailing list