jdk/makefiles/GensrcJObjC.gmk
author amurillo
Wed, 15 Aug 2012 16:49:38 -0700
changeset 13465 d3fc5d192448
parent 13164 72c5d01a857d
child 13702 efd6a05935b2
permissions -rw-r--r--
7191765: make jdk8 the default jprt release for hs24 Reviewed-by: jcoomes

#
# Copyright (c) 2011, 2012, 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.
#

GENSRC_JOBJC :=

JOBJC_FRAMEWORKS := Foundation CoreFoundation AppKit
FRAMEWORKS_DIR := /System/Library/Frameworks
GBM := /usr/bin/gen_bridge_metadata

JOBJC_SRC := $(JDK_TOPDIR)/src/macosx/native/jobjc
JOBJC_TMP := $(JDK_OUTPUTDIR)/gensrc_jobjc
JOBJC_DST := $(JDK_OUTPUTDIR)/gensrc_jobjc/src

#
# Build generator
#
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_PRIMITIVE_CODER,\
		SETUP:=GENERATE_OLDBYTECODE,\
		INCLUDES:=core/java \
                          com/apple,\
                HEADERS :=$(JOBJC_DST)/jni_headers/core ,\
		SRC:=$(JOBJC_SRC)/src \
                     $(JOBJC_SRC)/src/generator/java, \
		BIN:=$(JOBJC_TMP)/bin))

GENSRC_JOBJC += $(JOBJC_TMP)/bin/_the.batch

#
# Generate bridge support
#
BRIDGESUPPORT := $(addprefix $(JOBJC_TMP)/bridge/,$(addsuffix Full.bridgesupport,$(JOBJC_FRAMEWORKS)))

$(JOBJC_TMP)/bridge/%Full.bridgesupport : $(FRAMEWORKS_DIR)/%.framework/Headers/*.h
	$(MKDIR) -p $(@D)
	if [ -f $(FRAMEWORKS_DIR)/$*.framework/Resources/BridgeSupport/$(@F) ]; then \
		cp $(FRAMEWORKS_DIR)/$*.framework/Resources/BridgeSupport/$(@F) $@ ;\
	else \
		$(GBM) -F complete --framework $* -o $@ ; \
	fi

#
# Find Xbootclasspath
#
$(JOBJC_TMP)/_the.generator_bootclasspath : $(JOBJC_TMP)/bin/_the.batch
	$(JAVA) -cp $(JOBJC_TMP)/bin com.apple.internal.jobjc.generator.BootClassPathMinus JObjC.jar > $@.tmp
	$(MV) $@.tmp $@


#
# Run generator
#
TOOL_JOBJC := $(JAVA) -cp $(JOBJC_TMP)/bin -ea com.apple.internal.jobjc.generator.Generator

$(JOBJC_TMP)/_the.generator : $(JOBJC_TMP)/bin/_the.batch $(JOBJC_TMP)/_the.generator_bootclasspath $(BRIDGESUPPORT)
	$(JAVA) -d64 -Xbootclasspath:`$(CAT) $(JOBJC_TMP)/_the.generator_bootclasspath` -cp $(JOBJC_TMP)/bin -ea com.apple.internal.jobjc.generator.Generator dst=$(JOBJC_DST) frameworks=$(JOBJC_TMP)/bridge
	$(TOUCH) $@

GENSRC_JOBJC += $(JOBJC_TMP)/_the.generator