Import.gmk 7.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#
# Copyright (c) 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.
#

default: all

include $(SPEC)
include MakeBase.gmk

#######

IMPORT_TARGET_FILES :=

IMPORT_CLASSES := CORBA JAXP JAXWS LANGTOOLS
IMPORT_SOURCES := CORBA JAXP JAXWS LANGTOOLS
# Only Corba has binaries
IMPORT_BINARIES := CORBA

#######

# Put the libraries here. Different locations for different target apis.
ifeq ($(OPENJDK_TARGET_OS_API),posix)
44 45
    INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
    HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
else
    INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/bin
    HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/bin
endif

#######

#
# jar xf/unzip fails when executing them all in parallel
#   introduce artificial dependency (_DEP) buuhhh 

define ImportClasses
$1_CLASSES_DEP := $$(IMPORT_TARGET_CLASSES)
IMPORT_TARGET_CLASSES += $(JDK_OUTPUTDIR)/classes/_the.$1.classes.imported

$(JDK_OUTPUTDIR)/classes/_the.$1.classes.imported : $$($1_DIST)/lib/classes.jar $$($1_CLASSES_DEP)
	$(ECHO) Importing $1 classes.jar
	$(MKDIR) -p $$(@D)
64
	$(RM) $$@ $$@.tmp
65 66 67 68 69 70 71 72 73 74 75
	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
	$(MV) $$@.tmp $$@
endef

define ImportSources
$1_SOURCES_DEP := $$(IMPORT_TARGET_SOURCES)
IMPORT_TARGET_SOURCES += $(JDK_OUTPUTDIR)/impsrc/_the.$1.src.imported

$(JDK_OUTPUTDIR)/impsrc/_the.$1.src.imported : $$($1_DIST)/lib/src.zip $$($1_SOURCES_DEP)
	$(ECHO) Importing $1 src.zip
	$(MKDIR) -p $$(@D)
76
	$(RM) $$@ $$@.tmp
77 78 79 80 81 82 83 84 85 86 87
	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
	$(MV) $$@.tmp $$@
endef

define ImportBinaries
$1_BINARIES_DEP := $$(IMPORT_TARGET_BINARIES)
IMPORT_TARGET_BINARIES += $(JDK_OUTPUTDIR)/_the.$1.binaries.imported

$(JDK_OUTPUTDIR)/_the.$1.binaries.imported : $$($1_DIST)/lib/bin.zip $$($1_BINARIES_DEP)
	$(ECHO) Importing $1 bin.zip
	$(MKDIR) -p $$(@D)
88
	$(RM) $$@ $$@.tmp
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
	$(MV) $$@.tmp $$@
endef

#######

$(foreach I,$(IMPORT_CLASSES), $(eval $(call ImportClasses,$I)))
$(foreach I,$(IMPORT_SOURCES), $(eval $(call ImportSources,$I)))
$(foreach I,$(IMPORT_BINARIES), $(eval $(call ImportBinaries,$I)))

IMPORT_TARGET_FILES += $(IMPORT_TARGET_CLASSES) $(IMPORT_TARGET_SOURCES) $(IMPORT_TARGET_BINARIES)

#######

ifeq ($(OPENJDK_TARGET_OS),solaris)
define do-install-file
105 106
	$(MKDIR) -p '$$(@D)'
	$(RM) '$$@'
107 108 109 110
	$(CP) -r -P '$$<' '$$(@D)'
endef
else ifeq ($(OPENJDK_TARGET_OS),macosx)
define do-install-file
111 112
	$(MKDIR) -p '$$(@D)'
	$(RM) '$$@'
113 114 115 116
	$(CP) -pRP '$$<' '$$@'
endef
else
define do-install-file
117 118
	$(MKDIR) -p '$$(@D)'
	$(RM) '$$@'
119 120 121 122 123
	$(CP) -P '$$<' '$$@'
endef
endif

define CopyDir
124
        $1_SRC_FILES := $(shell $(FIND) $2 -type f -a ! -name "wb.jar")
125 126 127
        $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
        IMPORT_TARGET_FILES += $$($1_DST_FILES)
$3/% : $2/%
O
ohair 已提交
128
	$(ECHO) $(LOG_INFO) Copying $$(@F)
129 130 131 132 133 134 135 136 137 138 139 140
	$(do-install-file)
endef

#######

#
# Import hotspot
#

$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE)))
$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib))

141 142
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
                  $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159

ifneq ($(OPENJDK_TARGET_OS), windows)
    ifeq ($(JVM_VARIANT_SERVER), true)
        IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
        ifneq (,$(JSIG_DEBUGINFO))
            IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
        endif
    endif
    ifeq ($(JVM_VARIANT_CLIENT), true)
        IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
        ifneq (,$(JSIG_DEBUGINFO))
            IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
        endif
    endif
endif

$(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
160 161
	$(MKDIR) -p $(@D)
	$(RM) $@
162 163 164
	$(LN) -s ../$(@F) $@

$(INSTALL_LIBRARIES_HERE)/server/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
165 166
	$(MKDIR) -p $(@D)
	$(RM) $@
167 168 169
	$(LN) -s ../$(@F) $@

$(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
170 171
	$(MKDIR) -p $(@D)
	$(RM) $@
172 173 174 175 176 177
ifeq (REALLY_WEIRD,1)
	$(LN) -s ../$(@F) $@
else
#
# TODO: Check if this is what they really want...a zip containing a symlink
#
178
	$(RM) $@.tmp $(basename $@).debuginfo
179
	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
180 181 182
	$(ZIP) -q -y $@.tmp $(basename $@).debuginfo
	$(RM) $(basename $@).debuginfo
	$(MV) $@.tmp $@
183 184 185
endif

$(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
186 187
	$(MKDIR) -p $(@D)
	$(RM) $@
188 189 190
	$(LN) -s ../$(@F) $@

$(INSTALL_LIBRARIES_HERE)/client/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
191 192
	$(MKDIR) -p $(@D)
	$(RM) $@
193 194 195
	$(LN) -s ../$(@F) $@

$(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
196 197
	$(MKDIR) -p $(@D)
	$(RM) $@
198 199 200 201 202 203
ifeq (REALLY_WEIRD,1)
	$(LN) -s ../$(@F) $@
else
#
# TODO: Check if this is what they really want...a zip containing a symlink
#
204
	$(RM) $@.tmp $(basename $@).debuginfo
205
	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
206 207 208
	$(ZIP) -q -y $@.tmp $(basename $@).debuginfo
	$(RM) $(basename $@).debuginfo
	$(MV) $@.tmp $@
209 210 211 212 213 214
endif

#######

ifeq ($(OPENJDK_TARGET_OS),solaris)
define install-file
215 216
	$(MKDIR) -p '$(@D)'
	$(RM) '$@'
217 218 219 220
	$(CP) -r -P '$<' '$(@D)'
endef
else ifeq ($(OPENJDK_TARGET_OS),macosx)
define install-file
221 222
	$(MKDIR) -p '$(@D)'
	$(RM) '$@'
223 224 225 226
	$(CP) -pRP '$<' '$@'
endef
else
define install-file
227 228
	$(MKDIR) -p '$(@D)'
	$(RM) '$@'
229 230 231 232 233 234 235 236
	$(CP) -P '$<' '$@'
endef
endif

ifndef OPENJDK

IMPORT_TARGET_FILES += \
            $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar \
O
ohair 已提交
237
            $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
238 239

$(JDK_OUTPUTDIR)/lib/security/local_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
O
ohair 已提交
240
	$(ECHO) $(LOG_INFO) Copying $(@F)
241 242 243
	$(install-file)

$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
O
ohair 已提交
244
	$(ECHO) $(LOG_INFO) Copying $(@F)
245 246 247 248 249 250 251
	$(install-file)

endif # OPENJDK

#######

all: $(IMPORT_TARGET_FILES)