Makefile.inc revision 253
551N/A# -*- Makefile -*- rules commonly shared among X consolidation open source dirs 551N/A# Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 551N/A# Use subject to license terms. 551N/A# Permission is hereby granted, free of charge, to any person obtaining a 551N/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 919N/A# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 551N/A# Except as contained in this notice, the name of a copyright holder 551N/A# shall not be used in advertising or otherwise to promote the sale, use 551N/A# or other dealings in this Software without prior written authorization 551N/A# of the copyright holder. 1360N/A# @(#)Makefile.inc 1.81 07/11/20 1360N/A# Borrowed from Solaris OS/Net makefile.master: 1360N/A# The declaration POUND_SIGN is always '#'. This is needed to get around the 1360N/A# make feature that '#' is always a comment delimiter, even when escaped or 1360N/A# quoted. The only way of generating this is the :sh macro mechanism. Note 970N/A# however that in general :sh macros should be avoided in makefiles that are 970N/A# widely included into other makefiles, as the resulting shell executions can 970N/A# cause a noticable slowdown in build times. 970N/APOUND_SIGN:sh= echo \\043 970N/A# BUILD_DATE:sh=date +'%e-%B-%Y' 970N/A# BUILD_ID = X11 for Solaris Nevada, built $(BUILD_DATE) 551N/A### Machine architecture macros 551N/A# MACH will be either "sparc" or "i386" 1097N/A# ARCH will be either "sun4" or "i386" - mainly used in $(PROTODIR) 551N/AMACH32= $(MACH32_$(MACH)) 551N/AMACH64= $(MACH64_$(MACH)) 551N/A### Default compiler & options 551N/ADEFAULT_OPT_FLAGS = -xO4 -xbuiltin -xlibmil -xprefetch -xdepend 1193N/ADEFAULT_OPT_CFLAGS = $(DEFAULT_OPT_FLAGS) -xstrconst 1193N/ADEFAULT_OPT_CXXFLAGS = $(DEFAULT_OPT_FLAGS) 1193N/AOPT_CFLAGS = $(DEFAULT_OPT_CFLAGS) 551N/AOPT_CXXFLAGS = $(DEFAULT_OPT_CXXFLAGS) 970N/ACFLAGS = -v -mc $(OPT_CFLAGS) $(ARCH_FLAGS) 970N/ACXXFLAGS = -mc $(OPT_CXXFLAGS) $(ARCH_FLAGS) -norunpath 970N/ALDFLAGS = -z combreloc -z lazyload $(MAPFILES_FOR_ALL) ### Flags for libraries to meet various Solaris requirements # REQUIRED_LDFLAGS are forced on via LD_OPTIONS to override libtool when LIB_CFLAGS = $(CFLAGS) -D_REENTRANT $(ARCH_LIB_FLAGS) LIB_REQUIRED_LDFLAGS = -z text -z defs LIB_LDFLAGS = $(LDFLAGS) $(LIB_REQUIRED_LDFLAGS) PROG_CXXFLAGS = $(CXXFLAGS) PROG_LDFLAGS = $(LDFLAGS) $(MAPFILES_FOR_PROGS) -B direct # Linker mapfiles to link with for better performance & security # SPARC archicteture requires PLT section in .data be executable, so # we can only make .bss, not all of .data no-exec on SPARC MAPFILE_DIR = $(TOP)/common/mapfiles/ MAPFILE_NOEXBSS = $(MAPFILE_DIR)/map.noexbss MAPFILE_NOEXDATA_sparc = $(MAPFILE_NOEXBSS) MAPFILE_NOEXDATA_i386 = /usr/lib/ld/map.noexdata MAPFILE_NOEXDATA = $(MAPFILE_NOEXDATA_$(MACH)) MAPFILES_FOR_ALL = -M /usr/lib/ld/map.pagealign -M $(MAPFILE_NOEXDATA) MAPFILES_FOR_PROGS = -M /usr/lib/ld/map.bssalign -M /usr/lib/ld/map.noexstk \ ### Architecture specific flags DEFAULT_ARCH32_FLAGS_sparc = -xarch=v8plus DEFAULT_ARCH64_FLAGS_sparc = -xarch=v9 DEFAULT_ARCH_LIB_FLAGS_sparc = -xregs=no%appl # -xregs=no%frameptr is required on x86 when compiling at -xO4 or higher to # avoid losing stack frame pointers so you can't get stack traces or debug DEFAULT_ARCH32_FLAGS_i386 = -xtarget=pentium -xregs=no%frameptr DEFAULT_ARCH64_FLAGS_i386 = -xarch=generic64 -xregs=no%frameptr DEFAULT_ARCH_LIB_FLAGS_i386 = ARCH32_FLAGS = $(DEFAULT_ARCH32_FLAGS_$(MACH)) ARCH64_FLAGS = $(DEFAULT_ARCH64_FLAGS_$(MACH)) ARCH_LIB_FLAGS = $(DEFAULT_ARCH_LIB_FLAGS_$(MACH)) DEFAULT_GCC_CFLAGS = -O3 -fno-omit-frame-pointer -Wall DEFAULT_ARCH32_GCC_FLAGS_sparc = -mcpu=ultrasparc -m32 DEFAULT_ARCH64_GCC_FLAGS_sparc = -mcpu=ultrasparc -m64 DEFAULT_ARCH32_GCC_FLAGS_i386 = -march=i686 -m32 DEFAULT_ARCH64_GCC_FLAGS_i386 = -march=opteron -m64 ARCH32_GCC_FLAGS=$(DEFAULT_ARCH32_GCC_FLAGS_$(MACH)) ARCH64_GCC_FLAGS=$(DEFAULT_ARCH64_GCC_FLAGS_$(MACH)) # Need to use -Wl,.. to pass linker flags through gcc GCC_LDFLAGS_CMD=echo $(LDFLAGS) | \ sed -e
's/-M /-Wl,-M,/g' -e
's/-B /-Wl,-B,/g' GCC_LDFLAGS=$(GCC_LDFLAGS_CMD:sh) GCC_LIB_LDFLAGS_CMD=echo $(LIB_LDFLAGS) | \ sed -e
's/-M /-Wl,-M,/g' -e
's/-B /-Wl,-B,/g' GCC_LIB_LDFLAGS=$(GCC_LIB_LDFLAGS_CMD:sh) GCC_PROG_LDFLAGS_CMD=echo $(PROG_LDFLAGS) | \ sed -e
's/-M /-Wl,-M,/g' -e
's/-B /-Wl,-B,/g' GCC_PROG_LDFLAGS=$(GCC_PROG_LDFLAGS_CMD:sh) SUBDIR32 = $(SUBDIR32_$(MACH)) SUBDIR64 = $(SUBDIR64_$(MACH)) ### Proto directory to install into for packaging PROTODIR=$(TOP)/../proto-$(ARCH)-svr4 OW_X11LIB_DIR=$(OW_DIR)/lib/X11 FONT_DIR=$(OW_X11LIB_DIR)/fonts TRUETYPE_DIR=$(FONT_DIR)/TrueType X11_INCLUDES_DIR=$(X11_DIR)/include X11_DOC_DIR=$(X11_DIR)/share/doc X11_LOCALE_DIR=$(X11_DIR)/share/locale X11_MAN_DIR=$(X11_DIR)/share/man X11_ACLOCAL_DIR=$(X11_DIR)/share/aclocal X11_LC_MESSAGES_DIR=$(X11_LOCALE_DIR)/C/LC_MESSAGES # Subdirectory of /usr/X11/lib for X server private libraries X11_SERVERLIBS_SUBDIR=/X11/xserver X11_SERVERLIBS_DIR=$(X11_DIR)/lib$(X11_SERVERLIBS_SUBDIR) # Subdirectory of /usr/X11/lib for X server loadable modules X11_SERVERMODS_SUBDIR=/modules X11_SERVERMODS_DIR=$(X11_DIR)/lib$(X11_SERVERMODS_SUBDIR) MODULE_subdir_i386=$(ARCHLIBSUBDIR) MODULE_subdir=$(MODULE_subdir_$(MACH)) # Directory used for installing tools used during build but not # 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 all: $(BUILD_TYPES:%=source_%) $(BUILD_TYPES:%=build_%) install: $(BUILD_TYPES:%=install_%) clean: $(BUILD_TYPES:%=clean_%) build_gen: $(BUILD_TARGETS) ### Unpack source and apply patches source: $(BUILD_TYPES:%=source_%) source_32: $(BUILD_DIR_32)/.unpack_done source_64: $(BUILD_DIR_64)/.unpack_done UNPACK_TARGET = $(BUILD_DIR)/.unpack_done $(BUILD_DIR_32)/.unpack_done: $(BUILD_DIR_64)/.unpack_done: -e
's|-L\$${libdir}|-L\$${libdir} -R\$${libdir}|;' \
-e
's|(Requires: .*)\bx11\b|$$1|;' \
-e
's|Requires.private: .*$$||;'# -e 's|^prefix=@prefix@|prefix=\$$\{top_builddir\}@prefix@|' if [
"x$(SOURCE_TARBALL_NAME)" != "xNONE" ] ; then \ if [
"x$(SOURCE_UNCOMPRESS)" =
"x" ] ;
then \
echo "bzcat $(SOURCE_TARBALL) | (cd $(BUILD_DIR) ; tar -xf - )" ; \
echo "$(SOURCE_UNCOMPRESS) $(SOURCE_TARBALL) | (cd $(BUILD_DIR) ; tar -xf - )" ; \
if [
"x$(SOURCE_PATCHES)" != "x" ] ; then \ if [
"$$p" != "x" ] ; then \ PATCH_CMD=`
echo $$p |
awk -F,
'{if (NF > 1) FLAGS = $$2; else FLAGS="-p0" ; printf "gpatch -d $(SOURCE_DIR) %s < %s\n", FLAGS, $$1}'` ; \
if [
"x$(SUNTOUCHED_MANPAGES)" != "x" ] ; then \ $(SUNTOUCH_MAN_FLAGS) $(SUNTOUCHED_MANPAGES)" ; \
if [
"x$(FIX_PC_FILES)" != "x" ] ; then \ $(FIX_PC_OPS) $(FIX_PC_FILES)" ; \
### Regenerate autoconf/automake/libtools files after patching when needed # Include Xorg autoconf macros when rebuilding configure scripts ACLOCAL_PATH=aclocal -I $(PROTODIR)/usr/X11/share/aclocal autoreconf: $(UNPACK_TARGET) ### Source tarballs & downloading if necessary TARBALLDIR=$(TOP)/tarballs SOURCE_TARBALL=$(TARBALLDIR)/$(SOURCE_TARBALL_NAME) XORG_RELEASES_URL=http://xorg.freedesktop.org/releases/individual SF_DOWNLOADS_URL=http://easynews.dl.sourceforge.net/sourceforge # 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) if [
! -s $(SOURCE_TARBALL) ] ; then \ ### 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) ### Other tools needed to build # Some modules (such as FreeType 2) require GNU make @
echo "Checking for GNU make:"# Some modules use lndir to merge in sources from Sun specific directories LNDIR=$(PROTODIR)/usr/X11/bin/lndir DOCBOOKUTIL_BINDIR=$(PROTODIR)$(TOOLS_DIR)/bin DOCBOOK2HTML=$(DOCBOOKUTIL_BINDIR)/dockbook2html # Almost everything depends on the headers in xproto XPROTO_DEP=$(PROTODIR)/usr/lib/$(ARCHLIBSUBDIR)/pkgconfig/xproto.pc ### 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/ echo '=================' $$p ; \
{print}' $$p >
new/$$p ; \
|
sed -e
's% \./prev$(SOURCE_DIR)/% %' -e
's% \./tmp-regen$(SOURCE_DIR)/% %' \
|
grep -v
'^Common subdirectories:' \