hotspot/make/aix/makefiles/buildtree.make
changeset 22830 df1bb606b2ca
child 24238 641b2b1b0163
equal deleted inserted replaced
22829:08b62d0e80ed 22830:df1bb606b2ca
       
     1 #
       
     2 # Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
       
     3 # Copyright 2012, 2013 SAP AG. All rights reserved.
       
     4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     5 #
       
     6 # This code is free software; you can redistribute it and/or modify it
       
     7 # under the terms of the GNU General Public License version 2 only, as
       
     8 # published by the Free Software Foundation.
       
     9 #
       
    10 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    13 # version 2 for more details (a copy is included in the LICENSE file that
       
    14 # accompanied this code).
       
    15 #
       
    16 # You should have received a copy of the GNU General Public License version
       
    17 # 2 along with this work; if not, write to the Free Software Foundation,
       
    18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    19 #
       
    20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    21 # or visit www.oracle.com if you need additional information or have any
       
    22 # questions.
       
    23 #
       
    24 #
       
    25 
       
    26 # Usage:
       
    27 #
       
    28 # $(MAKE) -f buildtree.make SRCARCH=srcarch BUILDARCH=buildarch LIBARCH=libarch
       
    29 #         GAMMADIR=dir OS_FAMILY=os VARIANT=variant
       
    30 #
       
    31 # The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the
       
    32 # environment or on the command-line:
       
    33 #
       
    34 # ARCH		- sparc, i486, ... HotSpot cpu and os_cpu source directory
       
    35 # BUILDARCH     - build directory
       
    36 # LIBARCH       - the corresponding directory in JDK/JRE
       
    37 # GAMMADIR	- top of workspace
       
    38 # OS_FAMILY	- operating system
       
    39 # VARIANT	- core, compiler1, compiler2, or tiered
       
    40 # HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07)
       
    41 # HOTSPOT_BUILD_VERSION   - internal, internal-$(USER_RELEASE_SUFFIX) or empty
       
    42 # JRE_RELEASE_VERSION     - <major>.<minor>.<micro> (1.7.0)
       
    43 #
       
    44 # Builds the directory trees with makefiles plus some convenience files in
       
    45 # each directory:
       
    46 #
       
    47 # Makefile	- for "make foo"
       
    48 # flags.make	- with macro settings
       
    49 # vm.make	- to support making "$(MAKE) -v vm.make" in makefiles
       
    50 # adlc.make	-
       
    51 # trace.make	- generate tracing event and type definitions
       
    52 # jvmti.make	- generate JVMTI bindings from the spec (JSR-163)
       
    53 # sa.make	- generate SA jar file and natives
       
    54 #
       
    55 # The makefiles are split this way so that "make foo" will run faster by not
       
    56 # having to read the dependency files for the vm.
       
    57 
       
    58 -include $(SPEC)
       
    59 include $(GAMMADIR)/make/scm.make
       
    60 include $(GAMMADIR)/make/defs.make
       
    61 include $(GAMMADIR)/make/altsrc.make
       
    62 
       
    63 
       
    64 # 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details.
       
    65 QUIETLY$(MAKE_VERBOSE)	= @
       
    66 
       
    67 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
       
    68   PLATFORM_FILE = $(shell dirname $(shell dirname $(shell pwd)))/platform_zero
       
    69 else
       
    70   ifdef USE_SUNCC
       
    71     PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc
       
    72   else
       
    73     PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH)
       
    74   endif
       
    75 endif
       
    76 
       
    77 # Allow overriding of the arch part of the directory but default
       
    78 # to BUILDARCH if nothing is specified
       
    79 ifeq ($(VARIANTARCH),)
       
    80   VARIANTARCH=$(BUILDARCH)
       
    81 endif
       
    82 
       
    83 ifdef FORCE_TIERED
       
    84 ifeq		($(VARIANT),tiered)
       
    85 PLATFORM_DIR	= $(OS_FAMILY)_$(VARIANTARCH)_compiler2
       
    86 else
       
    87 PLATFORM_DIR	= $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT)
       
    88 endif
       
    89 else
       
    90 PLATFORM_DIR    = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT)
       
    91 endif
       
    92 
       
    93 #
       
    94 # We do two levels of exclusion in the shared directory.
       
    95 # TOPLEVEL excludes are pruned, they are not recursively searched,
       
    96 # but lower level directories can be named without fear of collision.
       
    97 # ALWAYS excludes are excluded at any level in the directory tree.
       
    98 #
       
    99 
       
   100 ALWAYS_EXCLUDE_DIRS     = $(SCM_DIRS)
       
   101 
       
   102 ifeq		($(VARIANT),tiered)
       
   103 TOPLEVEL_EXCLUDE_DIRS	= $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name agent
       
   104 else
       
   105 ifeq		($(VARIANT),compiler2)
       
   106 TOPLEVEL_EXCLUDE_DIRS	= $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name c1 -o -name agent
       
   107 else
       
   108 # compiler1 and core use the same exclude list
       
   109 TOPLEVEL_EXCLUDE_DIRS	= $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -name libadt -o -name agent
       
   110 endif
       
   111 endif
       
   112 
       
   113 # Get things from the platform file.
       
   114 COMPILER	= $(shell sed -n 's/^compiler[ 	]*=[ 	]*//p' $(PLATFORM_FILE))
       
   115 
       
   116 SIMPLE_DIRS	= \
       
   117 	$(PLATFORM_DIR)/generated/dependencies \
       
   118 	$(PLATFORM_DIR)/generated/adfiles \
       
   119 	$(PLATFORM_DIR)/generated/jvmtifiles \
       
   120 	$(PLATFORM_DIR)/generated/tracefiles
       
   121 
       
   122 TARGETS      = debug fastdebug optimized product
       
   123 SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS))
       
   124 
       
   125 # For dependencies and recursive makes.
       
   126 BUILDTREE_MAKE	= $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
       
   127 
       
   128 BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make sa.make
       
   129 
       
   130 BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
       
   131 	SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
       
   132 
       
   133 # Define variables to be set in flags.make.
       
   134 # Default values are set in make/defs.make.
       
   135 ifeq ($(HOTSPOT_BUILD_VERSION),)
       
   136   HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)
       
   137 else
       
   138   HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)
       
   139 endif
       
   140 # Set BUILD_USER from system-dependent hints:  $LOGNAME, $(whoami)
       
   141 ifndef HOTSPOT_BUILD_USER
       
   142   HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME)
       
   143 endif
       
   144 ifndef HOTSPOT_BUILD_USER
       
   145   HOTSPOT_BUILD_USER := $(shell whoami)
       
   146 endif
       
   147 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
       
   148 # or make/hotspot_distro.
       
   149 ifndef HOTSPOT_VM_DISTRO
       
   150   ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
       
   151     include $(GAMMADIR)/make/hotspot_distro
       
   152   else
       
   153     include $(GAMMADIR)/make/openjdk_distro
       
   154   endif
       
   155 endif
       
   156 
       
   157 # if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK
       
   158 ifndef OPENJDK
       
   159   ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
       
   160     OPENJDK=true
       
   161   endif
       
   162 endif
       
   163 
       
   164 BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION=  JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
       
   165 
       
   166 BUILDTREE	= \
       
   167 	$(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS)
       
   168 
       
   169 BUILDTREE_COMMENT	= echo "\# Generated by $(BUILDTREE_MAKE)"
       
   170 
       
   171 all:  $(SUBMAKE_DIRS)
       
   172 
       
   173 # Run make in each subdirectory recursively.
       
   174 $(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE
       
   175 	$(QUIETLY) [ -d $@ ] || { mkdir -p $@; }
       
   176 	$(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F)
       
   177 	$(QUIETLY) touch $@
       
   178 
       
   179 $(SIMPLE_DIRS):
       
   180 	$(QUIETLY) mkdir -p $@
       
   181 
       
   182 # Convenience macro which takes a source relative path, applies $(1) to the
       
   183 # absolute path, and then replaces $(GAMMADIR) in the result with a
       
   184 # literal "$(GAMMADIR)/" suitable for inclusion in a Makefile.
       
   185 gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2)))
       
   186 
       
   187 # This bit is needed to enable local rebuilds.
       
   188 # Unless the makefile itself sets LP64, any environmental
       
   189 # setting of LP64 will interfere with the build.
       
   190 LP64_SETTING/32 = LP64 = \#empty
       
   191 LP64_SETTING/64 = LP64 = 1
       
   192 
       
   193 DATA_MODE/ppc64 = 64
       
   194 
       
   195 DATA_MODE = $(DATA_MODE/$(BUILDARCH))
       
   196 
       
   197 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
       
   198 	@echo Creating $@ ...
       
   199 	$(QUIETLY) ( \
       
   200 	$(BUILDTREE_COMMENT); \
       
   201 	echo; \
       
   202 	echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \
       
   203 	sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \
       
   204 	echo; \
       
   205 	echo "GAMMADIR = $(GAMMADIR)"; \
       
   206 	echo "HS_ALT_MAKE = $(HS_ALT_MAKE)"; \
       
   207 	echo "OSNAME = $(OSNAME)"; \
       
   208 	echo "SYSDEFS = \$$(Platform_sysdefs)"; \
       
   209 	echo "SRCARCH = $(SRCARCH)"; \
       
   210 	echo "BUILDARCH = $(BUILDARCH)"; \
       
   211 	echo "LIBARCH = $(LIBARCH)"; \
       
   212 	echo "TARGET = $(TARGET)"; \
       
   213 	echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \
       
   214 	echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \
       
   215 	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
       
   216 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
       
   217 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
       
   218 	echo "OPENJDK = $(OPENJDK)"; \
       
   219 	echo "$(LP64_SETTING/$(DATA_MODE))"; \
       
   220 	echo; \
       
   221 	echo "# Used for platform dispatching"; \
       
   222 	echo "TARGET_DEFINES  = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \
       
   223 	echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \
       
   224 	echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \
       
   225 	echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \
       
   226 	echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \
       
   227 	echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \
       
   228 	echo "CFLAGS += \$$(TARGET_DEFINES)"; \
       
   229 	echo; \
       
   230 	echo "Src_Dirs_V = \\"; \
       
   231 	sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \
       
   232 	echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
       
   233 	echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
       
   234 	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
       
   235 	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
       
   236 	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
       
   237 	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
       
   238 	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
       
   239 	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
       
   240 	echo; \
       
   241 	echo "Src_Dirs_I = \\"; \
       
   242 	echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \
       
   243 	echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \
       
   244 	echo "$(call gamma-path,altsrc,share/vm) \\"; \
       
   245 	echo "$(call gamma-path,commonsrc,share/vm) \\"; \
       
   246 	echo "$(call gamma-path,altsrc,share/vm/precompiled) \\"; \
       
   247 	echo "$(call gamma-path,commonsrc,share/vm/precompiled) \\"; \
       
   248 	echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
       
   249 	echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
       
   250 	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
       
   251 	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
       
   252 	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
       
   253 	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
       
   254 	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
       
   255 	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
       
   256 	[ -n "$(CFLAGS_BROWSE)" ] && \
       
   257 	    echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
       
   258 	[ -n "$(ENABLE_FULL_DEBUG_SYMBOLS)" ] && \
       
   259 	    echo && echo "ENABLE_FULL_DEBUG_SYMBOLS = $(ENABLE_FULL_DEBUG_SYMBOLS)"; \
       
   260 	[ -n "$(OBJCOPY)" ] && \
       
   261 	    echo && echo "OBJCOPY = $(OBJCOPY)"; \
       
   262 	[ -n "$(STRIP_POLICY)" ] && \
       
   263 	    echo && echo "STRIP_POLICY = $(STRIP_POLICY)"; \
       
   264 	[ -n "$(ZIP_DEBUGINFO_FILES)" ] && \
       
   265 	    echo && echo "ZIP_DEBUGINFO_FILES = $(ZIP_DEBUGINFO_FILES)"; \
       
   266 	[ -n "$(ZIPEXE)" ] && \
       
   267 	    echo && echo "ZIPEXE = $(ZIPEXE)"; \
       
   268 	[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
       
   269 	    echo && \
       
   270 	    echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \
       
   271 	    echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \
       
   272 	[ -n "$(INCLUDE_TRACE)" ] && \
       
   273 	    echo && echo "INCLUDE_TRACE = $(INCLUDE_TRACE)"; \
       
   274 	echo; \
       
   275 	[ -n "$(SPEC)" ] && \
       
   276 	    echo "include $(SPEC)"; \
       
   277 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \
       
   278 	echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \
       
   279 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
       
   280 	) > $@
       
   281 
       
   282 flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
       
   283 	@echo Creating $@ ...
       
   284 	$(QUIETLY) ( \
       
   285 	$(BUILDTREE_COMMENT); \
       
   286 	echo; \
       
   287 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(TARGET).make"; \
       
   288 	) > $@
       
   289 
       
   290 ../shared_dirs.lst:  $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
       
   291 	@echo Creating directory list $@
       
   292 	$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
       
   293           find $(HS_ALT_SRC)/share/vm/* -prune \
       
   294 	  -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
       
   295           \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \
       
   296         fi;
       
   297 	$(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \
       
   298 	-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
       
   299         \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
       
   300 
       
   301 Makefile: $(BUILDTREE_MAKE)
       
   302 	@echo Creating $@ ...
       
   303 	$(QUIETLY) ( \
       
   304 	$(BUILDTREE_COMMENT); \
       
   305 	echo; \
       
   306 	echo include flags.make; \
       
   307 	echo; \
       
   308 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/top.make"; \
       
   309 	) > $@
       
   310 
       
   311 vm.make: $(BUILDTREE_MAKE)
       
   312 	@echo Creating $@ ...
       
   313 	$(QUIETLY) ( \
       
   314 	$(BUILDTREE_COMMENT); \
       
   315 	echo; \
       
   316 	echo include flags.make; \
       
   317 	echo include flags_vm.make; \
       
   318 	echo; \
       
   319 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
       
   320 	) > $@
       
   321 
       
   322 adlc.make: $(BUILDTREE_MAKE)
       
   323 	@echo Creating $@ ...
       
   324 	$(QUIETLY) ( \
       
   325 	$(BUILDTREE_COMMENT); \
       
   326 	echo; \
       
   327 	echo include flags.make; \
       
   328 	echo; \
       
   329 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
       
   330 	) > $@
       
   331 
       
   332 jvmti.make: $(BUILDTREE_MAKE)
       
   333 	@echo Creating $@ ...
       
   334 	$(QUIETLY) ( \
       
   335 	$(BUILDTREE_COMMENT); \
       
   336 	echo; \
       
   337 	echo include flags.make; \
       
   338 	echo; \
       
   339 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
       
   340 	) > $@
       
   341 
       
   342 trace.make: $(BUILDTREE_MAKE)
       
   343 	@echo Creating $@ ...
       
   344 	$(QUIETLY) ( \
       
   345 	$(BUILDTREE_COMMENT); \
       
   346 	echo; \
       
   347 	echo include flags.make; \
       
   348 	echo; \
       
   349 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
       
   350 	) > $@
       
   351 
       
   352 sa.make: $(BUILDTREE_MAKE)
       
   353 	@echo Creating $@ ...
       
   354 	$(QUIETLY) ( \
       
   355 	$(BUILDTREE_COMMENT); \
       
   356 	echo; \
       
   357 	echo include flags.make; \
       
   358 	echo; \
       
   359 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
       
   360 	) > $@
       
   361 
       
   362 FORCE:
       
   363 
       
   364 .PHONY:  all FORCE