2 # $Id: progs.mk,v 1.11 2012/11/06 17:18:54 sjg Exp $
4 # @(#) Copyright (c) 2006, Simon J. Gerraty
6 # This file is provided in the hope that it will
7 # be of use. There is absolutely NO WARRANTY.
8 # Permission to copy, redistribute or otherwise
9 # use this file is hereby granted provided that
10 # the above copyright notice and this notice are
13 # Please send copies of changes and bug-fixes to:
21 # In meta mode, we can capture dependenices for _one_ of the progs.
22 # if makefile doesn't nominate one, we use the first.
23 .ifndef UPDATE_DEPENDFILE_PROG
24 UPDATE_DEPENDFILE_PROG = ${PROGS:[1]}
25 .export UPDATE_DEPENDFILE_PROG
29 # They may have asked us to build just one
39 PROG_VARS += BINDIR CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS
40 .for v in ${PROG_VARS:O:u}
41 .if defined(${v}.${PROG})
42 $v += ${${v}_${PROG}:U${${v}.${PROG}}}
46 # for meta mode, there can be only one!
47 .if ${PROG} == ${UPDATE_DEPENDFILE_PROG:Uno}
48 UPDATE_DEPENDFILE ?= yes
50 UPDATE_DEPENDFILE ?= NO
52 # ensure that we don't clobber each other's dependencies
53 DEPENDFILE?= .depend.${PROG}
54 # prog.mk will do the rest
58 # We cannot capture dependencies for meta mode here
59 UPDATE_DEPENDFILE = NO
60 # nor can we safely run in parallel.
65 # handle being called [bsd.]progs.mk
66 .include <${.PARSEFILE:S,progs,prog,}>
69 # tell progs.mk we might want to install things
70 PROGS_TARGETS+= cleandepend cleandir cleanobj depend install
73 .if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
74 # bsd.prog.mk may need to know this
78 $p ${p}_p: .PHONY .MAKE
79 (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p})
81 .for t in ${PROGS_TARGETS:O:u}
83 (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} ${@:E})
87 .for t in ${PROGS_TARGETS:O:u}