1 # 2 # Copyright (c) 2000, 2014, 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. 8 # 9 # This code is distributed in the hope that it will be useful, but WITHOUT 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 # version 2 for more details (a copy is included in the LICENSE file that 13 # accompanied this code). 14 # 15 # You should have received a copy of the GNU General Public License version 16 # 2 along with this work; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 # 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 # 24 25 # Usage: 26 # 27 # $(MAKE) -f buildtree.make ARCH=arch BUILDARCH=buildarch LIBARCH=libarch 28 # GAMMADIR=dir OS_FAMILY=os VARIANT=variant 29 # 30 # The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the 31 # environment or on the command-line: 32 # 33 # ARCH - sparc, i486, ... HotSpot cpu and os_cpu source directory 34 # BUILDARCH - build directory 35 # LIBARCH - the corresponding directory in JDK/JRE 36 # GAMMADIR - top of workspace 37 # OS_FAMILY - operating system 38 # VARIANT - core, compiler1, compiler2, or tiered 39 # HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>] 40 # HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty 41 # JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0) 42 # 43 # Builds the directory trees with makefiles plus some convenience files in 44 # each directory: 45 # 46 # Makefile - for "make foo" 47 # flags.make - with macro settings 48 # vm.make - to support making "$(MAKE) -v vm.make" in makefiles 49 # adlc.make - 50 # trace.make - generate tracing event and type definitions 51 # jvmti.make - generate JVMTI bindings from the spec (JSR-163) 52 # sa.make - generate SA jar file and natives 53 # 54 # The makefiles are split this way so that "make foo" will run faster by not 55 # having to read the dependency files for the vm. 56 57 -include $(SPEC) 58 include $(GAMMADIR)/make/scm.make 59 include $(GAMMADIR)/make/defs.make 60 include $(GAMMADIR)/make/altsrc.make 61 107 108 SIMPLE_DIRS = \ 109 $(PLATFORM_DIR)/generated/dependencies \ 110 $(PLATFORM_DIR)/generated/adfiles \ 111 $(PLATFORM_DIR)/generated/jvmtifiles \ 112 $(PLATFORM_DIR)/generated/tracefiles 113 114 TARGETS = debug fastdebug optimized product 115 SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) 116 117 # For dependencies and recursive makes. 118 BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make 119 120 BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make sa.make dtrace.make 121 122 BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ 123 ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) 124 125 # Define variables to be set in flags.make. 126 # Default values are set in make/defs.make. 127 ifeq ($(HOTSPOT_BUILD_VERSION),) 128 HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION) 129 else 130 HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION) 131 endif 132 # Set BUILD_USER from system-dependent hints: $LOGNAME, $(whoami) 133 ifndef HOTSPOT_BUILD_USER 134 HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME) 135 endif 136 ifndef HOTSPOT_BUILD_USER 137 HOTSPOT_BUILD_USER := $(shell whoami) 138 endif 139 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro 140 # or make/hotspot_distro. 141 ifndef HOTSPOT_VM_DISTRO 142 ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) 143 include $(GAMMADIR)/make/hotspot_distro 144 else 145 include $(GAMMADIR)/make/openjdk_distro 146 endif 147 endif 148 149 # if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK 150 ifndef OPENJDK 151 ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) 152 OPENJDK=true 153 endif 154 endif 155 156 BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION= JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) 157 158 BUILDTREE = \ 159 $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS) 160 161 BUILDTREE_COMMENT = echo "\# Generated by $(BUILDTREE_MAKE)" 162 163 all: $(SUBMAKE_DIRS) 164 165 # Run make in each subdirectory recursively. 166 $(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE 167 $(QUIETLY) [ -d $@ ] || { mkdir -p $@; } 168 +$(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F) 169 $(QUIETLY) touch $@ 170 171 $(SIMPLE_DIRS): 172 $(QUIETLY) mkdir -p $@ 173 174 # Convenience macro which takes a source relative path, applies $(1) to the 175 # absolute path, and then replaces $(GAMMADIR) in the result with a 176 # literal "$(GAMMADIR)/" suitable for inclusion in a Makefile. 186 DATA_MODE/sparc = 32 187 DATA_MODE/sparcv9 = 64 188 DATA_MODE/amd64 = 64 189 190 DATA_MODE = $(DATA_MODE/$(BUILDARCH)) 191 192 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst 193 @echo $(LOG_INFO) Creating $@ ... 194 $(QUIETLY) ( \ 195 $(BUILDTREE_COMMENT); \ 196 echo; \ 197 echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \ 198 sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \ 199 echo; \ 200 echo "GAMMADIR = $(GAMMADIR)"; \ 201 echo "SYSDEFS = \$$(Platform_sysdefs)"; \ 202 echo "SRCARCH = $(ARCH)"; \ 203 echo "BUILDARCH = $(BUILDARCH)"; \ 204 echo "LIBARCH = $(LIBARCH)"; \ 205 echo "TARGET = $(TARGET)"; \ 206 echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \ 207 echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \ 208 echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ 209 echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ 210 echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ 211 echo "OPENJDK = $(OPENJDK)"; \ 212 echo "$(LP64_SETTING/$(DATA_MODE))"; \ 213 echo; \ 214 echo "# Used for platform dispatching"; \ 215 echo "TARGET_DEFINES = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \ 216 echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \ 217 echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \ 218 echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \ 219 echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \ 220 echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \ 221 echo "CFLAGS += \$$(TARGET_DEFINES)"; \ 222 echo; \ 223 echo "Src_Dirs_V = \\"; \ 224 sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ 225 echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \ 226 echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \ 227 echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ 228 echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ | 1 # 2 # Copyright (c) 2000, 2015, 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. 8 # 9 # This code is distributed in the hope that it will be useful, but WITHOUT 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 # version 2 for more details (a copy is included in the LICENSE file that 13 # accompanied this code). 14 # 15 # You should have received a copy of the GNU General Public License version 16 # 2 along with this work; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 # 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 # 24 25 # Usage: 26 # 27 # $(MAKE) -f buildtree.make ARCH=arch BUILDARCH=buildarch LIBARCH=libarch 28 # GAMMADIR=dir OS_FAMILY=os VARIANT=variant 29 # 30 # The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the 31 # environment or on the command-line: 32 # 33 # ARCH - sparc, i486, ... HotSpot cpu and os_cpu source directory 34 # BUILDARCH - build directory 35 # LIBARCH - the corresponding directory in JDK/JRE 36 # GAMMADIR - top of workspace 37 # OS_FAMILY - operating system 38 # VARIANT - core, compiler1, compiler2, or tiered 39 # VERSION_STRING - the JDK version string as specified by JEP-223 40 # HOTSPOT_VERSION_STRING - the same as VERSION_STRING, unless overridden by a standalone build 41 # 42 # Builds the directory trees with makefiles plus some convenience files in 43 # each directory: 44 # 45 # Makefile - for "make foo" 46 # flags.make - with macro settings 47 # vm.make - to support making "$(MAKE) -v vm.make" in makefiles 48 # adlc.make - 49 # trace.make - generate tracing event and type definitions 50 # jvmti.make - generate JVMTI bindings from the spec (JSR-163) 51 # sa.make - generate SA jar file and natives 52 # 53 # The makefiles are split this way so that "make foo" will run faster by not 54 # having to read the dependency files for the vm. 55 56 -include $(SPEC) 57 include $(GAMMADIR)/make/scm.make 58 include $(GAMMADIR)/make/defs.make 59 include $(GAMMADIR)/make/altsrc.make 60 106 107 SIMPLE_DIRS = \ 108 $(PLATFORM_DIR)/generated/dependencies \ 109 $(PLATFORM_DIR)/generated/adfiles \ 110 $(PLATFORM_DIR)/generated/jvmtifiles \ 111 $(PLATFORM_DIR)/generated/tracefiles 112 113 TARGETS = debug fastdebug optimized product 114 SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) 115 116 # For dependencies and recursive makes. 117 BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make 118 119 BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make sa.make dtrace.make 120 121 BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ 122 ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) 123 124 # Define variables to be set in flags.make. 125 # Default values are set in make/defs.make. 126 127 # Set BUILD_USER from system-dependent hints: $LOGNAME, $(whoami) 128 ifndef HOTSPOT_BUILD_USER 129 HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME) 130 endif 131 ifndef HOTSPOT_BUILD_USER 132 HOTSPOT_BUILD_USER := $(shell whoami) 133 endif 134 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro 135 # or make/hotspot_distro. 136 ifndef HOTSPOT_VM_DISTRO 137 ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) 138 include $(GAMMADIR)/make/hotspot_distro 139 else 140 include $(GAMMADIR)/make/openjdk_distro 141 endif 142 endif 143 144 # if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK 145 ifndef OPENJDK 146 ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) 147 OPENJDK=true 148 endif 149 endif 150 151 BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) 152 153 BUILDTREE = \ 154 $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS) 155 156 BUILDTREE_COMMENT = echo "\# Generated by $(BUILDTREE_MAKE)" 157 158 all: $(SUBMAKE_DIRS) 159 160 # Run make in each subdirectory recursively. 161 $(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE 162 $(QUIETLY) [ -d $@ ] || { mkdir -p $@; } 163 +$(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F) 164 $(QUIETLY) touch $@ 165 166 $(SIMPLE_DIRS): 167 $(QUIETLY) mkdir -p $@ 168 169 # Convenience macro which takes a source relative path, applies $(1) to the 170 # absolute path, and then replaces $(GAMMADIR) in the result with a 171 # literal "$(GAMMADIR)/" suitable for inclusion in a Makefile. 181 DATA_MODE/sparc = 32 182 DATA_MODE/sparcv9 = 64 183 DATA_MODE/amd64 = 64 184 185 DATA_MODE = $(DATA_MODE/$(BUILDARCH)) 186 187 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst 188 @echo $(LOG_INFO) Creating $@ ... 189 $(QUIETLY) ( \ 190 $(BUILDTREE_COMMENT); \ 191 echo; \ 192 echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \ 193 sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \ 194 echo; \ 195 echo "GAMMADIR = $(GAMMADIR)"; \ 196 echo "SYSDEFS = \$$(Platform_sysdefs)"; \ 197 echo "SRCARCH = $(ARCH)"; \ 198 echo "BUILDARCH = $(BUILDARCH)"; \ 199 echo "LIBARCH = $(LIBARCH)"; \ 200 echo "TARGET = $(TARGET)"; \ 201 echo "HOTSPOT_VERSION_STRING = $(HOTSPOT_VERSION_STRING)"; \ 202 echo "VERSION_STRING = $(VERSION_STRING)"; \ 203 echo "SA_BUILD_VERSION = $(HOTSPOT_VERSION_STRING)"; \ 204 echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ 205 echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ 206 echo "OPENJDK = $(OPENJDK)"; \ 207 echo "$(LP64_SETTING/$(DATA_MODE))"; \ 208 echo; \ 209 echo "# Used for platform dispatching"; \ 210 echo "TARGET_DEFINES = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \ 211 echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \ 212 echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \ 213 echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \ 214 echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \ 215 echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \ 216 echo "CFLAGS += \$$(TARGET_DEFINES)"; \ 217 echo; \ 218 echo "Src_Dirs_V = \\"; \ 219 sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ 220 echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \ 221 echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \ 222 echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ 223 echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ |