Makefile revision 1.96       1 #	$NetBSD: Makefile,v 1.96 1999/02/05 03:01:49 cjs 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 #   NO_SENDMAIL is normally undefined; if defined, it will not do a
     20 #	`make distribution' in the sendmail config file source directory.
     21 #   USE_BIND4 is normally unset; if set, it will install a named.boot
     22 #	instead of a named.conf in etc/namedb.
     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 # 
     26 # Targets:
     27 #    distribution: makes a full NetBSD distribution in DESTDIR. If
     28 #	INSTALL_DONE is set, it will not do a `make install.'
     29 #    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
     30 #	Called by distribution.
     31 #    snapshot: calls distribution, above, and then tars up the files
     32 #	into a release(7) format in RELEASEDIR. Any port-dependent
     33 #	stuff for this target is found in etc.${MACHINE}/Makefile.inc.
     34 
     35 # XXX: For NO_SENDMAIL and USE_BIND4
     36 .include <bsd.own.mk>
     37 
     38 TZDIR=		/usr/share/zoneinfo
     39 LOCALTIME?=	US/Pacific
     40 
     41 # setting NOOBJ prevents "make obj" from doing anything;
     42 # an objdir would break the installation stuff below
     43 NOOBJ=	oobj
     44 
     45 # MD Makefile.inc may append MD targets to BIN[123].  Make sure all
     46 # are empty, to preserve the old semantics of setting them below with "=".
     47 BIN1=	
     48 BIN2=
     49 BIN3=
     50 
     51 .if exists(etc.${MACHINE}/Makefile.inc)
     52 .include "etc.${MACHINE}/Makefile.inc"
     53 .endif
     54 
     55 # Use multiple jobs for kernel builds, if NBUILDJOBS set.
     56 # (Taken from src/Makefile.)
     57 .if defined(NBUILDJOBS)
     58 _J= -j${NBUILDJOBS}
     59 .endif
     60 
     61 # -rw-r--r--
     62 BINOWN= root
     63 BINGRP= wheel
     64 BIN1+=	aliases bootptab changelist csh.cshrc csh.login \
     65 	csh.logout daily daily.conf dm.conf floppytab ftpchroot \
     66 	ftpusers ftpwelcome gettytab group hosts hosts.lpd \
     67 	inetd.conf ld.so.conf lkm.conf mailer.conf man.conf \
     68 	monthly monthly.conf mrouted.conf netstart networks \
     69 	newsyslog.conf nsswitch.conf phones printcap profile protocols \
     70 	rbootd.conf rc rc.conf rc.lkm rc.local rc.subr \
     71 	rc.shutdown remote rpc security security.conf services \
     72 	shells syslog.conf weekly weekly.conf etc.${MACHINE}/ttys \
     73 	etc.${MACHINE}/disktab
     74 
     75 # -rw-rw-r--
     76 BIN2+=	motd
     77 
     78 # -rw-------
     79 BIN3+=	hosts.equiv
     80 
     81 NAMEDB=	127 root.cache
     82 .ifdef USE_BIND4
     83 NAMEDB+=	named.boot
     84 .else
     85 NAMEDB+=	named.conf
     86 .endif
     87 PCS=	pcs750.bin
     88 
     89 all clean cleandir depend distclean etc includes install lint:
     90 
     91 .ifndef DESTDIR
     92 distribution distrib-dirs snapshot:
     93 	@echo setenv DESTDIR before doing that!
     94 	@false
     95 .else
     96 distribution: distrib-dirs
     97 .if !defined(INSTALL_DONE)
     98 	(cd ..; ${MAKE} includes)
     99 	(cd ..; ${MAKE} install)
    100 .endif
    101 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
    102 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
    103 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
    104 	${INSTALL} -c -o root -g wheel -m 600 crontab \
    105 	    ${DESTDIR}/var/cron/tabs/root
    106 	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
    107 	pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd
    108 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
    109 	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
    110 	${INSTALL} -c -o root -g wheel -m 600 minfree \
    111 	    ${DESTDIR}/var/crash
    112 	(cd root; \
    113 		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
    114 		    ${DESTDIR}/root/.cshrc; \
    115 		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
    116 		    ${DESTDIR}/root/.klogin; \
    117 		${INSTALL} -c -o root -g wheel -m 644 dot.login \
    118 		    ${DESTDIR}/root/.login; \
    119 		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
    120 		    ${DESTDIR}/root/.profile; \
    121 		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
    122 		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
    123 		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
    124 	(cd mtree; ${MAKE} install)
    125 	(cd namedb; \
    126 		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \
    127 		    ${DESTDIR}/etc/namedb)
    128 	/bin/rm -f ${DESTDIR}/etc/localtime
    129 	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
    130 	/bin/rm -f ${DESTDIR}/etc/rmt
    131 	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
    132 	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
    133 		${DESTDIR}/etc/dumpdates
    134 	${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \
    135 		${DESTDIR}/etc/skeykeys
    136 	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
    137 		${DESTDIR}/var/cron/log
    138 	${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
    139 		${DESTDIR}/var/db/locate.database
    140 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    141 		${DESTDIR}/var/log/authlog
    142 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
    143 		${DESTDIR}/var/log/lastlog
    144 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
    145 		${DESTDIR}/var/log/lpd-errs
    146 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    147 		${DESTDIR}/var/log/maillog
    148 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    149 		${DESTDIR}/var/log/messages
    150 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    151 		${DESTDIR}/var/log/secure
    152 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    153 		${DESTDIR}/var/log/wtmp
    154 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    155 		${DESTDIR}/var/log/xferlog
    156 	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
    157 		${DESTDIR}/var/msgs/bounds
    158 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
    159 		${DESTDIR}/var/run/utmp
    160 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    161 		${DESTDIR}/var/games/atc_scores
    162 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    163 		${DESTDIR}/var/games/battlestar.log
    164 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    165 		${DESTDIR}/var/games/cfscores
    166 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    167 		${DESTDIR}/var/games/criblog
    168 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    169 		${DESTDIR}/var/games/robots_roll
    170 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    171 		${DESTDIR}/var/games/rogue.scores
    172 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    173 		${DESTDIR}/var/games/saillog
    174 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    175 		${DESTDIR}/var/games/snakerawscores
    176 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    177 		${DESTDIR}/var/games/snake.log
    178 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    179 		${DESTDIR}/var/games/tetris.scores
    180 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    181 		${DESTDIR}/var/games/larn/llog12.0
    182 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    183 		${DESTDIR}/var/games/larn/lscore12.0
    184 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    185 		${DESTDIR}/var/games/larn/playerids
    186 	(cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
    187 	    fstab.* ${DESTDIR}/etc)
    188 	(cd ${DESTDIR}/dev; ./MAKEDEV all)
    189 	(cd ../usr.bin/mail; ${MAKE} distribution)
    190 .ifndef NO_SENDMAIL
    191 	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
    192 .endif
    193 
    194 
    195 distrib-dirs:
    196 	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
    197 	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
    198 	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
    199 
    200 .if !defined(RELEASEDIR)
    201 snapshot snap_pre:
    202 	@echo setenv RELEASEDIR before doing that!
    203 	@false
    204 .else
    205 snapshot: distribution snap_pre snap_md snap_kern 
    206 	sh ../distrib/sets/maketars -s ../distrib/sets \
    207 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
    208 	(cd ${RELEASEDIR}/binary/sets && \
    209 		cksum -o 1 *.tgz >BSDSUM && \
    210 		cksum *.tgz >CKSUM && \
    211 		cksum -m *.tgz >MD5 && \
    212 		cksum -o 2 *.tgz >SYSVSUM )
    213 	(cd ${RELEASEDIR}/binary/kernel && if [ -r *.gz ]; then \
    214 		cksum -o 1 *.gz >BSDSUM && \
    215 		cksum *.gz >CKSUM && \
    216 		cksum -m *.gz >MD5 && \
    217 		cksum -o 2 *.gz >SYSVSUM \
    218 		; fi )
    219 
    220 snap_pre:
    221 	/bin/rm -rf ${RELEASEDIR}
    222 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
    223 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
    224 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
    225 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/kernel
    226 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/security
    227 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/installation
    228 
    229 # the regular expression does a basename(1) on .CURDIR so that we don't
    230 # have to keep looking up .. at compile time.
    231 KERNSRCDIR?=	${.CURDIR:C/[^\/]+$//}sys
    232 KERNOBJDIR?=	${KERNSRCDIR}/arch/${MACHINE}/compile
    233 KERNCONFDIR?=	${KERNSRCDIR}/arch/${MACHINE}/conf
    234 
    235 # This target builds the GENERIC kernel (which must exist for all
    236 # ports) and puts it in binary/sets/kern.tgz, and also builds any
    237 # kernels specified in EXTRA_KERNELS and puts them in
    238 # binary/kernel/netbsd.${KERN}.gz
    239 #
    240 snap_kern:
    241 	cd ${KERNCONFDIR} && config \
    242 		-b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC
    243 .ifndef BUILD
    244 	cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 
    245 .endif
    246 	cd ${KERNOBJDIR}/GENERIC &&	\
    247 		${MAKE} depend && ${MAKE} ${_J} &&	\
    248 		tar cf - netbsd |\
    249 		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
    250 .for kernel in ${EXTRA_KERNELS}
    251 	cd ${KERNCONFDIR} && config \
    252 		-b ${KERNOBJDIR}/${kernel} -s ${KERNSRCDIR} ${kernel}
    253 .ifndef BUILD
    254 	cd ${KERNOBJDIR}/${kernel} && ${MAKE} clean 
    255 .endif
    256 	cd ${KERNOBJDIR}/${kernel} &&	\
    257 		${MAKE} depend && ${MAKE} ${_J} &&	\
    258 		tar cf - netbsd |\
    259 		gzip -c -9 > ${RELEASEDIR}/binary/kernel/netbsd.${kernel}.gz
    260 .endfor # EXTRA_KERNELS
    261 	
    262 .endif # RELEASEDIR check
    263 
    264 snap_md:
    265 # nothing here -- look in the machine-dependent Makefile.inc
    266 
    267 .endif	# DESTDIR check
    268 
    269 .include <bsd.prog.mk>
    270