jdk

Форк
0
/
Doctor.gmk 
148 строк · 5.2 Кб
1
#
2
# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25

26
default: all
27

28
include $(SPEC)
29
include MakeBase.gmk
30

31
# Hook to include the corresponding custom file, if present.
32
$(eval $(call IncludeCustomExtension, Doctor.gmk))
33

34
################################################################################
35
#
36
# Help user diagnose possible errors and problems with the build environment.
37
#
38

39
prologue:
40
	$(ECHO)
41
	$(ECHO) '"make doctor" will help you analyze your build environment. It can highlight'
42
	$(ECHO) 'certain well-known problems, but it can never find all possible errors.'
43

44
TARGETS += prologue
45

46
check-git: prologue
47
	$(ECHO)
48
	$(ECHO) '* Verifying that configure has picked up git...'
49
        ifeq ($(GIT), )
50
	  $(ECHO) 'WARNING: "git" is not present. This will disable several checks.'
51
	  $(ECHO) '! Correct by installing git and verifying that it is in the PATH'
52
        endif
53

54
TARGETS += check-git
55

56
ifneq ($(GIT), )
57
  AUTOCRLF := $(shell $(GIT) config core.autocrlf)
58
endif
59

60
check-autocrlf: check-git
61
        ifneq ($(GIT), )
62
          ifeq ($(call isBuildOs, windows), true)
63
	    $(ECHO)
64
	    $(ECHO) '* Verifying git core.autocrlf value...'
65
            ifneq ($(AUTOCRLF), false)
66
	      $(ECHO) 'WARNING: core.autocrlf is not "false".  HIGH RISK of build failure!'
67
	      $(ECHO) '! Correct by running 'git config --global core.autocrlf false' and re-cloning the repo'
68
            endif
69
          endif
70
        endif
71

72
TARGETS += check-autocrlf
73

74
check-configure-warnings: check-autocrlf
75
	$(ECHO)
76
	$(ECHO) '* Checking for warnings from configure...'
77
	warning_output=`$(GREP) -e "^\* Memory limit:" -A 300 $(OUTPUTDIR)/configure.log | $(TAIL) -n +3 | $(SED) -e '$(DOLLAR){/^$(DOLLAR)/d;}'` && \
78
	if test -n "$$warning_output" ; then \
79
	  $(ECHO) ' ---' ; \
80
	  $(GREP) -e "^\* Memory limit:" -A 300 $(OUTPUTDIR)/configure.log | $(TAIL) -n +3 | $(SED) -e '$(DOLLAR){/^$(DOLLAR)/d;}' ; \
81
	  $(ECHO) ' ---' ; \
82
	  $(ECHO) '! Inspect the warnings, fix any problems, and re-run configure' ; \
83
	fi
84

85
TARGETS += check-configure-warnings
86

87
ifneq ($(GIT), )
88
  # This might have been set by custom component
89
  UNTRACKED_FILES ?= $(shell $(GIT) status --porcelain --ignored | $(CUT) -c 4-)
90
endif
91

92
check-core-files: check-configure-warnings
93
        ifneq ($(GIT), )
94
	  $(ECHO)
95
	  $(ECHO) '* Checking for left-over core files...'
96
	  core_files_found=`echo "$(UNTRACKED_FILES)" | $(TR) ' ' '\n' | $(GREP) core` && \
97
	  if test -n "$$core_files_found" ; then \
98
	    $(ECHO) 'Found these potential core files. They might interfere with the build process:' ; \
99
	    $(ECHO) ' ---' ; \
100
	    $(ECHO) $$core_files_found | $(TR) ' ' '\n'; \
101
	    $(ECHO) ' ---' ; \
102
	    $(ECHO) '! Remove left-over core files' ; \
103
	  fi || : # do nothing if grep returns non-0 value
104
        endif
105

106
TARGETS += check-core-files
107

108
check-bad-file-names: check-core-files
109
        ifneq ($(GIT), )
110
	  $(ECHO)
111
	  $(ECHO) '* Checking for untracked files with illegal names...'
112
	  core_files_found=`echo "$(UNTRACKED_FILES)" | $(TR) ' ' '\n' | $(GREP) '#'` && \
113
	  if test -n "$$core_files_found" ; then \
114
	    $(ECHO) 'Found these files with illegal names. They *will* cause build failures:' ; \
115
	    $(ECHO) ' ---' ; \
116
	    $(ECHO) $$core_files_found | $(TR) ' ' '\n'; \
117
	    $(ECHO) ' ---' ; \
118
	    $(ECHO) '! Remove all files with '#' in their name from the JDK source tree' ; \
119
	  fi || : # do nothing if grep returns non-0 value
120
        endif
121

122
TARGETS += check-bad-file-names
123

124
epilogue: check-bad-file-names
125
	$(ECHO)
126
	$(ECHO) '* If all else fails, try removing the entire build directory and re-creating'
127
	$(ECHO) 'the same configuration using:'
128
	$(ECHO) ' ---' ; \
129
	$(ECHO) configure_command_line=\$$\(make print-configuration\)
130
	$(ECHO) make dist-clean
131
	$(ECHO) bash configure \$$configure_command_line
132
	$(ECHO) ' ---' ; \
133
	$(ECHO)
134
	$(ECHO) '* The build README (doc/building.md) is a great source of information,'
135
	$(ECHO) 'especially the chapter "Fixing Unexpected Build Failures". Check it out!'
136
	$(ECHO)
137
	$(ECHO) '* If you still need assistance please contact build-dev@openjdk.org.'
138
	$(ECHO)
139

140
TARGETS += epilogue
141

142
################################################################################
143

144
doctor: $(TARGETS)
145

146
all: doctor
147

148
.PHONY: default all doctor $(TARGETS)
149

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.