1 # 2 # Copyright (c) 2011, 2018, 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 26 include LauncherCommon.gmk 27 28 $(eval $(call SetupBuildLauncher, pack200, \ 29 MAIN_MODULE := java.base, \ 30 MAIN_CLASS := com.sun.java.util.jar.pack.Driver, \ 31 )) 32 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 37 # 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. 42 # On AIX/xlc we need at least xlc 13.1 for the symbol hiding (see JDK-8214063) 43 # Also provide an override for non-conformant libraries. 44 ifeq ($(TOOLCHAIN_TYPE), gcc) 45 CXXFLAGS_JDKEXE += -fvisibility=hidden 46 LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL 47 else ifeq ($(TOOLCHAIN_TYPE), clang) 48 ifneq ($(call isTargetOs, macosx), true) 49 CXXFLAGS_JDKEXE += -fvisibility=hidden 50 endif 51 else ifeq ($(TOOLCHAIN_TYPE), solstudio) 52 CXXFLAGS_JDKEXE += -xldscope=hidden 53 endif 54 55 UNPACKEXE_SRC := $(TOPDIR)/src/jdk.pack/share/native/common-unpack \ 56 $(TOPDIR)/src/jdk.pack/share/native/unpack200 57 UNPACKEXE_CFLAGS := -I$(TOPDIR)/src/jdk.pack/share/native/common-unpack \ 58 -I$(TOPDIR)/src/java.base/share/native/libjava \ 59 -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava 60 61 ifeq ($(USE_EXTERNAL_LIBZ), true) 62 UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB 63 UNPACKEXE_LIBS := -lz 64 else 65 UNPACKEXE_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/libzip/zlib 66 UNPACKEXE_ZIPOBJS := $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zcrc32$(OBJ_SUFFIX) \ 67 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/deflate$(OBJ_SUFFIX) \ 68 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/trees$(OBJ_SUFFIX) \ 69 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zadler32$(OBJ_SUFFIX) \ 70 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/compress$(OBJ_SUFFIX) \ 71 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zutil$(OBJ_SUFFIX) \ 72 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inflate$(OBJ_SUFFIX) \ 73 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/infback$(OBJ_SUFFIX) \ 74 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \ 75 $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX) 76 77 endif 78 79 $(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \ 80 NAME := unpack200, \ 81 SRC := $(UNPACKEXE_SRC), \ 82 TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ 83 OPTIMIZATION := LOW, \ 84 CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) -DFULL, \ 85 CFLAGS_release := -DPRODUCT, \ 86 CFLAGS_linux := -fPIC, \ 87 CFLAGS_solaris := -KPIC, \ 88 CFLAGS_macosx := -fPIC, \ 89 DISABLED_WARNINGS_clang := format-nonliteral, \ 90 LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \ 91 $(call SET_SHARED_LIBRARY_ORIGIN), \ 92 LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \ 93 OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \ 94 MANIFEST := $(TOPDIR)/src/jdk.pack/windows/native/unpack200/unpack200_proto.exe.manifest, \ 95 MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \ 96 EXTRA_OBJECT_FILES := $(UNPACKEXE_ZIPOBJS) \ 97 )) 98 99 TARGETS += $(BUILD_UNPACKEXE) 100 101 ################################################################################