Home | History | Annotate | Line # | Download | only in etc
Makefile revision 1.105
      1 #	$NetBSD: Makefile,v 1.105 1999/03/05 07:21:44 mycroft 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 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 .if	(${MACHINE_ARCH} == "i386") || \
     78 	(${MACHINE_ARCH} == "m68k") || \
     79 	(${MACHINE_ARCH} == "ns32k") || \
     80 	(${MACHINE_ARCH} == "sparc") || \
     81 	(${MACHINE_ARCH} == "vax") || \
     82 	(${MACHINE_ARCH} == "arm32")
     83 BIN1+=	ld.so.conf
     84 .endif
     85 
     86 # -rw-rw-r--
     87 BIN2+=	motd
     88 
     89 # -rw-------
     90 BIN3+=	hosts.equiv
     91 
     92 NAMEDB=	127 root.cache
     93 .ifdef USE_BIND4
     94 NAMEDB+=	named.boot
     95 .else
     96 NAMEDB+=	named.conf
     97 .endif
     98 PCS=	pcs750.bin
     99 
    100 all clean cleandir depend distclean etc includes install lint:
    101 
    102 .ifndef DESTDIR
    103 distribution distrib-dirs snapshot:
    104 	@echo setenv DESTDIR before doing that!
    105 	@false
    106 .else
    107 distribution: distrib-dirs
    108 .if !defined(INSTALL_DONE)
    109 	(cd ..; ${MAKE} includes)
    110 	(cd ..; ${MAKE} install)
    111 .endif
    112 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
    113 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
    114 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
    115 	${INSTALL} -c -o root -g wheel -m 600 crontab \
    116 	    ${DESTDIR}/var/cron/tabs/root
    117 	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
    118 	pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd
    119 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
    120 	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
    121 	${INSTALL} -c -o root -g wheel -m 600 minfree \
    122 	    ${DESTDIR}/var/crash
    123 	(cd root; \
    124 		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
    125 		    ${DESTDIR}/root/.cshrc; \
    126 		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
    127 		    ${DESTDIR}/root/.klogin; \
    128 		${INSTALL} -c -o root -g wheel -m 644 dot.login \
    129 		    ${DESTDIR}/root/.login; \
    130 		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
    131 		    ${DESTDIR}/root/.profile; \
    132 		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
    133 		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
    134 		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
    135 	(cd mtree; ${MAKE} install)
    136 	(cd namedb; \
    137 		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \
    138 		    ${DESTDIR}/etc/namedb)
    139 	/bin/rm -f ${DESTDIR}/etc/localtime
    140 	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
    141 	/bin/rm -f ${DESTDIR}/etc/rmt
    142 	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
    143 	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
    144 		${DESTDIR}/etc/dumpdates
    145 	${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \
    146 		${DESTDIR}/etc/skeykeys
    147 	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
    148 		${DESTDIR}/var/cron/log
    149 	${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
    150 		${DESTDIR}/var/db/locate.database
    151 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    152 		${DESTDIR}/var/log/authlog
    153 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
    154 		${DESTDIR}/var/log/lastlog
    155 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
    156 		${DESTDIR}/var/log/lpd-errs
    157 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    158 		${DESTDIR}/var/log/maillog
    159 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    160 		${DESTDIR}/var/log/messages
    161 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    162 		${DESTDIR}/var/log/secure
    163 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    164 		${DESTDIR}/var/log/wtmp
    165 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    166 		${DESTDIR}/var/log/xferlog
    167 	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
    168 		${DESTDIR}/var/msgs/bounds
    169 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
    170 		${DESTDIR}/var/run/utmp
    171 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    172 		${DESTDIR}/var/games/atc_scores
    173 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    174 		${DESTDIR}/var/games/battlestar.log
    175 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    176 		${DESTDIR}/var/games/cfscores
    177 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    178 		${DESTDIR}/var/games/criblog
    179 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    180 		${DESTDIR}/var/games/robots_roll
    181 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    182 		${DESTDIR}/var/games/rogue.scores
    183 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    184 		${DESTDIR}/var/games/saillog
    185 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    186 		${DESTDIR}/var/games/snakerawscores
    187 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    188 		${DESTDIR}/var/games/snake.log
    189 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    190 		${DESTDIR}/var/games/tetris.scores
    191 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    192 		${DESTDIR}/var/games/larn/llog12.0
    193 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    194 		${DESTDIR}/var/games/larn/lscore12.0
    195 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    196 		${DESTDIR}/var/games/larn/playerids
    197 	(cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
    198 	    fstab.* ${DESTDIR}/etc)
    199 	(cd ${DESTDIR}/dev; ./MAKEDEV all)
    200 	(cd ../usr.bin/mail; ${MAKE} distribution)
    201 .ifndef NO_SENDMAIL
    202 	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
    203 .endif
    204 
    205 
    206 distrib-dirs:
    207 	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
    208 	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
    209 	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
    210 
    211 .if !defined(RELEASEDIR)
    212 snapshot snap_pre:
    213 	@echo setenv RELEASEDIR before doing that!
    214 	@false
    215 .else
    216 release snapshot: distribution snap_pre snap_md snap_kern 
    217 	sh ../distrib/sets/maketars -s ../distrib/sets \
    218 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
    219 .if exists(../domestic) && !defined(EXPORTABLE_SYSTEM)
    220 	sh ../distrib/sets/maketars -s ../distrib/sets \
    221 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr
    222 	(cd ${RELEASEDIR}/binary/security && \
    223 		cksum -o 1 *.tgz >BSDSUM && \
    224 		cksum *.tgz >CKSUM && \
    225 		cksum -m *.tgz >MD5 && \
    226 		cksum -o 2 *.tgz >SYSVSUM )
    227 .endif
    228 	(cd ${RELEASEDIR}/binary/sets && \
    229 		cksum -o 1 *.tgz >BSDSUM && \
    230 		cksum *.tgz >CKSUM && \
    231 		cksum -m *.tgz >MD5 && \
    232 		cksum -o 2 *.tgz >SYSVSUM )
    233 .ifdef EXTRA_KERNELS
    234 	(cd ${RELEASEDIR}/binary/kernel && \
    235 		cksum -o 1 *.gz >BSDSUM && \
    236 		cksum *.gz >CKSUM && \
    237 		cksum -m *.gz >MD5 && \
    238 		cksum -o 2 *.gz >SYSVSUM )
    239 .endif
    240 
    241 snap_pre:
    242 	/bin/rm -rf ${RELEASEDIR}
    243 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
    244 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
    245 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
    246 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/kernel
    247 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/security
    248 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/installation
    249 
    250 # the regular expression does a basename(1) on .CURDIR so that we don't
    251 # have to keep looking up .. at compile time.
    252 KERNSRCDIR?=	${.CURDIR:C/[^\/]+$//}sys
    253 KERNOBJDIR?=	${KERNSRCDIR}/arch/${MACHINE}/compile
    254 KERNCONFDIR?=	${KERNSRCDIR}/arch/${MACHINE}/conf
    255 
    256 # This target builds the GENERIC kernel (which must exist for all
    257 # ports) and puts it in binary/sets/kern.tgz, and also builds any
    258 # kernels specified in EXTRA_KERNELS and puts them in
    259 # binary/kernel/netbsd.${KERN}.gz
    260 #
    261 snap_kern:
    262 	cd ${KERNCONFDIR} && config \
    263 		-b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC
    264 .ifndef UPDATE
    265 	cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 
    266 .endif
    267 	cd ${KERNOBJDIR}/GENERIC &&	\
    268 		${MAKE} depend && ${MAKE} ${_J} &&	\
    269 		tar cf - netbsd |\
    270 		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
    271 .for kernel in ${EXTRA_KERNELS}
    272 	cd ${KERNCONFDIR} && config \
    273 		-b ${KERNOBJDIR}/${kernel} -s ${KERNSRCDIR} ${kernel}
    274 .ifndef UPDATE
    275 	cd ${KERNOBJDIR}/${kernel} && ${MAKE} clean 
    276 .endif
    277 	cd ${KERNOBJDIR}/${kernel} &&	\
    278 		${MAKE} depend && ${MAKE} ${_J} &&	\
    279 		gzip -c -9 < netbsd > \
    280 			${RELEASEDIR}/binary/kernel/netbsd.${kernel}.gz
    281 .endfor # EXTRA_KERNELS
    282 	
    283 .endif # RELEASEDIR check
    284 
    285 snap_md:
    286 # nothing here -- look in the machine-dependent Makefile.inc
    287 
    288 .endif	# DESTDIR check
    289 
    290 .include <bsd.prog.mk>
    291