xref: /freebsd/etc/Makefile (revision 01ff67f4bdf5959a719a6511a855f6a60c0e3a93)
1c6063d0dSWarner Losh.include <src.opts.mk>
2a8b8edb2SMaxim Sobolev.include <src.tools.mk>
3e1fe3dbaSRuslan Ermilov
4949199a2SJessica Clarke.include <bsd.compat.pre.mk>
5949199a2SJessica Clarke
6dd181acaSGlen BarberFILESGROUPS=	FILES
7874e7db1SBaptiste DaroussinNLS_ALIASES=	POSIX C \
8874e7db1SBaptiste Daroussin		en_US.US_ASCII C
9dd181acaSGlen Barber
10d5cc0579SBryan Drewery# No need as it is empty and just causes rebuilds since this file does so much.
11d5cc0579SBryan DreweryUPDATE_DEPENDFILE=	no
125e497231SEnji Cooper
133078531dSMaxim SobolevSUBDIR+=termcap
14e1fe3dbaSRuslan Ermilov.if ${MK_SENDMAIL} != "no"
155e497231SEnji CooperSUBDIR+=sendmail
16193f471dSGregory Neil Shapiro.endif
171bf9d5d9SRodney W. Grimes
18690f477dSSam Leffler# NB: keep these sorted by MK_* knobs
19690f477dSSam Leffler
20cb99e935SKyle EvansETCMAIL=aliases
21cb99e935SKyle Evans.if ${MK_SENDMAIL} != "no"
228cd7841dSBaptiste DaroussinETCMAIL_SENDMAIL+=Makefile README access.sample virtusertable.sample \
23cb99e935SKyle Evans	mailertable.sample
246e82f17aSGregory Neil Shapiro.endif
251bf9d5d9SRodney W. Grimes
26f9b4e354SRodney W. Grimes# Special top level files for FreeBSD
27831568b9SRuslan ErmilovFREEBSD=COPYRIGHT
28990baf30SRodney W. Grimes
294a63ae11SBrooks Davis# Sanitize DESTDIR
304a63ae11SBrooks DavisDESTDIR:=	${DESTDIR:C://*:/:g}
314a63ae11SBrooks Davis
32bbe8270cSRuslan Ermilovafterinstall:
33e1fe3dbaSRuslan Ermilov.if ${MK_MAN} != "no"
346dcff5b7SWarner Losh	${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb
35bbe8270cSRuslan Ermilov.endif
36bbe8270cSRuslan Ermilov
3748327bc9SPoul-Henning Kampdistribute:
38e8a34402SJulio Merino	# Avoid installing tests here; "make distribution" will do this and
39e8a34402SJulio Merino	# correctly place them in the right location.
40e8a34402SJulio Merino	${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
41ce047ebfSJessica Clarke	    DISTBASE=/${DISTRIBUTION} DESTDIR=${DISTDIR}/${DISTRIBUTION}
42ce047ebfSJessica Clarke	${_+_}cd ${.CURDIR} ; ${MAKE} distribution \
43ce047ebfSJessica Clarke	    DISTBASE=/${DISTRIBUTION} DESTDIR=${DISTDIR}/${DISTRIBUTION}
44012f2ce7SPaul Traina
4580f64943SRuslan Ermilov.include <bsd.endian.mk>
4680f64943SRuslan Ermilov
4764dc091fSBrooks Davis.if defined(NO_ROOT)
4864dc091fSBrooks DavisMETALOG.add?=	cat -l >> ${METALOG}
4964dc091fSBrooks Davis.endif
5064dc091fSBrooks Davis
5148327bc9SPoul-Henning Kampdistribution:
521ede9a7dSRuslan Ermilov.if !defined(DESTDIR)
531ede9a7dSRuslan Ermilov	@echo "set DESTDIR before running \"make ${.TARGET}\""
541ede9a7dSRuslan Ermilov	@false
551ede9a7dSRuslan Ermilov.endif
56e0cb3d9cSYaroslav Tykhiy	${_+_}cd ${.CURDIR}/gss; ${MAKE} install
57e017348aSEnji Cooper	${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
586dcff5b7SWarner Losh	${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
596dcff5b7SWarner Losh	${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
60156ebad6SKyle Evans	${INSTALL_SYMLINK} -T "package=runtime" ../var/run/os-release \
616467506bSWarner Losh		${DESTDIR}/etc/os-release
6263d39beaSDag-Erling Smørgrav.if ${MK_UNBOUND} != "no"
6363d39beaSDag-Erling Smørgrav	if [ ! -e ${DESTDIR}/etc/unbound ]; then \
6415779434SEmmanuel Vadot		${INSTALL_SYMLINK} -T "package=unbound" \
6515779434SEmmanuel Vadot		../var/unbound ${DESTDIR}/etc/unbound; \
6663d39beaSDag-Erling Smørgrav	fi
6763d39beaSDag-Erling Smørgrav.endif
68e1fe3dbaSRuslan Ermilov.if ${MK_SENDMAIL} != "no"
69e0cb3d9cSYaroslav Tykhiy	${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
70193f471dSGregory Neil Shapiro.endif
71e1fe3dbaSRuslan Ermilov.if ${MK_KERBEROS} != "no"
7299d38d6cSPoul-Henning Kamp	cd ${.CURDIR}/root; \
7399d38d6cSPoul-Henning Kamp	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
7415779434SEmmanuel Vadot		-T "package=runtime" \
7599d38d6cSPoul-Henning Kamp		dot.k5login ${DESTDIR}/root/.k5login;
7699d38d6cSPoul-Henning Kamp.endif
77b26c7f7fSBrad Davis
78dfdf74eaSEnji Cooper.if ${MK_MAIL} != "no"
79d2893b16SRuslan Ermilov	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
808cd7841dSBaptiste Daroussin	    -T "package=runtime,config" ${ETCMAIL} ${DESTDIR}/etc/mail
817ccabb05SEitan Adler	if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
824bcefa96SGregory Neil Shapiro	      ! -f ${DESTDIR}/etc/aliases ]; then \
838cd7841dSBaptiste Daroussin		${INSTALL_SYMLINK} -T "package=runtime" \
8415779434SEmmanuel Vadot		mail/aliases ${DESTDIR}/etc/aliases; \
854bcefa96SGregory Neil Shapiro	fi
86690f477dSSam Leffler.endif
878cd7841dSBaptiste Daroussin.if ${MK_SENDMAIL} != "no"
888cd7841dSBaptiste Daroussin	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
898cd7841dSBaptiste Daroussin		-T "package=sendmail" ${ETCMAIL_SENDMAIL} ${DESTDIR}/etc/mail
908cd7841dSBaptiste Daroussin.endif
91d2893b16SRuslan Ermilov	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
9215779434SEmmanuel Vadot		-T "package=runtime" ${FREEBSD} ${DESTDIR}/
93ac796179SAndriy Gapon.if ${MK_BOOT} != "no"
946dcff5b7SWarner Losh.if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints)
95920fa8dcSRuslan Ermilov	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
96c016c891SEmmanuel Vadot	    -T "package=bootloader,config" \
976dcff5b7SWarner Losh	    ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \
98920fa8dcSRuslan Ermilov	    ${DESTDIR}/boot/device.hints
99b906fea6SWarner Losh.endif
100ac796179SAndriy Gapon.endif
1011bf9d5d9SRodney W. Grimes
10275534bdaSBrooks DavisMTREES=		mtree/BSD.root.dist		/		\
10375534bdaSBrooks Davis		mtree/BSD.var.dist		/var		\
10475534bdaSBrooks Davis		mtree/BSD.usr.dist		/usr		\
1055dd72ff5SEd Maste		mtree/BSD.include.dist		/usr/include	\
1065dd72ff5SEd Maste		mtree/BSD.debug.dist		/usr/lib
107949199a2SJessica Clarke.for LIBCOMPAT libcompat in ${_ALL_LIBCOMPATS_libcompats}
108949199a2SJessica Clarke.if ${MK_LIB${LIBCOMPAT}} != "no"
109949199a2SJessica ClarkeMTREES+=	mtree/BSD.lib${libcompat}.dist	/usr
110949199a2SJessica ClarkeMTREES+=	mtree/BSD.lib${libcompat}.dist	/usr/lib/debug/usr
11174c52c65SJulio Merino.endif
112949199a2SJessica Clarke.endfor
113e2197f80SRui Paulo.if ${MK_TESTS} != "no"
114f703589eSEnji CooperMTREES+=	mtree/BSD.tests.dist		${TESTSBASE}
115*01ff67f4SJose Luis DuranMTREES+=	mtree/BSD.tests.dist		/usr/lib/debug${TESTSBASE}
116e2197f80SRui Paulo.endif
117e1fe3dbaSRuslan Ermilov.if ${MK_SENDMAIL} != "no"
11875534bdaSBrooks DavisMTREES+=	mtree/BSD.sendmail.dist		/
1198f1bb389SDoug Barton.endif
12075534bdaSBrooks Davis.for mtree in ${LOCAL_MTREE}
12175534bdaSBrooks DavisMTREES+=	../${mtree}			/
12275534bdaSBrooks Davis.endfor
12375534bdaSBrooks Davis
124fcaf7f86SDimitry Andric# Clean up files that have changed into directories, as mtree cannot handle this
125fcaf7f86SDimitry Andric# scenario.
126fcaf7f86SDimitry AndricDISTRIB_CLEANUP_FILES+=	${INCLUDEDIR}/c++/v1/__string
127ca217224SDimitry AndricDISTRIB_CLEANUP_FILES+=	${INCLUDEDIR}/c++/v1/__tuple
128e368e9b7SDimitry AndricDISTRIB_CLEANUP_FILES+=	${LIBEXECDIR}/kgdb
12926de3a17SBrad Davisdistrib-cleanup: .PHONY
130fcaf7f86SDimitry Andric	for file in ${DISTRIB_CLEANUP_FILES}; do \
13126de3a17SBrad Davis		if [ -f ${DESTDIR}/$${file} ]; then \
13226de3a17SBrad Davis			rm -f ${DESTDIR}/$${file}; \
13326de3a17SBrad Davis		fi; \
13426de3a17SBrad Davis	done
13526de3a17SBrad Davis
13626de3a17SBrad Davisdistrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
13797dc79f2SBaptiste Daroussin.for _m _d in ${MTREES}
13897dc79f2SBaptiste Daroussin	@m=${.CURDIR}/${_m}; \
13997dc79f2SBaptiste Daroussin	d=${DESTDIR}${_d}; \
140f703589eSEnji Cooper	test -d $$d || mkdir -p $$d; \
14115482f3fSBryan Drewery	${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
14215482f3fSBryan Drewery	    ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
143e8f617fdSSimon J. Gerraty	${MTREE_FILTER} $$m | \
14415482f3fSBryan Drewery	${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
1454dd729a5SBaptiste Daroussin	    -p $$d
14697dc79f2SBaptiste Daroussin.endfor
1474a63ae11SBrooks Davis.if defined(NO_ROOT)
14897dc79f2SBaptiste Daroussin.for _m _d in ${MTREES}
14997dc79f2SBaptiste Daroussin	@m=${.CURDIR}/${_m}; \
15097dc79f2SBaptiste Daroussin	d=${_d}; \
15176c100d6SJessica Clarke	test "$$d" = "/" && d=""; \
1524a63ae11SBrooks Davis	d=${DISTBASE}$$d; \
15325f0135cSKyle Evans	${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
1548caedc2aSBrooks Davis	    "sed s#^\.#.$$d# | ${METALOG.add}" ; \
155e8f617fdSSimon J. Gerraty	${MTREE_FILTER} $$m | \
15625f0135cSKyle Evans	${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
1574dd729a5SBaptiste Daroussin	    ${METALOG.add}
15897dc79f2SBaptiste Daroussin.endfor
1594a63ae11SBrooks Davis.endif
160f515b598SEnji Cooper.if ${MK_NLS} != "no"
161874e7db1SBaptiste Daroussin.for alias nls in ${NLS_ALIASES}
162d3c87514SEd Maste	${INSTALL_SYMLINK} -T "package=utilities" \
163d3c87514SEd Maste	    "${nls}" "${DESTDIR}${SHAREDIR}/nls/${alias}"
164874e7db1SBaptiste Daroussin.endfor
165f515b598SEnji Cooper.endif
1666e1a887cSRodney W. Grimes
1671bf9d5d9SRodney W. Grimes.include <bsd.prog.mk>
16827f3f39aSBryan Drewery
16927f3f39aSBryan Drewery.if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
17027f3f39aSBryan DreweryMTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
17127f3f39aSBryan Drewery	-e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
17227f3f39aSBryan Drewery	-e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
17327f3f39aSBryan Drewery	-e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
17427f3f39aSBryan Drewery	-e 's,\(gid=\)[^ ]*$$,\1${_gid},'
17527f3f39aSBryan Drewery.else
17627f3f39aSBryan DreweryMTREE_FILTER= cat
17727f3f39aSBryan Drewery.if !defined(NO_FSCHG)
17827f3f39aSBryan DreweryMTREE_FSCHG=	-i
17927f3f39aSBryan Drewery.endif
18027f3f39aSBryan Drewery.endif
181