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>
|
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
|
|
|
|
|
|
|
|
.if defined(DEBUG_FLAGS)
|
|
|
|
CFLAGS+=${DEBUG_FLAGS}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(CRUNCH_CFLAGS)
|
2003-06-29 18:16:26 +00:00
|
|
|
CFLAGS+=${CRUNCH_CFLAGS}
|
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-02-05 08:44:43 +00:00
|
|
|
.if defined(NOSHARED) && (${NOSHARED} != "no" && ${NOSHARED} != "NO")
|
1994-08-04 21:09:27 +00:00
|
|
|
LDFLAGS+= -static
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-11 10:44:30 +00:00
|
|
|
.if defined(PROG_CXX)
|
|
|
|
PROG= ${PROG_CXX}
|
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
|
|
|
.if defined(SRCS)
|
|
|
|
|
1998-05-15 09:30:13 +00:00
|
|
|
# If there are Objective C sources, link with Objective C libraries.
|
2004-01-27 23:22:15 +00:00
|
|
|
.if !empty(SRCS:M*.m)
|
1998-05-15 09:30:13 +00:00
|
|
|
OBJCLIBS?= -lobjc
|
|
|
|
LDADD+= ${OBJCLIBS}
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
|
|
|
|
2002-04-12 16:25:13 +00:00
|
|
|
${PROG}: ${OBJS}
|
|
|
|
.if defined(PROG_CXX)
|
|
|
|
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
.else
|
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
|
|
|
.endif
|
|
|
|
|
1995-05-07 06:39:30 +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.
|
|
|
|
OBJS= ${PROG}.o
|
1998-02-19 14:53:29 +00:00
|
|
|
|
1998-03-06 06:48:39 +00:00
|
|
|
${PROG}: ${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
|
2002-04-12 16:25:13 +00:00
|
|
|
.endif
|
1998-02-19 14:53:29 +00:00
|
|
|
|
1998-02-19 01:30:23 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2004-12-21 08:47:35 +00:00
|
|
|
.if !defined(NO_MAN) && !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) && \
|
2000-03-23 16:46:20 +00:00
|
|
|
!defined(MAN7) && !defined(MAN8) && !defined(MAN9) && \
|
2001-03-26 08:04:11 +00:00
|
|
|
!defined(MAN1aout)
|
2001-03-28 15:07:48 +00:00
|
|
|
MAN= ${PROG}.1
|
|
|
|
MAN1= ${MAN}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2002-06-03 14:49:34 +00:00
|
|
|
all: objwarn ${PROG} ${SCRIPTS}
|
2004-12-21 08:47:35 +00:00
|
|
|
.if !defined(NO_MAN)
|
2002-05-07 15:42:56 +00:00
|
|
|
all: _manpages
|
2001-03-26 08:04:11 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(PROG)
|
|
|
|
CLEANFILES+= ${PROG}
|
|
|
|
.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)
|
|
|
|
echo ${PROG}: ${DPADD} >> ${DEPENDFILE}
|
|
|
|
.endif
|
|
|
|
.else
|
1999-05-06 02:58:30 +00:00
|
|
|
echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
|
2002-04-12 08:17:24 +00:00
|
|
|
.if defined(PROG_CXX)
|
|
|
|
echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
|
|
|
|
.endif
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
2004-02-09 14:05:17 +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)
|
2001-04-02 11:44:20 +00:00
|
|
|
.if defined(PROGNAME)
|
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}
|
|
|
|
.else
|
2002-07-29 09:40:17 +00:00
|
|
|
${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
1999-07-31 20:27:33 +00:00
|
|
|
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2001-04-02 11:44:20 +00:00
|
|
|
.endif
|
2002-04-29 16:00:30 +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}
|
|
|
|
|
|
|
|
.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}
|
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>
|
|
|
|
|
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
|
|
|
|
2004-12-21 08:47:35 +00:00
|
|
|
.if !defined(NO_MAN)
|
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
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.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
|
|
|
|
|
2004-12-21 08:47:35 +00:00
|
|
|
.if !defined(NO_MAN)
|
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>
|
2004-12-20 15:46:56 +00:00
|
|
|
|
|
|
|
.if defined(PORTNAME)
|
|
|
|
.include <bsd.pkg.mk>
|
|
|
|
.endif
|