Home | History | Annotate | Line # | Download | only in etc
Makefile revision 1.112.2.6
      1 #	$NetBSD: Makefile,v 1.112.2.6 1999/11/27 16:16:31 he 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 # Directories to build in ${RELEASEDIR}.   MD Makefile.inc files can
     55 # add to this.
     56 # NOTE: Parent directories must be listed before subdirectories.
     57 INSTALLATION_DIRS= \
     58 	binary binary/sets binary/kernel binary/security installation
     59 
     60 .if exists(etc.${MACHINE}/Makefile.inc)
     61 .include "etc.${MACHINE}/Makefile.inc"
     62 .endif
     63 
     64 # Use multiple jobs for kernel builds, if NBUILDJOBS set.
     65 # (Taken from src/Makefile.)
     66 .if defined(NBUILDJOBS)
     67 _J= -j${NBUILDJOBS}
     68 .endif
     69 
     70 # -rw-r--r--
     71 BINOWN= root
     72 BINGRP= wheel
     73 BIN1+=	bootptab changelist csh.cshrc csh.login \
     74 	csh.logout daily daily.conf dm.conf floppytab ftpchroot \
     75 	ftpusers ftpwelcome gettytab group hosts hosts.lpd \
     76 	inetd.conf lkm.conf mailer.conf man.conf \
     77 	monthly monthly.conf mrouted.conf netstart networks \
     78 	newsyslog.conf nsswitch.conf phones printcap profile protocols \
     79 	rbootd.conf rc rc.conf rc.lkm rc.local rc.subr \
     80 	rc.shutdown rc.wscons remote rpc security security.conf services \
     81 	shells syslog.conf weekly weekly.conf wscons.conf \
     82 	etc.${MACHINE}/ttys etc.${MACHINE}/disktab
     83 
     84 .if	(${MACHINE_ARCH} == "i386") || \
     85 	(${MACHINE_ARCH} == "m68k") || \
     86 	(${MACHINE_ARCH} == "ns32k") || \
     87 	(${MACHINE_ARCH} == "sparc") || \
     88 	(${MACHINE_ARCH} == "vax") || \
     89 	(${MACHINE_ARCH} == "arm32")
     90 BIN1+=	ld.so.conf
     91 .endif
     92 
     93 # -rw-rw-r--
     94 BIN2+=	motd
     95 
     96 # -rw-------
     97 BIN3+=	hosts.equiv
     98 
     99 NAMEDB=	127 root.cache
    100 .ifdef USE_BIND4
    101 NAMEDB+=	named.boot
    102 .else
    103 NAMEDB+=	named.conf
    104 .endif
    105 PCS=	pcs750.bin
    106 
    107 all clean cleandir depend distclean etc includes install lint:
    108 
    109 .ifndef DESTDIR
    110 distribution distrib-dirs release snapshot:
    111 	@echo setenv DESTDIR before doing that!
    112 	@false
    113 .else
    114 distribution: distrib-dirs
    115 .if !defined(INSTALL_DONE)
    116 	(cd ..; ${MAKE} _DISTRIB= includes)
    117 	(cd ..; ${MAKE} _DISTRIB= install)
    118 .endif
    119 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
    120 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
    121 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
    122 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 aliases ${DESTDIR}/etc
    123 	${INSTALL} -c -o root -g wheel -m 600 crontab \
    124 	    ${DESTDIR}/var/cron/tabs/root
    125 	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
    126 	pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd
    127 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
    128 	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
    129 	${INSTALL} -c -o root -g wheel -m 600 minfree \
    130 	    ${DESTDIR}/var/crash
    131 	(cd root; \
    132 		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
    133 		    ${DESTDIR}/root/.cshrc; \
    134 		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
    135 		    ${DESTDIR}/root/.klogin; \
    136 		${INSTALL} -c -o root -g wheel -m 644 dot.login \
    137 		    ${DESTDIR}/root/.login; \
    138 		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
    139 		    ${DESTDIR}/root/.profile; \
    140 		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
    141 		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
    142 		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
    143 	(cd mtree; ${MAKE} install)
    144 	(cd namedb; \
    145 		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \
    146 		    ${DESTDIR}/etc/namedb)
    147 	/bin/rm -f ${DESTDIR}/etc/localtime
    148 	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
    149 	/bin/rm -f ${DESTDIR}/etc/rmt
    150 	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
    151 	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
    152 		${DESTDIR}/etc/dumpdates
    153 	${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \
    154 		${DESTDIR}/etc/skeykeys
    155 	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
    156 		${DESTDIR}/var/cron/log
    157 	${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
    158 		${DESTDIR}/var/db/locate.database
    159 	${INSTALL} -c -o uucp -g dialer -m 640 /dev/null \
    160 		${DESTDIR}/var/log/aculog
    161 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    162 		${DESTDIR}/var/log/authlog
    163 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
    164 		${DESTDIR}/var/log/lastlog
    165 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
    166 		${DESTDIR}/var/log/lpd-errs
    167 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    168 		${DESTDIR}/var/log/maillog
    169 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    170 		${DESTDIR}/var/log/messages
    171 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    172 		${DESTDIR}/var/log/secure
    173 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
    174 		${DESTDIR}/var/log/wtmp
    175 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
    176 		${DESTDIR}/var/log/xferlog
    177 	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
    178 		${DESTDIR}/var/msgs/bounds
    179 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
    180 		${DESTDIR}/var/run/utmp
    181 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    182 		${DESTDIR}/var/games/atc_scores
    183 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    184 		${DESTDIR}/var/games/battlestar.log
    185 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    186 		${DESTDIR}/var/games/cfscores
    187 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    188 		${DESTDIR}/var/games/criblog
    189 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    190 		${DESTDIR}/var/games/robots_roll
    191 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    192 		${DESTDIR}/var/games/rogue.scores
    193 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    194 		${DESTDIR}/var/games/saillog
    195 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    196 		${DESTDIR}/var/games/snakerawscores
    197 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    198 		${DESTDIR}/var/games/snake.log
    199 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    200 		${DESTDIR}/var/games/tetris.scores
    201 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    202 		${DESTDIR}/var/games/larn/llog12.0
    203 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    204 		${DESTDIR}/var/games/larn/lscore12.0
    205 	${INSTALL} -c -o games -g games -m 664 /dev/null \
    206 		${DESTDIR}/var/games/larn/playerids
    207 	(cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
    208 	    fstab.* ${DESTDIR}/etc)
    209 	(cd ${DESTDIR}/dev; ./MAKEDEV all)
    210 	(cd ../usr.bin/mail; ${MAKE} distribution)
    211 .ifndef NO_SENDMAIL
    212 	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
    213 	${DESTDIR}/usr/libexec/sendmail/sendmail -C ${DESTDIR}/etc/sendmail.cf -O AliasFile=${DESTDIR}/etc/aliases -bi
    214 .endif
    215 .ifdef BUILD_POSTFIX
    216 	(cd ../usr.sbin/postfix/etc; ${MAKE} distribution)
    217 .endif
    218 
    219 
    220 distrib-dirs:
    221 	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
    222 	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
    223 	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
    224 
    225 .if !defined(RELEASEDIR)
    226 release snapshot snap_pre snap_md_pre snap_md_post:
    227 	@echo setenv RELEASEDIR before doing that!
    228 	@false
    229 .else
    230 release snapshot: distribution snap_pre snap_md_pre snap_kern snap_md_post
    231 	sh ../distrib/sets/maketars -s ../distrib/sets \
    232 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
    233 .if exists(../domestic) && !defined(EXPORTABLE_SYSTEM)
    234 	sh ../distrib/sets/maketars -s ../distrib/sets \
    235 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr
    236 	(cd ${RELEASEDIR}/binary/security && \
    237 		cksum -o 1 *.tgz >BSDSUM && \
    238 		cksum *.tgz >CKSUM && \
    239 		cksum -m *.tgz >MD5 && \
    240 		cksum -o 2 *.tgz >SYSVSUM )
    241 .endif
    242 	(cd ${RELEASEDIR}/binary/sets && \
    243 		cksum -o 1 *.tgz >BSDSUM && \
    244 		cksum *.tgz >CKSUM && \
    245 		cksum -m *.tgz >MD5 && \
    246 		cksum -o 2 *.tgz >SYSVSUM )
    247 .ifdef EXTRA_KERNELS
    248 	(cd ${RELEASEDIR}/binary/kernel && \
    249 		cksum -o 1 *.gz >BSDSUM && \
    250 		cksum *.gz >CKSUM && \
    251 		cksum -m *.gz >MD5 && \
    252 		cksum -o 2 *.gz >SYSVSUM )
    253 .endif
    254 
    255 snap_pre:
    256 	/bin/rm -rf ${RELEASEDIR}
    257 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
    258 .for dir in ${INSTALLATION_DIRS}
    259 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/${dir}
    260 .endfor
    261 
    262 # the regular expression does a basename(1) on .CURDIR so that we don't
    263 # have to keep looking up .. at compile time.
    264 KERNSRCDIR?=	${.CURDIR:C/[^\/]+$//}sys
    265 KERNOBJDIR?=	${KERNSRCDIR}/arch/${MACHINE}/compile
    266 KERNCONFDIR?=	${KERNSRCDIR}/arch/${MACHINE}/conf
    267 
    268 # This target builds the GENERIC kernel (which must exist for all
    269 # ports) and puts it in binary/sets/kern.tgz, and also builds any
    270 # kernels specified in EXTRA_KERNELS. Since NetBSD's kernel build
    271 # system can create more than one kernel from a single configuration
    272 # we figure out how many there are, what they're named, and move them
    273 # to binary/kernel/${KERNEL}.${CONFIGFILE}.gz - most often KERNEL will
    274 # simply be "netbsd". If we don't find the "config" line, assume the
    275 # kernel will be "netbsd" (some config files are simple additions on
    276 # GENERIC, and just include it).
    277 #
    278 GETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
    279 		END{ if (found == 0) print "netbsd"; }'
    280 #
    281 .if !target(snap_kern)
    282 snap_kern:
    283 	cd ${KERNCONFDIR} && config \
    284 		-b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC
    285 .ifndef UPDATE
    286 	cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 
    287 .endif
    288 	cd ${KERNOBJDIR}/GENERIC && ${MAKE} depend && ${MAKE} ${_J}
    289 	cd ${KERNOBJDIR}/GENERIC &&	\
    290 		tar cf - `${GETKERNELAWK} ${KERNCONFDIR}/GENERIC` |\
    291 		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
    292 # XXX use same loop for ${EXTRA_KERNELS} and ${BUILD_KERNELS} but
    293 # XXX only install ${EXTRA_KERNELS} in binary/kernel???
    294 .for configfile in ${EXTRA_KERNELS}
    295 	cd ${KERNCONFDIR} && config \
    296 		-b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile}
    297 .ifndef UPDATE
    298 	cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 
    299 .endif
    300 	cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J}
    301 	cd ${KERNOBJDIR}/${configfile} &&	\
    302 		for kernel in `${GETKERNELAWK} \
    303 			${KERNCONFDIR}/${configfile}` ; {   \
    304 		gzip -c -9 < $${kernel} > \
    305 			${RELEASEDIR}/binary/kernel/$${kernel}.${configfile}.gz ; }
    306 .endfor # EXTRA_KERNELS
    307 .for configfile in ${BUILD_KERNELS}
    308 	cd ${KERNCONFDIR} && config \
    309 		-b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile}
    310 .ifndef UPDATE
    311 	cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 
    312 .endif
    313 	cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J}
    314 .endfor # BUILD_KERNELS
    315 .endif # no target(snap_kern)
    316 
    317 .endif # RELEASEDIR check
    318 
    319 snap_md_pre:
    320 # nothing here -- look in the machine-dependent Makefile.inc
    321 
    322 snap_md_post:
    323 # nothing here -- look in the machine-dependent Makefile.inc
    324 
    325 .endif	# DESTDIR check
    326 
    327 .include <bsd.prog.mk>
    328