components/zlib/Makefile
changeset 825 78809aba88fe
parent 800 2ad056ed89ec
child 1058 34d7aaa03423
equal deleted inserted replaced
824:3c0f8247e0cd 825:78809aba88fe
    37 include ../../make-rules/prep.mk
    37 include ../../make-rules/prep.mk
    38 include ../../make-rules/configure.mk
    38 include ../../make-rules/configure.mk
    39 include ../../make-rules/ips.mk
    39 include ../../make-rules/ips.mk
    40 include ../../make-rules/lint-libraries.mk
    40 include ../../make-rules/lint-libraries.mk
    41 
    41 
       
    42 #
       
    43 # We want to build hardware specific versions of the longest_match()
       
    44 # function into our shared library that has been hand optimised to use
       
    45 # some machine architecture specific instructions. Currently, we are doing
       
    46 # it for the T4 architecture, but later other architectures may be added.
       
    47 # This is done by taking advantage of the Solaris 11 linker-editor
       
    48 # "Symbol Capabilities" feature.  Refer to the section "Creating a Family
       
    49 # of Symbol Capabilities Functions", under "Identifying Capability
       
    50 # Requirements" in the "Linker and Libraries Guide"
       
    51 # (http://docs.oracle.com/cd/E19963-01/html/819-0690/chapter2-13.html#giskh).
       
    52 CAP_OBJS_sparcv7 += ../../capabilities/sun4v/sparcv7/symcap.o 
       
    53 CAP_OBJS_sparcv9 += ../../capabilities/sun4v/sparcv9/symcap.o 
       
    54 $(BUILD_DIR)/%/.built: CAP_OBJS=$(CAP_OBJS_$*)
       
    55 
    42 # Zlib won't build without cloning. We need also to get rid of default
    56 # Zlib won't build without cloning. We need also to get rid of default
    43 # Makefile and get our own version of zlib.h to avoid interactions
    57 # Makefile and get our own version of zconf.h to avoid interactions
    44 # between 32 and 64 bit builds.
    58 # between 32 and 64 bit builds.
       
    59 # Also, the x86 architecture does not require alignment for multi-byte
       
    60 # loads, so we can define UNALIGNED_OK for x86
       
    61 ifeq ($(MACH), i386)
    45 COMPONENT_PRE_CONFIGURE_ACTION = ( \
    62 COMPONENT_PRE_CONFIGURE_ACTION = ( \
    46 	$(CLONEY) $(SOURCE_DIR) $(@D); \
    63 	$(CLONEY) $(SOURCE_DIR) $(@D); \
    47 	$(RM) $(@D)/Makefile $(@D)/zconf.h; \
    64 	$(RM) $(@D)/Makefile $(@D)/zconf.h; \
    48 	$(CP) $(SOURCE_DIR)/zconf.h $(@D) )
    65 	$(CP) $(SOURCE_DIR)/zconf.h $(@D) )
       
    66 CFLAGS_EXTRA = -DUNALIGNED_OK -DORIG_LONGEST_MATCH_GLOBAL
       
    67 PIC_OBJS =
       
    68 else
       
    69 COMPONENT_PRE_CONFIGURE_ACTION = ( \
       
    70 	$(CLONEY) $(SOURCE_DIR) $(@D); \
       
    71 	$(RM) $(@D)/Makefile $(@D)/zconf.h; \
       
    72 	$(CP) $(SOURCE_DIR)/zconf.h $(@D) )
       
    73 CFLAGS_EXTRA = -DORIG_LONGEST_MATCH_GLOBAL -xinline=%auto,no%longest_match
       
    74 PIC_OBJS=$(CAP_OBJS)
       
    75 endif
    49 
    76 
    50 CFLAGS += $(CC_PIC) 
    77 CFLAGS += $(CC_PIC)
       
    78 
       
    79 CFLAGS += $(CFLAGS_EXTRA)
    51 
    80 
    52 # We need to reset configure options here because zlib is confused with
    81 # We need to reset configure options here because zlib is confused with
    53 # CC and CFLAGS definitions as configure parameters.
    82 # CC and CFLAGS definitions as configure parameters.
    54 CONFIGURE_OPTIONS	=  --shared
    83 CONFIGURE_OPTIONS	=  --shared
    55 CONFIGURE_OPTIONS	+= --prefix=/usr
    84 CONFIGURE_OPTIONS	+= --prefix=/usr
    56 CONFIGURE_OPTIONS	+= $(CONFIGURE_OPTIONS.$(BITS))
    85 CONFIGURE_OPTIONS	+= $(CONFIGURE_OPTIONS.$(BITS))
    57 CONFIGURE_OPTIONS.64	+= --libdir=/usr/lib/$(MACH64)
    86 CONFIGURE_OPTIONS.64	+= --libdir=/usr/lib/$(MACH64)
    58 
    87 
    59 CONFIGURE_ENV += CC="$(CC)"
    88 CONFIGURE_ENV += CC="$(CC)"
    60 CONFIGURE_ENV += CFLAGS="$(CFLAGS)"
    89 CONFIGURE_ENV += CFLAGS="$(CFLAGS) -xalias_level=basic -xdepend"
    61 CONFIGURE_ENV += LDSHARED="$(CC) $(CFLAGS) -G"
    90 CONFIGURE_ENV += LDSHARED="$(CC) $(CFLAGS) -G"
    62 
    91 
    63 # This LDSHARED definitions is forced to get all required options plus
    92 # This LDSHARED definitions is forced to get all required options plus
    64 # mapfile for result linking. While the one used with configure is just
    93 # mapfile for result linking. While the one used with configure is just
    65 # to allow Zlib detect capability of creating shared libraries.
    94 # to allow Zlib detect capability of creating shared libraries.
    66 COMPONENT_BUILD_ARGS = LDSHARED="$(CC) $(CFLAGS) -G -h libz.so.1 $(LD_OPTIONS_SO) -M ../../mapfile -L."
    95 COMPONENT_BUILD_ARGS = LDSHARED="$(CC) $(CFLAGS) -G -h libz.so.1 $(LD_OPTIONS_SO) -M ../../mapfile -L." PIC_OBJS=$(PIC_OBJS)
       
    96 
       
    97 $(BUILD_DIR)/sparc%/.built: COMPONENT_PRE_BUILD_ACTION = ( \
       
    98 	cd capabilities; \
       
    99 	$(ENV) SUBDIRS="sun4v" BUILD_ARCH=$* $(GMAKE) build )
    67 
   100 
    68 COMPONENT_TEST_TARGETS = test
   101 COMPONENT_TEST_TARGETS = test
    69 
   102 
    70 build:		$(BUILD_32_and_64)
   103 build:		$(BUILD_32_and_64)
    71 
   104 
    72 install:	$(INSTALL_32_and_64)
   105 install:	$(INSTALL_32_and_64)
    73 
   106 
    74 test:		$(TEST_32_and_64)
   107 test:		$(TEST_32_and_64)
    75 
   108 
       
   109 clean::
       
   110 	$(RM) -r $(BUILD_DIR) $(PROTO_DIR) capabilities/*/*/*.o
       
   111 
    76 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
   112 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
    77 
   113 
    78 include ../../make-rules/depend.mk
   114 include ../../make-rules/depend.mk