diff --git a/share/mk/bsd.README b/share/mk/bsd.README index b81a7146a438..018374ffa4b8 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -18,6 +18,7 @@ bsd.lib.mk. bsd.arch.inc.mk - includes arch-specific Makefile.$arch bsd.compiler.mk - defined based on current compiler +bsd.confs.mk - install of configuration files bsd.cpu.mk - sets CPU/arch-related variables (included from sys.mk) bsd.dep.mk - handle Makefile dependencies bsd.doc.mk - building troff system documents diff --git a/share/mk/bsd.confs.mk b/share/mk/bsd.confs.mk new file mode 100644 index 000000000000..654d831599eb --- /dev/null +++ b/share/mk/bsd.confs.mk @@ -0,0 +1,87 @@ +# $FreeBSD$ + +.if !target(____) +.error bsd.conf.mk cannot be included directly. +.endif + +.if ${MK_INCLUDES} != "no" +CONFGROUPS?= CONFS + +.if !target(buildconfig) +.for group in ${CONFSGROUPS} +buildconfig: ${${group}} +.endfor +.endif + +all: buildconfig + +.if !target(installconfig) +.for group in ${CONFGROUPS} +.if defined(${group}) && !empty(${group}) + +${group}OWN?= ${SHAREOWN} +${group}GRP?= ${SHAREGRP} +${group}MODE?= ${SHAREMODE} +${group}DIR?= ${ETCDIR}/ +STAGE_SETS+= ${group} +STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR} +STAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP} + +_${group}CONFS= +.for cnf in ${${group}} +.if defined(${group}OWN_${cnf:T}) || defined(${group}GRP_${cnf:T}) || \ + defined(${group}MODE_${cnf:T}) || defined(${group}DIR_${cnf:T}) || \ + defined(${group}NAME_${cnf:T}) || defined(${group}NAME) +${group}OWN_${cnf:T}?= ${${group}OWN} +${group}GRP_${cnf:T}?= ${${group}GRP} +${group}MODE_${cnf:T}?= ${${group}MODE} +${group}DIR_${cnf:T}?= ${${group}DIR} +.if defined(${group}NAME) +${group}NAME_${cnf:T}?= ${${group}NAME} +.else +${group}NAME_${cnf:T}?= ${cnf:T} +.endif +STAGE_AS_SETS+= ${cnf:T} +STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}} +# XXX {group}OWN,GRP,MODE +STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${group}DIR_${cnf:T}} +stage_as.${cnf:T}: ${cnf} +stage_config: stage_as.${cnf:T} + +installconfig: _${group}INS_${cnf:T} +_${group}INS_${cnf:T}: ${cnf} + ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ + ${.ALLSRC} \ + ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} +.else +_${group}CONFS+= ${cnf} +.endif +.endfor +.if !empty(_${group}CONFS) +stage_files.${group}: ${_${group}CONFS} +stage_config: stage_files.${group} + +installconfig: _${group}INS +_${group}INS: ${_${group}CONFS} +.if defined(${group}NAME) + ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ + ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} +.else + ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ + ${.ALLSRC} ${DESTDIR}${${group}DIR} +.endif +.endif + +.endif # defined(${group}) && !empty(${group}) +.endfor + +.endif # !target(installconfig) + +.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) +.if !defined(NO_STAGE_CONFIG) +STAGE_TARGETS+= stage_config +.endif +.endif + +.endif # ${MK_TOOLCHAIN} != "no" diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index ca765bbdddf0..0ed83454ebf0 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -390,6 +390,7 @@ _libinstall: .include .include .include +.include .endif .include diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 2f20da8620be..450db0844862 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -213,6 +213,7 @@ NLSGRP?= ${SHAREGRP} NLSMODE?= ${NOBINMODE} INCLUDEDIR?= /usr/include +ETCDIR?= /etc # # install(1) parameters. diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 601ee5b2fbf7..966c17e8cffa 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -249,6 +249,7 @@ _SCRIPTSINS_${script:T}: ${script} NLSNAME?= ${PROG} .include +.include .include .include .include diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk index 721987f6bd6a..ab527089c807 100644 --- a/share/mk/bsd.progs.mk +++ b/share/mk/bsd.progs.mk @@ -71,7 +71,7 @@ UPDATE_DEPENDFILE = NO # These are handled by the main make process. .ifdef _RECURSING_PROGS -_PROGS_GLOBAL_VARS= CLEANFILES CLEANDIRS FILESGROUPS SCRIPTS +_PROGS_GLOBAL_VARS= CLEANFILES CLEANDIRS FILESGROUPS SCRIPTS CONFGROUPS .for v in ${_PROGS_GLOBAL_VARS} $v = .endfor diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 9c480ac9a352..94e983891214 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -122,7 +122,7 @@ _sub.${__target}: _SUBDIR .endif .endfor -.for __target in files includes +.for __target in files includes config .for __stage in build install ${__stage}${__target}: .if make(${__stage}${__target})