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