version 1.73, 2017/07/04 00:59:11 |
version 1.74, 2017/07/09 15:29:52 |
|
|
.endif |
.endif |
|
|
.if defined(PROG) |
.if defined(PROG) |
SRCS?= ${PROG}.c |
SRCS ?= ${PROG}.c |
|
MAN ?= ${PROG}.1 |
|
.endif |
|
|
|
# if we have several progs, define appropriate vars instead |
|
.if defined(PROGS) |
|
. for p in ${PROGS} |
|
SRCS_$p ?= $p.c |
|
OBJS_$p = ${SRCS_$p:N*.h:N*.sh:R:S/$/.o/} |
|
DPADD_$p ?= ${DPADD} |
|
LDADD_$p ?= ${LDADD} |
|
|
|
# XXX still create SRCS, because it's what bsd.dep.mk understands |
|
SRCS += ${SRCS_$p} |
|
|
|
# and we can write the actual target already |
|
. if defined(OBJS_$p) && !empty(OBJS_$p) |
|
. if !empty(SRCS_$p:M*.C) || !empty(SRCS_$p:M*.cc) || \ |
|
!empty(SRCS_$p:M*.cpp) || !empty(SRCS_$p:M*.cxx) |
|
$p: ${LIBCRT0} ${OBJS_$p} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD_$p} |
|
${CXX} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS_$p} ${LDADD_$p} |
|
. else |
|
$p: ${LIBCRT0} ${OBJS_$p} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD_$p} |
|
${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS_$p} ${LDADD_$p} |
|
. endif |
|
. endif |
|
. endfor |
|
MAN ?= ${PROGS:=.1} |
|
.endif |
|
|
|
.if defined(PROG) || defined(PROGS) |
|
# ... so we create appropriate full list of obj, dep, lex, yacc... |
. if !empty(SRCS:N*.h:N*.sh) |
. if !empty(SRCS:N*.h:N*.sh) |
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/} |
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/} |
DEPS+= ${OBJS:R:S/$/.d/} |
DEPS+= ${OBJS:.o=.d} |
|
. endif |
|
|
_LEXINTM?=${SRCS:M*.l:.l=.c} |
_LEXINTM?=${SRCS:M*.l:.l=.c} |
_YACCINTM?=${SRCS:M*.y:.y=.c} |
_YACCINTM?=${SRCS:M*.y:.y=.c} |
. endif |
.endif |
|
|
|
.if defined(PROG) |
. if defined(OBJS) && !empty(OBJS) |
. if defined(OBJS) && !empty(OBJS) |
. if !empty(SRCS:M*.C) || !empty(SRCS:M*.cc) || !empty(SRCS:M*.cpp) || \ |
. if !empty(SRCS:M*.C) || !empty(SRCS:M*.cc) || \ |
!empty(SRCS:M*.cxx) |
!empty(SRCS:M*.cpp) || !empty(SRCS:M*.cxx) |
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD} |
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD} |
${CXX} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} |
${CXX} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} |
. else |
. else |
|
|
${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} |
${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} |
. endif |
. endif |
. endif # defined(OBJS) && !empty(OBJS) |
. endif # defined(OBJS) && !empty(OBJS) |
|
.endif |
|
|
. if !defined(MAN) |
|
MAN= ${PROG}.1 |
|
. endif # !defined(MAN) |
|
.endif # defined(PROG) |
|
|
|
.MAIN: all |
.MAIN: all |
all: ${PROG} _SUBDIRUSE |
all: ${PROG} ${PROGS} _SUBDIRUSE |
|
|
BUILDAFTER += ${PROG} ${OBJS} |
BUILDAFTER += ${PROG} ${PROGS} ${OBJS} |
|
|
.if !target(clean) |
.if !target(clean) |
clean: _SUBDIRUSE |
clean: _SUBDIRUSE |
rm -f a.out [Ee]rrs mklog *.core y.tab.h \ |
rm -f a.out [Ee]rrs mklog *.core y.tab.h \ |
${PROG} ${OBJS} ${_LEXINTM} ${_YACCINTM} ${CLEANFILES} |
${PROG} ${PROGS} ${OBJS} ${_LEXINTM} ${_YACCINTM} ${CLEANFILES} |
.endif |
.endif |
|
|
cleandir: _SUBDIRUSE clean |
cleandir: _SUBDIRUSE clean |
|
|
|
|
.if !target(realinstall) |
.if !target(realinstall) |
realinstall: |
realinstall: |
.if defined(PROG) |
. if defined(PROG) |
${INSTALL} ${INSTALL_COPY} -S ${INSTALL_STRIP} \ |
${INSTALL} ${INSTALL_COPY} -S ${INSTALL_STRIP} \ |
-o ${BINOWN} -g ${BINGRP} \ |
-o ${BINOWN} -g ${BINGRP} \ |
-m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}/${PROG} |
-m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}/${PROG} |
.endif |
. endif |
|
. if defined(PROGS) |
|
. for p in ${PROGS} |
|
${INSTALL} ${INSTALL_COPY} -S ${INSTALL_STRIP} \ |
|
-o ${BINOWN} -g ${BINGRP} \ |
|
-m ${BINMODE} $p ${DESTDIR}${BINDIR}/$p |
|
. endfor |
|
. endif |
.endif |
.endif |
|
|
install: maninstall _SUBDIRUSE |
install: maninstall _SUBDIRUSE |