Disconnect hostapd from building in base
[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 authpf -q > /dev/null) || \
114                 pw -V ${DESTDIR}/etc groupadd authpf -g 63
115         (pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
116                 pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
117         (pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
118                 pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
119         (pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
120                 pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
121
122 upgrade_check:
123         @if [ -n "`grep '^sendmail.*/usr/libexec/sendmail/sendmail' ${DESTDIR}/etc/mail/mailer.conf`" ]; then \
124                 echo "==================================================================" ; \
125                 echo "=  sendmail is being removed from the base system." ; \
126                 echo "=  /etc/mail/mailer.conf is still configured to use sendmail." ; \
127                 echo "=  See http://www.dragonflybsd.com/docs/docs/newhandbook/mta/" ; \
128                 echo "=  Quick: cp /usr/src/libexec/dma/mailer-conf/mailer.conf.dma " ; \
129                 echo "=            ${DESTDIR}/etc/mail/mailer.conf ; make upgrade" ; \
130                 echo "==================================================================" ; \
131                 /usr/bin/false ; \
132         fi
133
134 upgrade_etc:    upgrade_check preupgrade remove-obsolete-files
135         # files that should be dirs (not possible with Makefile_upgrade.inc)
136 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin
137         [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
138 .endfor
139 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
140         cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
141 .endif
142         cd ${UPGRADE_SRCDIR}; \
143             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
144                 ${BINUPDATE} ${DESTDIR}/etc; \
145             cap_mkdb ${DESTDIR}/etc/login.conf; \
146             for f in ${BIN1}; do \
147                 [ -e "${DESTDIR}/etc/$${f##*/}" ] || \
148                     ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
149                         $$f ${DESTDIR}/etc; \
150             done; \
151             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
152                 ${BIN2} ${DESTDIR}/etc;
153         cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
154             ${DEFAULTS} ${DESTDIR}/etc/defaults
155         cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
156         mkdir -p ${DESTDIR}/etc/rc.d
157         cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install 
158         cd ${UPGRADE_SRCDIR}/devd; ${MAKE} install
159         # "../share/termcap/make etc-termcap" expanded inline here:
160         ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
161         # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
162         ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
163         cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
164             ${MTREE} ${DESTDIR}/etc/mtree
165         cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
166         cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
167 .if !exists(${DESTDIR}/etc/pam.d)
168         mkdir -p ${DESTDIR}/etc/pam.d
169         cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
170         sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
171 .else
172 .for pamconf in README convert.sh atrun cron passwd rsh su system
173 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
174         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
175 .endif
176 .endfor
177 .endif
178         # these removals must occur AFTER any pam conversion
179         csh -c "rm -f /usr/lib/pam_{cleartext_pass_ok,deny,opie,opieaccess,permit,radius,skey,ssh,tacplus,unix}.so"
180         rm -f /etc/pam.conf
181 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
182         cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
183             COPYRIGHT ${DESTDIR}/
184 .endif
185         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
186         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
187         rm -f ${DESTDIR}/usr/include/sys/ata.h
188         ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
189         ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
190         ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
191 .if exists(${DESTDIR}/usr/lib/gcc2)
192         ldconfig -m ${DESTDIR}/usr/lib/gcc2
193 .endif
194 .for lib in ${COMPAT_LIBS:M*.so.*}
195 .if exists(${DESTDIR}/usr/lib/${lib})
196         chflags noschg ${DESTDIR}/usr/lib/${lib}
197         rm -f ${DESTDIR}/usr/lib/${lib}
198 .endif
199 .endfor
200 .if !defined(NO_OPENSSH)
201         cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc obj
202         cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc install
203 .endif
204 .if exists(${DESTDIR}/boot)
205 .if exists(${DESTDIR}/kernel)
206         chflags noschg ${DESTDIR}/kernel
207         mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
208         chflags schg ${DESTDIR}/boot/kernel
209 .endif
210 .if exists(${DESTDIR}/modules)
211         mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
212         rm -rf ${DESTDIR}/boot/modules/modules
213 .endif
214 .if exists(${DESTDIR}/kernel.old)
215         mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
216 .endif
217 .if exists(${DESTDIR}/modules.old)
218         mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
219         rm -rf ${DESTDIR}/boot/modules.old/modules.old
220 .endif
221 .endif
222 .if exists(${DESTDIR}/etc/settings.conf)
223         mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
224 .endif
225         for ext in a so.0; do \
226                 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
227                 dest=$$(readlink "$$f"); \
228                 case "$$dest" in \
229                 libthread_xu.*|libc_r.*) \
230                         ln -fs thread/$$dest $$f ;; \
231                 esac; \
232         done
233         ldconfig -R
234         mkdir -p ${DESTDIR}/dev
235
236 # The existence of cleartext_pass_ok means pam config files are out of date.
237         @set - `fgrep cleartext_pass_ok ${DESTDIR}/etc/pam.d/*`; \
238         if [ $$# -gt 0 ] ; \
239         then \
240                 echo "It appears your PAM configuration files need to be updated"; \
241                 echo "This can be done by manually editing the files or:"; \
242                 echo "  cd ${UPGRADE_SRCDIR}/pam.d"; \
243                 echo "  make install"; \
244         fi
245
246 distribution:
247         cd ${.CURDIR}; \
248             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
249                 ${BINUPDATE} ${DESTDIR}/etc; \
250             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
251                 ${BIN1} ${DESTDIR}/etc; \
252             cap_mkdb ${DESTDIR}/etc/login.conf; \
253             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
254                 ${BIN2} ${DESTDIR}/etc; \
255             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
256                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
257             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
258         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
259             ${DEFAULTS} ${DESTDIR}/etc/defaults
260         cd ${.CURDIR}/pam.d; ${MAKE} install
261         cd ${.CURDIR}/bluetooth; ${MAKE} install
262         cd ${.CURDIR}/periodic; ${MAKE} install
263         cd ${.CURDIR}/rc.d; ${MAKE} install 
264         cd ${.CURDIR}/devd; ${MAKE} install
265         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
266         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
267         cd ${.CURDIR}; \
268             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
269                 Makefile.usr ${DESTDIR}/usr/Makefile
270 .for dir in ${DIRS}
271 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
272         cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
273         cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
274 .endif
275 .endfor
276         mkdir -p ${DESTDIR}/dev
277         cd ${.CURDIR}/root; \
278             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
279                 dot.cshrc ${DESTDIR}/root/.cshrc; \
280             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
281                 dot.klogin ${DESTDIR}/root/.klogin; \
282             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
283                 dot.login ${DESTDIR}/root/.login; \
284             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
285                 dot.profile ${DESTDIR}/root/.profile; \
286             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
287         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
288             ${MTREE} ${DESTDIR}/etc/mtree
289         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
290             ${PPPCNF} ${DESTDIR}/etc/ppp
291         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
292             ${ETCMAIL} ${DESTDIR}/etc/mail
293         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
294               ! -f ${DESTDIR}/etc/aliases ]; then \
295                 set -x; \
296                 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
297         fi
298         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
299             ${DESTDIR}/etc/dumpdates
300         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
301             ${DESTDIR}/var/db/locate.database
302         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
303             ${DESTDIR}/var/log/auth.log
304         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
305             ${DESTDIR}/var/log/cron
306         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
307             ${DESTDIR}/var/log/daemon
308         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
309             ${DESTDIR}/var/log/lpd-errs
310         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
311             ${DESTDIR}/var/log/maillog
312         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
313             ${DESTDIR}/var/log/lastlog
314         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
315             ${DESTDIR}/var/log/lastlogx
316         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
317             ${DESTDIR}/var/log/messages
318         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
319             ${DESTDIR}/var/log/security
320         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
321             ${DESTDIR}/var/log/slip.log
322         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
323             ${DESTDIR}/var/log/ppp.log
324         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
325             ${DESTDIR}/var/log/wtmp
326         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
327             ${DESTDIR}/var/log/wtmpx
328         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
329             ${DESTDIR}/var/run/utmp
330         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
331             ${DESTDIR}/var/run/utmpx
332         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
333             ${DESTDIR}/var/crash
334         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
335             COPYRIGHT ${DESTDIR}/
336         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
337         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
338         rm -f ${DESTDIR}/usr/include/sys/ata.h
339         ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
340         ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
341         ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
342 .if !defined(NOMAN)
343         cd ${.CURDIR}/../share/man; ${MAKE} makedb
344 .endif
345
346 distrib-dirs:
347         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
348         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
349         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
350         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
351                 -p ${DESTDIR}/usr/include
352         cd ${DESTDIR}/; test -e sys || (rm -f sys;  ${LN} -s usr/src/sys sys)
353         cd ${DESTDIR}/usr/share/nls; \
354         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
355         while [ $$# -gt 0 ] ; \
356         do \
357                 rm -rf "$$1"; \
358                 ${LN} -s "$$2" "$$1"; \
359                 shift; shift; \
360         done
361
362 etc-examples:
363         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
364             ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf opieaccess \
365             ${DESTDIR}/usr/share/examples/etc
366         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
367             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
368
369 .include <bsd.prog.mk>