1 #
   2 # Copyright (c) 2013, 2016, 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 ################################################################################
  27 # Create the libjsig.so shared library
  28 
  29 default: all
  30 
  31 include $(SPEC)
  32 include MakeBase.gmk
  33 include NativeCompilation.gmk
  34 
  35 ifneq ($(OPENJDK_TARGET_OS), windows)
  36   ifeq ($(STATIC_BUILD), false)
  37     LIBJSIG_STRIP_SYMBOLS := true
  38     ifeq ($(OPENJDK_TARGET_OS), linux)
  39       LIBJSIG_CFLAGS := -fPIC -D_GNU_SOURCE -D_REENTRANT $(EXTRA_CFLAGS)
  40       LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE) $(EXTRA_CFLAGS)
  41       LIBJSIG_LIBS := $(LIBDL)
  42 
  43       # NOTE: The old build compiled this library without -soname.
  44       # To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
  45       SET_SHARED_LIBRARY_NAME :=
  46 
  47       # Flags for other CPUs can be provided in EXTRA_CFLAGS
  48       ifeq ($(OPENJDK_TARGET_CPU), x86_64)
  49         LIBJSIG_CPU_FLAGS := -m64
  50       else ifeq ($(OPENJDK_TARGET_CPU), x86)
  51         LIBJSIG_CPU_FLAGS := -m32 -march=i586
  52       endif
  53 
  54     else ifeq ($(OPENJDK_TARGET_OS), solaris)
  55       LIBJSIG_CFLAGS := -m64 -KPIC -mt
  56       LIBJSIG_LDFLAGS := -m64 -mt -xnolib
  57       LIBJSIG_LIBS := $(LIBDL)
  58 
  59       # NOTE: The old build compiled this library without -soname.
  60       # To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
  61       SET_SHARED_LIBRARY_NAME :=
  62 
  63     else ifeq ($(OPENJDK_TARGET_OS), aix)
  64       LIBJSIG_CFLAGS := -q64 -D_GNU_SOURCE -D_REENTRANT -qpic=large
  65       LIBJSIG_LDFLAGS := -b64 -bexpall -G -bnoentry -qmkshrobj -brtl -bnolibpath -bernotok
  66       LIBJSIG_LIBS := $(LIBDL)
  67 
  68       # NOTE: The old build compiled this library without -soname.
  69       # To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
  70       SET_SHARED_LIBRARY_NAME :=
  71 
  72     else ifeq ($(OPENJDK_TARGET_OS), macosx)
  73       LIBJSIG_CFLAGS := -m64 -D_GNU_SOURCE -pthread -mno-omit-leaf-frame-pointer -mstack-alignment=16 -fPIC
  74       LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE)
  75       # NOTE: This lib is not stripped on macosx in old build. Looks like a mistake.
  76       LIBJSIG_STRIP_SYMBOLS := false
  77     else
  78       $(error Unknown target OS $(OPENJDK_TARGET_OS) in CompileLibjsig.gmk)
  79     endif
  80 
  81     LIBJSIG_SRC_FILE := $(HOTSPOT_TOPDIR)/src/os/$(HOTSPOT_TARGET_OS)/vm/jsig.c
  82     LIBJSIG_MAPFILE := $(wildcard $(HOTSPOT_TOPDIR)/make/mapfiles/libjsig/mapfile-vers-$(OPENJDK_TARGET_OS))
  83     LIBJSIG_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/libjsig
  84 
  85     LIBJSIG_LDFLAGS += $(SHARED_LIBRARY_FLAGS)
  86 
  87     $(eval $(call SetupNativeCompilation, BUILD_LIBJSIG, \
  88         LIBRARY := jsig, \
  89         EXTRA_FILES := $(LIBJSIG_SRC_FILE), \
  90         OUTPUT_DIR := $(LIBJSIG_OUTPUTDIR), \
  91         LANG := C, \
  92         CFLAGS := $(LIBJSIG_CFLAGS) $(LIBJSIG_CPU_FLAGS), \
  93         LDFLAGS := $(LIBJSIG_LDFLAGS) $(LIBJSIG_CPU_FLAGS), \
  94         LIBS := $(LIBJSIG_LIBS), \
  95         MAPFILE := $(LIBJSIG_MAPFILE), \
  96         OBJECT_DIR := $(LIBJSIG_OUTPUTDIR)/objs, \
  97         STRIP_SYMBOLS := $(LIBJSIG_STRIP_SYMBOLS), \
  98     ))
  99 
 100     TARGETS += $(BUILD_LIBJSIG)
 101   endif
 102 endif
 103 
 104 all: $(TARGETS)
 105 
 106 .PHONY: all