jdk/makefiles/GensrcJObjC.gmk
changeset 13702 efd6a05935b2
parent 13164 72c5d01a857d
child 14231 a0c23c1c010f
equal deleted inserted replaced
13694:ffe6bce5a521 13702:efd6a05935b2
    36 #
    36 #
    37 # Build generator
    37 # Build generator
    38 #
    38 #
    39 $(eval $(call SetupJavaCompilation,BUILD_JOBJC_PRIMITIVE_CODER,\
    39 $(eval $(call SetupJavaCompilation,BUILD_JOBJC_PRIMITIVE_CODER,\
    40 		SETUP:=GENERATE_OLDBYTECODE,\
    40 		SETUP:=GENERATE_OLDBYTECODE,\
       
    41 		DISABLE_SJAVAC:=true,\
    41 		INCLUDES:=core/java \
    42 		INCLUDES:=core/java \
    42                           com/apple,\
    43                           com/apple,\
    43                 HEADERS :=$(JOBJC_DST)/jni_headers/core ,\
    44                 HEADERS:=$(JOBJC_DST)/jni_headers/core ,\
    44 		SRC:=$(JOBJC_SRC)/src \
    45 		SRC:=$(JOBJC_SRC)/src \
    45                      $(JOBJC_SRC)/src/generator/java, \
    46                      $(JOBJC_SRC)/src/generator/java, \
    46 		BIN:=$(JOBJC_TMP)/bin))
    47 		BIN:=$(JOBJC_TMP)/bin))
    47 
    48 
    48 GENSRC_JOBJC += $(JOBJC_TMP)/bin/_the.batch
    49 GENSRC_JOBJC += $(BUILD_JOBJC_PRIMITIVE_CODER)
    49 
    50 
    50 #
    51 #
    51 # Generate bridge support
    52 # Generate bridge support for select frameworks
    52 #
    53 #
    53 BRIDGESUPPORT := $(addprefix $(JOBJC_TMP)/bridge/,$(addsuffix Full.bridgesupport,$(JOBJC_FRAMEWORKS)))
    54 BRIDGESUPPORT := $(addprefix $(JOBJC_TMP)/bridge/,$(addsuffix Full.bridgesupport,$(JOBJC_FRAMEWORKS)))
    54 
    55 
    55 $(JOBJC_TMP)/bridge/%Full.bridgesupport : $(FRAMEWORKS_DIR)/%.framework/Headers/*.h
    56 #
    56 	$(MKDIR) -p $(@D)
    57 # Define macro for rules to create bridge support
    57 	if [ -f $(FRAMEWORKS_DIR)/$*.framework/Resources/BridgeSupport/$(@F) ]; then \
    58 #    Not sure why, but if the system has this framework bridge support,
    58 		cp $(FRAMEWORKS_DIR)/$*.framework/Resources/BridgeSupport/$(@F) $@ ;\
    59 #    we appear to copy that, otherwise we run GBM which can be very slow.
    59 	else \
    60 #
    60 		$(GBM) -F complete --framework $* -o $@ ; \
    61 define CreateBridgeSupport # Framework
    61 	fi
    62 $(RM) $@ $@.tmp
       
    63 $(MKDIR) -p $(@D)
       
    64 if [ -f $(FRAMEWORKS_DIR)/$1.framework/Resources/BridgeSupport/$(@F) ]; then \
       
    65     $(CP) $(FRAMEWORKS_DIR)/$1.framework/Resources/BridgeSupport/$(@F) $@.tmp ;\
       
    66 else \
       
    67     $(GBM) -F complete --framework $1 -o $@.tmp ; \
       
    68 fi
       
    69 $(MV) $@.tmp $@
       
    70 endef
    62 
    71 
    63 #
    72 #
    64 # Find Xbootclasspath
    73 # Currently 3 frameworks, avoid pattern rule due to the names being conflicting
    65 #
    74 #
    66 $(JOBJC_TMP)/_the.generator_bootclasspath : $(JOBJC_TMP)/bin/_the.batch
    75 $(JOBJC_TMP)/bridge/FoundationFull.bridgesupport : \
       
    76 		$(wildcard $(FRAMEWORKS_DIR)/Foundation.framework/Headers/*.h)
       
    77 	$(call CreateBridgeSupport,Foundation)
       
    78 $(JOBJC_TMP)/bridge/CoreFoundationFull.bridgesupport : \
       
    79 		$(wildcard $(FRAMEWORKS_DIR)/CoreFoundation.framework/Headers/*.h)
       
    80 	$(call CreateBridgeSupport,CoreFoundation)
       
    81 $(JOBJC_TMP)/bridge/AppKitFull.bridgesupport : \
       
    82 		$(wildcard $(FRAMEWORKS_DIR)/AppKit.framework/Headers/*.h)
       
    83 	$(call CreateBridgeSupport,AppKit)
       
    84 
       
    85 #
       
    86 # Find Xbootclasspath, for some reason, this involves firing up Java just
       
    87 #     so we can get the boot classpath, so we can remove anything in that
       
    88 #     classpath that ends with "JObjC.jar", and emit the new bootclasspath.
       
    89 #
       
    90 $(JOBJC_TMP)/_the.generator_bootclasspath : $(BUILD_JOBJC_PRIMITIVE_CODER)
       
    91 	$(RM) $@
    67 	$(JAVA) -cp $(JOBJC_TMP)/bin com.apple.internal.jobjc.generator.BootClassPathMinus JObjC.jar > $@.tmp
    92 	$(JAVA) -cp $(JOBJC_TMP)/bin com.apple.internal.jobjc.generator.BootClassPathMinus JObjC.jar > $@.tmp
    68 	$(MV) $@.tmp $@
    93 	$(MV) $@.tmp $@
    69 
    94 
    70 
       
    71 #
    95 #
    72 # Run generator
    96 # Run generator
       
    97 #    Now we use bootclasspath to run java again, with the bridge support to
       
    98 #    generate more source.
       
    99 #    Note the use of the | (order-only) on the BRIDGESUPPORT, should serialize
       
   100 #    them just in case GBM run in parallel has issues.
    73 #
   101 #
    74 TOOL_JOBJC := $(JAVA) -cp $(JOBJC_TMP)/bin -ea com.apple.internal.jobjc.generator.Generator
   102 $(JOBJC_TMP)/_the.generator : $(JOBJC_TMP)/_the.generator_bootclasspath | $(BRIDGESUPPORT)
    75 
   103 	$(RM) $@
    76 $(JOBJC_TMP)/_the.generator : $(JOBJC_TMP)/bin/_the.batch $(JOBJC_TMP)/_the.generator_bootclasspath $(BRIDGESUPPORT)
       
    77 	$(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
   104 	$(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
    78 	$(TOUCH) $@
   105 	$(TOUCH) $@
    79 
   106 
    80 GENSRC_JOBJC += $(JOBJC_TMP)/_the.generator
   107 GENSRC_JOBJC += $(JOBJC_TMP)/_the.generator
       
   108