1409N/A# -*- Makefile -*- rules commonly shared among X consolidation open source dirs
1607N/A# Copyright (c) 2008, 2016, Oracle
and/or its affiliates. All rights reserved.
1409N/A# Permission is hereby granted, free of charge, to any person obtaining a
1409N/A# copy of this software and associated documentation files (the "Software"),
1409N/A# to deal in the Software without restriction, including without limitation
1409N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
1409N/A#
and/or sell copies of the Software, and to permit persons to whom the
1409N/A# Software is furnished to do so, subject to the following conditions:
1409N/A# The above copyright notice and this permission notice (including the next
1409N/A# paragraph) shall be included in all copies or substantial portions of the
1409N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1409N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1409N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1409N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1409N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1409N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1409N/A# Use ksh93 for shell commands in Makefiles so that builds are the same
1409N/A# on Nevada (where
/bin/sh is still ancient Bourne shell) and Indiana
1409N/A# The declaration POUND_SIGN is always '#'. This is needed to get around the
1409N/A# make feature that '#' is always a comment delimiter, even when escaped or
1409N/A# quoted. We use this macro expansion method to get POUND_SIGN rather than
1409N/A# always breaking out a shell because the general case can cause a noticable
1409N/APOUND_SIGN= $(PRE_POUND:pre\%=%)
1409N/A# Set default build target to all
1409N/A# The infrastructure in the main tree requires Solaris make
1409N/A# Different builders want different settings for various options such
1409N/A# as branding or download sites. The top-level "make setup" command
1533N/A cd $(TOP) ; $(MAKE) $(MAKEFLAGS) setup
1409N/A### Machine architecture macros
1409N/A# MACH will be either "sparc" or "i386"
1409N/A# Architecture subdirectories
1409N/ASUBDIR32 = $(SUBDIR32_$(MACH))
1409N/ASUBDIR64 = $(SUBDIR64_$(MACH))
1409N/ALIBSUBDIR = $(LIBSUBDIR_$(BUILD_TYPE))
1409N/AARCHLIBSUBDIR = $(LIBSUBDIR)
1409N/A### Default compiler & options
1422N/A# Our default compiler is Solaris Studio, but if you want to default to GNU
1409N/A# compilers, you can change this here - some modules with specific
1409N/A# requirements override this in their makefiles with MODULE_COMPILER.
1409N/A# Flags used by either compiler in debug builds
1409N/ADEBUG_FLAGS_common = -g $(MODTYPE_DEBUG_FLAGS) $(MODULE_DEBUG_FLAGS)
1409N/AOPT_FLAGS_suncc = -xO4 -xbuiltin=%none -xlibmil -xprefetch -xdepend
1422N/AOPT_FLAGS_suncc += -xspace -W0,-xglobalstatic
1409N/ADEBUG_FLAGS_suncc = $(DEBUG_FLAGS_common)
1409N/A$(BUILD_DEBUG:yes=) DEBUG_OR_OPT_FLAGS_suncc = $(DEBUG_FLAGS_suncc)
1409N/A$(BUILD_DEBUG:yes=$(POUND_SIGN)) DEBUG_OR_OPT_FLAGS_suncc = $(OPT_FLAGS_suncc)
1409N/ACFLAGS_suncc = $(DEBUG_OR_OPT_FLAGS_suncc)
1515N/ACFLAGS_suncc += -v -fd -features=extensions,conststrings
1409N/ACXXFLAGS_suncc = $(DEBUG_OR_OPT_FLAGS_suncc)
1409N/ACXXFLAGS_suncc += +w2 -norunpath -features=extensions
1409N/A# -D__<arch>__ flags are to match gcc definitions that are used in much
1409N/A# of the upstream open source code base
1409N/AARCH_FLAGS_sparc_suncc = -xarch=sparc -D__sparc__
1409N/AARCH32_FLAGS_sparc_suncc = -m32
1409N/AARCH64_FLAGS_sparc_suncc = -m64
1409N/A# -xregs=no%frameptr is required on x86 when compiling at -xO4 or higher to
1409N/A# avoid losing stack frame pointers so you can't get stack traces or debug
1409N/AARCH_FLAGS_i386_suncc = -xregs=no%frameptr
1409N/AARCH32_FLAGS_i386_suncc = -m32 -xarch=sse2 -D__i386__
1409N/AARCH64_FLAGS_i386_suncc = -m64 -xarch=sse2 -D__amd64__
1409N/A# SPARC ABI requires system libraries not use application registers
1422N/AARCH_LIB_FLAGS_sparc_suncc = -xregs=no%appl
1607N/A# Flags to specify which language version to support, default to C11/C++11
1607N/AC_VERSION_FLAGS_suncc = -std=c11 -xlang=c11
1607N/ACXX_VERSION_FLAGS_suncc = -std=c++11 -xlang=c99
1409N/ADEBUG_FLAGS_gcc = $(DEBUG_FLAGS_common)
1409N/A$(BUILD_DEBUG:yes=) DEBUG_OR_OPT_FLAGS_gcc = $(DEBUG_FLAGS_gcc)
1409N/A$(BUILD_DEBUG:yes=$(POUND_SIGN)) DEBUG_OR_OPT_FLAGS_gcc = $(OPT_FLAGS_gcc)
1409N/AWARNFLAGS_gcc = -Wall -Wno-unknown-pragmas
1409N/ACFLAGS_gcc = $(DEBUG_OR_OPT_FLAGS_gcc) \
1409N/A -fno-omit-frame-pointer $(WARNFLAGS_gcc)
1409N/ACXXFLAGS_gcc = $(DEBUG_OR_OPT_FLAGS_gcc) \
1409N/A -fno-omit-frame-pointer $(WARNFLAGS_gcc)
1409N/AARCH32_FLAGS_sparc_gcc = -mcpu=ultrasparc -m32
1409N/AARCH64_FLAGS_sparc_gcc = -mcpu=ultrasparc -m64
1409N/AARCH32_FLAGS_i386_gcc = -march=pentium4 -m32
1409N/AARCH64_FLAGS_i386_gcc = -march=opteron -m64
1409N/A# SPARC ABI requires system libraries not use application registers
1409N/AARCH_LIB_FLAGS_sparc_gcc = -mno-app-regs
1607N/A# Default to C11 plus GNU extensions, since we primarily use gcc for code
1607N/A# that requires the GNU extensions.
1607N/AC_VERSION_FLAGS_gcc = -std=gnu11
1607N/ACXX_VERSION_FLAGS_gcc = -std=gnu++11
1409N/ACC_suncc_parfait = parfait-cc
1409N/ACXX_suncc_parfait = parfait-CC
1409N/ACC_gcc_parfait = parfait-gcc
1409N/ACXX_gcc_parfait = parfait-g++
1409N/A# If USE_PARFAIT is yes, use _parfait variants
1409N/APARFAIT_1 = $(USE_PARFAIT:no=)
1409N/APARFAIT_2 = $(PARFAIT_1:yes=$(POUND_SIGN))
1409N/A$(PARFAIT_2) WITH_PARFAIT=$(POUND_SIGN)
1409N/A$(WITH_PARFAIT) WITHOUT_PARFAIT=$(POUND_SIGN)
1409N/A$(WITH_PARFAIT) CHOSEN_COMPILER=$(MODULE_COMPILER)_parfait
1409N/A$(WITHOUT_PARFAIT) CHOSEN_COMPILER=$(MODULE_COMPILER)
1409N/A$(WITH_PARFAIT) AR=$(AR_parfait)
1409N/A$(WITH_PARFAIT) AS=$(AS_parfait)
1494N/A$(WITH_PARFAIT) LD=$(LD_parfait)
1422N/A# Additional environment variables needed to build with parfait
1422N/APARFAIT_ENV_gcc = PARFAIT_NATIVEGCC="$(GCC)"
1422N/APARFAIT_ENV_gcc += PARFAIT_NATIVEGXX="$(GXX)"
1422N/APARFAIT_ENV = $(PARFAIT_ENV_$(MODULE_COMPILER))
1607N/A# Output shorter error messages when parfait-wrapped compilers fail,
1607N/A# unless building with V=1 to be more verbose
1607N/APARFAIT_QUIET_ENV_V_1 = # parfait is noisy unless you tell it to be quiet
1607N/APARFAIT_QUIET_ENV_V_0 = PARFAIT_WRAPPER_QUIETNATIVE=1
1607N/APARFAIT_QUIET_ENV_V_ = $(PARFAIT_QUIET_ENV_V_0)
1607N/APARFAIT_QUIET_ENV = $(PARFAIT_QUIET_ENV_V_$(V))
1607N/APARFAIT_ENV += $(PARFAIT_QUIET_ENV)
1607N/A# Allow modules to override default language choices
1607N/AC_VERSION_DEFAULT = $(C_VERSION_FLAGS_SET:yes=$(POUND_SIGN))
1607N/A$(C_VERSION_DEFAULT) C_VERSION_FLAGS = $(C_VERSION_FLAGS_$(MODULE_COMPILER))
1607N/ACXX_VERSION_DEFAULT = $(CXX_VERSION_FLAGS_SET:yes=$(POUND_SIGN))
1607N/A$(CXX_VERSION_DEFAULT) CXX_VERSION_FLAGS = $(CXX_VERSION_FLAGS_$(MODULE_COMPILER))
1409N/A## Set common variables based on above rules
1607N/A# Architecture & version flags affect how compiler links to C & C++ runtimes
1607N/A# so need to be included in $(CC) and $(CXX) when passed to configure to make
1607N/A# sure configure tests are run against the right versions.
1409N/ACC = $(CC_$(CHOSEN_COMPILER))
1607N/ACC += $(ARCH_FLAGS) $(C_VERSION_FLAGS)
1409N/ACXX = $(CXX_$(CHOSEN_COMPILER))
1607N/ACXX += $(ARCH_FLAGS) $(CXX_VERSION_FLAGS)
1409N/ACFLAGS = $(CFLAGS_$(MODULE_COMPILER)) $(ARCH_FLAGS)
1607N/ACFLAGS += $(C_VERSION_FLAGS)
1409N/ACXXFLAGS = $(CXXFLAGS_$(MODULE_COMPILER)) $(ARCH_FLAGS)
1607N/ACXXFLAGS += $(CXX_VERSION_FLAGS)
1409N/AARCH32_FLAGS = $(ARCH32_FLAGS_$(MACH)_$(MODULE_COMPILER))
1409N/AARCH32_FLAGS += $(ARCH_FLAGS_$(MACH)_$(MODULE_COMPILER))
1409N/AARCH64_FLAGS = $(ARCH64_FLAGS_$(MACH)_$(MODULE_COMPILER))
1409N/AARCH64_FLAGS += $(ARCH_FLAGS_$(MACH)_$(MODULE_COMPILER))
1409N/AARCH_LIB_FLAGS = $(ARCH_LIB_FLAGS_$(MACH)_$(MODULE_COMPILER))
1409N/A# Flags for specific binary types
1409N/ALIB_CFLAGS = $(CFLAGS) $(ARCH_LIB_FLAGS)
1409N/ALIB_CXXFLAGS = $(CXXFLAGS) $(ARCH_LIB_FLAGS)
1425N/APROG_CPPFLAGS = $(CPPFLAGS) -DFD_SETSIZE=$(FD_SETSIZE)
1409N/A# Default FD_SETSIZE - 1024 was the 32-bit default and was big enough
1409N/A# and eats a lot of memory for fd_sets and cpu doing operations on them
1409N/AFD_SETSIZE_DEFAULT = $(FD_SETSIZE_SET:yes=$(POUND_SIGN))
1409N/A$(FD_SETSIZE_DEFAULT) FD_SETSIZE = 1024
1409N/A# Linker mapfiles to link with for better performance & security
1409N/A# SPARC architecture requires PLT section in .data be executable, so
1409N/A# we can only make .bss, not all of .data no-exec on SPARC
1409N/AMAPFILE_NOEXDATA_sparc = $(MAPFILE_NOEXBSS)
1409N/AMAPFILE_NOEXDATA = $(MAPFILE_NOEXDATA_$(MACH))
1409N/AMAPFILES_FOR_ALL = $(MAPFILE_PAGEALIGN) $(MAPFILE_NOEXDATA)
1477N/AMAPFILES_FOR_PROGS = $(MAPFILE_HEAPALIGN) $(MAPFILE_NOEXBSS)
1477N/A# Security Extensions file tagging.
1477N/A# Security Extensions can be explicitly controlled at the binary level via
1477N/A# tagging. Binaries built with -z <extension>=enable will have the extension
1477N/A# enabled in the 'tagged-files' model, while binaries built with
1477N/A# -z <extension>=disable will have it disabled regardless of the model.
1477N/A# Currently supported extensions are:
1477N/A# -z aslr Address Space Layout Randomization
1477N/A# -z nxstack Non-executable Stack
1477N/A# -z nxheap Non-executable Heap
1477N/A# -z aslr|nxstack|nxheap are only valid when linking executables.
1477N/AZASLR_ENABLE= -z aslr=enable
1477N/AZASLR_DISABLE= -z aslr=disable
1477N/AZNXSTACK_ENABLE= -z nxstack=enable
1477N/AZNXSTACK_DISABLE= -z nxstack=disable
1477N/AZNXSTACK= $(ZNXSTACK_ENABLE)
1477N/AZNXHEAP_ENABLE= -z nxheap=enable
1477N/AZNXHEAP_DISABLE= -z nxheap=disable
1425N/A# Flags to discard at link time unnecessary dependencies, .o files or
1425N/A# ELF sections that upstream may have included that we don't use.
1425N/AZDISCARD_UNUSED_DEP = -zdiscard-unused=dependencies
1425N/AZDISCARD_UNUSED_FIL = -zdiscard-unused=files
1425N/AZDISCARD_UNUSED_SEC = -zdiscard-unused=sections
1409N/A# Common flags for all binaries
1425N/ADEFAULT_LD_OPTIONS = -z lazyload -B direct -z guidance
1425N/ADEFAULT_LD_OPTIONS += $(MAPFILES_FOR_ALL)
1409N/A# Strip debug info out of non-debug builds
1425N/A$(BUILD_DEBUG:yes=$(POUND_SIGN)) DEFAULT_LD_OPTIONS += -z strip-class=debug
1425N/ADEFAULT_LD_OPTIONS_gcc = $(ZDISCARD_UNUSED_DEP) $(ZDISCARD_UNUSED_FIL)
1425N/ADEFAULT_LD_OPTIONS += $(DEFAULT_LD_OPTIONS_$(MODULE_COMPILER))
1425N/A# Ensure required flags for .so's are applied, despite libtool interference
1425N/ADEFAULT_LD_SHARED_OPTIONS = -z text -z defs
1477N/ADEFAULT_LD_EXEC_OPTIONS = $(ZASLR) $(ZNXHEAP) $(ZNXSTACK) $(MAPFILES_FOR_PROGS)
1409N/A# Link with X server private libraries like libXfont & libfontenc
1409N/AX11_SERVERLIBS_LDFLAGS= -L$(PROTODIR)$(X11_SERVERLIBS_DIR)$(ARCHLIBSUBDIR) \
1409N/A -R$(X11_SERVERLIBS_DIR)$(ARCHLIBSUBDIR)
1409N/A# Proto directory to install into for packaging
1409N/APROTODIR=$(PROTOTOP)/root_$(MACH)
1494N/APROTODIR_DEBUG=$(PROTOTOP)/root_$(MACH)-debug
1409N/APROTOMETA=$(PROTOTOP)/metadata_$(MACH)
1610N/A# Standard paths for modules to install into, relative to $(MODULE_PREFIX)
1610N/AMODULE_BIN_DIR = $(MODULE_PREFIX)/bin
1610N/AMODULE_INCLUDES_DIR = $(MODULE_PREFIX)/include
1610N/AMODULE_LIB_DIR = $(MODULE_PREFIX)/lib
1610N/AMODULE_FULLARCH_LIB_DIR = $(MODULE_LIB_DIR)$(MODULE_ADD_LIB_SUBDIR)$(ARCHLIBSUBDIR)
1610N/AMODULE_DATA_DIR = $(MODULE_PREFIX)/share
1610N/AMODULE_SBIN_DIR = $(MODULE_PREFIX)/sbin
1610N/A# System-wide standard paths that don't differ depending on $(MODULE_PREFIX)
1610N/ATRUETYPE_FONT_DIR = $(SHARE_FONT_DIR)/TrueType
1610N/AX11_FONT_DIR = $(SHARE_FONT_DIR)/X11
1610N/AX11_X11LIB_DIR = $(X11_LIB_DIR)/X11
1610N/AXORG_SDK_INCLUDES_DIR = $(X11_INCLUDES_DIR)/xorg
1610N/AX11_SERVERLIBS_SUBDIR = /xorg
1610N/AX11_SERVERLIBS_DIR = $(X11_LIB_DIR)$(X11_SERVERLIBS_SUBDIR)
1610N/AX11_SERVERMODS_DIR = $(X11_LIB_DIR)$(X11_SERVERMODS_SUBDIR)
1409N/A# PKGCONFIG_DIR is constructed of _prefix + ARCHLIBSUBDIR + _suffix
1409N/APKGCONFIG_DIR_suffix=/pkgconfig
1409N/APKGCONFIG_DIR=$(PKGCONFIG_DIR_prefix)$(ARCHLIBSUBDIR)$(PKGCONFIG_DIR_suffix)
1409N/APKGCONFIG_DIR_32=$(PKGCONFIG_DIR_prefix)$(PKGCONFIG_DIR_suffix)
1409N/APKGCONFIG_DIR_64=$(PKGCONFIG_DIR_prefix)/$(SUBDIR64)$(PKGCONFIG_DIR_suffix)
1409N/A# System-wide directory for packaged release notes
1409N/A# Directory used for installing tools used during build but not
1409N/ATOOLS_DIR=$(PROTOTOP)/tools_$(MACH)
1409N/A# Work around _TIME, _DATE, embedded date chatter in component builds
1409N/A# to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
1409N/ACONSTANT_TIME = LD_PRELOAD_32=$(TOOLS_DIR)/time-$(MACH32).so
1409N/ACONSTANT_TIME += LD_PRELOAD_64=$(TOOLS_DIR)/time-$(MACH64).so
1409N/ACONSTANT_TIME += TIME_CONSTANT=$(TIME_CONSTANT)
1409N/A### Other tools needed to build
1409N/A# When changing PYTHON_VERSION, check that PYTHON_PKG_VERSION &
1409N/A# We want our python modules installed to vendor-packages, not site-packages
1409N/A# When changing PERL_VERSION, check that PERL_PKG_VERSION is
1418N/A# perl -p/-n commands treat missing files as warnings, not fatal errors
1418N/A# Adding the following raises them to errors so that make detects a problem
1418N/APERL_MISSING_FILES_ERROR = -e 'BEGIN {$$SIG{__WARN__} = sub { die $$_[0] };}'
1409N/A# Script used to install files in proto area
1409N/A# Some modules (such as FreeType 2) require GNU make
1409N/A# Pick a version of GNU automake, since Solaris includes multiple ones
1409N/A# Directory to find tools used during build, even when installing to a
1409N/A# temporary dest dir, such as during 'make manifest'
1409N/A# Some modules use lndir to merge in sources from Sun specific directories
1610N/ALNDIR = $(PROTOTOOLS_BIN_DIR)/lndir
1409N/A# Commands to run font utilities from proto area
1610N/AMKFONTSCALE = $(PROTOTOOLS_BIN_DIR)/mkfontscale
1610N/AINSTALLALIAS = $(PROTOTOOLSDIR)$(X11_X11LIB_DIR)/installalias
1610N/AFC_QUERY = $(PROTOTOOLS_BIN_DIR)/fc-query
1610N/AFC_SCAN = $(PROTOTOOLS_BIN_DIR)/fc-scan
1479N/A# it directly here, instead of futzing with command paths in the script
1479N/AMKFONTDIR=$(MKFONTSCALE) -b -s -l
1409N/A# Script fragment to start echoing commands in shell sequences in make rules
1409N/A# Sets PS4 to "" so output isn't prepended with "+ " and looks like normal
1409N/ASTART_CMD_ECHO = PS4="" ; set -x
1409N/A### Sources, in-tree and upstream
1409N/A# If you need to use a closer mirror for
X.Org or SourceForge, override
1409N/AXRU_DEFAULT = $(XORG_RELEASES_URL_SET:yes=$(POUND_SIGN))
1409N/ASFU_DEFAULT = $(SF_DOWNLOADS_URL_SET:yes=$(POUND_SIGN))
1409N/AFDO_GIT_DEFAULT = $(FDO_GIT_URL_SET:yes=$(POUND_SIGN))
1409N/AXORG_GIT_DEFAULT = $(XORG_GIT_URL_SET:yes=$(POUND_SIGN))
1409N/A$(XORG_GIT_DEFAULT) XORG_GIT_URL=$(FDO_GIT_URL)/xorg
1409N/A# Target created when sources are unpacked
1409N/AUNPACK_TARGET = $(SOURCE_DIR)/$(UNPACK_FILE)
1409N/A# Most module versions are in the individual makefiles, but the Xserver is
1409N/A# referenced in multiple places, so it's kept here for easy sharing.
1409N/A# Current Xorg server source tarball to use sources from:
1409N/A# Minimum Xorg server version that we expect to be ABI compatible with.
1409N/A# Usually .99 of the previous minor release series, as that's the convention
1409N/A# for the development snapshots of the next release series.
1409N/A# Next highest Xorg server version that we expect to be ABI incompatible with.
1409N/A# Usually .99 of the current release series, as Xorg tends to break ABI's
1409N/A# in each minor release train (1.8, 1.9, etc.)
1409N/A# Version of pkgfmt output rules to apply
1409N/A# For use in debugging or calling from scripts like the code review helper
1409N/A# Use such as: make print_make_vars VARS="MODTYPE MODULE_NAME"
1409N/A# or: make print_make_vars BUILD_TYPE=32 VARS=SOURCE_DIR
1409N/A @print -n ' $(@:print_make_var-%=%)="$($(@:print_make_var-%=%))"'
1409N/Aprint_make_vars: $(VARS:%=print_make_var-%)