Home | History | Annotate | Line # | Download | only in etc
Makefile revision 1.157
      1 #	$NetBSD: Makefile,v 1.157 2000/08/03 13:00:02 kleink Exp $
      2 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
      3 
      4 # Environment variables without default values:
      5 #   DESTDIR must be set before anything in this file will work.
      6 #   RELEASEDIR is where the tarred up stuff for a snapshot or
      7 #	release will be placed.
      8 #
      9 # Environment variables with default values:
     10 #   LOCALTIME will set the default local time for the system you
     11 #	build; it determines what /etc/localtime is symlink'd to.
     12 #   KERNSRCDIR points to kernel source; it is set by default to ../sys,
     13 #	but can be overridden.
     14 #   KERNOBJDIR is the kernel build directory, it defaults to
     15 #	${KERNSRCDIR}/arch/${MACHINE}/compile/KERNELNAME, but can be
     16 #	overridden.
     17 #   KERNCONFDIR is where the configuration files for kernels are found;
     18 #	default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
     19 #   UPDATE is normally undefined; if defined, don't do a 'make clean'
     20 #	before kernel compile
     21 #   NO_SENDMAIL is normally undefined; if defined, it will not do a
     22 #	`make distribution' in the sendmail config file source directory.
     23 #   EXTRA_KERNELS has a machine-dependent list of kernels to build added
     24 #	to it, but you may also set this to have extra ones built.
     25 #   BUILD_KERNELS are a machine-dependent list of kernels that should just
     26 #	be built in place but not made into sets or installed, e.g., an
     27 #	INSTALL kernel used later in src/distrib/.
     28 #
     29 # Targets:
     30 #    distribution: makes a full NetBSD distribution in DESTDIR. If
     31 #	INSTALL_DONE is set, it will not do a `make install.'
     32 #    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
     33 #	Called by distribution.
     34 #    snapshot: calls distribution, above, and then tars up the files
     35 #	into a release(7) format in RELEASEDIR. Any port-dependent
     36 #	stuff for this target is found in etc.${MACHINE}/Makefile.inc.
     37 #    release: a synonym for `snapshot'
     38 
     39 # do this before bsd.own.mk so we get correct KERNSRCDIR
     40 .include "../Makefile.inc"
     41 
     42 # For NO_SENDMAIL, INSTPRIV, MKCRYPTO
     43 .include <bsd.own.mk>
     44 
     45 TZDIR=		/usr/share/zoneinfo
     46 LOCALTIME?=	UTC
     47 
     48 # setting NOOBJ prevents "make obj" from doing anything;
     49 # an objdir would break the installation stuff below
     50 MKOBJ=	no
     51 
     52 # MD Makefile.inc may append MD targets to BIN[123].  Make sure all
     53 # are empty, to preserve the old semantics of setting them below with "=".
     54 BIN1=	
     55 BIN2=
     56 BIN3=
     57 
     58 # Directories to build in ${RELEASEDIR}.   MD Makefile.inc files can
     59 # add to this.
     60 # NOTE: Parent directories must be listed before subdirectories.
     61 INSTALLATION_DIRS= \
     62 	binary binary/sets binary/kernel binary/security installation
     63 
     64 .if exists(etc.${MACHINE}/Makefile.inc)
     65 .include "etc.${MACHINE}/Makefile.inc"
     66 .endif
     67 
     68 # Use multiple jobs for kernel builds, if NBUILDJOBS set.
     69 # (Taken from src/Makefile.)
     70 .if defined(NBUILDJOBS)
     71 _J= -j${NBUILDJOBS}
     72 .endif
     73 
     74 # -rw-r--r--
     75 BINOWN= root
     76 BINGRP= wheel
     77 BIN1+=	bootptab changelist csh.cshrc csh.login csh.logout daily \
     78 	daily.conf dm.conf floppytab ftpchroot ftpusers ftpwelcome \
     79 	gettytab group hosts hosts.lpd inetd.conf lkm.conf \
     80 	mailer.conf man.conf monthly monthly.conf mrouted.conf \
     81 	netconfig networks newsyslog.conf nsswitch.conf ntp.conf \
     82 	phones printcap profile protocols rbootd.conf rc rc.conf \
     83 	rc.lkm rc.local rc.subr rc.shutdown rc.wscons remote rpc \
     84 	security security.conf services shells sysctl.conf syslog.conf \
     85 	weekly weekly.conf wscons.conf \
     86 	etc.${MACHINE}/ttys etc.${MACHINE}/disktab
     87 
     88 .if	(${MACHINE_ARCH} == "m68k") || \
     89 	(${MACHINE_ARCH} == "ns32k") || \
     90 	(${MACHINE_ARCH} == "vax") || \
     91 	(${MACHINE_ARCH} == "arm32")
     92 BIN1+=	ld.so.conf
     93 .elif exists(etc.${MACHINE_ARCH}/ld.so.conf)
     94 BIN1+=	etc.${MACHINE_ARCH}/ld.so.conf
     95 .endif
     96 
     97 .if exists(etc.${MACHINE_ARCH}/ttyaction)
     98 BIN1+=	etc.${MACHINE_ARCH}/ttyaction
     99 .endif
    100 
    101 # IPv6
    102 BIN1+=	rtadvd.conf
    103 
    104 # -rw-rw-r--
    105 BIN2+=	motd
    106 
    107 # -rw-------
    108 BIN3+=	hosts.equiv
    109 
    110 NAMEDB=	127 root.cache named.conf localhost loopback.v6
    111 PCS=	pcs750.bin
    112 
    113 all clean cleandir depend distclean etc includes install lint:
    114 
    115 .include <bsd.kernobj.mk>
    116 
    117 obj:
    118 	mkdir -p ${KERNOBJDIR}
    119 
    120 .ifndef DESTDIR
    121 distribution distrib-dirs release snapshot:
    122 	@echo setenv DESTDIR before doing that!
    123 	@false
    124 .else
    125 distribution: distrib-dirs
    126 .if !defined(INSTALL_DONE)
    127 	(cd ..; ${MAKE} _DISTRIB= includes)
    128 	(cd ..; ${MAKE} _DISTRIB= install)
    129 .endif
    130 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} \
    131 	    ${DESTDIR}/etc
    132 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} \
    133 	    ${DESTDIR}/etc
    134 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} \
    135 	    ${DESTDIR}/etc
    136 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 aliases \
    137 	    ${DESTDIR}/etc/mail
    138 	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 crontab \
    139 	    ${DESTDIR}/var/cron/tabs/root
    140 	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 master.passwd \
    141 	    ${DESTDIR}/etc
    142 	pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd
    143 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
    144 	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
    145 	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 minfree \
    146 	    ${DESTDIR}/var/crash
    147 	(cd root; \
    148 		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.cshrc \
    149 		    ${DESTDIR}/root/.cshrc; \
    150 		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 dot.klogin \
    151 		    ${DESTDIR}/root/.klogin; \
    152 		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.login \
    153 		    ${DESTDIR}/root/.login; \
    154 		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.profile \
    155 		    ${DESTDIR}/root/.profile; \
    156 		${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.shrc \
    157 		    ${DESTDIR}/root/.shrc; \
    158 		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
    159 		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
    160 		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
    161 	(cd mtree; ${MAKE} install)
    162 	(cd namedb; \
    163 		${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
    164 		    ${NAMEDB} ${DESTDIR}/etc/namedb)
    165 	(cd rc.d; ${MAKE} install)
    166 	/bin/rm -f ${DESTDIR}/etc/localtime
    167 	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
    168 	/bin/rm -f ${DESTDIR}/etc/rmt
    169 	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
    170 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g operator -m 664 /dev/null \
    171 		${DESTDIR}/etc/dumpdates
    172 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g operator -m 600 /dev/null \
    173 		${DESTDIR}/etc/skeykeys
    174 	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 /dev/null \
    175 		${DESTDIR}/var/at/at.deny
    176 	${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 /dev/null \
    177 		${DESTDIR}/var/cron/log
    178 	${INSTALL} ${INSTPRIV} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
    179 		${DESTDIR}/var/db/locate.database
    180 	${INSTALL} ${INSTPRIV} -c -o uucp -g dialer -m 640 /dev/null \
    181 		${DESTDIR}/var/log/aculog
    182 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    183 		${DESTDIR}/var/log/authlog
    184 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
    185 		${DESTDIR}/var/log/lastlog
    186 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
    187 		${DESTDIR}/var/log/lpd-errs
    188 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    189 		${DESTDIR}/var/log/maillog
    190 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    191 		${DESTDIR}/var/log/messages
    192 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    193 		${DESTDIR}/var/log/secure
    194 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    195 		${DESTDIR}/var/log/sendmail.st
    196 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    197 		${DESTDIR}/var/log/wtmp
    198 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    199 		${DESTDIR}/var/log/xferlog
    200 	${INSTALL} ${INSTPRIV} -c -o daemon -g staff -m 664 /dev/null \
    201 		${DESTDIR}/var/msgs/bounds
    202 	${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
    203 		${DESTDIR}/var/run/utmp
    204 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    205 		${DESTDIR}/var/games/atc_scores
    206 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    207 		${DESTDIR}/var/games/battlestar.log
    208 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    209 		${DESTDIR}/var/games/cfscores
    210 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    211 		${DESTDIR}/var/games/criblog
    212 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    213 		${DESTDIR}/var/games/robots_roll
    214 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    215 		${DESTDIR}/var/games/rogue.scores
    216 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    217 		${DESTDIR}/var/games/saillog
    218 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    219 		${DESTDIR}/var/games/snakerawscores
    220 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    221 		${DESTDIR}/var/games/snake.log
    222 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    223 		${DESTDIR}/var/games/tetris.scores
    224 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    225 		${DESTDIR}/var/games/larn/llog12.0
    226 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    227 		${DESTDIR}/var/games/larn/lscore12.0
    228 	${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \
    229 		${DESTDIR}/var/games/larn/playerids
    230 	(cd etc.${MACHINE}; ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} \
    231 	    -g ${BINGRP} -m 444 fstab.* ${DESTDIR}/etc)
    232 	(cd ${DESTDIR}/dev; ./MAKEDEV all)
    233 	(cd ../usr.bin/mail; ${MAKE} distribution)
    234 	(cd ../gnu/usr.sbin/postfix/; ${MAKE} distribution)
    235 .if (${MKCRYPTO} != "no")
    236 	(cd ../usr.bin/ssh; ${MAKE} distribution)
    237 .endif
    238 .ifndef NO_SENDMAIL
    239 	(cd ../gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
    240 	${DESTDIR}/usr/libexec/sendmail/sendmail -C ${DESTDIR}/etc/mail/sendmail.cf -O AliasFile=${DESTDIR}/etc/mail/aliases -O DontBlameSendmail=MapInUnsafeDirPath -bi
    241 .endif
    242 
    243 distrib-dirs:
    244 	${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${DESTDIR}
    245 	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
    246 	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
    247 
    248 .if !defined(RELEASEDIR)
    249 release snapshot snap_pre snap_md_pre snap_md_post:
    250 	@echo setenv RELEASEDIR before doing that!
    251 	@false
    252 .else
    253 release snapshot: distribution snap_pre snap_md_pre snap_kern snap_md_post
    254 	(cd ../distrib/sets; ${MAKE} sets)
    255 	sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/kernel '*.gz'
    256 
    257 snap_pre:
    258 	/bin/rm -rf ${RELEASEDIR}
    259 	${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${RELEASEDIR}
    260 .for dir in ${INSTALLATION_DIRS}
    261 	${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${RELEASEDIR}/${dir}
    262 .endfor
    263 
    264 
    265 # This target builds the GENERIC kernel (which must exist for all
    266 # ports) and puts it in binary/sets/kern.tgz, and also builds any
    267 # kernels specified in EXTRA_KERNELS. Since NetBSD's kernel build
    268 # system can create more than one kernel from a single configuration
    269 # we figure out how many there are, what they're named, and move them
    270 # to binary/kernel/${KERNEL}.${CONFIGFILE}.gz - most often KERNEL will
    271 # simply be "netbsd". If we don't find the "config" line, assume the
    272 # kernel will be "netbsd" (some config files are simple additions on
    273 # GENERIC, and just include it).
    274 #
    275 GETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
    276 		END{ if (found == 0) print "netbsd"; }'
    277 #
    278 .if !target(snap_kern)
    279 snap_kern:
    280 .ifndef KERNELS_DONE
    281 .for configfile in GENERIC ${EXTRA_KERNELS} ${BUILD_KERNELS}
    282 	cd ${KERNCONFDIR} && ${CONFIG} \
    283 		-b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile}
    284 .ifndef UPDATE
    285 	cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 
    286 .endif
    287 	cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J}
    288 .endfor # kernels
    289 	cd ${KERNOBJDIR}/GENERIC &&	\
    290 		tar cf - `${GETKERNELAWK} ${KERNCONFDIR}/GENERIC` |\
    291 		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
    292 .for configfile in GENERIC ${EXTRA_KERNELS}
    293 	cd ${KERNOBJDIR}/${configfile} &&	\
    294 		for kernel in `${GETKERNELAWK} \
    295 			${KERNCONFDIR}/${configfile}` ; {   \
    296 		gzip -c -9 < $${kernel} > \
    297 			${RELEASEDIR}/binary/kernel/$${kernel}.${configfile}.gz ; }
    298 .endfor # EXTRA_KERNELS
    299 .endif # KERNELS_DONE
    300 .endif # no target(snap_kern)
    301 
    302 .endif # RELEASEDIR check
    303 
    304 snap_md_pre:
    305 # nothing here -- look in the machine-dependent Makefile.inc
    306 
    307 snap_md_post:
    308 # nothing here -- look in the machine-dependent Makefile.inc
    309 
    310 .endif	# DESTDIR check
    311 
    312 .include <bsd.prog.mk>
    313