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