Skip to content

Commit

Permalink
Merge remote-tracking branch 'freebsd/master' into hardened/current/m…
Browse files Browse the repository at this point in the history
…aster
  • Loading branch information
opntr-auto committed Sep 24, 2015
2 parents ccc813d + 1aac11f commit c0bbd9e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 34 deletions.
22 changes: 22 additions & 0 deletions share/mk/bsd.README
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ LDADD Additional loader objects. Usually used for libraries.

LDADD=-lutil -lcompat

LIBADD Additional libraries. This is for base system libraries
and is only valid inside of the /usr/src tree.
Rather than use LDADD=-lname use LIBADD=name.

LDFLAGS Additional loader flags. Passed to the loader via CC,
since that's used to link programs as well, so loader
specific flags need to be prefixed with -Wl, to work.
Expand All @@ -292,6 +296,20 @@ PROG_CXX If defined, the name of the program to build. Also
standard C++ library. PROG_CXX overrides the value
of PROG if PROG is also set.

PROGS When used with <bsd.progs.mk>, allow building multiple
PROGS_CXX PROG and PROGS_CXX in one Makefile. To define
individual variables for each program the VAR.prog
syntax should be used. For example:

PROGS= foo bar
SRCS.foo= foo_src.c
LDADD.foo= -lutil
SRCS.bar= bar_src.c

The supported variables are BINDIR BINGRP BINMODE BINOWN
CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS DPSRCS LDADD
LDFLAGS LIBADD MAN MLINKS PROGNAME SRCS.

PROGNAME The name that the above program will be installed as, if
different from ${PROG}.

Expand Down Expand Up @@ -394,6 +412,10 @@ LIBMODE Library mode.

LDADD Additional loader objects.

LIBADD Additional libraries. This is for base system libraries
and is only valid inside of the /usr/src tree.
Rather than use LDADD=-lname use LIBADD=name.

MAN The manual pages to be installed (use a .1 - .9 suffix).

SRCS List of source files to build the library. Suffix types
Expand Down
2 changes: 1 addition & 1 deletion share/mk/bsd.prog.mk
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ realinstall: _maninstall
.ORDER: beforeinstall _maninstall
.endif

.endif
.endif # !target(install)

.if !target(lint)
lint: ${SRCS:M*.c}
Expand Down
37 changes: 15 additions & 22 deletions share/mk/bsd.progs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ PROG ?= $t

.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}
PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN PROGNAME \
SRCS
PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LIBADD LINKS \
LDFLAGS MLINKS ${PROG_OVERRIDE_VARS}
.for v in ${PROG_VARS:O:u}
.if empty(${PROG_OVERRIDE_VARS:M$v})
.if defined(${v}.${PROG})
Expand All @@ -60,25 +62,27 @@ UPDATE_DEPENDFILE ?= NO

# prog.mk will do the rest
.else
all: ${FILES} ${PROGS} ${SCRIPTS}
all: ${PROGS}

# We cannot capture dependencies for meta mode here
UPDATE_DEPENDFILE = NO
# nor can we safely run in parallel.
.NOTPARALLEL:
.endif
.endif
.endif # PROGS || PROGS_CXX

# The non-recursive call to bsd.progs.mk will handle FILES; NUL out
# FILESGROUPS so recursive calls don't duplicate the work
# These are handled by the main make process.
.ifdef _RECURSING_PROGS
FILESGROUPS=
_PROGS_GLOBAL_VARS= CLEANFILES CLEANDIRS FILESGROUPS SCRIPTS
.for v in ${_PROGS_GLOBAL_VARS}
$v =
.endfor
.endif

# handle being called [bsd.]progs.mk
.include <bsd.prog.mk>

.ifndef _RECURSING_PROGS
.if !empty(PROGS) && !defined(_RECURSING_PROGS)
# tell progs.mk we might want to install things
PROGS_TARGETS+= checkdpadd clean cleandepend cleandir cleanobj depend install

Expand All @@ -88,12 +92,14 @@ PROGS_TARGETS+= checkdpadd clean cleandepend cleandir cleanobj depend install
x.$p= PROG_CXX=$p
.endif

# Main PROG target
$p ${p}_p: .PHONY .MAKE
(cd ${.CURDIR} && \
DEPENDFILE=.depend.$p \
${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \
SUBDIR= PROG=$p ${x.$p})

# Pseudo targets for PROG, such as 'install'.
.for t in ${PROGS_TARGETS:O:u}
$p.$t: .PHONY .MAKE
(cd ${.CURDIR} && \
Expand All @@ -103,21 +109,8 @@ $p.$t: .PHONY .MAKE
.endfor
.endfor

.if !empty(PROGS)
# Depend main pseudo targets on all PROG.pseudo targets too.
.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
4 changes: 0 additions & 4 deletions share/mk/bsd.test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ test: beforetest realtest
test: aftertest
.endif

.if !empty(SUBDIR)
.include <bsd.subdir.mk>
.endif

.ifdef PROG
# we came here via bsd.progs.mk below
# parent will do staging.
Expand Down
10 changes: 3 additions & 7 deletions share/mk/local.meta.sys.mk
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ OBJTOP:= ${OBJROOT}${TARGET_OBJ_SPEC}
.endif
.endif

.if ${.CURDIR} == ${SRCTOP}
RELDIR = .
.elif ${.CURDIR:M${SRCTOP}/*}
RELDIR := ${.CURDIR:S,${SRCTOP}/,,}
.endif

HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}

.if ${OBJTOP} == ${HOST_OBJTOP} || ${REQUESTED_MACHINE:U${MACHINE}} == "host"
Expand Down Expand Up @@ -165,7 +159,7 @@ STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP}

LDFLAGS_LAST+= -Wl,-rpath-link -Wl,${STAGE_LIBDIR}
.if ${MK_SYSROOT} == "yes"
SYSROOT?= ${STAGE_OBJTOP}/
SYSROOT?= ${STAGE_OBJTOP}
.else
LDFLAGS_LAST+= -L${STAGE_LIBDIR}
.endif
Expand Down Expand Up @@ -214,6 +208,7 @@ TOOLSDIR?= ${HOST_OBJTOP}/tools
.elif defined(STAGE_HOST_OBJTOP) && exists(${STAGE_HOST_OBJTOP}/usr/bin)
TOOLSDIR?= ${STAGE_HOST_OBJTOP}
.endif
.if !empty(TOOLSDIR)
.if ${.MAKE.LEVEL} == 0 && exists(${TOOLSDIR}/usr/bin)
PATH:= ${PATH:S,:, ,g:@d@${exists(${TOOLSDIR}$d):?${TOOLSDIR}$d:}@:ts:}:${PATH}
.export PATH
Expand All @@ -224,6 +219,7 @@ CXX?= ${TOOLSDIR}/usr/bin/c++
.export HOST_CC CC CXX
.endif
.endif
.endif

.if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
# cross-building
Expand Down
6 changes: 6 additions & 0 deletions share/mk/src.sys.env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# make sure this is defined in a consistent manner
SRCTOP:= ${.PARSEDIR:tA:H:H}

.if ${.CURDIR} == ${SRCTOP}
RELDIR = .
.elif ${.CURDIR:M${SRCTOP}/*}
RELDIR := ${.CURDIR:S,${SRCTOP}/,,}
.endif

# site customizations that do not depend on anything!
SRC_ENV_CONF?= /etc/src-env.conf
.if !empty(SRC_ENV_CONF) && !target(_src_env_conf_included_)
Expand Down

0 comments on commit c0bbd9e

Please sign in to comment.