Makefile revision 1258
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder#
e9458b1a7a19a63aa4c179f9ab20f4d50681c168Jens Elkner# CDDL HEADER START
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski#
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# The contents of this file are subject to the terms of the
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu# Common Development and Distribution License (the "License").
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# You may not use this file except in compliance with the License.
3f69b6948966979163bdfe8331c38833d5d90ecdChristian Maeder#
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# or http://www.opensolaris.org/os/licensing.
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# See the License for the specific language governing permissions
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski# and limitations under the License.
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder#
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# When distributing Covered Code, include this CDDL HEADER in each
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# If applicable, add the following below this CDDL HEADER, with the
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# fields enclosed by brackets "[]" replaced with your own identifying
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# information: Portions Copyright [yyyy] [name of copyright owner]
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder#
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# CDDL HEADER END
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder#
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder
cdb68707ccdbff6aef4f34a897a8650515685feeChristian Maeder#
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder#
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederinclude ../../make-rules/shared-macros.mk
9029484754c7b2037321e7cbd077580866845265Christian Maeder
9029484754c7b2037321e7cbd077580866845265Christian MaederCOMPONENT_NAME= zlib
9029484754c7b2037321e7cbd077580866845265Christian MaederCOMPONENT_VERSION= 1.2.3
9029484754c7b2037321e7cbd077580866845265Christian MaederCOMPONENT_PROJECT_URL= http://www.zlib.net/
9029484754c7b2037321e7cbd077580866845265Christian MaederCOMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
9029484754c7b2037321e7cbd077580866845265Christian MaederCOMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz
9029484754c7b2037321e7cbd077580866845265Christian MaederCOMPONENT_ARCHIVE_HASH= \
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder sha256:1795c7d067a43174113fdf03447532f373e1c6c57c08d61d9e4e9be5e244b05e
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian MaederCOMPONENT_ARCHIVE_URL= http://downloads.sourceforge.net/project/libpng/zlib/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
9029484754c7b2037321e7cbd077580866845265Christian MaederCOMPONENT_BUGDB= library/libz
9029484754c7b2037321e7cbd077580866845265Christian Maeder
9029484754c7b2037321e7cbd077580866845265Christian Maederinclude ../../make-rules/prep.mk
9029484754c7b2037321e7cbd077580866845265Christian Maederinclude ../../make-rules/configure.mk
9029484754c7b2037321e7cbd077580866845265Christian Maederinclude ../../make-rules/ips.mk
9029484754c7b2037321e7cbd077580866845265Christian Maederinclude ../../make-rules/lint-libraries.mk
9029484754c7b2037321e7cbd077580866845265Christian Maeder
9029484754c7b2037321e7cbd077580866845265Christian Maeder#
9029484754c7b2037321e7cbd077580866845265Christian Maeder# We want to build hardware specific versions of the longest_match()
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# function into our shared library that has been hand optimised to use
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# some machine architecture specific instructions. Currently, we are doing
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# it for the T4 architecture, but later other architectures may be added.
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# This is done by taking advantage of the Solaris 11 linker-editor
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# "Symbol Capabilities" feature. Refer to the section "Creating a Family
9029484754c7b2037321e7cbd077580866845265Christian Maeder# of Symbol Capabilities Functions", under "Identifying Capability
9029484754c7b2037321e7cbd077580866845265Christian Maeder# Requirements" in the "Linker and Libraries Guide"
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# (http://docs.oracle.com/cd/E19963-01/html/819-0690/chapter2-13.html#giskh).
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian MaederCAP_OBJS_sparcv7 += ../../capabilities/sun4v/sparcv7/symcap.o
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian MaederCAP_OBJS_sparcv9 += ../../capabilities/sun4v/sparcv9/symcap.o
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder$(BUILD_DIR)/%/.built: CAP_OBJS=$(CAP_OBJS_$*)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder# Zlib won't build without cloning. We need also to get rid of default
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder# Makefile and get our own version of zconf.h to avoid interactions
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# between 32 and 64 bit builds.
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder# Also, the x86 architecture does not require alignment for multi-byte
9029484754c7b2037321e7cbd077580866845265Christian Maeder# loads, so we can define UNALIGNED_OK for x86
9029484754c7b2037321e7cbd077580866845265Christian Maederifeq ($(MACH), i386)
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian MaederCOMPONENT_PRE_CONFIGURE_ACTION = ( \
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder $(CLONEY) $(SOURCE_DIR) $(@D); \
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder $(RM) $(@D)/Makefile $(@D)/zconf.h; \
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder $(CP) $(SOURCE_DIR)/zconf.h $(@D) )
9029484754c7b2037321e7cbd077580866845265Christian MaederCFLAGS_EXTRA = -DUNALIGNED_OK -DORIG_LONGEST_MATCH_GLOBAL
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian MaederPIC_OBJS =
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maederelse
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian MaederCOMPONENT_PRE_CONFIGURE_ACTION = ( \
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder $(CLONEY) $(SOURCE_DIR) $(@D); \
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder $(RM) $(@D)/Makefile $(@D)/zconf.h; \
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maeder $(CP) $(SOURCE_DIR)/zconf.h $(@D) )
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian MaederCFLAGS_EXTRA = -DORIG_LONGEST_MATCH_GLOBAL -xinline=%auto,no%longest_match
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian MaederPIC_OBJS=$(CAP_OBJS)
57a2436f9d44e37042498a3b3dfacd301d91bb6dChristian Maederendif
CFLAGS += $(CC_PIC)
CFLAGS += $(CFLAGS_EXTRA)
# We need to reset configure options here because zlib is confused with
# CC and CFLAGS definitions as configure parameters.
CONFIGURE_OPTIONS = --shared
CONFIGURE_OPTIONS += --prefix=/usr
CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
CONFIGURE_OPTIONS.64 += --libdir=/usr/lib/$(MACH64)
CONFIGURE_ENV += CC="$(CC)"
CONFIGURE_ENV += CFLAGS="$(CFLAGS) -xalias_level=basic -xdepend"
CONFIGURE_ENV += LDSHARED="$(CC) $(CFLAGS) -G"
# This LDSHARED definitions is forced to get all required options plus
# mapfile for result linking. While the one used with configure is just
# to allow Zlib detect capability of creating shared libraries.
COMPONENT_BUILD_ARGS = LDSHARED="$(CC) $(CFLAGS) -G -h libz.so.1 $(LD_OPTIONS_SO) -M ../../mapfile -L." PIC_OBJS=$(PIC_OBJS)
$(BUILD_DIR)/sparc%/.built: COMPONENT_PRE_BUILD_ACTION = ( \
cd capabilities; \
$(ENV) SUBDIRS="sun4v" BUILD_ARCH=$* $(GMAKE) build )
COMPONENT_TEST_TARGETS = test
build: $(BUILD_32_and_64)
install: $(INSTALL_32_and_64)
test: $(TEST_32_and_64)
clean::
$(RM) -r $(BUILD_DIR) $(PROTO_DIR) capabilities/*/*/*.o
BUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS)
include ../../make-rules/depend.mk