sync
[bitrig.git] / Makefile
blobe724ba179ed26972d0a85ac663a0af732000f109
1 # $OpenBSD: Makefile,v 1.119 2013/06/17 19:16:02 robert Exp $
4 # For more information on building in tricky environments, please see
5 # the list of possible environment variables described in
6 # /usr/share/mk/bsd.README.
8 # Building recommendations:
10 # 1) If at all possible, put this source tree in /usr/src. If /usr/src
11 # must be a symbolic link, set BSDSRCDIR in the environment to point to
12 # the real location.
14 # 2) It is also recommended that you compile with objects outside the
15 # source tree. To do this, ensure /usr/obj exists or points to some
16 # area of disk of sufficient size. Then do "cd /usr/src; make obj".
17 # This will make a symbolic link called "obj" in each directory, as
18 # well as populate the /usr/obj properly with directories for the
19 # objects.
21 # 3) It is strongly recommended that you build and install a new kernel
22 # before rebuilding your system. Some of the new programs may use new
23 # functionality or depend on API changes that your old kernel doesn't have.
25 # 4) If you are reasonably sure that things will compile OK, use the
26 # "make build" target supplied here. Good luck.
28 # 5) If you want to setup a cross-build environment, there is a "cross-gcc"
29 # target available which upon completion of:
30 # make -f Makefile.cross TARGET=<target> cross-gcc"
31 # (where <target> is one of the names in the /sys/arch directory) will produce
32 # a set of compilation tools along with the includes in the /usr/cross/<target>
33 # directory. The "cross-distrib" target will build cross-tools as well as
34 # binaries for a given <target>.
37 .include <bsd.own.mk> # for NOMAN, if it's there.
39 SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share
40 SUBDIR+= gnu
42 SUBDIR+= sys
44 .if (${KERBEROS5:L} == "yes")
45 SUBDIR+=kerberosV/tools
46 SUBDIR+=kerberosV/libexec
47 SUBDIR+=kerberosV/usr.bin
48 SUBDIR+=kerberosV/usr.sbin
49 .endif
51 .if make(clean) || make(cleandir) || make(obj)
52 SUBDIR+= distrib regress
53 .endif
55 regression-tests:
56 @echo Running regression tests...
57 @cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress
59 includes:
60 cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
62 beforeinstall:
63 cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs
64 cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} install-mtree
65 cd ${.CURDIR}/include && exec ${MAKE} includes
67 afterinstall:
68 .ifndef NOMAN
69 cd ${.CURDIR}/share/man && exec ${MAKE} makedb
70 .endif
72 .ifdef DESTDIR
73 build:
74 @echo cannot build with DESTDIR set
75 @false
76 .else
77 build:
78 .ifdef GLOBAL_AUTOCONF_CACHE
79 cp /dev/null ${GLOBAL_AUTOCONF_CACHE}
80 .endif
81 cd ${.CURDIR}/share/mk && exec ${SUDO} ${MAKE} install
82 cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
83 ${SUDO} ${MAKE} cleandir
84 cd ${.CURDIR}/lib/csu && ${MAKE} depend && ${MAKE} && \
85 NOMAN=1 exec ${SUDO} ${MAKE} install
86 cd ${.CURDIR}/lib/libc && ${MAKE} depend && ${MAKE} && \
87 NOMAN=1 exec ${SUDO} ${MAKE} install
88 cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \
89 NOMAN=1 exec ${SUDO} ${MAKE} install
90 ${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install
91 .endif
93 CROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \
94 cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \
95 cross-depend cross-clean cross-cleandir
97 .if !defined(TARGET)
98 ${CROSS_TARGETS}:
99 @echo "TARGET must be set for $@"; exit 1
100 .else
101 . include "Makefile.cross"
102 .endif # defined(TARGET)
104 .PHONY: ${CROSS_TARGETS} \
105 build regression-tests includes beforeinstall afterinstall \
106 all depend
108 .if !defined(SNAPDIR)
109 presnap:
110 echo "SNAPDIR must defined"
111 snap:
112 echo "SNAPDIR must defined"
113 exit 1
114 .else
115 .NOTPARALLEL:
116 ARCH!= uname -m
117 SNAPROOTDIR=${SNAPDIR}/${ARCH}/root
118 .if defined(SNAPDATE)
119 SNAPRELDIR!= echo ${SNAPDIR}/${ARCH}/release.$$(date "+%y%m%d%H%M")
120 .else
121 SNAPRELDIR!= echo ${SNAPDIR}/${ARCH}/release
122 .endif
123 SNAPLOGFILE != echo ${SNAPDIR}/buildlog.${ARCH}.$$(date "+%y%m%d%H%M")
124 snapinfo:
125 @echo rootdir = ${SNAPROOTDIR}
126 @echo reldir = ${SNAPRELDIR}
127 @echo logfile = ${SNAPLOGFILE}
129 buildworld:
130 rm -rf /usr/obj/*
131 make obj >/dev/null
132 cd ${.CURDIR} etc && DESTDIR=/ make distrib-dirs
133 make build
135 snap:
136 make do_snap 2>&1 | tee ${SNAPLOGFILE}
138 do_snap: buildworld do_snap_rel
140 do_snap_rel:
141 date
142 rm -rf ${SNAPROOTDIR}
143 mkdir -p ${SNAPROOTDIR}
144 mkdir -p ${SNAPRELDIR}
145 cd ${.CURDIR} etc && DESTDIR=${SNAPROOTDIR} RELEASEDIR=${SNAPRELDIR} make release
146 cd ${.CURDIR} distrib/sets && DESTDIR=${SNAPROOTDIR} sh checkflist
147 .endif
151 .include <bsd.subdir.mk>