1#
2# Copyright (c) 2012, 2014, 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# Unpack the binary distributions of the crypto classes if they exist.
33SEC_FILES_ZIP := $(JDK_TOPDIR)/make/tools/crypto/sec-bin.zip
34SEC_FILES_WIN_ZIP := $(JDK_TOPDIR)/make/tools/crypto/sec-windows-bin.zip
35JGSS_WIN32_FILES_ZIP := $(JDK_TOPDIR)/make/tools/crypto/jgss-windows-i586-bin.zip
36JGSS_WIN64_FILES_ZIP := $(JDK_TOPDIR)/make/tools/crypto/jgss-windows-x64-bin.zip
37
38define unzip-sec-file
39	$(ECHO) Unzipping $(<F)
40	$(MKDIR) -p $(@D) $(JDK_OUTPUTDIR)
41	$(RM) $@
42	($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
43	$(MV) $@.tmp $@
44endef
45
46define unzip-native-sec-file
47	$(ECHO) Unzipping $(<F)
48	$(MKDIR) -p $(@D)
49	$(RM) $@
50	($(CD) $(SUPPORT_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
51	$(MV) $@.tmp $@
52endef
53
54$(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped: $(SEC_FILES_ZIP)
55	$(call unzip-sec-file)
56
57# Trying to unzip both of the sec files at the same time may cause a race
58# when creating directories common to both files.
59$(SUPPORT_OUTPUTDIR)/_the.sec-windows-bin.unzipped: $(SEC_FILES_WIN_ZIP) \
60    | $(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped
61	$(call unzip-sec-file)
62
63$(SUPPORT_OUTPUTDIR)/_the.jgss-windows-i586-bin.unzipped: $(JGSS_WIN32_FILES_ZIP)
64	$(call unzip-native-sec-file)
65
66$(SUPPORT_OUTPUTDIR)/_the.jgss-windows-x64-bin.unzipped: $(JGSS_WIN64_FILES_ZIP)
67	$(call unzip-native-sec-file)
68
69ifneq ($(wildcard $(SEC_FILES_ZIP)), )
70  IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped
71  ifeq ($(OPENJDK_TARGET_OS), windows)
72    IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.sec-windows-bin.unzipped
73    ifeq ($(OPENJDK_TARGET_CPU), x86)
74      IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.jgss-windows-i586-bin.unzipped
75    endif
76    ifeq ($(OPENJDK_TARGET_CPU), x86_64)
77      IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.jgss-windows-x64-bin.unzipped
78    endif
79  endif
80endif
81
82################################################################################
83
84sec: $(IMPORT_TARGET_FILES)
85
86all: sec
87
88.PHONY: sec all
89