Makefile.inc revision 599
98N/A# -*- Makefile -*- rules commonly shared among X consolidation open source dirs 911N/A# Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. 810N/A# Use subject to license terms. 98N/A# Permission is hereby granted, free of charge, to any person obtaining a 919N/A# copy of this software and associated documentation files (the 919N/A# "Software"), to deal in the Software without restriction, including 919N/A# without limitation the rights to use, copy, modify, merge, publish, 919N/A# distribute, and/or sell copies of the Software, and to permit persons 919N/A# to whom the Software is furnished to do so, provided that the above 919N/A# copyright notice(s) and this permission notice appear in all copies of 919N/A# the Software and that both the above copyright notice(s) and this 919N/A# permission notice appear in supporting documentation. 919N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 919N/A# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 919N/A# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 919N/A# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 919N/A# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL 919N/A# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING 919N/A# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 919N/A# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 98N/A# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 98N/A# Except as contained in this notice, the name of a copyright holder 98N/A# shall not be used in advertising or otherwise to promote the sale, use 493N/A# or other dealings in this Software without prior written authorization 98N/A# of the copyright holder. 837N/A# @(#)Makefile.inc 1.97 08/12/19 911N/A# Which compiler to use to build module 98N/AMODTYPE_COMPILER_DEFAULT = $(MODTYPE_COMPILER_SET:yes=$(POUND_SIGN)) 98N/A$(MODTYPE_COMPILER_DEFAULT) MODTYPE_COMPILER = $(DEFAULT_COMPILER) 98N/AMODULE_COMPILER_DEFAULT = $(MODULE_COMPILER_SET:yes=$(POUND_SIGN)) 98N/A$(MODULE_COMPILER_DEFAULT) MODULE_COMPILER = $(MODTYPE_COMPILER) 98N/A# Which make to use to build module 98N/AMODTYPE_MAKE_DEFAULT = $(MODTYPE_MAKE_SET:yes=$(POUND_SIGN)) 98N/A$(MODTYPE_MAKE_DEFAULT) MODTYPE_MAKE = $(MAKE) MODULE_MAKE_DEFAULT = $(MODULE_MAKE_SET:yes=$(POUND_SIGN)) $(MODULE_MAKE_DEFAULT) MODULE_MAKE = $(MODTYPE_MAKE) MODTYPE_PREFIX_DEFAULT = $(MODTYPE_PREFIX_SET:yes=$(POUND_SIGN)) $(MODULE_PREFIX_DEFAULT) MODTYPE_PREFIX=$(X11_DIR) MODULE_PREFIX_DEFAULT = $(MODULE_PREFIX_SET:yes=$(POUND_SIGN)) $(MODULE_PREFIX_DEFAULT) MODULE_PREFIX=$(MODTYPE_PREFIX) # Directory created by unpacking source, if not set in module makefile SOURCE_DIRNAME_DEFAULT = $(SOURCE_DIRNAME_SET:yes=$(POUND_SIGN)) $(SOURCE_DIRNAME_DEFAULT) SOURCE_DIRNAME=$(MODULE_NAME)-$(MODULE_VERSION) SOURCE_DIR = $(BUILD_DIR)/$(SOURCE_DIRNAME) # Set default tarball if not set in module makefile SOURCE_TARBALL_NAME_DEFAULT = $(SOURCE_TARBALL_NAME_SET:yes=$(POUND_SIGN)) $(SOURCE_TARBALL_NAME_DEFAULT) SOURCE_TARBALL_NAME=$(SOURCE_DIRNAME).tar.bz2 # Tarballs for most modules built here are found in the X.Org archives/repos # in a directory with the same name as what we use in our tree SOURCE_TARBALL_DIR_DEFAULT = $(SOURCE_TARBALL_DIR_SET:yes=$(POUND_SIGN)) $(SOURCE_TARBALL_DIR_DEFAULT) SOURCE_TARBALL_DIR=$(MODTYPE) # Set default download location if not set in module makefile SOURCE_URL_DEFAULT = $(SOURCE_URL_SET:yes=$(POUND_SIGN)) $(SOURCE_URL_DEFAULT) SOURCE_URL=$(XORG_RELEASES_URL)/$(SOURCE_TARBALL_DIR)/$(SOURCE_TARBALL_NAME) # Set default git repo location if not set in module makefile GIT_URL_DEFAULT = $(GIT_URL_SET:yes=$(POUND_SIGN)) $(GIT_URL_DEFAULT) GIT_URL=$(XORG_GIT_URL)/$(SOURCE_TARBALL_DIR)/$(MODULE_NAME).git # Set default build type to 32-bit if not set in module makefile BUILD_TYPES_DEFAULT = $(BUILD_TYPES_SET:yes=$(POUND_SIGN)) $(BUILD_TYPES_DEFAULT) BUILD_TYPES=32 # Set default rules if not set in module/modtype Makefile SOURCE_TARGETS_DEFAULT = $(SOURCE_TARGETS_SET:yes=$(POUND_SIGN)) $(SOURCE_TARGETS_DEFAULT) SOURCE_TARGETS=default_source \ CONFIGURE_TARGETS_DEFAULT = $(CONFIGURE_TARGETS_SET:yes=$(POUND_SIGN)) $(CONFIGURE_TARGETS_DEFAULT) CONFIGURE_TARGETS=default_configure \ BUILD_TARGETS_DEFAULT = $(BUILD_TARGETS_SET:yes=$(POUND_SIGN)) $(BUILD_TARGETS_DEFAULT) BUILD_TARGETS=default_build \ INSTALL_TARGETS_DEFAULT = $(INSTALL_TARGETS_SET:yes=$(POUND_SIGN)) $(INSTALL_TARGETS_DEFAULT) INSTALL_TARGETS=default_install \ # Additional flags to pass to make in 32-bit & 64-bit builds BUILD_32_FLAGS= BUILD_DIR=$(BUILD_DIR_32) ARCH_FLAGS="$(ARCH32_FLAGS)" \ BUILD_64_FLAGS= BUILD_DIR=$(BUILD_DIR_64) ARCH_FLAGS="$(ARCH64_FLAGS)" \ all: $(BUILD_TYPES:%=source_%) $(BUILD_TYPES:%=build_%) all_32: source_32 configure_32 build_32 all_64: source_64 configure_64 build_64 clean:: $(BUILD_TYPES:%=clean_%) source: $(BUILD_TYPES:%=source_%) source_gen:: $(SOURCE_TARGETS) source_32: $(BUILD_DIR_32)/.unpack_done $(BUILD_DIR_32)/.unpack_done: source_64: $(BUILD_DIR_64)/.unpack_done $(BUILD_DIR_64)/.unpack_done: configure: $(BUILD_TYPES:%=configure_%) configure_gen: $(CONFIGURE_TARGETS) build: $(BUILD_TYPES:%=build_%) build_gen: $(BUILD_TARGETS) install: $(BUILD_TYPES:%=install_%) install_gen:: $(INSTALL_TARGETS) install_license DEBUG_BUILD_FLAGS = BUILD_DEBUG=yes ### Source tarballs & downloading if necessary SOURCE_TARBALL=$(TARBALLDIR)/$(SOURCE_TARBALL_NAME) GIT_CLONE_DIR=$(MODULE_NAME)-$(MODULE_VERSION) # Download if SOURCE_TARBALL_NAME is not set to NONE and the file either # doesn't exist or is empty # If MODULE_VERSION is xgit, checkout source from git repo instead of if [[
"$(MODULE_VERSION)" =
"git" ]] ;
then \
if [[
! -d $(GIT_CLONE_DIR) ]] ; then \ if [[
! -z "$(GIT_BRANCH)" ]] ; then \ if [[
"$(SOURCE_TARBALL_NAME)" != "NONE" ]] ; then \ if [[
! -s $(SOURCE_TARBALL) ]] ; then \ # Update a git cloned repo if [[
"$(MODULE_VERSION)" =
"git" ]] ;
then \
if [[
! -z "$(GIT_BRANCH)" ]] ; then \ ### Unpack source and apply patches -e
's|-L\$${libdir}|-L\$${libdir} -R\$${libdir}|;' \
-e
's|Requires.private: .*$$||;'# -e 's|(Requires: .*)\bx11\b|$$1|;' \ # -e 's|^prefix=@prefix@|prefix=\$$\{top_builddir\}@prefix@|' -a
'{Availability, $(SUN_PACKAGE)}' \
-a
'{Interface Stability, $(MODULE_STABILITY)}' \
default_source: $(MODULE_SOURCE_DEPS) $(MODTYPE_SOURCE_DEPS) @
if [[
"$(SOURCE_TARBALL_NAME)" != "NONE" ]] ; then \ if [[
"$(MODULE_VERSION)" =
"git" ]] ;
then \
SOURCE_CMD=
'gtar --exclude=.git* -cf - $(GIT_CLONE_DIR)' ; \
SOURCE_CMD=
"$${UNCOMP_CMD:-bzcat} $(SOURCE_TARBALL)" ; \
print "$${SOURCE_CMD} | (cd $(BUILD_DIR) ; gtar -xf - )" ; \
print "mkdir -p $(SOURCE_DIR)" ; \
if [[
"$(ADDITIONAL_SOURCE_DIR)" != "" ]] ; then \ if [[
! -x $(LNDIR) ]] ; then \ print "cd $(SOURCE_DIR) && $(LNDIR) ../../$(ADDITIONAL_SOURCE_DIR)" ; \
if [[
"$(SOURCE_PATCHES)" != "" ]] ; then \ if [[
"$$p" != "x" ]] ; then \ PATCH_CMD=
"$$(print $$p | awk -F, '{if (NF > 1) FLAGS = $$2; else FLAGS="-
p0" ; printf "gpatch -d $(
SOURCE_DIR) %s < %s\n
", FLAGS, $$1}')" ; \
print "$${PATCH_CMD}" ; \
if [[
"$(SUNTOUCHED_MANPAGES)" != "" ]] ; then \ $(SUNTOUCH_MAN_FLAGS) $(SUNTOUCHED_MANPAGES)" ; \
if [[
"$(FIX_PC_FILES)" != "" ]] ; then \ $(FIX_PC_OPS) $(FIX_PC_FILES)" ; \
### Run configure scripts # Include Xorg autoconf macros when rebuilding configure scripts # and use automake 1.10 instead of the older 1.9. # /opt/jdsbld/share/aclocal is needed to get the nls.m4 from CBEgettext # due to: 6785384 SUNWgnu-gettext does not include autoconf m4 files ACLOCAL_PATH=/usr/bin/aclocal-1.10 ACLOCAL_INCLUDES = -I $(PROTODIR)$(X11_ACLOCAL_DIR) \ AUTOMAKE_PATH=/usr/bin/automake-1.10 AUTORECONF_ENV= ACLOCAL="$(ACLOCAL_PATH) $(ACLOCAL_INCLUDES)" \ # Dependencies for running configure to make a Makefile CONFIGURE_DEPS = $(UNPACK_TARGET) \ # Command line options to GNU autoconf configure script DEFAULT_CONFIG_OPTS = --prefix=$(MODULE_PREFIX) \ CONFIG_OPTS = $(DEFAULT_CONFIG_OPTS) \ # Environment variable options to GNU autoconf configure script $(USE_DEFAULT_CONFIG_CPPFLAGS:no=$(POUND_SIGN)) DEFAULT_CONFIG_CPPFLAGS= \ $(USE_DEFAULT_CONFIG_LDFLAGS:no=$(POUND_SIGN)) DEFAULT_CONFIG_LDFLAGS= \ DEFAULT_PKG_CONFIG_PATH=$(TOP)/common/pc-files/$(BUILD_DIR):$(PROTODIR)/usr/lib/$(ARCHLIBSUBDIR)/pkgconfig:/usr/lib$(ARCHLIBSUBDIR)/pkgconfig # Set USE_DEFAULT_CONFIG_ENV=no in a Makefile to not use this default $(USE_DEFAULT_CONFIG_ENV:no=$(POUND_SIGN)) DEFAULT_CONFIG_ENV = \ CC=
"$(CC)" CXX=
"$(CXX)" \
CFLAGS=
"$(MODTYPE_CFLAGS) $(MODULE_CFLAGS)" \
CXXFLAGS=
"$(MODTYPE_CXXFLAGS) $(MODULE_CXXFLAGS)" \
CPPFLAGS=
"$(DEFAULT_CONFIG_CPPFLAGS) $(MODTYPE_CPPFLAGS) $(MODULE_CPPFLAGS)" \
LDFLAGS=
"$(DEFAULT_CONFIG_LDFLAGS) $(MODTYPE_CFLAGS) $(MODTYPE_LDFLAGS) $(MODULE_CFLAGS) $(MODULE_LDFLAGS)" \
CONFIG_ENV = $(DEFAULT_CONFIG_ENV) $(MODTYPE_CONFIG_ENV) $(MODULE_CONFIG_ENV) # File created by running configure - defaults to the top-level Makefile # in a source directory unless AUTOCONF_TARGET_SET=yes is set AUTOCONF_TARGET_DEFAULT = $(AUTOCONF_TARGET_SET:yes=$(POUND_SIGN)) $(AUTOCONF_TARGET_DEFAULT) AUTOCONF_TARGET=$(SOURCE_DIR)/Makefile $(AUTOCONF_TARGET): $(CONFIGURE_DEPS) if [[
"$(AUTORECONF)" =
"yes" ]] ;
then \
if [[
"$(DELIBTOOLIZE)" =
"yes" ]] ;
then \
default_configure:: $(AUTOCONF_TARGET) ### Remove libtool from build process when needed ### Generate mapfiles to limit/version exported symbols in libraries SPEC2MAP= /usr/lib/abi/spec2map SPECMAP= mapfile.vers.$(LIBNAME) SPECFILE= spec/$(LIBNAME).spec $(BUILD_DIR_32)/$(SPECMAP): $(SPECFILE) $(VERSFILE) $(BUILD_DIR_64)/$(SPECMAP): $(SPECFILE) $(VERSFILE) ### Default rules for common build pattern LD_OPTIONS = -L$(PROTODIR)$(X11_DIR)/lib$(LIBSUBDIR) \ BUILD_ENV = LD_OPTIONS='$(LD_OPTIONS)' \ DEFAULT_BUILD_MAKEFLAGS=$(MODTYPE_MAKEFLAGS) $(MODULE_MAKEFLAGS) \ default_build:: $(UNPACK_TARGET) $(CONFIGURE_TARGETS) $(MODTYPE_BUILD_DEPS) $(MODULE_BUILD_DEPS) $(MODULE_MAKE) print_default_build_flags: @
print "BUILD_ENV='$(BUILD_ENV)'" ; \
print "MAKE='$(MODULE_MAKE)'" ; \
print "MAKE_FLAGS='$(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS)'" DEFAULT_INSTALL_MAKEFLAGS= -e DESTDIR=$(PROTODIR) \ # Dependencies for make install step INSTALL_DEPS = $(BUILD_TARGETS) $(MODTYPE_INSTALL_DEPS) $(MODULE_INSTALL_DEPS) default_install:: $(INSTALL_DEPS) print_default_install_flags: @
print "BUILD_ENV='$(BUILD_ENV)'" ; \
print "MAKE='$(MODULE_MAKE)'" ; \
print "MAKE_FLAGS='$(MAKEFLAGS) $(DEFAULT_INSTALL_MAKEFLAGS)'" # Set comments in ELF binaries to help identify versions/builds ELF_COMMENTS = $(MODULE_NAME) $(MODULE_VERSION) ELF_COMMENTS += $(MODTYPE_ELF_COMMENTS)$(MODULE_ELF_COMMENTS) ### Other tools/dependencies needed to build # Some modules (such as FreeType 2) require GNU make @
print -n
"Building with GNU make from $$(whence gmake): " @
print "Building with make from $$(whence $(MAKE))"# Some modules use lndir to merge in sources from Sun specific directories # Some modules use these tools to convert DocBook docs to text or html $(DOCBOOK2HTML) $(DOCBOOK2TEXT): # Almost everything depends on the headers in xproto @
print "$(XPROTO_DEP) not found..."### Useful rules for maintaining patch sets # regenerate patches against new baseline to reduce messages about hunks # having fuzz or offsets when applying patches - new patches will be in new/ p=$$(
print $$f |
sed 's/,.*$$//') ; \
print '=================' $$p ; \
{print}' $$p >
new/$$p ; \
|
sed -e
's% \./prev$(SOURCE_DIR)/% %' -e
's% \./tmp-regen$(SOURCE_DIR)/% %' \
|
grep -v
'^Common subdirectories:' \
# Default license file name is COPYING (X.Org & GNU autoconf default) # For other license file names, set LICENSE_FILE to the file name # and set LICENSE_FILE_SET=yes # A file in the same directory as the Makefile takes precedence # over one that is delivered in the package. # For additional license files, set EXTRA_LICENSE_FILES to a list of LICENSE_FILE_DEFAULT = $(LICENSE_FILE_SET:yes=$(POUND_SIGN)) $(LICENSE_FILE_DEFAULT) LICENSE_FILE=COPYING @
THIS_MODULE=
"$$(echo $(PWD) | sed 's|.*/open-src/||')" ; \
if [[
"$${LICENSE_TO_COPY}" != "" ]] ; then \ if [[
"$(EXTRA_LICENSES)" != "" ]] ; then \