home | help
BUILD(7)		 Miscellaneous Information Manual		BUILD(7)

NAME
     build -- information on how to build the system

DESCRIPTION
     The  sources  for	the FreeBSD system and its applications are contained in
     three different directories, normally /usr/src, /usr/doc,	and  /usr/ports.
     Directory /usr/src contains the "base system" sources, which is loosely de-
     fined  as the things required to rebuild the system to a useful state.  Di-
     rectory /usr/doc contains the source for the system documentation,  exclud-
     ing the manual pages.  Directory /usr/ports contains a tree that provides a
     consistent  interface for building and installing third party applications.
     For more information about the ports build process, see ports(7).

     The make(1) command is used in each of these directories to build	and  in-
     stall the things in that directory.  Issuing the make(1) command in any di-
     rectory or subdirectory of those directories has the same effect as issuing
     the  same	command in all subdirectories of that directory.  With no target
     specified, the things in that directory are just built.

     A source tree is allowed to be read-only.	As described in make(1), objects
     are usually built in a separate object directory hierarchy specified by the
     environment  variable  MAKEOBJDIRPREFIX,  or  under  /usr/obj  if	variable
     MAKEOBJDIRPREFIX  is  not set.  For a given source directory, its canonical
     object directory would be ${MAKEOBJDIRPREFIX}${.CURDIR} if make(1) variable
     MAKEOBJDIRPREFIX is set, or /usr/obj${.CURDIR} if this variable is not set.
     Cross-builds set the object directory as described in the documentation for
     the buildworld target below.

     The build may be controlled by defining make(1) variables described in  the
     "ENVIRONMENT"   section   below,	and   by  the  variables  documented  in
     make.conf(5).

     The following list provides the names and actions for the targets supported
     by the build system:

     clean	  Remove any files created during the build process.

     cleandepend  Remove the file ${.OBJDIR}/${DEPENDFILE} generated by a  prior
		  "make depend" step.

     cleandir	  Remove the canonical object directory if it exists, or perform
		  actions equivalent to "make clean cleandepend" if it does not.
		  This target will also remove an obj link in ${.CURDIR} if that
		  exists.

		  It  is advisable to run "make cleandir" twice: the first invo-
		  cation will remove the canonical object directory and the sec-
		  ond one will clean up ${.CURDIR}.

     depend	  Generate   a	 list	of   build    dependencies    in    file
		  ${.OBJDIR}/${DEPENDFILE}.

     install	  Install  the	results of the build to the appropriate location
		  in the installation directory hierarchy specified in	variable
		  DESTDIR.

     obj	  Create the canonical object directory associated with the cur-
		  rent directory.

     objlink	  Create  a  symbolic  link to the canonical object directory in
		  ${.CURDIR}.

     tags	  Generate a tags  file  using	the  program  specified  in  the
		  make(1)  variable  CTAGS.   The build system supports ctags(1)
		  and GNU Global.

     The other supported targets under directory /usr/src are:

     buildenv	      Spawn an interactive shell with environment variables  set
		      up for cross-building the system.  The target architecture
		      needs  to  be specified with make(1) variables TARGET_ARCH
		      and TARGET.

		      This target is only useful after	a  complete  cross-tool-
		      chain  including	the compiler, linker, assembler, headers
		      and libraries has been built; see the toolchain target be-
		      low.

     buildworld       Build everything but the kernel, configure files	in  etc,
		      and  release.   The  actual  build location prefix used is
		      ${MAKEOBJDIRPREFIX}${.CURDIR}  for  native   builds,   and
		      ${MAKEOBJDIRPREFIX}/${TARGET}${.CURDIR}  for  cross builds
		      and native builds with variable CROSS_BUILD_TESTING set.

     cleanworld       Attempt  to  clean  up  targets  built  by   a   preceding
		      buildworld step.

     distributeworld  Distribute  everything  compiled by a preceding buildworld
		      step.  Files are placed in the directory hierarchy  speci-
		      fied  by	make(1)  variable  DISTDIR.  This target is used
		      while building a release; see release(7).

     installworld     Install everything built by a  preceding	buildworld  step
		      into  the  directory hierarchy pointed to by make(1) vari-
		      able DESTDIR.

		      If installing onto an NFS file system and running  make(1)
		      with the -j option, make sure that rpc.lockd(8) is running
		      on  both client and server.  See rc.conf(5) on how to make
		      it start at boot time.

     toolchain	      Create the build toolchain needed to build the rest of the
		      system.  For cross-architecture builds, this step  creates
		      a cross-toolchain.

     universe	      Execute  a  buildworld and buildkernel for all kernels in-
		      cluding LINT, for each architecture supported by the build
		      system.  This command takes a long time.

     update	      Get updated sources as configured in make.conf(5).

     Kernel specific build targets in /usr/src are:

     buildkernel      Rebuild the kernel and the kernel modules.

     installkernel    Install the kernel and the  kernel  modules  to  directory
		      ${DESTDIR}/boot/kernel,  renaming  any pre-existing direc-
		      tory with this name to kernel.old if it contained the cur-
		      rently  running  kernel.	 The  target   directory   under
		      ${DESTDIR}  may  be  modified  using  the INSTKERNNAME and
		      KODIR make(1) variables.

     kernel	      Equivalent to buildkernel followed by installkernel

     kernel-toolchain
		      Rebuild the tools needed for kernel compilation.	Use this
		      if you did not do a buildworld first.

     reinstallkernel  Reinstall the kernel and the kernel  modules,  overwriting
		      the  contents  of  the  target  directory.   As  with  the
		      installkernel target, the target directory can  be  speci-
		      fied using the make(1) variable INSTKERNNAME.

     Convenience  targets  for cleaning up the install destination directory de-
     noted by variable DESTDIR include:

     check-old	      Print a list of old files and directories in the system.

     delete-old       Delete obsolete base system files and directories interac-
		      tively.  When -DBATCH_DELETE_OLD_FILES is specified at the
		      command line, the delete operation  will	be  non-interac-
		      tive.   The  variables  DESTDIR,	TARGET_ARCH  and  TARGET
		      should be set as with "make installworld".

     delete-old-libs  Delete obsolete base system libraries interactively.  This
		      target should only be used if no 3rd party  software  uses
		      these  libraries.  When -DBATCH_DELETE_OLD_FILES is speci-
		      fied at the command line, the  delete  operation	will  be
		      non-interactive.	 The  variables DESTDIR, TARGET_ARCH and
		      TARGET should be set as with "make installworld".

ENVIRONMENT
     Variables that influence all builds include:

     DESTDIR	       The directory hierarchy prefix where built  objects  will
		       be  installed.  If not set, DESTDIR defaults to the empty
		       string.

     MAKEOBJDIRPREFIX  Defines the prefix for directory names  in  the	tree  of
		       built  objects.	 Defaults  to  /usr/obj  if not defined.
		       This variable should only be set in the	environment  and
		       not via /etc/make.conf or the command line.

     NO_WERROR	       If defined, compiler warnings will not cause the build to
		       halt, even if the makefile says otherwise.

     Additionally,  builds  in	/usr/src are influenced by the following make(1)
     variables:

     LOCAL_DIRS       If set, this variable supplies a list of additional direc-
		      tories to build, relative to the root of the source tree.

     SUBDIR_OVERRIDE  Override the default  list  of  sub-directories  and  only
		      build  the  sub-directory  named	in  this variable.  This
		      variable is useful when debugging failed builds.

			    make some-target SUBDIR_OVERRIDE=foo/bar

     TARGET	      The target hardware platform.  This is  analogous  to  the
		      "uname  -m" output.  This is necessary to cross-build some
		      target architectures.   For  example,  cross-building  for
		      PC98  machines  requires TARGET_ARCH=i386 and TARGET=pc98.
		      If not set, TARGET defaults to the current hardware  plat-
		      form.

     TARGET_ARCH      The target machine processor architecture.  This is analo-
		      gous  to	the  "uname -p" output.  Set this to cross-build
		      for a different architecture.  If not set, TARGET_ARCH de-
		      faults to the current machine architecture.

     Builds under directory /usr/doc are influenced  by  the  following  make(1)
     variables:

     DOC_LANG  If  set, restricts the documentation build to the language subdi-
	       rectories specified as its content.  The  default  action  is  to
	       build documentation for all languages.

FILES
     /usr/doc/Makefile
     /usr/doc/share/mk/doc.project.mk
     /usr/ports/Mk/bsd.port.mk
     /usr/ports/Mk/bsd.sites.mk
     /usr/share/examples/etc/make.conf
     /usr/src/Makefile
     /usr/src/Makefile.inc1

EXAMPLES
     For  an  "approved" method of updating your system from the latest sources,
     please see the "COMMON ITEMS" section in src/UPDATING.

     The following sequence of commands can be used to	cross-build  the  system
     for the sparc64 architecture on an i386 host:

	   cd /usr/src
	   make TARGET_ARCH=sparc64 buildworld
	   make TARGET_ARCH=sparc64 DESTDIR=/clients/sparc64 installworld

SEE ALSO
     cc(1),   install(1),  make(1),  make.conf(5),  src.conf(5),  ports(7),  re-
     lease(7), config(8), mergemaster(8), reboot(8), shutdown(8)

AUTHORS
     Mike W. Meyer <mwm@mired.org>.

FreeBSD 7.0			 October 1, 2006			BUILD(7)

home | help