Allow this to work with fmake

Based on patch from Garret Cooper.
This commit is contained in:
Simon J. Gerraty 2013-11-13 15:10:32 +00:00
parent 4d1da75392
commit b4ffe103d4

View File

@ -16,14 +16,20 @@
.MAIN: all
.if defined(PROGS)
.if defined(PROGS) || defined(PROGS_CXX)
# we really only use PROGS below...
PROGS += ${PROGS_CXX}
# In meta mode, we can capture dependenices for _one_ of the progs.
# if makefile doesn't nominate one, we use the first.
.if defined(.PARSEDIR)
.ifndef UPDATE_DEPENDFILE_PROG
UPDATE_DEPENDFILE_PROG = ${PROGS:[1]}
.export UPDATE_DEPENDFILE_PROG
.endif
.else
UPDATE_DEPENDFILE_PROG?= no
.endif
.ifndef PROG
# They may have asked us to build just one
@ -40,11 +46,13 @@ PROG_VARS += BINDIR CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS
.for v in ${PROG_VARS:O:u}
.if defined(${v}.${PROG})
$v += ${${v}_${PROG}:U${${v}.${PROG}}}
.else
$v ?=
.endif
.endfor
# for meta mode, there can be only one!
.if ${PROG} == ${UPDATE_DEPENDFILE_PROG:Uno}
.if ${PROG} == ${UPDATE_DEPENDFILE_PROG}
UPDATE_DEPENDFILE ?= yes
.endif
UPDATE_DEPENDFILE ?= NO
@ -63,7 +71,7 @@ UPDATE_DEPENDFILE = NO
.endif
# handle being called [bsd.]progs.mk
.include <${.PARSEFILE:S,progs,prog,}>
.include <bsd.prog.mk>
.ifndef PROG
# tell progs.mk we might want to install things
@ -76,11 +84,11 @@ x.$p= PROG_CXX=$p
.endif
$p ${p}_p: .PHONY .MAKE
(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p})
(cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} PROG=$p ${x.$p})
.for t in ${PROGS_TARGETS:O:u}
$p.$t: .PHONY .MAKE
(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} ${@:E})
(cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} ${@:E})
.endfor
.endfor