jdk/make/GenerateClasslist.gmk
author egahlin
Tue, 23 Aug 2016 22:51:24 +0200
changeset 40666 83beca9dbc5f
parent 37805 62e458968aad
child 40681 87d3f0e6a51f
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37805
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     1
#
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     2
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     4
#
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    10
#
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    15
# accompanied this code).
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    16
#
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    20
#
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    23
# questions.
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    24
#
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    25
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    26
################################################################################
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    27
# Generate classlist
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    28
################################################################################
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    29
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    30
default: all
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    31
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    32
include $(SPEC)
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    33
include MakeBase.gmk
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    34
include Tools.gmk
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    35
include JarArchive.gmk
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    36
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    37
################################################################################
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    38
# Create a jar with our generator class. Using a jar is intentional since it
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    39
# will load more classes
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    40
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    41
$(eval $(call SetupJarArchive, CLASSLIST_JAR, \
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    42
    SRCS := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    43
    INCLUDES := build/tools/classlist, \
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    44
    JAR := $(SUPPORT_OUTPUTDIR)/classlist.jar, \
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    45
))
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    46
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    47
TARGETS += $(CLASSLIST_JAR)
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    48
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    49
################################################################################
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    50
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    51
CLASSLIST_FILE := $(SUPPORT_OUTPUTDIR)/classlist/classlist
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    52
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    53
# If an external buildjdk has been supplied, we don't build a separate interim
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    54
# image, so just use the external build jdk instead.
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    55
ifeq ($(EXTERNAL_BUILDJDK), true)
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    56
  INTERIM_IMAGE_DIR := $(BUILD_JDK)
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    57
endif
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    58
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    59
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    60
	$(call MakeDir, $(@D))
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    61
	$(call LogInfo, Generating lib/classlist)
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    62
	$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.tmp \
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    63
	    -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    64
	    build.tools.classlist.HelloClasslist $(LOG_DEBUG) 2>&1
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    65
        # Filter out generated classes, remove after JDK-8149977
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    66
	$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@ \
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    67
	    -Xshare:dump -XX:SharedClassListFile=$@.tmp $(LOG_DEBUG) 2>&1
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    68
	$(RM) $@.tmp
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    69
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    70
TARGETS += $(CLASSLIST_FILE)
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    71
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    72
################################################################################
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    73
62e458968aad 8150044: Generate classlists at build-time
redestad
parents:
diff changeset
    74
all: $(TARGETS)