Fix gcc80 -Wbool-operation warnings in fortune(6) and hack(6).
[dragonfly.git] / etc / Makefile
blob916b3d22f3b1bdeaa7103f88549145bcf946bf1e
1 # from: @(#)Makefile 5.11 (Berkeley) 5/21/91
2 # $FreeBSD: src/etc/Makefile,v 1.219.2.38 2003/03/04 09:49:00 ru Exp $
4 SUBDIR= sendmail
6 # Files that should be installed read-only (444)
8 BINUPDATE= devd.conf fbtab gettytab network.subr \
9 pf.os \
10 protocols \
11 rc rc.firewall6 \
12 rc.sendmail rc.shutdown \
13 rc.subr rpc \
14 etc.${MACHINE_ARCH}/disktab
15 .if defined(BINARY_UPGRADE) # location of these depends on upgrade method
16 BINUPDATE+=mail.rc locate.rc
17 .else
18 BINUPDATE+=${.CURDIR}/../usr.bin/mail/misc/mail.rc \
19 ${.CURDIR}/../usr.bin/locate/locate/locate.rc
20 .endif
22 # Initial distribution files are installed read-write (644)
24 BIN1= auth.conf auto_master \
25 crontab csh.cshrc csh.login csh.logout \
26 devtab dhclient.conf dntpd.conf \
27 ftpusers group \
28 hosts hosts.allow hosts.equiv hosts.lpd \
29 inetd.conf login.access login.conf \
30 motd modems netconfig networks newsyslog.conf \
31 nscd.conf pf.conf phones printcap profile \
32 regdomain.xml remote sensorsd.conf services \
33 shells sysctl.conf syslog.conf \
34 wpa_supplicant.conf \
35 etc.${MACHINE_ARCH}/ttys
36 .if defined(BINARY_UPGRADE) # location of these depends on upgrade method
37 BIN1+= manpath.config
38 .else
39 BIN1+= ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
40 .endif
42 DIRS+= lib/libssh usr.bin/openssl usr.bin/ssh usr.sbin/sshd
44 # Files that should be installed read-only-executable (555) root:wheel
46 BIN2= pccard_ether rc.firewall rc.suspend rc.resume
48 DEFAULTS= compilers.conf devfs.conf make.conf mkinitrd.conf periodic.conf \
49 pfi.conf rc.conf uuids
51 MTREE= BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
52 BSD.var.dist
54 PPPCNF= ppp.conf
56 ETCMAIL=aliases mailer.conf access.sample virtusertable.sample \
57 mailertable.sample
59 # Use this directory as the source for new configuration files when upgrading
60 UPGRADE_SRCDIR?=${.CURDIR}
62 # Include file which contains obsolete files
63 .if exists(${DESTDIR}/etc/upgrade/Makefile_upgrade.inc)
64 .include "${DESTDIR}/etc/upgrade/Makefile_upgrade.inc"
65 .endif
67 remove-obsolete-files:
68 @if [ -z "${TO_REMOVE}" ]; then \
69 echo "Please do a 'make installworld' first."; \
70 echo "See build(7) for further information."; \
71 /usr/bin/false; \
72 fi;
73 @echo "===> Remove now obsolete files"
74 @for item in ${TO_REMOVE}; do \
75 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
76 echo "${DESTDIR}$${item}"; \
77 chflags -Rf noschg "${DESTDIR}$${item}"; \
78 rm -rf "${DESTDIR}$${item}"; \
79 fi; \
80 done;
81 @for item in ${TO_REMOVE:M*/man/man[1-9]/*:C@/man/man([1-9])/@/man/cat\1/@g}; do \
82 if [ -e ${DESTDIR}$${item} ]; then \
83 echo "${DESTDIR}$${item}"; \
84 chflags -Rf noschg "${DESTDIR}$${item}"; \
85 rm -rf "${DESTDIR}$${item}"; \
86 fi; \
87 done
89 remove-deprecated-files:
90 .if defined(REMOVE_DEPRECATED)
91 @echo "===> Remove now deprecated files"
92 @for item in ${TO_REMOVE_LATE}; do \
93 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
94 echo "${DESTDIR}$${item}"; \
95 chflags -Rf noschg "${DESTDIR}$${item}"; \
96 rm -rf "${DESTDIR}$${item}"; \
97 fi; \
98 done;
99 .else
100 @echo "===> Checking for deprecated files"
101 @count=0; for item in ${TO_REMOVE_LATE}; do \
102 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
103 echo "${DESTDIR}$${item} is deprecated"; \
104 count=`expr $$count + 1`; \
105 fi; \
106 done; \
107 if [ "$$count" -gt 0 ]; then \
108 echo "==================================================================" ; \
109 echo "= You have $$count now deprecated files." ; \
110 echo "= Once you are sure that none of your third party (ports or local)" ; \
111 echo "= software are still using them, rerun with REMOVE_DEPRECATED set." ; \
112 echo "==================================================================" ; \
114 .endif
116 preupgrade:
117 (pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
118 pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
119 -c "Mail user" \
120 -d /nonexistent -s /sbin/nologin
121 (pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
122 pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
123 -c "pflogd privsep user" \
124 -d /var/empty -s /sbin/nologin
125 (pw -V ${DESTDIR}/etc usershow _sdpd -q > /dev/null) || \
126 pw -V ${DESTDIR}/etc useradd _sdpd -u 70 \
127 -c "sdpd privsep user" \
128 -d /var/empty -s /sbin/nologin
129 (pw -V ${DESTDIR}/etc usershow _dhcp -q > /dev/null) || \
130 pw -V ${DESTDIR}/etc useradd _dhcp -u 77 \
131 -c "DHCP programs" \
132 -d /var/empty -s /sbin/nologin
133 (pw -V ${DESTDIR}/etc groupshow video -q > /dev/null) || \
134 pw -V ${DESTDIR}/etc groupadd video -g 44
135 (pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
136 pw -V ${DESTDIR}/etc groupadd authpf -g 63
137 (pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
138 pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
139 (pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
140 pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
141 (pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
142 pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
144 upgrade_check:
145 @if [ -n "`grep '^sendmail.*/usr/libexec/sendmail/sendmail' ${DESTDIR}/etc/mail/mailer.conf`" ]; then \
146 echo "==================================================================" ; \
147 echo "= sendmail is being removed from the base system." ; \
148 echo "= /etc/mail/mailer.conf is still configured to use sendmail." ; \
149 echo "= See http://www.dragonflybsd.com/docs/docs/newhandbook/mta/" ; \
150 echo "= Quick: cp /usr/src/libexec/dma/mailer-conf/mailer.conf.dma " ; \
151 echo "= ${DESTDIR}/etc/mail/mailer.conf ; make upgrade" ; \
152 echo "==================================================================" ; \
153 /usr/bin/false ; \
156 upgrade_base: upgrade_check preupgrade remove-obsolete-files
157 # files that should be dirs (not possible with Makefile_upgrade.inc)
158 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin
159 [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
160 .endfor
161 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
162 cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
163 .endif
164 cd ${UPGRADE_SRCDIR}; \
165 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
166 ${BINUPDATE} ${DESTDIR}/etc; \
167 cap_mkdb ${DESTDIR}/etc/login.conf; \
168 for f in ${BIN1}; do \
169 [ -e "${DESTDIR}/etc/$${f##*/}" ] || \
170 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
171 $$f ${DESTDIR}/etc; \
172 done; \
173 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
174 ${BIN2} ${DESTDIR}/etc;
175 cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
176 ${DEFAULTS} ${DESTDIR}/etc/defaults
177 cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
178 mkdir -p ${DESTDIR}/etc/rc.d
179 cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install
180 cd ${UPGRADE_SRCDIR}/devd; ${MAKE} install
181 mkdir -p ${DESTDIR}/etc/autofs
182 cd ${UPGRADE_SRCDIR}/autofs; ${MAKE} install
183 # "../share/termcap/make etc-termcap" expanded inline here:
184 ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
185 # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
186 ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
187 cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
188 ${MTREE} ${DESTDIR}/etc/mtree
189 cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
190 cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
191 .if !exists(${DESTDIR}/etc/pam.d)
192 mkdir -p ${DESTDIR}/etc/pam.d
193 cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
194 sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
195 .else
196 .for pamconf in README convert.sh atrun cron passwd rsh su system
197 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
198 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
199 .endif
200 .endfor
201 .endif
202 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
203 cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
204 COPYRIGHT ${DESTDIR}/
205 .endif
206 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
207 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
208 rm -f ${DESTDIR}/usr/include/sys/ata.h
209 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
210 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
211 ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
212 .if exists(${DESTDIR}/usr/lib/gcc2)
213 ldconfig -m ${DESTDIR}/usr/lib/gcc2
214 .endif
215 .for lib in ${COMPAT_LIBS:M*.so.*}
216 .if exists(${DESTDIR}/usr/lib/${lib})
217 chflags noschg ${DESTDIR}/usr/lib/${lib}
218 rm -f ${DESTDIR}/usr/lib/${lib}
219 .endif
220 .endfor
221 cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc obj
222 cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc install
223 .if exists(${DESTDIR}/boot)
224 .if exists(${DESTDIR}/kernel)
225 chflags noschg ${DESTDIR}/kernel
226 mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
227 chflags schg ${DESTDIR}/boot/kernel
228 .endif
229 .if exists(${DESTDIR}/modules)
230 mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
231 rm -rf ${DESTDIR}/boot/modules/modules
232 .endif
233 .if exists(${DESTDIR}/kernel.old)
234 mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
235 .endif
236 .if exists(${DESTDIR}/modules.old)
237 mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
238 rm -rf ${DESTDIR}/boot/modules.old/modules.old
239 .endif
240 .endif
241 .if exists(${DESTDIR}/etc/settings.conf)
242 mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
243 .endif
244 for ext in a so.0; do \
245 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
246 dest=$$(readlink "$$f"); \
247 case "$$dest" in \
248 libthread_xu.*|libc_r.*) \
249 ln -fs thread/$$dest $$f ;; \
250 esac; \
251 done
252 ldconfig -R
253 mkdir -p ${DESTDIR}/dev
254 mkdir -p ${DESTDIR}/var/run/sem
255 chmod 1777 ${DESTDIR}/var/run/sem
257 # The existence of cleartext_pass_ok means pam config files are out of date.
258 @set - `fgrep cleartext_pass_ok ${DESTDIR}/etc/pam.d/*`; \
259 if [ $$# -gt 0 ] ; \
260 then \
261 echo "It appears your PAM configuration files need to be updated"; \
262 echo "This can be done by manually editing the files or:"; \
263 echo " cd ${UPGRADE_SRCDIR}/pam.d"; \
264 echo " make install"; \
267 upgrade_etc: upgrade_base remove-deprecated-files
268 @echo "Upgrade was successful"
270 distribution:
271 cd ${.CURDIR}; \
272 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
273 ${BINUPDATE} ${DESTDIR}/etc; \
274 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
275 ${BIN1} ${DESTDIR}/etc; \
276 cap_mkdb ${DESTDIR}/etc/login.conf; \
277 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
278 ${BIN2} ${DESTDIR}/etc; \
279 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
280 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
281 pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
282 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
283 ${DEFAULTS} ${DESTDIR}/etc/defaults
284 cd ${.CURDIR}/pam.d; ${MAKE} install
285 cd ${.CURDIR}/bluetooth; ${MAKE} install
286 cd ${.CURDIR}/periodic; ${MAKE} install
287 cd ${.CURDIR}/rc.d; ${MAKE} install
288 cd ${.CURDIR}/devd; ${MAKE} install
289 cd ${.CURDIR}/autofs; ${MAKE} install
290 cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
291 cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
292 cd ${.CURDIR}; \
293 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
294 Makefile.usr ${DESTDIR}/usr/Makefile
295 .for dir in ${DIRS}
296 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
297 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
298 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
299 .endif
300 .endfor
301 mkdir -p ${DESTDIR}/dev
302 cd ${.CURDIR}/root; \
303 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
304 dot.cshrc ${DESTDIR}/root/.cshrc; \
305 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
306 dot.klogin ${DESTDIR}/root/.klogin; \
307 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
308 dot.login ${DESTDIR}/root/.login; \
309 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
310 dot.profile ${DESTDIR}/root/.profile; \
311 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
312 cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
313 ${MTREE} ${DESTDIR}/etc/mtree
314 cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
315 ${PPPCNF} ${DESTDIR}/etc/ppp
316 cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
317 ${ETCMAIL} ${DESTDIR}/etc/mail
318 @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
319 ! -f ${DESTDIR}/etc/aliases ]; then \
320 set -x; \
321 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
323 ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
324 ${DESTDIR}/etc/dumpdates
325 ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
326 ${DESTDIR}/var/db/locate.database
327 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
328 ${DESTDIR}/var/log/auth.log
329 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
330 ${DESTDIR}/var/log/cron
331 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
332 ${DESTDIR}/var/log/daemon
333 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
334 ${DESTDIR}/var/log/lpd-errs
335 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
336 ${DESTDIR}/var/log/maillog
337 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
338 ${DESTDIR}/var/log/lastlog
339 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
340 ${DESTDIR}/var/log/lastlogx
341 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
342 ${DESTDIR}/var/log/messages
343 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
344 ${DESTDIR}/var/log/security
345 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
346 ${DESTDIR}/var/log/slip.log
347 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
348 ${DESTDIR}/var/log/ppp.log
349 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
350 ${DESTDIR}/var/log/wtmp
351 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
352 ${DESTDIR}/var/log/wtmpx
353 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
354 ${DESTDIR}/var/run/utmp
355 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
356 ${DESTDIR}/var/run/utmpx
357 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
358 ${DESTDIR}/var/crash
359 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
360 COPYRIGHT ${DESTDIR}/
361 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
362 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
363 rm -f ${DESTDIR}/usr/include/sys/ata.h
364 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
365 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
366 ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
367 .if !defined(NOMAN)
368 cd ${.CURDIR}/../share/man; ${MAKE} makedb
369 .endif
373 distrib-dirs:
374 mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
375 mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
376 mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
377 mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
378 -p ${DESTDIR}/usr/include
379 -chflags xlink ${DESTDIR}/* ${DESTDIR}/usr/* ${DESTDIR}/var/* \
380 ${DESTDIR}/home/*
381 cd ${DESTDIR}/; test -e sys || (rm -f sys; ${LN} -s usr/src/sys sys)
382 .if !defined(NO_SHARE)
383 cd ${DESTDIR}/usr/share/nls; \
384 rm -rf "POSIX"; \
385 rm -rf "en_US.US-ASCII"; \
386 ${LN} -s "C" "POSIX"; \
387 ${LN} -s "C" "en_US.US-ASCII"
388 .endif
390 etc-examples:
391 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
392 ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf opieaccess \
393 ${DESTDIR}/usr/share/examples/etc
394 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
395 ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
397 .include <bsd.prog.mk>