xref: /freebsd/contrib/bmake/mk/genfiles.mk (revision 6a7405f5a6b639682cacf01e35d561411ff556aa)
1# SPDX-License-Identifier: BSD-2-Clause
2#
3# $Id: genfiles.mk,v 1.3 2024/09/21 21:14:19 sjg Exp $
4#
5#	@(#) Copyright (c) 2024, Simon J. Gerraty
6#
7#	This file is provided in the hope that it will
8#	be of use.  There is absolutely NO WARRANTY.
9#	Permission to copy, redistribute or otherwise
10#	use this file is hereby granted provided that
11#	the above copyright notice and this notice are
12#	left intact.
13#
14#	Please send copies of changes and bug-fixes to:
15#	sjg@crufty.net
16#
17
18# Pipe the sources though egrep -v if EXCLUDES.${.TARGET} is defined
19# and/or sed if SED_CMDS.${.TARGET} is defined
20# Note: this works best in meta mode as any change to EXCLUDES or
21# SED_CMDS will make the target out-of-date.
22_GENFILES_USE:	.USE
23	@cat ${SRCS.${.TARGET}:U${.ALLSRC:u}} \
24	${EXCLUDES.${.TARGET}:D| ${EGREP:Uegrep} -v '${EXCLUDS.${.TARGET}:ts|}'} \
25	${SED_CMDS.${.TARGET}:D| ${SED:Used} ${SED_CMDS.${.TARGET}}} \
26	> ${.TARGET}
27