< prev index next >

make/common/MakeBase.gmk

Print this page

  1 #
  2 # Copyright (c) 2011, 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

135 
136 # Locate all sourcecode repositories included in the forest, as relative paths
137 FindAllReposRel = \
138     $(strip $(subst $(TOPDIR)/,.,$(patsubst $(TOPDIR)/%/, %, $(FindAllReposAbs))))
139 
140 ################################################################################
141 
142 define SetupLogging
143   ifeq ($$(LOG_PROFILE_TIMES_FILE), true)
144     ifeq ($$(IS_GNU_TIME), yes)
145       SHELL :=  $$(BASH) $$(TOPDIR)/make/scripts/shell-profiler.sh \
146                 gnutime $$(TIME) \
147                 $$(OUTPUTDIR)/build-profile.log $$(SHELL)
148     else ifneq ($$(FLOCK), )
149       SHELL :=  $$(BASH) $$(TOPDIR)/make/scripts/shell-profiler.sh \
150                 flock $$(FLOCK) \
151                 $$(OUTPUTDIR)/build-profile.log $$(SHELL)
152     endif
153   endif
154 




155   ifeq ($$(LOG_LEVEL), trace)
156     SHELL_NO_RECURSE := $$(SHELL)
157     # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
158     # For each target executed, will print
159     # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
160     # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much
161     # (and causing a crash on Cygwin).
162     SHELL = $$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(SHELL_NO_RECURSE) -x
163   endif
164 
165   # The LOG_PREFIX is set for sub recursive calls like buildjdk and bootcycle.
166   # The warn level can never be turned off
167   LogWarn = $$(info $(LOG_PREFIX)$$(strip $$1))
168   LOG_WARN :=
169   ifneq ($$(findstring $$(LOG_LEVEL), info debug trace),)
170     LogInfo = $$(info $(LOG_PREFIX)$$(strip $$1))
171     LOG_INFO :=
172   else
173     LogInfo =
174     LOG_INFO := > /dev/null

  1 #
  2 # Copyright (c) 2011, 2024, 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

135 
136 # Locate all sourcecode repositories included in the forest, as relative paths
137 FindAllReposRel = \
138     $(strip $(subst $(TOPDIR)/,.,$(patsubst $(TOPDIR)/%/, %, $(FindAllReposAbs))))
139 
140 ################################################################################
141 
142 define SetupLogging
143   ifeq ($$(LOG_PROFILE_TIMES_FILE), true)
144     ifeq ($$(IS_GNU_TIME), yes)
145       SHELL :=  $$(BASH) $$(TOPDIR)/make/scripts/shell-profiler.sh \
146                 gnutime $$(TIME) \
147                 $$(OUTPUTDIR)/build-profile.log $$(SHELL)
148     else ifneq ($$(FLOCK), )
149       SHELL :=  $$(BASH) $$(TOPDIR)/make/scripts/shell-profiler.sh \
150                 flock $$(FLOCK) \
151                 $$(OUTPUTDIR)/build-profile.log $$(SHELL)
152     endif
153   endif
154 
155   ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
156     SHELL := $$(SHELL) -x
157   endif
158 
159   ifeq ($$(LOG_LEVEL), trace)
160     SHELL_NO_RECURSE := $$(SHELL)
161     # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
162     # For each target executed, will print
163     # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
164     # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much
165     # (and causing a crash on Cygwin).
166     SHELL = $$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(SHELL_NO_RECURSE) -x
167   endif
168 
169   # The LOG_PREFIX is set for sub recursive calls like buildjdk and bootcycle.
170   # The warn level can never be turned off
171   LogWarn = $$(info $(LOG_PREFIX)$$(strip $$1))
172   LOG_WARN :=
173   ifneq ($$(findstring $$(LOG_LEVEL), info debug trace),)
174     LogInfo = $$(info $(LOG_PREFIX)$$(strip $$1))
175     LOG_INFO :=
176   else
177     LogInfo =
178     LOG_INFO := > /dev/null
< prev index next >