Merge branch 'vendor/OPENSSL'
[dragonfly.git] / etc / Makefile
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 $
3
4 SUBDIR= sendmail
5
6 # Files that should be installed read-only (444)
7 #
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
21
22 # Initial distribution files are installed read-write (644)
23 #
24 BIN1=   amd.map auth.conf \
25         crontab csh.cshrc csh.login csh.logout \
26         devtab dhclient.conf dm.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
41
42 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
43 .if !defined(NO_OPENSSH)
44 DIRS+=  secure/lib/libssh \
45         secure/usr.bin/ssh \
46         secure/usr.sbin/sshd
47 .endif
48 DIRS+=  secure/usr.bin/openssl
49 .endif
50
51 # Files that should be installed read-only-executable (555) root:wheel
52 #
53 BIN2=   pccard_ether rc.firewall rc.suspend rc.resume
54
55 DEFAULTS= compilers.conf devfs.conf make.conf mkinitrd.conf periodic.conf \
56           pfi.conf rc.conf uuids
57
58 MTREE=  BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
59         BSD.var.dist
60
61 PPPCNF= ppp.conf
62
63 ETCMAIL=aliases mailer.conf access.sample virtusertable.sample \
64         mailertable.sample
65
66 # Use this directory as the source for new configuration files when upgrading
67 UPGRADE_SRCDIR?=${.CURDIR}
68
69 # Include file which contains obsolete files
70 .if exists(${DESTDIR}/etc/upgrade/Makefile_upgrade.inc)
71 .include "${DESTDIR}/etc/upgrade/Makefile_upgrade.inc"
72 .endif
73
74 remove-obsolete-files:
75         @if [ -z "${TO_REMOVE}" ]; then \
76                 echo "Please do a 'make installworld' first."; \
77                 echo "See build(7) for further information."; \
78                 /usr/bin/false; \
79         fi;
80         @echo "===> Remove now obsolete files"
81         @for item in ${TO_REMOVE}; do \
82                 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
83                         echo "${DESTDIR}$${item}"; \
84                         chflags -Rf noschg "${DESTDIR}$${item}"; \
85                         rm -rf "${DESTDIR}$${item}"; \
86                 fi; \
87         done;
88         @for item in ${TO_REMOVE:M*/man/man[1-9]/*:C@/man/man([1-9])/@/man/cat\1/@g}; do \
89                 if [ -e ${DESTDIR}$${item} ]; then \
90                         echo "${DESTDIR}$${item}"; \
91                         chflags -Rf noschg "${DESTDIR}$${item}"; \
92                         rm -rf "${DESTDIR}$${item}"; \
93                 fi; \
94         done
95
96 preupgrade:
97         (pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
98                 pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
99                    -c "Mail user" \
100                    -d /nonexistent -s /sbin/nologin
101         (pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
102                 pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
103                    -c "pflogd privsep user" \
104                    -d /var/empty -s /sbin/nologin
105         (pw -V ${DESTDIR}/etc usershow _sdpd -q > /dev/null) || \
106                 pw -V ${DESTDIR}/etc useradd _sdpd -u 70 \
107                    -c "sdpd privsep user" \
108                    -d /var/empty -s /sbin/nologin
109         (pw -V ${DESTDIR}/etc usershow _dhcp -q > /dev/null) || \
110                 pw -V ${DESTDIR}/etc useradd _dhcp -u 77 \
111                    -c "DHCP programs" \
112                    -d /var/empty -s /sbin/nologin
113         (pw -V ${DESTDIR}/etc groupshow video -q > /dev/null) || \
114                 pw -V ${DESTDIR}/etc groupadd video -g 44
115         (pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
116                 pw -V ${DESTDIR}/etc groupadd authpf -g 63
117         (pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
118                 pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
119         (pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
120                 pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
121         (pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
122                 pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
123
124 upgrade_check:
125         @if [ -n "`grep '^sendmail.*/usr/libexec/sendmail/sendmail' ${DESTDIR}/etc/mail/mailer.conf`" ]; then \
126                 echo "==================================================================" ; \
127                 echo "=  sendmail is being removed from the base system." ; \
128                 echo "=  /etc/mail/mailer.conf is still configured to use sendmail." ; \
129                 echo "=  See http://www.dragonflybsd.com/docs/docs/newhandbook/mta/" ; \
130                 echo "=  Quick: cp /usr/src/libexec/dma/mailer-conf/mailer.conf.dma " ; \
131                 echo "=            ${DESTDIR}/etc/mail/mailer.conf ; make upgrade" ; \
132                 echo "==================================================================" ; \
133                 /usr/bin/false ; \
134         fi
135
136 upgrade_etc:    upgrade_check preupgrade remove-obsolete-files
137         # files that should be dirs (not possible with Makefile_upgrade.inc)
138 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin
139         [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
140 .endfor
141 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
142         cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
143 .endif
144         cd ${UPGRADE_SRCDIR}; \
145             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
146                 ${BINUPDATE} ${DESTDIR}/etc; \
147             cap_mkdb ${DESTDIR}/etc/login.conf; \
148             for f in ${BIN1}; do \
149                 [ -e "${DESTDIR}/etc/$${f##*/}" ] || \
150                     ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
151                         $$f ${DESTDIR}/etc; \
152             done; \
153             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
154                 ${BIN2} ${DESTDIR}/etc;
155         cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
156             ${DEFAULTS} ${DESTDIR}/etc/defaults
157         cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
158         mkdir -p ${DESTDIR}/etc/rc.d
159         cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install 
160         cd ${UPGRADE_SRCDIR}/devd; ${MAKE} install
161         # "../share/termcap/make etc-termcap" expanded inline here:
162         ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
163         # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
164         ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
165         cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
166             ${MTREE} ${DESTDIR}/etc/mtree
167         cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
168         cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
169 .if !exists(${DESTDIR}/etc/pam.d)
170         mkdir -p ${DESTDIR}/etc/pam.d
171         cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
172         sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
173 .else
174 .for pamconf in README convert.sh atrun cron passwd rsh su system
175 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
176         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
177 .endif
178 .endfor
179 .endif
180         # these removals must occur AFTER any pam conversion
181         csh -c "rm -f /usr/lib/pam_{cleartext_pass_ok,deny,opie,opieaccess,permit,radius,skey,ssh,tacplus,unix}.so"
182         rm -f /etc/pam.conf
183 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
184         cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
185             COPYRIGHT ${DESTDIR}/
186 .endif
187         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
188         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
189         rm -f ${DESTDIR}/usr/include/sys/ata.h
190         ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
191         ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
192         ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
193 .if exists(${DESTDIR}/usr/lib/gcc2)
194         ldconfig -m ${DESTDIR}/usr/lib/gcc2
195 .endif
196 .for lib in ${COMPAT_LIBS:M*.so.*}
197 .if exists(${DESTDIR}/usr/lib/${lib})
198         chflags noschg ${DESTDIR}/usr/lib/${lib}
199         rm -f ${DESTDIR}/usr/lib/${lib}
200 .endif
201 .endfor
202 .if !defined(NO_OPENSSH)
203         cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc obj
204         cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc install
205 .endif
206 .if exists(${DESTDIR}/boot)
207 .if exists(${DESTDIR}/kernel)
208         chflags noschg ${DESTDIR}/kernel
209         mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
210         chflags schg ${DESTDIR}/boot/kernel
211 .endif
212 .if exists(${DESTDIR}/modules)
213         mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
214         rm -rf ${DESTDIR}/boot/modules/modules
215 .endif
216 .if exists(${DESTDIR}/kernel.old)
217         mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
218 .endif
219 .if exists(${DESTDIR}/modules.old)
220         mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
221         rm -rf ${DESTDIR}/boot/modules.old/modules.old
222 .endif
223 .endif
224 .if exists(${DESTDIR}/etc/settings.conf)
225         mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
226 .endif
227         for ext in a so.0; do \
228                 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
229                 dest=$$(readlink "$$f"); \
230                 case "$$dest" in \
231                 libthread_xu.*|libc_r.*) \
232                         ln -fs thread/$$dest $$f ;; \
233                 esac; \
234         done
235         ldconfig -R
236         mkdir -p ${DESTDIR}/dev
237
238 # The existence of cleartext_pass_ok means pam config files are out of date.
239         @set - `fgrep cleartext_pass_ok ${DESTDIR}/etc/pam.d/*`; \
240         if [ $$# -gt 0 ] ; \
241         then \
242                 echo "It appears your PAM configuration files need to be updated"; \
243                 echo "This can be done by manually editing the files or:"; \
244                 echo "  cd ${UPGRADE_SRCDIR}/pam.d"; \
245                 echo "  make install"; \
246         fi
247
248 distribution:
249         cd ${.CURDIR}; \
250             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
251                 ${BINUPDATE} ${DESTDIR}/etc; \
252             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
253                 ${BIN1} ${DESTDIR}/etc; \
254             cap_mkdb ${DESTDIR}/etc/login.conf; \
255             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
256                 ${BIN2} ${DESTDIR}/etc; \
257             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
258                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
259             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
260         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
261             ${DEFAULTS} ${DESTDIR}/etc/defaults
262         cd ${.CURDIR}/pam.d; ${MAKE} install
263         cd ${.CURDIR}/bluetooth; ${MAKE} install
264         cd ${.CURDIR}/periodic; ${MAKE} install
265         cd ${.CURDIR}/rc.d; ${MAKE} install 
266         cd ${.CURDIR}/devd; ${MAKE} install
267         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
268         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
269         cd ${.CURDIR}; \
270             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
271                 Makefile.usr ${DESTDIR}/usr/Makefile
272 .for dir in ${DIRS}
273 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
274         cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
275         cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
276 .endif
277 .endfor
278         mkdir -p ${DESTDIR}/dev
279         cd ${.CURDIR}/root; \
280             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
281                 dot.cshrc ${DESTDIR}/root/.cshrc; \
282             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
283                 dot.klogin ${DESTDIR}/root/.klogin; \
284             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
285                 dot.login ${DESTDIR}/root/.login; \
286             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
287                 dot.profile ${DESTDIR}/root/.profile; \
288             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
289         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
290             ${MTREE} ${DESTDIR}/etc/mtree
291         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
292             ${PPPCNF} ${DESTDIR}/etc/ppp
293         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
294             ${ETCMAIL} ${DESTDIR}/etc/mail
295         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
296               ! -f ${DESTDIR}/etc/aliases ]; then \
297                 set -x; \
298                 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
299         fi
300         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
301             ${DESTDIR}/etc/dumpdates
302         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
303             ${DESTDIR}/var/db/locate.database
304         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
305             ${DESTDIR}/var/log/auth.log
306         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
307             ${DESTDIR}/var/log/cron
308         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
309             ${DESTDIR}/var/log/daemon
310         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
311             ${DESTDIR}/var/log/lpd-errs
312         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
313             ${DESTDIR}/var/log/maillog
314         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
315             ${DESTDIR}/var/log/lastlog
316         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
317             ${DESTDIR}/var/log/lastlogx
318         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
319             ${DESTDIR}/var/log/messages
320         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
321             ${DESTDIR}/var/log/security
322         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
323             ${DESTDIR}/var/log/slip.log
324         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
325             ${DESTDIR}/var/log/ppp.log
326         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
327             ${DESTDIR}/var/log/wtmp
328         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
329             ${DESTDIR}/var/log/wtmpx
330         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
331             ${DESTDIR}/var/run/utmp
332         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
333             ${DESTDIR}/var/run/utmpx
334         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
335             ${DESTDIR}/var/crash
336         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
337             COPYRIGHT ${DESTDIR}/
338         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
339         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
340         rm -f ${DESTDIR}/usr/include/sys/ata.h
341         ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
342         ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
343         ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
344 .if !defined(NOMAN)
345         cd ${.CURDIR}/../share/man; ${MAKE} makedb
346 .endif
347
348 #
349 #
350 distrib-dirs:
351         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
352         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
353         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
354         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
355                 -p ${DESTDIR}/usr/include
356         -chflags xlink ${DESTDIR}/* ${DESTDIR}/usr/* ${DESTDIR}/var/* \
357                         ${DESTDIR}/home/*
358         cd ${DESTDIR}/; test -e sys || (rm -f sys;  ${LN} -s usr/src/sys sys)
359         cd ${DESTDIR}/usr/share/nls; \
360         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
361         while [ $$# -gt 0 ] ; \
362         do \
363                 rm -rf "$$1"; \
364                 ${LN} -s "$$2" "$$1"; \
365                 shift; shift; \
366         done
367
368 etc-examples:
369         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
370             ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf opieaccess \
371             ${DESTDIR}/usr/share/examples/etc
372         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
373             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
374
375 .include <bsd.prog.mk>