Import.gmk 10.0 KB
Newer Older
1
#
2
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
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
# 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.
43 44 45
ifeq ($(OPENJDK_TARGET_OS_API), posix)
  INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
  HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
46
else
47 48
  INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin
  HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/bin
49 50 51 52 53 54
endif

#######

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

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

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

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

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

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

85
  $(JDK_OUTPUTDIR)/_the.$1.binaries.imported: $$($1_DIST)/lib/bin.zip $$($1_BINARIES_DEP)
86 87
	$(ECHO) Importing $1 bin.zip
	$(MKDIR) -p $$(@D)
88
	$(RM) $$@ $$@.tmp
89 90 91 92 93 94
	($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
	$(MV) $$@.tmp $$@
endef

#######

95 96 97
$(foreach I, $(IMPORT_CLASSES), $(eval $(call ImportClasses,$I)))
$(foreach I, $(IMPORT_SOURCES), $(eval $(call ImportSources,$I)))
$(foreach I, $(IMPORT_BINARIES), $(eval $(call ImportBinaries,$I)))
98 99 100 101 102 103

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

#######

define CopyDir
104 105 106 107
  $1_SRC_FILES := $(shell $(FIND) $2 -type f -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE),$4) \))
  $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
  IMPORT_TARGET_FILES += $$($1_DST_FILES)
  $3/%: $2/%
O
ohair 已提交
108
	$(ECHO) $(LOG_INFO) Copying $$(@F)
109
	$$(install-file)
110 111 112 113 114 115 116
endef

#######

#
# Import hotspot
#
117 118
HOTSPOT_IMPORT_FILES := $(addprefix $(LIBRARY_PREFIX), jvm.* saproc.* jsig.* sawindbg.* jvm_db.* jvm_dtrace.*) \
    Xusage.txt sa-jdi.jar
119 120
$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE), $(HOTSPOT_IMPORT_FILES)))
$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib, $(HOTSPOT_IMPORT_FILES)))
121

122
ifeq ($(OPENJDK_TARGET_OS), macosx)
123 124
  JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
      $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
125
else
126
  JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
127
      $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
128
endif
129 130

ifneq ($(OPENJDK_TARGET_OS), windows)
131 132 133 134
  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))
135
    endif
136 137 138 139 140
  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))
141
    endif
142
  endif
143 144 145 146 147 148
  ifneq ($(OPENJDK_TARGET_OS), macosx)
    ifeq ($(JVM_VARIANT_MINIMAL1), true)
      IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
      ifneq (,$(JSIG_DEBUGINFO))
        IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
      endif
149
    endif
150
  endif
151 152
endif

153
$(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
154 155
	$(MKDIR) -p $(@D)
	$(RM) $@
156 157
	$(LN) -s ../$(@F) $@

158
ifeq ($(OPENJDK_TARGET_OS), macosx)
159
  $(INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
160 161 162 163
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(LN) -s ../$(@F) $@

164
  $(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
165 166
	$(MKDIR) -p $(@D)
	$(RM) $@
167 168 169 170
	$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
	$(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
	$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
171 172
	$(MV) $@.tmp $@
else
173
  $(INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
174 175
	$(MKDIR) -p $(@D)
	$(RM) $@
176 177
	$(LN) -s ../$(@F) $@

178
  $(INSTALL_LIBRARIES_HERE)/server/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
179 180 181
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(RM) $@.tmp $(basename $@).debuginfo
182
	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
183
	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
184 185
	$(RM) $(basename $@).debuginfo
	$(MV) $@.tmp $@
186
endif
187

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

193
ifeq ($(OPENJDK_TARGET_OS), macosx)
194
  $(INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
195 196 197 198
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(LN) -s ../$(@F) $@

199
  $(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
200 201
	$(MKDIR) -p $(@D)
	$(RM) $@
202 203 204 205
	$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
	$(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
	$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
206 207
	$(MV) $@.tmp $@
else
208
  $(INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
209 210
	$(MKDIR) -p $(@D)
	$(RM) $@
211 212
	$(LN) -s ../$(@F) $@

213
  $(INSTALL_LIBRARIES_HERE)/client/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
214 215 216
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(RM) $@.tmp $(basename $@).debuginfo
217
	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
218
	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
219 220
	$(RM) $(basename $@).debuginfo
	$(MV) $@.tmp $@
221
endif
222

223
$(INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
224 225 226 227
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(LN) -s ../$(@F) $@

228
ifneq ($(OPENJDK_TARGET_OS), macosx)
229
  $(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
230 231 232 233
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(LN) -s ../$(@F) $@

234
  $(INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
235 236 237 238 239 240 241
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(RM) $@.tmp $(basename $@).debuginfo
	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
	$(RM) $(basename $@).debuginfo
	$(MV) $@.tmp $@
242
endif
243

244 245
##########################################################################################
# Unpack the binary distributions of the crypto classes if they exist.
246 247 248 249
SEC_FILES_ZIP := $(JDK_TOPDIR)/make/tools/crypto/sec-bin.zip
SEC_FILES_WIN_ZIP := $(JDK_TOPDIR)/make/tools/crypto/sec-windows-bin.zip
JGSS_WIN32_FILES_ZIP := $(JDK_TOPDIR)/make/tools/crypto/jgss-windows-i586-bin.zip
JGSS_WIN64_FILES_ZIP := $(JDK_TOPDIR)/make/tools/crypto/jgss-windows-x64-bin.zip
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270

define unzip-sec-file
	$(ECHO) Unzipping $(<F)
	$(MKDIR) -p $(@D)
	$(RM) $@
	($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) $< > $@.tmp)
	$(MV) $@.tmp $@
endef

$(JDK_OUTPUTDIR)/classes/_the.sec-bin.unzipped: $(SEC_FILES_ZIP)
	$(call unzip-sec-file)

$(JDK_OUTPUTDIR)/classes/_the.sec-windows-bin.unzipped: $(SEC_FILES_WIN_ZIP)
	$(call unzip-sec-file)

$(JDK_OUTPUTDIR)/classes/_the.jgss-windows-i586-bin.unzipped: $(JGSS_WIN32_FILES_ZIP)
	$(call unzip-sec-file)

$(JDK_OUTPUTDIR)/classes/_the.jgss-windows-x64-bin.unzipped: $(JGSS_WIN64_FILES_ZIP)
	$(call unzip-sec-file)

271
ifneq ($(wildcard $(SEC_FILES_ZIP)), )
272
  IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.sec-bin.unzipped
273
  ifeq ($(OPENJDK_TARGET_OS), windows)
274
    IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.sec-windows-bin.unzipped
275
    ifeq ($(OPENJDK_TARGET_CPU), x86)
276 277
      IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.jgss-windows-i586-bin.unzipped
    endif
278
    ifeq ($(OPENJDK_TARGET_CPU), x86_64)
279 280 281 282 283 284
      IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.jgss-windows-x64-bin.unzipped
    endif
  endif
endif

##########################################################################################
285 286

all: $(IMPORT_TARGET_FILES)