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
|
|
|
|
1998-08-08 07:02:08 +00:00
|
|
|
.if !target(__initialized__)
|
|
|
|
__initialized__:
|
1994-08-04 21:09:27 +00:00
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
1994-05-30 19:09:18 +00:00
|
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
|
|
.endif
|
1998-08-08 07:02:08 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1998-06-05 18:38:55 +00:00
|
|
|
.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .s .S
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-09-16 14:30:25 +00:00
|
|
|
CFLAGS+=${COPTS} ${DEBUG_FLAGS}
|
1994-08-04 21:09:27 +00:00
|
|
|
.if defined(DESTDIR)
|
|
|
|
CFLAGS+= -I${DESTDIR}/usr/include
|
1997-05-23 08:38:46 +00:00
|
|
|
CXXINCLUDES+= -I${DESTDIR}/usr/include/g++
|
1994-08-04 21:09:27 +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
|
|
|
|
1997-06-28 08:14:10 +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
|
|
|
|
|
|
|
.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.
|
|
|
|
.if ${SRCS:M*.m} != ""
|
|
|
|
OBJCLIBS?= -lobjc
|
|
|
|
LDADD+= ${OBJCLIBS}
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
|
|
|
|
1998-03-06 06:48:39 +00:00
|
|
|
${PROG}: ${OBJS}
|
1994-08-04 21:09:27 +00:00
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
|
|
|
|
|
1995-05-07 06:39:30 +00:00
|
|
|
.else !defined(SRCS)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1998-02-19 14:53:29 +00:00
|
|
|
.if !target(${PROG})
|
1994-08-28 15:32:10 +00:00
|
|
|
SRCS= ${PROG}.c
|
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}
|
1994-08-28 15:32:10 +00:00
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
|
1994-05-30 19:09:18 +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
|
|
|
|
2001-03-26 08:04:11 +00:00
|
|
|
.if !defined(NOMAN) && !defined(MAN) && \
|
|
|
|
!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
|
|
|
|
|
|
|
|
.MAIN: all
|
2001-03-26 08:04:11 +00:00
|
|
|
.if !defined(NOMAN)
|
2001-04-07 11:13:46 +00:00
|
|
|
all: objwarn ${PROG} ${SCRIPTS} all-man _SUBDIR
|
2001-03-26 08:04:11 +00:00
|
|
|
.else
|
2001-04-07 11:13:46 +00:00
|
|
|
all: objwarn ${PROG} ${SCRIPTS} _SUBDIR
|
2001-03-26 08:04:11 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1998-02-25 02:56:58 +00:00
|
|
|
CLEANFILES+= ${PROG} ${OBJS}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2000-01-09 15:40:32 +00:00
|
|
|
.if defined(PROG)
|
1997-04-09 16:10:27 +00:00
|
|
|
_EXTRADEPEND:
|
1998-08-30 20:33:27 +00:00
|
|
|
.if ${OBJFORMAT} == aout
|
1997-04-09 16:10:27 +00:00
|
|
|
echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \
|
1997-04-23 18:47:42 +00:00
|
|
|
${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE}
|
1997-08-30 23:23:18 +00:00
|
|
|
.else
|
1999-05-06 02:58:30 +00:00
|
|
|
echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
1997-04-09 16:10:27 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
|
1999-07-31 20:27:33 +00:00
|
|
|
_INSTALLFLAGS:= ${INSTALLFLAGS}
|
|
|
|
.for ie in ${INSTALLFLAGS_EDIT}
|
|
|
|
_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
|
|
|
|
.endfor
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
realinstall: beforeinstall
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
2001-04-02 11:44:20 +00:00
|
|
|
.if defined(PROGNAME)
|
|
|
|
${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
|
|
|
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
|
|
|
|
.else
|
1994-08-04 21:09:27 +00:00
|
|
|
${INSTALL} ${COPY} ${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
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(HIDEGAME)
|
2001-06-14 06:08:02 +00:00
|
|
|
(cd ${DESTDIR}${ORIGBINDIR}; ln -fs dm ${PROG}; \
|
|
|
|
chown -h ${BINOWN}:${ORIGBINGRP} ${PROG})
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.if defined(LINKS) && !empty(LINKS)
|
|
|
|
@set ${LINKS}; \
|
|
|
|
while test $$# -ge 2; do \
|
|
|
|
l=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
|
|
|
t=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
1994-08-28 15:32:10 +00:00
|
|
|
${ECHO} $$t -\> $$l; \
|
1999-03-23 03:06:25 +00:00
|
|
|
ln -f $$l $$t; \
|
|
|
|
done; true
|
|
|
|
.endif
|
|
|
|
.if defined(SYMLINKS) && !empty(SYMLINKS)
|
|
|
|
@set ${SYMLINKS}; \
|
|
|
|
while test $$# -ge 2; do \
|
|
|
|
l=$$1; \
|
|
|
|
shift; \
|
|
|
|
t=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
|
|
|
${ECHO} $$t -\> $$l; \
|
|
|
|
ln -fs $$l $$t; \
|
1994-05-30 19:09:18 +00:00
|
|
|
done; true
|
|
|
|
.endif
|
|
|
|
|
2001-04-07 11:13:46 +00:00
|
|
|
.if defined(SCRIPTS) && !empty(SCRIPTS)
|
|
|
|
realinstall: _scriptsinstall
|
|
|
|
|
|
|
|
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}
|
|
|
|
_scriptsinstall: SCRIPTSINS_${script:T}
|
|
|
|
SCRIPTSINS_${script:T}: ${script}
|
|
|
|
${INSTALL} ${COPY} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
|
|
|
|
-g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
|
|
|
|
${_INSTALLFLAGS} ${.ALLSRC} \
|
|
|
|
${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
install: afterinstall _SUBDIR
|
1994-08-04 21:09:27 +00:00
|
|
|
.if !defined(NOMAN)
|
|
|
|
afterinstall: realinstall maninstall
|
|
|
|
.else
|
1994-05-30 19:09:18 +00:00
|
|
|
afterinstall: realinstall
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
1995-01-14 07:51:10 +00:00
|
|
|
DISTRIBUTION?= bin
|
1994-11-13 21:05:28 +00:00
|
|
|
.if !target(distribute)
|
1996-06-24 04:26:21 +00:00
|
|
|
distribute: _SUBDIR
|
1997-06-21 15:40:34 +00:00
|
|
|
.for dist in ${DISTRIBUTION}
|
|
|
|
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
|
|
|
|
.endfor
|
1994-11-13 21:05:28 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(lint)
|
1996-06-24 04:26:21 +00:00
|
|
|
lint: ${SRCS} _SUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
2001-04-19 19:45:19 +00:00
|
|
|
@${LINT} ${LINTFLAGS} ${.ALLSRC} | more 2>&1
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(NOTAGS)
|
|
|
|
tags:
|
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(tags)
|
1996-06-24 04:26:21 +00:00
|
|
|
tags: ${SRCS} _SUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(PROG)
|
1998-03-23 14:58:30 +00:00
|
|
|
@cd ${.CURDIR} && gtags ${GTAGSFLAGS} ${.OBJDIR}
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(HTML)
|
1998-03-23 14:58:30 +00:00
|
|
|
@cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
|
1997-04-13 06:44:25 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !defined(NOMAN)
|
|
|
|
.include <bsd.man.mk>
|
2001-03-27 08:43:28 +00:00
|
|
|
.else
|
|
|
|
.if !target(all-man)
|
|
|
|
all-man:
|
|
|
|
.endif
|
|
|
|
.if !target(maninstall)
|
1994-05-30 19:09:18 +00:00
|
|
|
maninstall:
|
|
|
|
.endif
|
2001-03-27 08:43:28 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1998-03-12 20:02:17 +00:00
|
|
|
.if !target(regress)
|
|
|
|
regress:
|
|
|
|
.endif
|
|
|
|
|
1999-01-22 12:41:27 +00:00
|
|
|
.if ${OBJFORMAT} != aout || make(checkdpadd) || defined(NEED_LIBNAMES)
|
1997-08-30 23:23:18 +00:00
|
|
|
.include <bsd.libnames.mk>
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.include <bsd.dep.mk>
|
1998-03-06 06:48:39 +00:00
|
|
|
|
|
|
|
.if defined(PROG) && !exists(${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>
|