jdk/makefiles/GensrcJObjC.gmk
author cl
Thu, 01 Aug 2013 04:56:06 -0700
changeset 18980 9543adaf5371
parent 14344 a5537423264b
child 20547 453837141fac
permissions -rw-r--r--
Added tag jdk8-b101 for changeset 7af02a20e411
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     1
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     2
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     4
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    10
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    15
# accompanied this code).
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    16
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    20
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    23
# questions.
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    24
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    25
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    26
GENSRC_JOBJC :=
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    27
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    28
JOBJC_FRAMEWORKS := Foundation CoreFoundation AppKit
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    29
FRAMEWORKS_DIR := /System/Library/Frameworks
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    30
GBM := /usr/bin/gen_bridge_metadata
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    31
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    32
JOBJC_SRC := $(JDK_TOPDIR)/src/macosx/native/jobjc
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    33
JOBJC_TMP := $(JDK_OUTPUTDIR)/gensrc_jobjc
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    34
JOBJC_DST := $(JDK_OUTPUTDIR)/gensrc_jobjc/src
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    35
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    36
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    37
# Build generator
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    38
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    39
$(eval $(call SetupJavaCompilation,BUILD_JOBJC_PRIMITIVE_CODER,\
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    40
		SETUP:=GENERATE_OLDBYTECODE,\
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    41
		DISABLE_SJAVAC:=true,\
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    42
		INCLUDES:=core/java \
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    43
                          com/apple,\
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    44
		SRC:=$(JOBJC_SRC)/src \
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    45
                     $(JOBJC_SRC)/src/generator/java, \
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    46
		BIN:=$(JOBJC_TMP)/bin))
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    47
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    48
GENSRC_JOBJC += $(BUILD_JOBJC_PRIMITIVE_CODER)
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    49
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    50
#
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    51
# Generate bridge support for select frameworks
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    52
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    53
BRIDGESUPPORT := $(addprefix $(JOBJC_TMP)/bridge/,$(addsuffix Full.bridgesupport,$(JOBJC_FRAMEWORKS)))
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    54
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    55
#
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    56
# Define macro for rules to create bridge support
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    57
#    Not sure why, but if the system has this framework bridge support,
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    58
#    we appear to copy that, otherwise we run GBM which can be very slow.
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    59
#
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    60
define CreateBridgeSupport # Framework
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    61
$(RM) $@ $@.tmp
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    62
$(MKDIR) -p $(@D)
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    63
if [ -f $(FRAMEWORKS_DIR)/$1.framework/Resources/BridgeSupport/$(@F) ]; then \
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    64
    $(CP) $(FRAMEWORKS_DIR)/$1.framework/Resources/BridgeSupport/$(@F) $@.tmp ;\
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    65
else \
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
    66
    $(GBM) $(LOG_INFO) -F complete --framework $1 -o $@.tmp ; \
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    67
fi
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    68
$(MV) $@.tmp $@
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    69
endef
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    70
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    71
#
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    72
# Currently 3 frameworks, avoid pattern rule due to the names being conflicting
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    73
#
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    74
$(JOBJC_TMP)/bridge/FoundationFull.bridgesupport : \
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    75
		$(wildcard $(FRAMEWORKS_DIR)/Foundation.framework/Headers/*.h)
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    76
	$(call CreateBridgeSupport,Foundation)
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    77
$(JOBJC_TMP)/bridge/CoreFoundationFull.bridgesupport : \
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    78
		$(wildcard $(FRAMEWORKS_DIR)/CoreFoundation.framework/Headers/*.h)
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    79
	$(call CreateBridgeSupport,CoreFoundation)
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    80
$(JOBJC_TMP)/bridge/AppKitFull.bridgesupport : \
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    81
		$(wildcard $(FRAMEWORKS_DIR)/AppKit.framework/Headers/*.h)
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    82
	$(call CreateBridgeSupport,AppKit)
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    83
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    84
#
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    85
# Find Xbootclasspath, for some reason, this involves firing up Java just
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    86
#     so we can get the boot classpath, so we can remove anything in that
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    87
#     classpath that ends with "JObjC.jar", and emit the new bootclasspath.
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    88
#
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    89
$(JOBJC_TMP)/_the.generator_bootclasspath : $(BUILD_JOBJC_PRIMITIVE_CODER)
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
    90
	$(ECHO) Generating jobjc framework bridge
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    91
	$(RM) $@
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
    92
	$(JAVA) $(LOG_INFO) -cp $(JOBJC_TMP)/bin com.apple.internal.jobjc.generator.BootClassPathMinus JObjC.jar > $@.tmp
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    93
	$(MV) $@.tmp $@
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    94
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    95
#
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    96
# Run generator
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    97
#    Now we use bootclasspath to run java again, with the bridge support to
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    98
#    generate more source.
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
    99
#
14344
a5537423264b 8002220: build-infra: update for mac, solaris 11 issues
erikj
parents: 14231
diff changeset
   100
$(JOBJC_TMP)/_the.generator : $(JOBJC_TMP)/_the.generator_bootclasspath $(BRIDGESUPPORT)
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
   101
	$(RM) $@
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
   102
	$(JAVA) $(LOG_INFO) -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
13164
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
   103
	$(TOUCH) $@
72c5d01a857d 7181504: Update of latest build-infra Makefiles
erikj
parents:
diff changeset
   104
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
   105
# The generator delets all files in the target dir so it has to work in its
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
   106
# own dir and have the files copied over to gensrc aftewards.
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
   107
$(JDK_OUTPUTDIR)/gensrc/_the.jobjc.files : $(JOBJC_TMP)/_the.generator
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
   108
	$(MKDIR) -p $(@D)
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
   109
	$(CP) -rp $(JOBJC_DST)/* $(@D)
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
   110
	$(TOUCH) $@
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
   111
14231
a0c23c1c010f 8000992: Update new build-infra makefiles
ohair
parents: 13702
diff changeset
   112
GENSRC_JOBJC += $(JDK_OUTPUTDIR)/gensrc/_the.jobjc.files