langtools/make/GenstubsLangtools.gmk
author alitvinov
Fri, 28 Mar 2014 14:41:37 +0400
changeset 24135 f273b57ed7e1
parent 22703 322d8adeabe1
permissions -rw-r--r--
8032832: Applet/browser deadlocks, when IIS integrated authentication is used Reviewed-by: chegar, weijun

#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

# This must be the first rule
default: all

include $(SPEC)
include MakeBase.gmk

include CommonLangtools.gmk

# GenStubs is used to bootstrap any dependencies from javac to the new JDK that is not
# yet built. It is currently not needed but might be again in the future. The following
# exercises the functionality to verify that it works.
TOOL_GENSTUBS_CMD = $(JAVA) \
     "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" \
     genstubs.GenStubs

# We fetch source from the JDK...
JDKS := $(JDK_TOPDIR)/src/share/classes

# Build the list of classes to generate stubs from. java/util/function/Predicate.java isn't
# currently needed, but is used as a demo for now.

STUBSOURCES := $(shell $(FIND) $(JDKS) -name "*.java" | $(GREP) \
    -e "$(JDKS)/java/util/function/Predicate.java")

# Rewrite the file names into class names because the GenStubs tool require this.
STUBCLASSES := $(subst /,., $(patsubst $(JDKS)/%.java, %, $(STUBSOURCES)))

# Now setup the build recipe for genstubs.
$(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs: $(STUBSOURCES)
	$(MKDIR) -p $(@D)
	$(MKDIR) -p $(LANGTOOLS_OUTPUTDIR)/tmpstubs
	$(ECHO) $(LOG_INFO) Generating stubs from JDK sources.
	$(TOOL_GENSTUBS_CMD) -s $(LANGTOOLS_OUTPUTDIR)/tmpstubs -sourcepath $(JDKS) $(STUBCLASSES)
	if $(DIFF) -x "_the*" -rq $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(LANGTOOLS_OUTPUTDIR)/genstubs \
	    > /dev/null 2>&1; then \
	  $(ECHO) $(LOG_INFO) No changes in the stubs!; \
	  $(RM) -r $(LANGTOOLS_OUTPUTDIR)/tmpstubs; \
	else \
	  $(ECHO) $(LOG_INFO) Changes in stubs detected!; \
	  $(RM) -r $(@D); \
	  $(MV) $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(@D); \
	fi
	$(TOUCH) $@

all: $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs