blob: c7138f2ee991d42559c8c320731afd27eb504cd9 [file] [log] [blame]
Chris Hegarty3bc69d32014-08-17 15:54:13 +01001#
Magnus Ihse Bursiee23e30e2018-02-28 21:16:11 +01002# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
Chris Hegarty3bc69d32014-08-17 15:54:13 +01003# 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
26include LauncherCommon.gmk
27
Magnus Ihse Bursie5aee1302015-11-05 10:54:05 +010028$(eval $(call SetupBuildLauncher, pack200, \
Alan Batemandb4d3832016-03-17 19:04:16 +000029 MAIN_MODULE := java.base, \
Magnus Ihse Bursie5aee1302015-11-05 10:54:05 +010030 MAIN_CLASS := com.sun.java.util.jar.pack.Driver, \
31))
Chris Hegarty3bc69d32014-08-17 15:54:13 +010032
33################################################################################
34# The order of the object files on the link command line affects the size of the resulting
35# binary (at least on linux) which causes the size to differ between old and new build.
36
Magnus Ihse Bursie44bab942018-04-05 21:33:38 +020037# Tell the compiler not to export any functions unless declared so in
38# the source code. On Windows, this is the default and cannot be changed.
39# On Mac, we have always exported all symbols, probably due to oversight
40# and/or misunderstanding. To emulate this, don't hide any symbols
41# by default.
Matthias Baeskene7578902018-04-26 13:55:16 +020042# On AIX/xlc we need at least xlc 13.1 for the symbol hiding
Magnus Ihse Bursie44bab942018-04-05 21:33:38 +020043# Also provide an override for non-conformant libraries.
44ifeq ($(TOOLCHAIN_TYPE), gcc)
45 CXXFLAGS_JDKEXE += -fvisibility=hidden
46 LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
47else ifeq ($(TOOLCHAIN_TYPE), clang)
48 ifneq ($(OPENJDK_TARGET_OS), macosx)
49 CXXFLAGS_JDKEXE += -fvisibility=hidden
50 endif
51else ifeq ($(TOOLCHAIN_TYPE), solstudio)
52 CXXFLAGS_JDKEXE += -xldscope=hidden
53else ifeq ($(TOOLCHAIN_TYPE), xlc)
Matthias Baeskene7578902018-04-26 13:55:16 +020054 ifneq ($(CC_VERSION_NUMBER), 12.1)
55 CXXFLAGS_JDKEXE += -qvisibility=hidden
56 endif
Magnus Ihse Bursie44bab942018-04-05 21:33:38 +020057endif
58
Erik Joelsson72c4ec52017-09-12 19:03:56 +020059UNPACKEXE_SRC := $(TOPDIR)/src/jdk.pack/share/native/common-unpack \
60 $(TOPDIR)/src/jdk.pack/share/native/unpack200
61UNPACKEXE_CFLAGS := -I$(TOPDIR)/src/jdk.pack/share/native/common-unpack \
62 -I$(TOPDIR)/src/java.base/share/native/libjava \
63 -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
Chris Hegarty3bc69d32014-08-17 15:54:13 +010064
65ifeq ($(USE_EXTERNAL_LIBZ), true)
66 UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB
Matthias Kloseb191aa42015-10-22 12:12:32 +020067 UNPACKEXE_LIBS := -lz
Chris Hegarty3bc69d32014-08-17 15:54:13 +010068else
Erik Joelsson72c4ec52017-09-12 19:03:56 +020069 UNPACKEXE_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/libzip/zlib
Chris Hegarty441905c2014-12-03 14:22:58 +000070 UNPACKEXE_ZIPOBJS := $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zcrc32$(OBJ_SUFFIX) \
71 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/deflate$(OBJ_SUFFIX) \
72 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/trees$(OBJ_SUFFIX) \
73 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zadler32$(OBJ_SUFFIX) \
74 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/compress$(OBJ_SUFFIX) \
75 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zutil$(OBJ_SUFFIX) \
76 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inflate$(OBJ_SUFFIX) \
77 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/infback$(OBJ_SUFFIX) \
78 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \
79 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX)
Chris Hegarty3bc69d32014-08-17 15:54:13 +010080
81endif
82
Magnus Ihse Bursief74d0ae2018-03-15 01:20:47 +010083$(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
Magnus Ihse Bursiee23e30e2018-02-28 21:16:11 +010084 NAME := unpack200, \
Chris Hegarty3bc69d32014-08-17 15:54:13 +010085 SRC := $(UNPACKEXE_SRC), \
Erik Joelssonda8b1352016-10-12 14:25:07 +020086 TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
Chris Hegarty3bc69d32014-08-17 15:54:13 +010087 OPTIMIZATION := LOW, \
Erik Joelssonc9bf2982015-02-06 09:57:28 +010088 CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) -DFULL, \
Chris Hegarty3bc69d32014-08-17 15:54:13 +010089 CFLAGS_release := -DPRODUCT, \
90 CFLAGS_linux := -fPIC, \
91 CFLAGS_solaris := -KPIC, \
92 CFLAGS_macosx := -fPIC, \
Erik Joelsson2f8f0b22018-02-08 12:01:32 -080093 DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \
Erik Joelssonc9bf2982015-02-06 09:57:28 +010094 LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
95 $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
Chris Hegarty3bc69d32014-08-17 15:54:13 +010096 $(call SET_SHARED_LIBRARY_ORIGIN), \
Magnus Ihse Bursie0bac07b2015-10-29 16:31:00 +010097 LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
Magnus Ihse Bursie5aee1302015-11-05 10:54:05 +010098 OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
Erik Joelsson72c4ec52017-09-12 19:03:56 +020099 MANIFEST := $(TOPDIR)/src/jdk.pack/windows/native/unpack200/unpack200_proto.exe.manifest, \
Magnus Ihse Bursiee9cf2472015-06-11 00:23:01 +0200100 MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
Magnus Ihse Bursie41b53b02015-04-16 14:48:11 +0200101))
Chris Hegarty3bc69d32014-08-17 15:54:13 +0100102
Chris Hegarty3bc69d32014-08-17 15:54:13 +0100103ifneq ($(USE_EXTERNAL_LIBZ), true)
104
105 $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
106
107endif
108
Erik Joelssonc9bf2982015-02-06 09:57:28 +0100109TARGETS += $(BUILD_UNPACKEXE)
Chris Hegarty3bc69d32014-08-17 15:54:13 +0100110
111################################################################################