Page MenuHomeFreeBSD

D3444.id8093.diff
No OneTemporary

D3444.id8093.diff

Index: share/mk/bsd.prog.mk
===================================================================
--- share/mk/bsd.prog.mk
+++ share/mk/bsd.prog.mk
@@ -16,6 +16,18 @@
NO_WERROR=
.endif
+_PROGS= ${PROG} ${PROGS}
+_PROGS_CXX= ${PROG_CXX} ${PROGS_CXX}
+_PROGS_LIST= ${_PROGS} ${_PROGS_CXX}
+
+.if defined(PROG)
+SRCS.${PROG}:= ${SRCS}
+.endif
+.if defined(PROG_CXX)
+SRCS.${PROG_CXX}:= ${SRCS}
+.endif
+.undef SRCS
+
.if defined(DEBUG_FLAGS)
CFLAGS+=${DEBUG_FLAGS}
CXXFLAGS+=${DEBUG_FLAGS}
@@ -25,10 +37,6 @@
.endif
.endif
-.if defined(PROG_CXX)
-PROG= ${PROG_CXX}
-.endif
-
.if !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static)
MK_DEBUG_FILES= no
.endif
@@ -51,135 +59,108 @@
LDFLAGS+= -static
.endif
+.for p in ${_PROGS_LIST}
.if ${MK_DEBUG_FILES} != "no"
-PROG_FULL=${PROG}.full
+PROG_FULL.$p=$p.full
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
-.if defined(BINDIR) && (\
- ${BINDIR} == "/bin" ||\
- ${BINDIR} == "/libexec" ||\
- ${BINDIR} == "/sbin" ||\
- ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin)(/.*)?%/usr/bin%} == "/usr/bin"\
+BINDIR.$p?= ${BINDIR}
+.if defined(BINDIR.$p) && (\
+ ${BINDIR.$p} == "/bin" ||\
+ ${BINDIR.$p} == "/libexec" ||\
+ ${BINDIR.$p} == "/sbin" ||\
+ ${BINDIR.$p:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin)(/.*)?%/usr/bin%} == "/usr/bin"\
)
-DEBUGFILEDIR= ${DEBUGDIR}${BINDIR}
+DEBUGFILEDIR.$p= ${DEBUGDIR}${BINDIR.$p}
.else
-DEBUGFILEDIR?= ${BINDIR}/.debug
+DEBUGFILEDIR.$p?= ${BINDIR.$p}/.debug
DEBUGMKDIR=
.endif
.else
-PROG_FULL= ${PROG}
-.endif
-
-.if defined(PROG)
-PROGNAME?= ${PROG}
-
-.if defined(SRCS)
-
-OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
-
-.if target(beforelinking)
-beforelinking: ${OBJS}
-${PROG_FULL}: beforelinking
-.endif
-${PROG_FULL}: ${OBJS}
-.if defined(PROG_CXX)
- ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
-.else
- ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
-.endif
-.if ${MK_CTF} != "no"
- ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
-.endif
-
-.else # !defined(SRCS)
-
-.if !target(${PROG})
-.if defined(PROG_CXX)
-SRCS= ${PROG}.cc
-.else
-SRCS= ${PROG}.c
+PROG_FULL.$p= $p
.endif
-# Always make an intermediate object file because:
-# - it saves time rebuilding when only the library has changed
-# - the name of the object gets put into the executable symbol table instead of
-# the name of a variable temporary object.
-# - it's useful to keep objects around for crunching.
-OBJS+= ${PROG}.o
+.if ${_PROGS:M$p}
+SRCS.$p?= $p.c
+CC.$p= ${CC}
+FLAGS.$p= ${CFLAGS}
+.elif ${_PROGS_CXX:M$p}
+SRCS.$p?= $p.cc
+CC.$p= ${CXX}
+FLAGS.$p= ${CXXFLAGS}
+.endif
+
+PROGNAME_$p?= $p
+SRCS+= ${SRCS.$p}
+OBJS.$p= ${SRCS.$p:N*.h:R:S/$/.o/g}
+OBJS+= ${OBJS.$p}
.if target(beforelinking)
-beforelinking: ${OBJS}
-${PROG_FULL}: beforelinking
-.endif
-${PROG_FULL}: ${OBJS}
-.if defined(PROG_CXX)
- ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
-.else
- ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
+beforelinking: ${OBJS.$p}
+${PROG_FULL.$p}: beforelinking
.endif
+${PROG_FULL.$p}: ${OBJS.$p}
+ ${CC.$p} ${FLAGS.$p} ${LDFLAGS} -o ${.TARGET} ${OBJS.$p} ${LDADD} ${LDADD.$p}
.if ${MK_CTF} != "no"
- ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
+ ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS.$p}
.endif
-.endif # !target(${PROG})
-
-.endif # !defined(SRCS)
.if ${MK_DEBUG_FILES} != "no"
-${PROG}: ${PROG_FULL} ${PROGNAME}.debug
- ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \
- ${PROG_FULL} ${.TARGET}
+$p: ${PROG_FULL.$p} ${PROGNAME.$p}.debug
+ ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME.$p}.debug \
+ ${PROG_FULL.$p} ${.TARGET}
-${PROGNAME}.debug: ${PROG_FULL}
- ${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET}
+${PROGNAME.$p}.debug: ${PROG_FULL.$p}
+ ${OBJCOPY} --only-keep-debug ${PROG_FULL.$p} ${.TARGET}
.endif
.if ${MK_MAN} != "no" && !defined(MAN) && \
!defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
!defined(MAN7) && !defined(MAN8) && !defined(MAN9)
-MAN= ${PROG}.1
+MAN= $p.1
MAN1= ${MAN}
.endif
-.endif # defined(PROG)
+CLEANFILES+= $p
+
+.if ${MK_DEBUG_FILES} != "no"
+CLEANFILES+= ${PROG_FULL.$p} ${PROGNAME.$p}.debug
+.endif
+.endfor # for(_PROGS_LIST)
.if defined(_SKIP_BUILD)
all:
.else
-all: beforebuild .WAIT ${PROG} ${SCRIPTS}
+all: beforebuild .WAIT ${_PROGS_LIST} ${SCRIPTS}
beforebuild: objwarn
.if ${MK_MAN} != "no"
all: _manpages
.endif
.endif
-.if defined(PROG)
-CLEANFILES+= ${PROG}
-.if ${MK_DEBUG_FILES} != "no"
-CLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug
-.endif
-.endif
-
.if defined(OBJS)
CLEANFILES+= ${OBJS}
.endif
.include <bsd.libnames.mk>
-.if defined(PROG)
+.if defined(_PROGS_LIST)
_EXTRADEPEND:
+.for p in ${_PROGS}
.if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib)
-.if defined(DPADD) && !empty(DPADD)
- echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE}
-.endif
+.if (defined(DPADD) && !empty(DPADD)) || (defined(DPADD.$p) && !empty(DPADD.$p))
+ echo ${PROG_FULL.$p}: ${DPADD} ${DPADD.$p} >> ${DEPENDFILE}
+. endif
.else
- echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
-.if defined(PROG_CXX)
+ echo ${PROG_FULL.$p}: ${LIBC} ${DPADD} ${DPADD.$p} >> ${DEPENDFILE}
+.endif
+.endfor
+.for p in ${_PROGS_CXX}
.if ${COMPILER_TYPE} == "clang" && empty(CXXFLAGS:M-stdlib=libstdc++)
- echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
+ echo ${PROG_FULL.$p}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
.else
- echo ${PROG_FULL}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
-.endif
-.endif
+ echo ${PROG_FULL.$p}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
.endif
+.endfor
.endif
.if !target(install)
@@ -200,17 +181,17 @@
realinstall: _proginstall
.ORDER: beforeinstall _proginstall
_proginstall:
-.if defined(PROG)
+.for p in ${_PROGS_LIST}
${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
+ ${_INSTALLFLAGS} $p ${DESTDIR}${BINDIR.$p}/${PROGNAME.$p}
.if ${MK_DEBUG_FILES} != "no"
-.if defined(DEBUGMKDIR)
- ${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}
+.if defined(DEBUGMKDIR.$p)
+ ${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR.$p}
.endif
${INSTALL} -T debug -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \
- ${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug
-.endif
+ ${PROGNAME.$p}.debug ${DESTDIR}${DEBUGFILEDIR.$p}/${PROGNAME.$p}.debug
.endif
+.endfor
.endif # !target(realinstall)
.if defined(SCRIPTS) && !empty(SCRIPTS)
@@ -262,7 +243,7 @@
.if !target(lint)
lint: ${SRCS:M*.c}
-.if defined(PROG)
+.if defined(_PROGS_LIST)
${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
.endif
.endif
@@ -273,7 +254,7 @@
.include <bsd.dep.mk>
-.if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE})
+.if defined(_PROGS_LIST) && !exists(${.OBJDIR}/${DEPENDFILE})
${OBJS}: ${SRCS:M*.h}
.endif
Index: share/mk/bsd.progs.mk
===================================================================
--- share/mk/bsd.progs.mk
+++ /dev/null
@@ -1,123 +0,0 @@
-# $FreeBSD$
-# $Id: progs.mk,v 1.11 2012/11/06 17:18:54 sjg Exp $
-#
-# @(#) Copyright (c) 2006, Simon J. Gerraty
-#
-# This file is provided in the hope that it will
-# be of use. There is absolutely NO WARRANTY.
-# Permission to copy, redistribute or otherwise
-# use this file is hereby granted provided that
-# the above copyright notice and this notice are
-# left intact.
-#
-# Please send copies of changes and bug-fixes to:
-# sjg@crufty.net
-#
-
-.MAIN: all
-
-.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.
-.ifndef UPDATE_DEPENDFILE_PROG
-UPDATE_DEPENDFILE_PROG = ${PROGS:[1]}
-.export UPDATE_DEPENDFILE_PROG
-.endif
-
-.ifndef PROG
-# They may have asked us to build just one
-.for t in ${PROGS}
-.if make($t)
-PROG ?= $t
-.endif
-.endfor
-.endif
-
-.if defined(PROG)
-# just one of many
-PROG_OVERRIDE_VARS += BINDIR DPSRCS MAN SRCS
-PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LIBADD LDFLAGS ${PROG_OVERRIDE_VARS}
-.for v in ${PROG_VARS:O:u}
-.if empty(${PROG_OVERRIDE_VARS:M$v})
-.if defined(${v}.${PROG})
-$v += ${${v}.${PROG}}
-.elif defined(${v}_${PROG})
-$v += ${${v}_${PROG}}
-.endif
-.else
-$v ?=
-.endif
-.endfor
-
-# for meta mode, there can be only one!
-.if ${PROG} == ${UPDATE_DEPENDFILE_PROG}
-UPDATE_DEPENDFILE ?= yes
-.endif
-UPDATE_DEPENDFILE ?= NO
-
-# prog.mk will do the rest
-.else
-all: ${FILES} ${PROGS} ${SCRIPTS}
-
-# We cannot capture dependencies for meta mode here
-UPDATE_DEPENDFILE = NO
-# nor can we safely run in parallel.
-.NOTPARALLEL:
-.endif
-.endif
-
-# The non-recursive call to bsd.progs.mk will handle FILES; NUL out
-# FILESGROUPS so recursive calls don't duplicate the work
-.ifdef _RECURSING_PROGS
-FILESGROUPS=
-.endif
-
-# handle being called [bsd.]progs.mk
-.include <bsd.prog.mk>
-
-.ifndef _RECURSING_PROGS
-# tell progs.mk we might want to install things
-PROGS_TARGETS+= checkdpadd clean cleandepend cleandir cleanobj depend install
-
-.for p in ${PROGS}
-.if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
-# bsd.prog.mk may need to know this
-x.$p= PROG_CXX=$p
-.endif
-
-$p ${p}_p: .PHONY .MAKE
- (cd ${.CURDIR} && \
- DEPENDFILE=.depend.$p \
- ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \
- SUBDIR= PROG=$p ${x.$p})
-
-.for t in ${PROGS_TARGETS:O:u}
-$p.$t: .PHONY .MAKE
- (cd ${.CURDIR} && \
- DEPENDFILE=.depend.$p \
- ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \
- SUBDIR= PROG=$p ${x.$p} ${@:E})
-.endfor
-.endfor
-
-.if !empty(PROGS)
-.for t in ${PROGS_TARGETS:O:u}
-$t: ${PROGS:%=%.$t}
-.endfor
-.endif
-
-.if empty(PROGS) && !empty(SCRIPTS)
-
-.for t in ${PROGS_TARGETS:O:u}
-scripts.$t: .PHONY .MAKE
- (cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} SUBDIR= _RECURSING_PROGS= \
- $t)
-$t: scripts.$t
-.endfor
-
-.endif
-
-.endif
Index: share/mk/bsd.test.mk
===================================================================
--- share/mk/bsd.test.mk
+++ share/mk/bsd.test.mk
@@ -101,11 +101,7 @@
MK_STAGING= no
.endif
-.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
-.include <bsd.progs.mk>
-.endif
-.include <bsd.files.mk>
-
+.include <bsd.prog.mk>
.if !defined(PROG) && ${MK_STAGING} != "no"
.if !defined(_SKIP_BUILD)
# this will handle staging if needed
@@ -116,7 +112,6 @@
.if !empty(PROGS)
stage_files.prog: ${PROGS}
.endif
-.include <bsd.prog.mk>
.endif
.if !target(objwarn)

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 17, 3:58 PM (10 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29832754
Default Alt Text
D3444.id8093.diff (10 KB)

Event Timeline