OpenGrok

Cross Reference: open-src
xref: /fox/fox-gate/XW_NV/open-src
Home | History | Annotate | only in /fox/fox-gate/XW_NV/open-src
Up to higher level directory
NameDateSize
app/15-Dec-2010
common/15-Dec-2010
data/15-Dec-2010
doc/15-Dec-2010
driver/15-Dec-2010
font/15-Dec-2010
lib/15-Dec-2010
Makefile15-Dec-20102.6K
proto/15-Dec-2010
README15-Dec-201020.8K
util/15-Dec-2010
xserver/15-Dec-2010

README

      1 This is documentation of the Makefile system used in this tree.
      2 
      3 General Overview:
      4 -----------------
      5 This tree builds dozens of open source modules that are each released 
      6 separately and delivered as source in seperate tarballs.   These modules
      7 are organized in subdirectories based on the X.Org module list, though
      8 modules from other sources are included as appropriate.   For instance,
      9 the application xterm is built in open-src/app/xterm, while the fontconfig
     10 library is in open-src/lib/fontconfig.
     11 
     12 In this tree, the term "module" is used for a specific set of source built
     13 generally from a single tarball from upstream, such as xterm or fontconfig.
     14 The directories grouping these together are referred to as "module type"
     15 directories - app, lib, font, etc.   Each module is thus found in a 
     16 subdirectory of the form open-src/<module type>/<module> .   Various flags
     17 can be set at either the individual module level or for all modules of a
     18 module type.
     19 
     20 For each module, at build time the tarball is unpacked, patches applied for
     21 post-release bug fixes or customizations, and then the build is run.
     22 
     23 To allow building both 32-bit and 64-bit versions in the same build,
     24 this all happens in subdirectories named build_32 & build_64 in each
     25 modules' directory.   Since those subdirectories are competely recreatable
     26 from the source tarball and patches, rebuilding the tree or running make clean
     27 simply removes them entirely and recreates them.
     28 
     29 You should be able to run make commands in any module directory or
     30 module-type directory, though since most of the intermodule dependencies 
     31 are not declared, many modules will break unless you've done a full-tree
     32 build at some point to populate the proto area with the bits needed.
     33 
     34 
     35 =============================================================================
     36 
     37 Make targets you can build in each module:
     38 ------------------------------------------
     39 
     40 For most of these you can append _32 or _64 to do just the 32-bit or 64-bit
     41 versions of the targets, while the version listed here repeats for all build
     42 types set in the BUILD_TYPES variable.    These are defined in the 
     43 open-src/common/Makefile.inc file, though open-src/<module type>/Makefile.inc
     44 may add additional rules needed for modules of that type.
     45 
     46 make clean
     47 	Completely removes build_* directories.
     48 
     49 make source
     50 	Creates build_* directories by unpacking sources from tarball
     51 	and applying patches.
     52 
     53 make configure
     54 	Runs GNU autoconf script or similar configuration steps if
     55 	needed, including autoreconf or delibtoolize if variables are set.
     56 	(Runs make source first if needed.)
     57 
     58 make build
     59 	Compile the software into the binaries that get installed.
     60 	(Runs make configure first if needed.)
     61 
     62 make install
     63 	Install files into the proto area where make_release_packages
     64 	will pull them from to make packages and where other parts of
     65 	the build will use them.   (Runs make build first if needed.)
     66 
     67 make all (or just "make" with no arguments)
     68 	equivalent to make build for most modules
     69 
     70 make debug
     71 	same as make all, but with compiler optimization flags changed 
     72 	to "-g".  (Note that if you haven't done a make clean first, 
     73 	doesn't force a recompile, so running make debug in a directory 
     74 	you already built non-debug may not actually build debug versions.)
     75 
     76 make debug-install
     77 	same as make install, but with compiler optimization flags changed 
     78 	to "-g".  (See warning on make debug about doing a make clean first.)
     79 
     80 make download
     81 	If open-src/tarballs does not contain the tarball needed for this
     82 	module, download it from $(SOURCE_URL).   (See "Building from git"
     83 	section below if MODULE_VERSION=git.)
     84 
     85 make regen-patches
     86 	Create a directory new/ containing patches generated against the
     87 	current tarball.   Useful when updating to a new version and patches
     88 	still apply, but you want to get rid of warnings about patch fuzz
     89 	and line offsets.
     90 
     91 make git-update
     92 	See "Building from git" section below. 
     93 
     94 =============================================================================
     95 
     96 Make targets you can build in parent directories:
     97 -------------------------------------------------
     98 
     99 In the top-level open-src directory, or any of the module type directories,
    100 you can run these make commands to run the appropriate targets for all modules
    101 in that directory.   The Makefiles at each level all include the same rules
    102 from open-src/common/Makefile.subdirs to define these.
    103 
    104 make all
    105 	Run make all in all subdirectories.
    106 
    107 make clean
    108 	Run make clean in all subdirectories.
    109 
    110 make World
    111 	Run make clean in all subdirectories, then make all in all subdirs.
    112 
    113 make install
    114 	Run make install in all subdirectories.
    115 
    116 make download
    117 	Run make download in all subdirectories.
    118 
    119 make source
    120 	Run make source in all subdirectories.
    121 
    122 make git-update
    123 	Run make git-update in all subdirectories.
    124 
    125 make debug-build
    126 	Run make debug-build in all subdirectories.
    127 
    128 make debug-install
    129 	Run make debug-install in all subdirectories.
    130 
    131 =============================================================================
    132 
    133 Variables that can be set in the Makefile for each module:
    134 ----------------------------------------------------------
    135 
    136 Required for all modules:
    137 
    138 MODULE_NAME
    139  - Name of the module being built - usually the same as the name of the
    140    directory it's being built in and the tarball used for the sources.
    141 
    142 MODULE_VERSION
    143  - Version of the source to use, used by default in the tarball name and
    144    source directory unpacked from it.
    145    - Special values:  
    146 	"git" - see "Building from git" below
    147         "src" - used when there is no upstream tarball, only local sources
    148 	"NONE" - used when no build_* directories are created
    149 
    150 Required for some modules:
    151 
    152 SUN_PACKAGE
    153  - Package name that this module is shipped in, to list in attributes section
    154    of man page
    155  * Required if SUNTOUCHED_MANPAGES is not empty
    156 
    157 MODULE_STABILITY
    158  - Interface Stability to list in attributes section of man page
    159  * Required if SUNTOUCHED_MANPAGES is not empty
    160 
    161 LIBNAME
    162  - Name of library built in this module
    163  * Required for lib modules if SUNTOUCHED_MANPAGES is not empty
    164    or if *.spec files are being used to set library versioning information.
    165 
    166 Optional, default is empty:
    167 
    168 SOURCE_UNCOMPRESS
    169  - Command to use to uncompress tarball, if not bzcat
    170 
    171 SOURCE_PATCHES
    172  - Patches to apply to the sources after unpacking the tarball
    173    Entries can be either a simple file name or filename,flags
    174    to specify flags to be passed to gpatch.   The flags argument
    175    is most commonly used to specify -p1 to ignore the a/ & b/ path
    176    prefixes in git-generated patch files - if no flags are specified,
    177    -p0 is passed to treat paths as relative to the top of $(BUILD_DIR).
    178 
    179 ADDITIONAL_SOURCE_DIR
    180  - Directory containing additional source files to be linked into the
    181    build directory by the default_source rule.
    182 
    183 SUNTOUCHED_MANPAGES
    184  - Man pages to add Solaris attributes section and other common Solaris
    185    man page conventions to, via the open-src/common/suntouch-manpages.pl
    186    script.
    187 
    188 MODULE_SUNTOUCH_MAN_FLAGS
    189  - Additional flags to pass to open-src/common/suntouch-manpages.pl, such as
    190    -p /usr/X11/bin to add a path of /usr/X11/bin to the command in the 
    191    synopsis.   Available flags are:
    192       -a '{attribute, value}, ...' - entries for Attributes section table
    193       -l libname                   - add library line to synopsis
    194       -p path                      - add path to command in synopsis
    195 
    196 FIX_PC_FILES
    197  - Names of pkgconfig .pc or .pc.in files in the module, which will be
    198    "fixed" to add required -R flags for linking libraries with and remove
    199    unnecessary Requires.privates lines from.
    200 
    201 MODULE_SOURCE_DEPS, MODULE_CONFIGURE_DEPS, 
    202 MODULE_BUILD_DEPS, MODULE_INSTALL_DEPS
    203  - Makefile targets/rules that the default_* rules list as dependencies
    204 
    205 MODULE_ADD_SOURCE_TARGETS, MODULE_ADD_CONFIGURE_TARGETS, 
    206 MODULE_ADD_BUILD_TARGETS, MODULE_ADD_INSTALL_TARGETS
    207  - Additional targets/rules run by "make source", "make configure", etc.
    208    in addition to default_* if *_TARGETS is not overridden.
    209 
    210 MODULE_CONFIG_OPTS
    211  - Additional arguments passed to configure script by default_config rule
    212 
    213 MODULE_CONFIG_ENV
    214  - Additional environment variables passed to configure script 
    215    by default_config rule
    216 
    217 MODULE_CFLAGS
    218  - C Compiler flags passed to configure via CFLAGS variable by
    219    default_config rule.
    220 
    221 MODULE_CXXFLAGS
    222  - C++ Compiler flags passed to configure via CXXFLAGS variable by
    223    default_config rule.
    224 
    225 MODULE_CPPFLAGS
    226  - C preprocessor flags (-I & -D) passed to configure via CPPFLAGS 
    227    variable by default_config rule.
    228 
    229 MODULE_DEBUG_FLAGS
    230  - C Compiler flags passed to configure via CFLAGS variable by
    231    default_config rule when building debug versions (such as via "make debug")
    232 
    233 MODULE_LDFLAGS
    234  - Linker flags passed to configure via LDFLAGS variable by default_config
    235    rule.
    236 
    237 USE_DEFAULT_CONFIG_CPPFLAGS
    238  - If set to "no", don't pass the normal set of -I flags in CPPFLAGS
    239    to configure script in default_config rule.   MODULE_CPPFLAGS and
    240    MODTYPE_CPPFLAGS will still be passed.
    241 
    242 USE_DEFAULT_CONFIG_LDFLAGS
    243  - If set to "no", don't pass the normal set of linker flags in LDFLAGS
    244    to configure script in default_config rule.   MODULE_LDFLAGS and
    245    MODTYPE_LDFLAGS will still be passed.
    246 
    247 USE_DEFAULT_CONFIG_ENV
    248  - If set to "no", don't pass the normal set of default environment variables
    249    to configure script in default_config rule.  MODULE_CONFIG_ENV and
    250    MODTYPE_CONFIG_ENG will still be passed.
    251 
    252 AUTORECONF
    253  - If set to "yes", the default_config rule will run autoreconf before
    254    running configure, to regenerate autoconf/automake/libtool created
    255    files after patches have been applied to the *.ac/*.am/*.in source files.
    256 
    257 DELIBTOOLIZE
    258  - If set to "yes", the default_config rule will run the script
    259    open-src/common/delibtoolize.pl to remove libtool calls from Makefiles
    260    after running configure.
    261 
    262 MODULE_LD_OPTIONS
    263  - Additional options passed via LD_OPTIONS environment variable to
    264    force options to be used by ld, regardless of options passed by
    265    libtool/compiler etc.   Used by default_build & default_install rules.
    266 
    267 MODULE_BUILD_ENV
    268  - Additional environment variables passed when calling make
    269    by default_build & default_install rules
    270 
    271 MODULE_MAKEFLAGS
    272  - Additional command line arguments passed when calling make
    273    by default_build & default_install
    274 
    275 MODULE_BUILD_MAKEFLAGS
    276  - Additional command line arguments passed when calling make
    277    by default_build
    278 
    279 MODULE_INSTALL_MAKEFLAGS
    280  - Additional command line arguments passed when calling make
    281    by default_install
    282 
    283 EXTRA_LICENSES
    284  - Additional files containing copyright & license information for this module,
    285    beyond what's in LICENSE_FILE, such as subsets for specific packages.
    286    Will be copied under their own names to $(PROTODIR)/licenses/<path>/
    287    for use by include statements in package copyright.add files, where
    288    path is the same as the directory & subdirectory the module source is in.
    289    Files are looked for relative to module directory, include $(SOURCE_DIR)/
    290    in the filename to look relative to the top-level source directory.
    291 
    292 Optional, with non-empty default:
    293 
    294 * Important, for these, to override the default values, you must not only
    295   set the variable, but set another variable <variable>_SET=yes before the
    296   Makefile.inc is included to prevent the default from being set.   For
    297   example:
    298 	SOURCE_URL=http://fontconfig.org/release/$(SOURCE_TARBALL_NAME)
    299 	SOURCE_URL_SET=yes
    300 
    301 MODULE_COMPILER
    302  - Compiler to use, either "suncc" or "gcc".   
    303    Default: $(DEFAULT_COMPILER) setting in common/Makefile.init, 
    304    which is set to suncc in the master sources.
    305 
    306 MODULE_MAKE
    307  - make command to use, either "$(MAKE)" or "$(GNUMAKE)".   
    308    Default: "$(MAKE)" (which is assumed to be Solaris make, not GNU).
    309 
    310 MODULE_PREFIX
    311  - Prefix to install files under, passed to configure scripts via --prefix.
    312    Default: $(X11_DIR) (aka /usr/X11).
    313 
    314 SOURCE_DIRNAME
    315  - Directory that will be created when the source tarball is unpacked.
    316    Default: $(MODULE_NAME)-$(MODULE_VERSION)
    317 
    318 SOURCE_TARBALL_NAME
    319  - Name of tarball file under open-src/tarballs directory for this module.
    320    Set to "NONE" if there is no upstream tarball.
    321    Default: $(SOURCE_DIRNAME).tar.bz2
    322 
    323 SOURCE_TARBALL_DIR
    324  - For X.Org sources, what directory the source tarball & git repo is in
    325    on freedesktop.org - usually the same as the module type directory in
    326    this tree.
    327    Default: $(MODTYPE)
    328 
    329 SOURCE_URL
    330  - URL to download the SOURCE_TARBALL from when running "make download"
    331    Default: $(XORG_RELEASES_URL)/$(SOURCE_TARBALL_DIR)/$(SOURCE_TARBALL_NAME)
    332 
    333 GIT_URL
    334  - URL to check out the current sources via the git code manager if 
    335    MODULE_VERSION is set to "git" - see "Building from git" below
    336    Default: $(XORG_GIT_URL)/$(SOURCE_TARBALL_DIR)/$(MODULE_NAME).git
    337 
    338 BUILD_TYPES
    339  - What type of output to build for this module - usually the word-size of
    340    the binaries built (32 and/or 64), but may be set to any string if other
    341    distinctions are useful.   For most modules that don't build binaries, 
    342    (fonts, proto headers, docs, etc.) it's set to 32 for simplicity.
    343    For each value xx in this list, a build_xx directory will be made and
    344    the source_xx, configure_xx, build_xx and install_xx rules run.
    345    Default: 32
    346 
    347 SOURCE_TARGETS, CONFIGURE_TARGETS, BUILD_TARGETS, INSTALL_TARGETS
    348  - Makefile targets/rules to run for "make source", "make configure",
    349    "make build", and "make install"
    350    Defaults: default_source, default_configure, default_build, default_install
    351    The *_TARGETS may be appended to by setting the MODTYPE_ADD_*_TARGETS 
    352    and/or MODULE_ADD_*_TARGETS variables.
    353 
    354 AUTOCONF_TARGET
    355  - File created by running the default_configure rule.   If this file exists,
    356    make will not run the default_configure rule - if it does not exist, it
    357    will be run.
    358    Default: $(SOURCE_DIR)/Makefile
    359 
    360 LICENSE_FILE
    361  - File containing copyright & license information for this module.
    362    Will be copied to $(PROTODIR)/licenses/<path>/COPYING
    363    for use by include statements in package copyright.add files, where
    364    path is the same as the directory & subdirectory the module source is in.
    365    File is looked for first in module directory, if not found there,
    366    in top-level source directory (SOURCE_DIR).
    367    Default: COPYING
    368 
    369 MODULE_MTLEVEL
    370  - For modules in the lib directory, Multi-thread safety level to list in
    371    attributes section of SUNTOUCHED_MANPAGES
    372    Default: See XInitThreads(3X11)
    373 
    374 =============================================================================
    375 
    376 Variables that can be set in the Makefile.inc for each module type:
    377 -------------------------------------------------------------------
    378 
    379 Some settings are common to most, if not all of the modules of a given
    380 type.   For those, these variables can be set in 
    381 open-src/<module_type>/Makefile.inc - they have the same meanings and uses
    382 as the MODULE_* versions documented above, and appear in commands before
    383 the MODULE_* versions - the general pattern is
    384 	foo=<tree-wide-defaults> $(MODTYPE_foo) $(MODULE_foo)
    385 
    386 Required for all module types:
    387 
    388 MODTYPE
    389  - Name of the directory for this module type, usually the same as the 
    390    directory for the module type in X.Org's source trees.
    391 
    392 Optional, default is empty:
    393 
    394 	- MODTYPE_SUNTOUCH_MAN_FLAGS
    395 	- MODTYPE_SOURCE_DEPS
    396 	- MODTYPE_CONFIGURE_DEPS
    397 	- MODTYPE_BUILD_DEPS
    398 	- MODTYPE_INSTALL_DEPS
    399 	- MODTYPE_ADD_SOURCE_TARGETS
    400 	- MODTYPE_ADD_CONFIGURE_TARGETS
    401 	- MODTYPE_ADD_BUILD_TARGETS
    402 	- MODTYPE_ADD_INSTALL_TARGETS
    403 	- MODTYPE_CONFIG_OPTS
    404 	- MODTYPE_CONFIG_ENV
    405 	- MODTYPE_CFLAGS
    406 	- MODTYPE_CXXFLAGS
    407 	- MODTYPE_CPPFLAGS
    408 	- MODTYPE_DEBUG_FLAGS
    409 	- MODTYPE_LDFLAGS
    410 	- MODTYPE_LD_OPTIONS
    411 	- MODTYPE_BUILD_ENV
    412 	- MODTYPE_MAKEFLAGS
    413 	- MODTYPE_BUILD_MAKEFLAGS
    414 	- MODTYPE_INSTALL_MAKEFLAGS
    415 
    416 Optional, with non-empty default:
    417 
    418 [See note in module variable section about setting _SET variables to override]
    419 
    420 	- MODTYPE_COMPILER
    421 	- MODTYPE_MAKE
    422 	- MODTYPE_PREFIX
    423 
    424 =============================================================================
    425 
    426 Setting per-platform variables:
    427 -------------------------------
    428 
    429 open-src/common/Makefile.init defines $MACH to be either sparc or i386
    430 for the platform being built.   You can reference this variable in the
    431 names of other variables to set different values for each platform.
    432 For instance, to build only 64-bit on SPARC, but both 32-bit and 64-bit 
    433 on x86/x64, you can do:
    434 
    435 	BUILD_TYPES_sparc=64
    436 	BUILD_TYPES_i386=32 64
    437 	BUILD_TYPES=$(BUILD_TYPES_$(MACH))
    438 	BUILD_TYPES_SET=yes
    439 
    440 
    441 =============================================================================
    442 
    443 Variables you may want to customize for your site/tree:
    444 
    445 XORG_RELEASES_URL & SF_DOWNLOADS_URL (set in open-src/common/Makefile.init)
    446 - urls for X.Org & sourceforge mirrors to download tarballs from
    447 
    448 FDO_GIT_URL (set in open-src/common/Makefile.init)
    449 - url for git repositories hosted on freedesktop.org, including
    450   X.Org, Mesa, pixman, etc.  - defaults to anonymous git over http, can 
    451   change to use another protocol if needed
    452 
    453 =============================================================================
    454 
    455 Tools for developers to use:
    456 
    457 Some tools to ease development are available in the util/build-tools
    458 directory of the tree.
    459 
    460 find-build-errors - looks for a log/buildit-XW file (or another file you
    461 	specify on the command line) and tries to isolate out just the
    462 	build errors for easier reading than the raw build logs.   
    463 	If you did buildit -p, also shows packaging errors.
    464 
    465 xmake - when you change one file in a large module like xserver and just
    466 	want to rebuild in that subdirectory of the build_32 or build_64
    467 	tree, running xmake will attempt to run make or gmake in that
    468 	directory with the same flags and environment variables that would
    469 	be passed from running make in the module make directory
    470 
    471 =============================================================================
    472 
    473 Building from git:
    474 
    475 For debugging and development purposes, such as working on the merge of
    476 a X.org release still in development, you can choose to  to check out a 
    477 the upstream sources from a the git repository instead of a tarball.
    478 
    479 You must *NOT* check in to the master gate a module using this feature,
    480 since this would produce a build that's not reproducible and changing
    481 unexpectedly.
    482 
    483 To use this, set MODULE_VERSION to "git" in a module's Makefile.
    484 To check out a branch other than master, add GIT_BRANCH="branch-name".
    485 
    486 Once you've done this "make download" will clone the git repo initially, and
    487 "make git-update" will update an existing repo.   The clone will be located
    488 in the $(MODULE_NAME)-git subdirectory in the module directory, and the
    489 "make source" command will copy it instead of unpacking a tarball.
    490 
    491 =============================================================================
    492 
    493 Known deficiencies (aka TODO):
    494 
    495 Things we should fix someday, but haven't had time to do yet, include:
    496 
    497 - Builds are slow.   Painfully slow.   Things we might be able to do to
    498   speed them up include:
    499 	- Using a cache of configure script results shared among all the
    500 	  components in the tree
    501 	- Setting up proper parallel make rules so that multi-core/cpu
    502 	  machines can build more than one bit at a time.
    503 	- Profiling the builds to see where bottlenecks are
    504 
    505 - There aren't dependency relationships listed in most of the module
    506   makefiles - you can't bringover the tree and just cd open-src/xserver/xorg
    507   and make, because it won't find many of the dependencies - pretty much you
    508   have to run ./buildit at the toplevel first to build the entire tree and then
    509   go to work on the module you care about.   It would be cool if it would do
    510   this for you (like I believe the ON tree does), though tracking down all the
    511   dependencies will probably take a while - getting them done for xserver/xorg
    512   first would be most useful.
    513 
    514 =============================================================================
    515 
    516 Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
    517 Use subject to license terms.
    518 
    519 Permission is hereby granted, free of charge, to any person obtaining a
    520 copy of this software and associated documentation files (the
    521 "Software"), to deal in the Software without restriction, including
    522 without limitation the rights to use, copy, modify, merge, publish,
    523 distribute, and/or sell copies of the Software, and to permit persons
    524 to whom the Software is furnished to do so, provided that the above
    525 copyright notice(s) and this permission notice appear in all copies of
    526 the Software and that both the above copyright notice(s) and this
    527 permission notice appear in supporting documentation.
    528 
    529 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    530 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    531 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
    532 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
    533 HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
    534 INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
    535 FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    536 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
    537 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    538 
    539 Except as contained in this notice, the name of a copyright holder
    540 shall not be used in advertising or otherwise to promote the sale, use
    541 or other dealings in this Software without prior written authorization
    542 of the copyright holder.
    543