1 # $Id: progs.mk,v 1.13 2013/08/02 18:28:48 sjg Exp $
3 # @(#) Copyright (c) 2006, Simon J. Gerraty
5 # This file is provided in the hope that it will
6 # be of use. There is absolutely NO WARRANTY.
7 # Permission to copy, redistribute or otherwise
8 # use this file is hereby granted provided that
9 # the above copyright notice and this notice are
12 # Please send copies of changes and bug-fixes to:
20 # In meta mode, we can capture dependenices for _one_ of the progs.
21 # if makefile doesn't nominate one, we use the first.
22 .ifndef UPDATE_DEPENDFILE_PROG
23 UPDATE_DEPENDFILE_PROG = ${PROGS:[1]}
24 .export UPDATE_DEPENDFILE_PROG
28 # They may have asked us to build just one
51 .for v in ${PROG_VARS:O:u}
52 .if defined(${v}.${PROG}) || defined(${v}_${PROG})
53 $v += ${${v}_${PROG}:U${${v}.${PROG}}}
57 # for meta mode, there can be only one!
58 .if ${PROG} == ${UPDATE_DEPENDFILE_PROG:Uno}
59 UPDATE_DEPENDFILE ?= yes
61 UPDATE_DEPENDFILE ?= NO
63 # ensure that we don't clobber each other's dependencies
64 DEPENDFILE?= .depend.${PROG}
65 # prog.mk will do the rest
69 # We cannot capture dependencies for meta mode here
70 UPDATE_DEPENDFILE = NO
71 # nor can we safely run in parallel.
76 # handle being called [bsd.]progs.mk
77 .include <${.PARSEFILE:S,progs,prog,}>
80 # tell progs.mk we might want to install things
81 PROGS_TARGETS+= cleandepend cleandir cleanobj depend install
84 .if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
85 # bsd.prog.mk may need to know this
89 $p ${p}_p: .PHONY .MAKE
90 (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p})
92 .for t in ${PROGS_TARGETS:O:u}
94 (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} ${@:E})
98 .for t in ${PROGS_TARGETS:O:u}