8256541: Sort out what version of awk is used in the build system

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2020-11-30 16:35:02 +00:00
parent e3abe51a31
commit a3e1980c08
15 changed files with 26 additions and 31 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -45,11 +45,6 @@ $(OUTPUTDIR)/compile_commands.json: $(wildcard $(MAKESUPPORT_OUTPUTDIR)/compile-
$(RM) $@ $(RM) $@
$(FIND) $(MAKESUPPORT_OUTPUTDIR)/compile-commands/ -name \*.json | \ $(FIND) $(MAKESUPPORT_OUTPUTDIR)/compile-commands/ -name \*.json | \
$(SORT) | $(XARGS) $(CAT) >> $@.tmp $(SORT) | $(XARGS) $(CAT) >> $@.tmp
$(if $(FIXPATH),$(FIXPATH) $(AWK) 'BEGIN { \
tmpfile = substr(ARGV[2],2); \
cmd = "$(CP) " "\047" tmpfile "\047" " $@.tmp"; \
system(cmd); \
}' -- @$@.tmp)
$(SED) -e '1s/^/[\$(NEWLINE)/' -e '$(DOLLAR)s/,\s\{0,\}$(DOLLAR)/\$(NEWLINE)]/' $@.tmp > $@ $(SED) -e '1s/^/[\$(NEWLINE)/' -e '$(DOLLAR)s/,\s\{0,\}$(DOLLAR)/\$(NEWLINE)]/' $@.tmp > $@
$(RM) $@.tmp $(RM) $@.tmp

View File

@ -153,7 +153,6 @@ LN := ln
MIG := mig MIG := mig
MKDIR := mkdir MKDIR := mkdir
MV := mv MV := mv
NAWK := nawk
NICE := nice NICE := nice
PATCH := patch PATCH := patch
PRINTF := printf PRINTF := printf

View File

@ -57,7 +57,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
UTIL_REQUIRE_PROGS(MKDIR, [gmkdir mkdir]) UTIL_REQUIRE_PROGS(MKDIR, [gmkdir mkdir])
UTIL_REQUIRE_PROGS(MKTEMP, mktemp) UTIL_REQUIRE_PROGS(MKTEMP, mktemp)
UTIL_REQUIRE_PROGS(MV, mv) UTIL_REQUIRE_PROGS(MV, mv)
UTIL_REQUIRE_PROGS(NAWK, [nawk gawk awk]) UTIL_REQUIRE_PROGS(AWK, [gawk nawk awk])
UTIL_REQUIRE_PROGS(PRINTF, printf) UTIL_REQUIRE_PROGS(PRINTF, printf)
UTIL_REQUIRE_PROGS(READLINK, [greadlink readlink]) UTIL_REQUIRE_PROGS(READLINK, [greadlink readlink])
UTIL_REQUIRE_PROGS(RM, rm) UTIL_REQUIRE_PROGS(RM, rm)
@ -75,7 +75,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
UTIL_REQUIRE_PROGS(XARGS, xargs) UTIL_REQUIRE_PROGS(XARGS, xargs)
# Then required tools that require some special treatment. # Then required tools that require some special treatment.
UTIL_REQUIRE_SPECIAL(AWK, [AC_PROG_AWK])
UTIL_REQUIRE_SPECIAL(GREP, [AC_PROG_GREP]) UTIL_REQUIRE_SPECIAL(GREP, [AC_PROG_GREP])
UTIL_REQUIRE_SPECIAL(EGREP, [AC_PROG_EGREP]) UTIL_REQUIRE_SPECIAL(EGREP, [AC_PROG_EGREP])
UTIL_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP]) UTIL_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP])

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -53,7 +53,6 @@ export LDD="@LDD@"
export LN="@LN@" export LN="@LN@"
export MKDIR="@MKDIR@" export MKDIR="@MKDIR@"
export MV="@MV@" export MV="@MV@"
export NAWK="@NAWK@"
export NM="@GNM@" export NM="@GNM@"
export OBJDUMP="@OBJDUMP@" export OBJDUMP="@OBJDUMP@"
export OTOOL="@OTOOL@" export OTOOL="@OTOOL@"

View File

@ -707,7 +707,6 @@ LN:=@LN@
MIG:=@MIG@ MIG:=@MIG@
MKDIR:=@MKDIR@ MKDIR:=@MKDIR@
MV:=@MV@ MV:=@MV@
NAWK:=@NAWK@
NICE:=@NICE@ NICE:=@NICE@
PANDOC:=@FIXPATH@ @PANDOC@ PANDOC:=@FIXPATH@ @PANDOC@
PATCH:=@PATCH@ PATCH:=@PATCH@

View File

@ -89,7 +89,7 @@ BUILDTIMESDIR=$(OUTPUTDIR)/make-support/build-times
# Record starting time for build of a sub repository. # Record starting time for build of a sub repository.
define RecordStartTime define RecordStartTime
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \ $(DATE) '+%Y %m %d %H %M %S' | $(AWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
endef endef
@ -97,10 +97,10 @@ endef
# easy to read format. Handles builds that cross midnight. Expects # easy to read format. Handles builds that cross midnight. Expects
# that a build will never take 24 hours or more. # that a build will never take 24 hours or more.
define RecordEndTime define RecordEndTime
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$(strip $1) $(DATE) '+%Y %m %d %H %M %S' | $(AWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)_human_readable $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)_human_readable
$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$(strip $1)` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$(strip $1)` $1 | \ $(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$(strip $1)` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$(strip $1)` $1 | \
$(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \ $(AWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \ M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
> $(BUILDTIMESDIR)/build_time_diff_$(strip $1) > $(BUILDTIMESDIR)/build_time_diff_$(strip $1)
endef endef
@ -439,6 +439,8 @@ endif
# This is normally not needed since we use the FIXPATH prefix for command lines, # This is normally not needed since we use the FIXPATH prefix for command lines,
# but might be needed in certain circumstances. # but might be needed in certain circumstances.
ifeq ($(call isTargetOs, windows), true) ifeq ($(call isTargetOs, windows), true)
FixPathArgs = \
$(shell $(FIXPATH) cmd /c echo $1)
ifeq ($(call isBuildOsEnv, windows.wsl), true) ifeq ($(call isBuildOsEnv, windows.wsl), true)
FixPath = \ FixPath = \
$(shell $(WSLPATH) -m $1) $(shell $(WSLPATH) -m $1)
@ -447,6 +449,8 @@ ifeq ($(call isTargetOs, windows), true)
$(shell $(CYGPATH) -m $1) $(shell $(CYGPATH) -m $1)
endif endif
else else
FixPathArgs = \
$1
FixPath = \ FixPath = \
$1 $1
endif endif

View File

@ -338,7 +338,7 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
$(RM) $@ $(RM) $@
$(foreach m, $(MODULE_INFOS), \ $(foreach m, $(MODULE_INFOS), \
( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
$(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ $(AWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
/^ *requires/ { sub(/;/, ""); \ /^ *requires/ { sub(/;/, ""); \
sub(/requires /, " "); \ sub(/requires /, " "); \
@ -352,7 +352,7 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
printf(" %s", $$0) } \ printf(" %s", $$0) } \
END { printf("\n") }' $m && \ END { printf("\n") }' $m && \
$(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \ $(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
$(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ $(AWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
/^ *requires *transitive/ { \ /^ *requires *transitive/ { \
sub(/;/, ""); \ sub(/;/, ""); \

View File

@ -72,10 +72,10 @@ define WriteCompileCommandsFragment
$(call LogInfo, Creating compile commands fragment for $(notdir $3)) $(call LogInfo, Creating compile commands fragment for $(notdir $3))
$(call MakeDir, $(dir $1)) $(call MakeDir, $(dir $1))
$(call WriteFile,{ \ $(call WriteFile,{ \
"directory": "$(strip $2)"$(COMMA) \ "directory": "$(strip $(call FixPathArgs, $2))"$(COMMA) \
"file": "$(strip $3)"$(COMMA) \ "file": "$(strip $(call FixPathArgs, $3))"$(COMMA) \
"command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\ "command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
$(subst $(FIXPATH),,$4))))" \ $(subst $(FIXPATH),,$(call FixPathArgs, $4)))))" \
}$(COMMA), \ }$(COMMA), \
$1) $1)
endef endef

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -177,7 +177,7 @@ define SetupTextFileProcessingBody
$1_INCLUDES_PARTIAL_AWK := $$(subst $$(SPACE);,,$$(subst $$(SPACE)=>$$(SPACE),"$$(RIGHT_PAREN)$$(RIGHT_PAREN) \ $1_INCLUDES_PARTIAL_AWK := $$(subst $$(SPACE);,,$$(subst $$(SPACE)=>$$(SPACE),"$$(RIGHT_PAREN)$$(RIGHT_PAREN) \
{ include$$(LEFT_PAREN)",$$(subst $$(SPACE);$$(SPACE),"$$(RIGHT_PAREN) } \ { include$$(LEFT_PAREN)",$$(subst $$(SPACE);$$(SPACE),"$$(RIGHT_PAREN) } \
else if $$(LEFT_PAREN)matches$$(LEFT_PAREN)",$$(strip $$($1_INCLUDES))))) else if $$(LEFT_PAREN)matches$$(LEFT_PAREN)",$$(strip $$($1_INCLUDES)))))
$1_INCLUDES_COMMAND_LINE := $(NAWK) '$$($1_INCLUDES_HEADER_AWK) \ $1_INCLUDES_COMMAND_LINE := $(AWK) '$$($1_INCLUDES_HEADER_AWK) \
{ if (matches("$$($1_INCLUDES_PARTIAL_AWK)") } else print }' { if (matches("$$($1_INCLUDES_PARTIAL_AWK)") } else print }'
else else
# We don't have any includes, just pipe the file through cat. # We don't have any includes, just pipe the file through cat.

View File

@ -168,7 +168,7 @@ ifeq ($(call check-jvm-feature, compiler2), true)
$(SINGLE_AD_SRCFILE): $(AD_SRC_FILES) $(SINGLE_AD_SRCFILE): $(AD_SRC_FILES)
$(call LogInfo, Preprocessing adlc files $(^F)) $(call LogInfo, Preprocessing adlc files $(^F))
$(call MakeDir, $(@D)) $(call MakeDir, $(@D))
$(NAWK) $(INSERT_FILENAME_AWK_SCRIPT) $^ > $@ $(AWK) $(INSERT_FILENAME_AWK_SCRIPT) $^ > $@
############################################################################## ##############################################################################
# Run the adlc tool on the single concatenated ad source file, and store the # Run the adlc tool on the single concatenated ad source file, and store the
@ -205,7 +205,7 @@ ifeq ($(call check-jvm-feature, compiler2), true)
$(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(adlc_run_TARGET) $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(adlc_run_TARGET)
$(call LogInfo, Postprocessing adlc file $*) $(call LogInfo, Postprocessing adlc file $*)
$(call MakeDir, $(@D)) $(call MakeDir, $(@D))
$(NAWK) \ $(AWK) \
'BEGIN { print "#line 1 \"$*\""; } \ 'BEGIN { print "#line 1 \"$*\""; } \
/^#line 999999$$/ {print "#line " (NR+1) " \"$*\""; next} \ /^#line 999999$$/ {print "#line " (NR+1) " \"$*\""; next} \
$(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), false), \ $(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), false), \

View File

@ -114,7 +114,7 @@ endif
$(JVM_OUTPUTDIR)/symbols-objects: $(BUILD_LIBJVM_ALL_OBJS) $(JVM_OUTPUTDIR)/symbols-objects: $(BUILD_LIBJVM_ALL_OBJS)
$(call LogInfo, Generating symbol list from object files) $(call LogInfo, Generating symbol list from object files)
$(CD) $(JVM_OUTPUTDIR)/objs && \ $(CD) $(JVM_OUTPUTDIR)/objs && \
$(DUMP_SYMBOLS_CMD) | $(NAWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@ $(DUMP_SYMBOLS_CMD) | $(AWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@
SYMBOLS_SRC += $(JVM_OUTPUTDIR)/symbols-objects SYMBOLS_SRC += $(JVM_OUTPUTDIR)/symbols-objects

View File

@ -36,7 +36,7 @@ $(GENSRC_EXCEPTIONS_DST)/_the.%.marker: $(GENSRC_EXCEPTIONS_SRC)/%/exceptions \
$(GENSRC_EXCEPTIONS_CMD) $(GENSRC_EXCEPTIONS_CMD)
$(call LogInfo, Generating exceptions java.nio $*) $(call LogInfo, Generating exceptions java.nio $*)
$(call MakeDir, $(@D)/$*) $(call MakeDir, $(@D)/$*)
SCRIPTS="$(TOPDIR)/make/scripts" NAWK="$(NAWK)" SH="$(SH)" $(SH) \ SCRIPTS="$(TOPDIR)/make/scripts" AWK="$(AWK)" SH="$(SH)" $(SH) \
$(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_DEBUG) $(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_DEBUG)
$(TOUCH) $@ $(TOUCH) $@

View File

@ -78,10 +78,10 @@ endif
define generate-preproc-src define generate-preproc-src
$(call MakeDir, $(@D)) $(call MakeDir, $(@D))
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_$(@F), \ $(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_$(@F), \
( $(NAWK) '/@@END_COPYRIGHT@@/{exit}1' $< && \ ( $(AWK) '/@@END_COPYRIGHT@@/{exit}1' $< && \
$(CPP) $(CPP_FLAGS) $(SYSROOT_CFLAGS) $(CFLAGS_JDKLIB) $(CPP_FILEPREFIX) $< \ $(CPP) $(CPP_FLAGS) $(SYSROOT_CFLAGS) $(CFLAGS_JDKLIB) $(CPP_FILEPREFIX) $< \
2> >($(GREP) -v '^$(<F)$$' >&2) \ 2> >($(GREP) -v '^$(<F)$$' >&2) \
| $(NAWK) '/@@START_HERE@@/,0' \ | $(AWK) '/@@START_HERE@@/,0' \
| $(SED) -e 's/@@START_HERE@@/\/\/ AUTOMATICALLY GENERATED FILE - DO NOT EDIT/' \ | $(SED) -e 's/@@START_HERE@@/\/\/ AUTOMATICALLY GENERATED FILE - DO NOT EDIT/' \
-e 's/PREFIX_//' -e 's/^#.*//' \ -e 's/PREFIX_//' -e 's/^#.*//' \
) > $@ \ ) > $@ \

View File

@ -68,7 +68,7 @@ $(GENSRC_DIR)/module-info.java.extra: $(GENSRC_DIR)/_gensrc_proc_done
($(CD) $(GENSRC_DIR)/META-INF/providers && \ ($(CD) $(GENSRC_DIR)/META-INF/providers && \
p=""; \ p=""; \
impl=""; \ impl=""; \
for i in $$($(NAWK) '$$0=FILENAME" "$$0' * | $(SORT) -k 2 | $(SED) 's/ .*//'); do \ for i in $$($(AWK) '$$0=FILENAME" "$$0' * | $(SORT) -k 2 | $(SED) 's/ .*//'); do \
c=$$($(CAT) $$i | $(TR) -d '\n\r'); \ c=$$($(CAT) $$i | $(TR) -d '\n\r'); \
if test x$$p != x$$c; then \ if test x$$p != x$$c; then \
if test x$$p != x; then \ if test x$$p != x; then \

View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# #
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,6 @@ if [ "x$COPYRIGHT_YEARS" != x ]; then
__END__ __END__
fi fi
$NAWK ' /^#.*Copyright.*Oracle/ { next } $AWK ' /^#.*Copyright.*Oracle/ { next }
/^#([^!]|$)/ { sub(/^#/, " *"); print } /^#([^!]|$)/ { sub(/^#/, " *"); print }
/^$/ { print " */"; exit } ' $0 /^$/ { print " */"; exit } ' $0