Makefile revision 304
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster###############################################################################
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Use subject to license terms.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Permission is hereby granted, free of charge, to any person obtaining a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# copy of this software and associated documentation files (the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# "Software"), to deal in the Software without restriction, including
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# without limitation the rights to use, copy, modify, merge, publish,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# distribute, and/or sell copies of the Software, and to permit persons
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# to whom the Software is furnished to do so, provided that the above
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# copyright notice(s) and this permission notice appear in all copies of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# the Software and that both the above copyright notice(s) and this
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# permission notice appear in supporting documentation.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Except as contained in this notice, the name of a copyright holder
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# shall not be used in advertising or otherwise to promote the sale, use
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# or other dealings in this Software without prior written authorization
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# of the copyright holder.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# @(#)Makefile 1.9 07/07/11
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterPWD:sh=pwd
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterTOP=$(PWD)/../..
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Build 32-bit, 64-bit, or both?
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterBUILD_TYPES=32 64
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterBUILD_TYPES_SET=yes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Version number (used in path names)
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_VERS=6.5.2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Source tarball
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterSOURCE_TARBALL_NAME=MesaLib-$(MESA_VERS).tar.bz2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Download site for source
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterSOURCE_URL=$(SF_DOWNLOADS_URL)/mesa3d/$(SOURCE_TARBALL_NAME)
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterSOURCE_URL_SET=yes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Patches to apply to source after unpacking, in order
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterSOURCE_PATCHES= \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster solaris-paths.patch \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mklib.patch \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster solaris-dri-port.patch \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster glext.h.patch \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 6538497.patch \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 6559710.patch \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mesa965.patch \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster maxtexunit.patch
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Directory created by unpacking source
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterSOURCE_DIR=$(BUILD_DIR)/Mesa-$(MESA_VERS)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Library built in tree
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_LIB=$(SOURCE_DIR)/lib/libGL.so.1
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Where to install most files
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_prefix=$(PROTODIR)$(X11_DIR)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Where to install libraries
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_libdir=$(MESA_prefix)/lib
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# What to build
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterBUILD_TARGETS=$(GNUMAKE) $(MESA_LIB)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster### Include common rulesets
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinclude $(TOP)/common/Makefile.inc
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster### Rules specific to this directory:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Merge in additional sources from sun-src directory
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostersource_gen:: $(LNDIR)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mkdir -p $(SOURCE_DIR)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (cd $(SOURCE_DIR) && $(LNDIR) ../../sun-src)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_CFG_32_sparc=sunos5-v8
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_CFG_64_sparc=sunos5-v9
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Build with gcc on x86:
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_CFLAGS=$(DEFAULT_GCC_CFLAGS) $(ARCH_GCC_FLAGS) -D_REENTRANT
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_CFG_32_i386=solaris-x86-gcc-dri
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_CFG_64_i386=solaris-x64-gcc-dri
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Build with Sun Studio cc on x86:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#MESA_CFLAGS=$(LIB_CFLAGS)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#MESA_CFG_32_i386=solaris-x86-cc-dri
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#MESA_CFG_64_i386=solaris-x64-cc-dri
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_CFG_32 = $(MESA_CFG_32_$(MACH))
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_CFG_64 = $(MESA_CFG_64_$(MACH))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterBUILD_32_FLAGS=ARCH_GCC_FLAGS="$(ARCH32_GCC_FLAGS)" MESA_CFG=$(MESA_CFG_32)
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterBUILD_64_FLAGS=ARCH_GCC_FLAGS="$(ARCH64_GCC_FLAGS)" MESA_CFG=$(MESA_CFG_64)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# pkg-config --cflags libdrm
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterLIBDRM_CFLAGS = -I$(PROTODIR)$(X11_INCLUDES_DIR) -I$(PROTODIR)$(X11_INCLUDES_DIR)/drm
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# pkg-config --libs libdrm
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterLIBDRM_LIB = -L$(PROTODIR)$(X11_SERVERLIBS_DIR)$(ARCHLIBSUBDIR) -R$(X11_SERVERLIBS_DIR)$(ARCHLIBSUBDIR) -ldrm
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_INCLUDES= -I$(PROTODIR)$(X11_INCLUDES_DIR)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_MAKEVARS= SHELL=/bin/ksh PASSED_CFLAGS="$(MESA_CFLAGS)" PASSED_INCLUDES="$(MESA_INCLUDES)" ARCH_FLAGS="" LIBDRM_CFLAGS="$(LIBDRM_CFLAGS)" LIBDRM_LIB="$(LIBDRM_LIB)"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMESA_MAKEENV= PKG_CONFIG_PATH=$(PROTODIR)/usr/lib$(ARCHLIBSUBDIR)/pkgconfig:$(TOP)/common/pc-files/$(BUILD_DIR):/usr/lib$(ARCHLIBSUBDIR)/pkgconfig
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# LD_OPTIONS="$(LIB_REQUIRED_LDFLAGS)"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Build Mesa
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster$(MESA_LIB): $(GNUMAKE) $(UNPACK_TARGET)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (cd $(SOURCE_DIR)/configs && rm -f current && ln -s $(MESA_CFG) current)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (cd $(SOURCE_DIR) && $(MESA_MAKEENV) $(GNUMAKE) $(MFLAGS) -e $(MESA_MAKEVARS) default)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinstall_gen: $(MESA_LIB)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (cd $(SOURCE_DIR) && $(GNUMAKE) $(MFLAGS) -e DESTDIR=$(PROTODIR) ARCHLIBSUBDIR=$(ARCHLIBSUBDIR) install )
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster