1994-08-04 21:09:27 +00:00
|
|
|
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
|
1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-17 13:49:29 +00:00
|
|
|
.include <bsd.init.mk>
|
2014-05-07 18:15:02 +00:00
|
|
|
.include <bsd.compiler.mk>
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-09-20 19:32:51 +00:00
|
|
|
.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2004-08-13 14:30:26 +00:00
|
|
|
# XXX The use of COPTS in modern makefiles is discouraged.
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(COPTS)
|
|
|
|
CFLAGS+=${COPTS}
|
|
|
|
.endif
|
|
|
|
|
2006-09-11 05:35:57 +00:00
|
|
|
.if ${MK_ASSERT_DEBUG} == "no"
|
|
|
|
CFLAGS+= -DNDEBUG
|
2006-09-13 23:27:21 +00:00
|
|
|
NO_WERROR=
|
2006-09-11 05:35:57 +00:00
|
|
|
.endif
|
|
|
|
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(DEBUG_FLAGS)
|
|
|
|
CFLAGS+=${DEBUG_FLAGS}
|
2010-02-18 03:32:51 +00:00
|
|
|
CXXFLAGS+=${DEBUG_FLAGS}
|
2008-05-22 01:14:43 +00:00
|
|
|
|
2011-11-30 18:11:49 +00:00
|
|
|
.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
|
2008-05-22 01:14:43 +00:00
|
|
|
CTFFLAGS+= -g
|
|
|
|
.endif
|
2003-08-31 15:20:17 +00:00
|
|
|
.endif
|
|
|
|
|
2013-06-07 21:40:02 +00:00
|
|
|
.if defined(PROG_CXX)
|
|
|
|
PROG= ${PROG_CXX}
|
|
|
|
.endif
|
|
|
|
|
2014-09-02 19:05:34 +00:00
|
|
|
.if !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static)
|
2013-06-07 21:40:02 +00:00
|
|
|
MK_DEBUG_FILES= no
|
|
|
|
.endif
|
|
|
|
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(CRUNCH_CFLAGS)
|
2003-06-29 18:16:26 +00:00
|
|
|
CFLAGS+=${CRUNCH_CFLAGS}
|
2013-06-07 21:40:02 +00:00
|
|
|
.else
|
|
|
|
.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
|
|
|
|
empty(DEBUG_FLAGS:M-gdwarf-*)
|
|
|
|
CFLAGS+= -g
|
|
|
|
CTFFLAGS+= -g
|
|
|
|
.endif
|
2003-08-31 15:20:17 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-09-16 14:30:25 +00:00
|
|
|
.if !defined(DEBUG_FLAGS)
|
1994-05-30 19:09:18 +00:00
|
|
|
STRIP?= -s
|
1994-09-16 14:30:25 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2004-12-21 09:59:45 +00:00
|
|
|
.if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
|
1994-08-04 21:09:27 +00:00
|
|
|
LDFLAGS+= -static
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
PROG_FULL=${PROG}.full
|
|
|
|
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
|
|
|
|
.if defined(BINDIR) && (\
|
|
|
|
${BINDIR} == "/bin" ||\
|
|
|
|
${BINDIR} == "/libexec" ||\
|
|
|
|
${BINDIR} == "/sbin" ||\
|
Step 1 of eliminating the "games" distribution: Move binaries to /usr/bin;
update paths; and include everything in the "base" distribution.
The "games" distribution being optional made sense when there were more
games and we had small disks; but the "games-like" games were moved into
the ports tree a dozen years ago and the remaining "utility-like" games
occupy less than 0.001% of my laptop's small hard drive. Meanwhile every
new user is confronted by the question "do you want games installed" when
they they try to install FreeBSD.
The next steps will be:
2. Removing punch card (bcd, ppt), phase-of-moon (pom), clock (grdc), and
caesar cipher (caesar, rot13) utilities. I intend to keep fortune, factor,
morse, number, primes, and random, since there is evidence that those are
still being used.
3. Merging src/games into src/usr.bin.
This change will not be MFCed.
Reviewed by: jmg
Discussed at: EuroBSDCon
Approved by: gjb (release-affecting changes)
2015-02-12 05:35:00 +00:00
|
|
|
${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin)(/.*)?%/usr/bin%} == "/usr/bin"\
|
2013-06-07 21:40:02 +00:00
|
|
|
)
|
|
|
|
DEBUGFILEDIR= ${DEBUGDIR}${BINDIR}
|
|
|
|
.else
|
|
|
|
DEBUGFILEDIR?= ${BINDIR}/.debug
|
|
|
|
DEBUGMKDIR=
|
|
|
|
.endif
|
|
|
|
.else
|
|
|
|
PROG_FULL= ${PROG}
|
2002-04-11 10:44:30 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
2013-03-26 20:32:46 +00:00
|
|
|
PROGNAME?= ${PROG}
|
2013-06-07 21:40:02 +00:00
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(SRCS)
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
|
|
|
|
2010-09-10 16:21:09 +00:00
|
|
|
.if target(beforelinking)
|
2012-12-31 21:54:43 +00:00
|
|
|
beforelinking: ${OBJS}
|
2013-06-07 21:40:02 +00:00
|
|
|
${PROG_FULL}: beforelinking
|
2010-09-10 16:21:09 +00:00
|
|
|
.endif
|
2013-06-07 21:40:02 +00:00
|
|
|
${PROG_FULL}: ${OBJS}
|
2002-04-12 16:25:13 +00:00
|
|
|
.if defined(PROG_CXX)
|
|
|
|
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
.else
|
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
.endif
|
2011-11-30 18:11:49 +00:00
|
|
|
.if ${MK_CTF} != "no"
|
2011-11-29 08:38:47 +00:00
|
|
|
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
|
|
|
|
.endif
|
2002-04-12 16:25:13 +00:00
|
|
|
|
2005-04-11 07:13:29 +00:00
|
|
|
.else # !defined(SRCS)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-12 16:25:13 +00:00
|
|
|
.if !target(${PROG})
|
2002-04-11 10:44:30 +00:00
|
|
|
.if defined(PROG_CXX)
|
|
|
|
SRCS= ${PROG}.cc
|
|
|
|
.else
|
1994-08-28 15:32:10 +00:00
|
|
|
SRCS= ${PROG}.c
|
2002-04-11 10:44:30 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-28 15:32:10 +00:00
|
|
|
# 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.
|
2013-03-26 18:46:40 +00:00
|
|
|
OBJS+= ${PROG}.o
|
1998-02-19 14:53:29 +00:00
|
|
|
|
2010-09-10 16:21:09 +00:00
|
|
|
.if target(beforelinking)
|
2012-12-31 21:54:43 +00:00
|
|
|
beforelinking: ${OBJS}
|
2013-06-07 21:40:02 +00:00
|
|
|
${PROG_FULL}: beforelinking
|
2010-09-10 16:21:09 +00:00
|
|
|
.endif
|
2013-06-07 21:40:02 +00:00
|
|
|
${PROG_FULL}: ${OBJS}
|
2002-04-12 08:17:24 +00:00
|
|
|
.if defined(PROG_CXX)
|
|
|
|
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
.else
|
2002-04-11 08:54:21 +00:00
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2011-11-30 18:11:49 +00:00
|
|
|
.if ${MK_CTF} != "no"
|
2011-11-29 08:38:47 +00:00
|
|
|
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
|
|
|
|
.endif
|
2013-06-07 21:40:02 +00:00
|
|
|
.endif # !target(${PROG})
|
1998-02-19 14:53:29 +00:00
|
|
|
|
2012-12-14 18:30:01 +00:00
|
|
|
.endif # !defined(SRCS)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
${PROG}: ${PROG_FULL} ${PROGNAME}.debug
|
|
|
|
${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \
|
|
|
|
${PROG_FULL} ${.TARGET}
|
|
|
|
|
|
|
|
${PROGNAME}.debug: ${PROG_FULL}
|
|
|
|
${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET}
|
|
|
|
.endif
|
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no" && !defined(MAN) && \
|
2001-03-26 08:04:11 +00:00
|
|
|
!defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
|
1994-05-30 19:09:18 +00:00
|
|
|
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
|
2013-01-16 23:21:04 +00:00
|
|
|
!defined(MAN7) && !defined(MAN8) && !defined(MAN9)
|
2001-03-28 15:07:48 +00:00
|
|
|
MAN= ${PROG}.1
|
|
|
|
MAN1= ${MAN}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2012-12-14 18:30:01 +00:00
|
|
|
.endif # defined(PROG)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
.if defined(_SKIP_BUILD)
|
|
|
|
all:
|
|
|
|
.else
|
2014-08-13 01:27:51 +00:00
|
|
|
all: beforebuild .WAIT ${PROG} ${SCRIPTS}
|
|
|
|
beforebuild: objwarn
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
2002-05-07 15:42:56 +00:00
|
|
|
all: _manpages
|
2001-03-26 08:04:11 +00:00
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(PROG)
|
|
|
|
CLEANFILES+= ${PROG}
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
CLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug
|
|
|
|
.endif
|
2003-08-31 15:20:17 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(OBJS)
|
|
|
|
CLEANFILES+= ${OBJS}
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2004-02-09 14:05:17 +00:00
|
|
|
.include <bsd.libnames.mk>
|
|
|
|
|
2000-01-09 15:40:32 +00:00
|
|
|
.if defined(PROG)
|
1997-04-09 16:10:27 +00:00
|
|
|
_EXTRADEPEND:
|
2004-02-09 14:05:17 +00:00
|
|
|
.if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib)
|
|
|
|
.if defined(DPADD) && !empty(DPADD)
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE}
|
2004-02-09 14:05:17 +00:00
|
|
|
.endif
|
|
|
|
.else
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
|
2014-05-10 16:38:03 +00:00
|
|
|
.if defined(PROG_CXX)
|
2014-03-30 23:43:30 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang" && empty(CXXFLAGS:M-stdlib=libstdc++)
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
|
2012-08-25 19:30:15 +00:00
|
|
|
.else
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${PROG_FULL}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
|
2002-04-12 08:17:24 +00:00
|
|
|
.endif
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
2004-02-09 14:05:17 +00:00
|
|
|
.endif
|
2012-08-25 19:30:15 +00:00
|
|
|
.endif
|
1997-04-09 16:10:27 +00:00
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(install)
|
|
|
|
|
2004-11-12 13:24:34 +00:00
|
|
|
.if defined(PRECIOUSPROG)
|
2004-12-21 09:53:14 +00:00
|
|
|
.if !defined(NO_FSCHG)
|
2004-11-03 18:01:21 +00:00
|
|
|
INSTALLFLAGS+= -fschg
|
|
|
|
.endif
|
2004-11-12 13:24:34 +00:00
|
|
|
INSTALLFLAGS+= -S
|
|
|
|
.endif
|
2004-11-03 18:01:21 +00:00
|
|
|
|
1999-07-31 20:27:33 +00:00
|
|
|
_INSTALLFLAGS:= ${INSTALLFLAGS}
|
|
|
|
.for ie in ${INSTALLFLAGS_EDIT}
|
|
|
|
_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
|
|
|
|
.endfor
|
|
|
|
|
2004-02-09 14:05:17 +00:00
|
|
|
.if !target(realinstall) && !defined(INTERNALPROG)
|
2002-05-07 15:30:49 +00:00
|
|
|
realinstall: _proginstall
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall _proginstall
|
2002-05-07 15:30:49 +00:00
|
|
|
_proginstall:
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
2002-07-29 09:40:17 +00:00
|
|
|
${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
2001-04-02 11:44:20 +00:00
|
|
|
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
.if defined(DEBUGMKDIR)
|
|
|
|
${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}
|
|
|
|
.endif
|
|
|
|
${INSTALL} -T debug -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \
|
|
|
|
${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug
|
|
|
|
.endif
|
2001-04-02 11:44:20 +00:00
|
|
|
.endif
|
2005-04-11 07:13:29 +00:00
|
|
|
.endif # !target(realinstall)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2001-04-07 11:13:46 +00:00
|
|
|
.if defined(SCRIPTS) && !empty(SCRIPTS)
|
|
|
|
realinstall: _scriptsinstall
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall _scriptsinstall
|
2001-04-07 11:13:46 +00:00
|
|
|
|
|
|
|
SCRIPTSDIR?= ${BINDIR}
|
|
|
|
SCRIPTSOWN?= ${BINOWN}
|
|
|
|
SCRIPTSGRP?= ${BINGRP}
|
|
|
|
SCRIPTSMODE?= ${BINMODE}
|
|
|
|
|
2013-01-29 00:07:54 +00:00
|
|
|
STAGE_AS_SETS+= scripts
|
|
|
|
stage_as.scripts: ${SCRIPTS}
|
|
|
|
FLAGS.stage_as.scripts= -m ${SCRIPTSMODE}
|
|
|
|
STAGE_FILES_DIR.scripts= ${STAGE_OBJTOP}
|
2001-04-07 11:13:46 +00:00
|
|
|
.for script in ${SCRIPTS}
|
|
|
|
.if defined(SCRIPTSNAME)
|
|
|
|
SCRIPTSNAME_${script:T}?= ${SCRIPTSNAME}
|
|
|
|
.else
|
|
|
|
SCRIPTSNAME_${script:T}?= ${script:T:R}
|
|
|
|
.endif
|
|
|
|
SCRIPTSDIR_${script:T}?= ${SCRIPTSDIR}
|
|
|
|
SCRIPTSOWN_${script:T}?= ${SCRIPTSOWN}
|
|
|
|
SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP}
|
|
|
|
SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE}
|
2013-01-29 00:07:54 +00:00
|
|
|
STAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}}
|
2001-12-17 13:59:35 +00:00
|
|
|
_scriptsinstall: _SCRIPTSINS_${script:T}
|
|
|
|
_SCRIPTSINS_${script:T}: ${script}
|
2002-07-29 09:40:17 +00:00
|
|
|
${INSTALL} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
|
2001-04-07 11:13:46 +00:00
|
|
|
-g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
|
2002-04-17 16:29:02 +00:00
|
|
|
${.ALLSRC} \
|
2001-04-07 11:13:46 +00:00
|
|
|
${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2002-07-02 12:37:09 +00:00
|
|
|
NLSNAME?= ${PROG}
|
|
|
|
.include <bsd.nls.mk>
|
|
|
|
|
2015-10-09 21:57:42 +00:00
|
|
|
.include <bsd.confs.mk>
|
2002-06-03 14:49:34 +00:00
|
|
|
.include <bsd.files.mk>
|
2002-05-15 16:19:54 +00:00
|
|
|
.include <bsd.incs.mk>
|
2002-07-02 12:16:54 +00:00
|
|
|
.include <bsd.links.mk>
|
2002-05-12 16:01:00 +00:00
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
2002-05-07 15:42:56 +00:00
|
|
|
realinstall: _maninstall
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall _maninstall
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
2002-05-07 15:30:49 +00:00
|
|
|
|
2015-09-23 23:20:49 +00:00
|
|
|
.endif # !target(install)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.if !target(lint)
|
2002-09-20 19:32:51 +00:00
|
|
|
lint: ${SRCS:M*.c}
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
2002-09-20 19:32:51 +00:00
|
|
|
${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
1994-05-30 19:09:18 +00:00
|
|
|
.include <bsd.man.mk>
|
1998-03-12 20:02:17 +00:00
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.include <bsd.dep.mk>
|
1998-03-06 06:48:39 +00:00
|
|
|
|
2002-04-07 14:58:12 +00:00
|
|
|
.if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE})
|
1998-03-06 07:28:01 +00:00
|
|
|
${OBJS}: ${SRCS:M*.h}
|
1998-03-06 06:48:39 +00:00
|
|
|
.endif
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
.include <bsd.obj.mk>
|
2001-05-19 23:18:21 +00:00
|
|
|
|
|
|
|
.include <bsd.sys.mk>
|