Makefile.inc revision 254
# -*- Makefile -*- rules commonly shared among X consolidation open source dirs # Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. # Use subject to license terms. # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, and/or sell copies of the Software, and to permit persons # to whom the Software is furnished to do so, provided that the above # copyright notice(s) and this permission notice appear in all copies of # the Software and that both the above copyright notice(s) and this # permission notice appear in supporting documentation. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT # OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR # HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL # INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING # FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Except as contained in this notice, the name of a copyright holder # shall not be used in advertising or otherwise to promote the sale, use # or other dealings in this Software without prior written authorization # of the copyright holder. # @(#)Makefile.inc 1.82 07/11/27 # Borrowed from Solaris OS/Net makefile.master: # The declaration POUND_SIGN is always '#'. This is needed to get around the # make feature that '#' is always a comment delimiter, even when escaped or # quoted. The only way of generating this is the :sh macro mechanism. Note # however that in general :sh macros should be avoided in makefiles that are # widely included into other makefiles, as the resulting shell executions can # cause a noticable slowdown in build times. POUND_SIGN:sh= echo \\043 # BUILD_DATE:sh=date +'%e-%B-%Y' # BUILD_ID = X11 for Solaris Nevada, built $(BUILD_DATE) ### Machine architecture macros # MACH will be either "sparc" or "i386" # ARCH will be either "sun4" or "i386" - mainly used in $(PROTODIR) MACH32= $(MACH32_$(MACH)) MACH64= $(MACH64_$(MACH)) ### Default compiler & options DEFAULT_OPT_FLAGS = -xO4 -xbuiltin -xlibmil -xprefetch -xdepend DEFAULT_OPT_CFLAGS = $(DEFAULT_OPT_FLAGS) -xstrconst DEFAULT_OPT_CXXFLAGS = $(DEFAULT_OPT_FLAGS) OPT_CFLAGS = $(DEFAULT_OPT_CFLAGS) OPT_CXXFLAGS = $(DEFAULT_OPT_CXXFLAGS) CFLAGS = -v -mc $(OPT_CFLAGS) $(ARCH_FLAGS) CXXFLAGS = -mc $(OPT_CXXFLAGS) $(ARCH_FLAGS) -norunpath LDFLAGS = -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) -a "x$(SOURCE_TARBALL_NAME)" != "xNONE" ] ; 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:' \