blob: eee94e221d65d7e740af9b75d85cbcb352a8815f [file] [log] [blame]
erikjaf85fc42012-07-03 16:10:44 -07001#
2# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation. Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26default: all
27
28include $(SPEC)
29include MakeBase.gmk
30
31#######
32
33IMPORT_TARGET_FILES :=
34
35IMPORT_CLASSES := CORBA JAXP JAXWS LANGTOOLS
36IMPORT_SOURCES := CORBA JAXP JAXWS LANGTOOLS
37# Only Corba has binaries
38IMPORT_BINARIES := CORBA
39
40#######
41
42# Put the libraries here. Different locations for different target apis.
43ifeq ($(OPENJDK_TARGET_OS_API),posix)
44 ifneq ($(OPENJDK_TARGET_OS),macosx)
45 INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib/$(LIBARCH)
46 else
47 INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib
48 endif
49 HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/lib/$(LIBARCH)
50else
51 INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/bin
52 HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/bin
53endif
54
55#######
56
57#
58# jar xf/unzip fails when executing them all in parallel
59# introduce artificial dependency (_DEP) buuhhh
60
61define ImportClasses
62$1_CLASSES_DEP := $$(IMPORT_TARGET_CLASSES)
63IMPORT_TARGET_CLASSES += $(JDK_OUTPUTDIR)/classes/_the.$1.classes.imported
64
65$(JDK_OUTPUTDIR)/classes/_the.$1.classes.imported : $$($1_DIST)/lib/classes.jar $$($1_CLASSES_DEP)
66 $(ECHO) Importing $1 classes.jar
67 $(MKDIR) -p $$(@D)
68 ($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
69 $(MV) $$@.tmp $$@
70endef
71
72define ImportSources
73$1_SOURCES_DEP := $$(IMPORT_TARGET_SOURCES)
74IMPORT_TARGET_SOURCES += $(JDK_OUTPUTDIR)/impsrc/_the.$1.src.imported
75
76$(JDK_OUTPUTDIR)/impsrc/_the.$1.src.imported : $$($1_DIST)/lib/src.zip $$($1_SOURCES_DEP)
77 $(ECHO) Importing $1 src.zip
78 $(MKDIR) -p $$(@D)
79 ($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
80 $(MV) $$@.tmp $$@
81endef
82
83define ImportBinaries
84$1_BINARIES_DEP := $$(IMPORT_TARGET_BINARIES)
85IMPORT_TARGET_BINARIES += $(JDK_OUTPUTDIR)/_the.$1.binaries.imported
86
87$(JDK_OUTPUTDIR)/_the.$1.binaries.imported : $$($1_DIST)/lib/bin.zip $$($1_BINARIES_DEP)
88 $(ECHO) Importing $1 bin.zip
89 $(MKDIR) -p $$(@D)
90 ($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
91 $(MV) $$@.tmp $$@
92endef
93
94#######
95
96$(foreach I,$(IMPORT_CLASSES), $(eval $(call ImportClasses,$I)))
97$(foreach I,$(IMPORT_SOURCES), $(eval $(call ImportSources,$I)))
98$(foreach I,$(IMPORT_BINARIES), $(eval $(call ImportBinaries,$I)))
99
100IMPORT_TARGET_FILES += $(IMPORT_TARGET_CLASSES) $(IMPORT_TARGET_SOURCES) $(IMPORT_TARGET_BINARIES)
101
102#######
103
104ifeq ($(OPENJDK_TARGET_OS),solaris)
105define do-install-file
106 $(MKDIR) -p $$(@D)
107 $(CP) -r -P '$$<' '$$(@D)'
108endef
109else ifeq ($(OPENJDK_TARGET_OS),macosx)
110define do-install-file
111 $(MKDIR) -p $$(@D)
112 $(CP) -pRP '$$<' '$$@'
113endef
114else
115define do-install-file
116 $(MKDIR) -p $$(@D)
117 $(CP) -P '$$<' '$$@'
118endef
119endif
120
121define CopyDir
122 $1_SRC_FILES := $(shell $(FIND) $2 -type f)
123 $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
124 IMPORT_TARGET_FILES += $$($1_DST_FILES)
125$3/% : $2/%
126 $(ECHO) Copying $$(@F)
127 $(do-install-file)
128endef
129
130#######
131
132#
133# Import hotspot
134#
135
136$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE)))
137$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib))
138
139JSIG_DEBUGINFO := $(wildcard $(HOTSPOT_DIST)/jre/lib/$(LIBARCH)/libjsig.debuginfo) \
140 $(wildcard $(HOTSPOT_DIST)/jre/lib/$(LIBARCH)/libjsig.diz)
141
142ifneq ($(OPENJDK_TARGET_OS), windows)
143 ifeq ($(JVM_VARIANT_SERVER), true)
144 IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
145 ifneq (,$(JSIG_DEBUGINFO))
146 IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
147 endif
148 endif
149 ifeq ($(JVM_VARIANT_CLIENT), true)
150 IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
151 ifneq (,$(JSIG_DEBUGINFO))
152 IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
153 endif
154 endif
155endif
156
157$(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
158 $(RM) -f $@
159 $(LN) -s ../$(@F) $@
160
161$(INSTALL_LIBRARIES_HERE)/server/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
162 $(RM) -f $@
163 $(LN) -s ../$(@F) $@
164
165$(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
166 $(RM) -f $@
167ifeq (REALLY_WEIRD,1)
168 $(LN) -s ../$(@F) $@
169else
170#
171# TODO: Check if this is what they really want...a zip containing a symlink
172#
173 $(RM) -f $(basename $@).debuginfo
174 $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
175 $(ZIP) -q -y $@ $(basename $@).debuginfo
176 $(RM) -f $(basename $@).debuginfo
177endif
178
179$(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
180 $(RM) -f $@
181 $(LN) -s ../$(@F) $@
182
183$(INSTALL_LIBRARIES_HERE)/client/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
184 $(RM) -f $@
185 $(LN) -s ../$(@F) $@
186
187$(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
188 $(RM) -f $@
189ifeq (REALLY_WEIRD,1)
190 $(LN) -s ../$(@F) $@
191else
192#
193# TODO: Check if this is what they really want...a zip containing a symlink
194#
195 $(RM) -f $(basename $@).debuginfo
196 $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
197 $(ZIP) -q -y $@ $(basename $@).debuginfo
198 $(RM) -f $(basename $@).debuginfo
199endif
200
201#######
202
203ifeq ($(OPENJDK_TARGET_OS),solaris)
204define install-file
205 $(MKDIR) -p $(@D)
206 $(CP) -r -P '$<' '$(@D)'
207endef
208else ifeq ($(OPENJDK_TARGET_OS),macosx)
209define install-file
210 $(MKDIR) -p $(@D)
211 $(CP) -pRP '$<' '$@'
212endef
213else
214define install-file
215 $(MKDIR) -p $(@D)
216 $(CP) -P '$<' '$@'
217endef
218endif
219
220ifndef OPENJDK
221
222IMPORT_TARGET_FILES += \
223 $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar \
224 $(JDK_OUTPUTDIR)/lib/security/local_policy.jar \
225 $(JDK_OUTPUTDIR)/lib/jce.jar
226
227$(JDK_OUTPUTDIR)/lib/jce.jar : $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
228 $(ECHO) Copying $(@F)
229 $(install-file)
230
231$(JDK_OUTPUTDIR)/lib/security/local_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
232 $(ECHO) Copying $(@F)
233 $(install-file)
234
235$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
236 $(ECHO) Copying $(@F)
237 $(install-file)
238
239endif # OPENJDK
240
241#######
242
243all: $(IMPORT_TARGET_FILES)