[BACK]Return to bsd.prog.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

Annotation of src/share/mk/bsd.prog.mk, Revision 1.8

1.1       cgd         1: #      @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
                      2:
                      3: .if exists(${.CURDIR}/../Makefile.inc)
                      4: .include "${.CURDIR}/../Makefile.inc"
                      5: .endif
                      6:
                      7: .SUFFIXES: .out .o .c .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0
                      8:
                      9: .8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:
                     10:        nroff -mandoc ${.IMPSRC} > ${.TARGET}
                     11:
                     12: CFLAGS+=${COPTS}
                     13:
                     14: STRIP?=        -s
                     15:
                     16: BINGRP?=       bin
                     17: BINOWN?=       bin
                     18: BINMODE?=      555
                     19:
1.4       nate       20:
                     21: LIBCRT0?=      /usr/lib/crt0.o
1.1       cgd        22: LIBC?=         /usr/lib/libc.a
                     23: LIBCOMPAT?=    /usr/lib/libcompat.a
                     24: LIBCURSES?=    /usr/lib/libcurses.a
                     25: LIBDBM?=       /usr/lib/libdbm.a
                     26: LIBDES?=       /usr/lib/libdes.a
                     27: LIBL?=         /usr/lib/libl.a
                     28: LIBKDB?=       /usr/lib/libkdb.a
                     29: LIBKRB?=       /usr/lib/libkrb.a
                     30: LIBM?=         /usr/lib/libm.a
                     31: LIBMP?=                /usr/lib/libmp.a
                     32: LIBPC?=                /usr/lib/libpc.a
                     33: LIBPLOT?=      /usr/lib/libplot.a
                     34: LIBRESOLV?=    /usr/lib/libresolv.a
1.5       cgd        35: LIBRPC?=       /usr/lib/librpc.a
1.1       cgd        36: LIBTERM?=      /usr/lib/libterm.a
                     37: LIBUTIL?=      /usr/lib/libutil.a
                     38:
                     39: .if defined(SHAREDSTRINGS)
                     40: CLEANFILES+=strings
                     41: .c.o:
                     42:        ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
                     43:        @${CC} ${CFLAGS} -c x.c -o ${.TARGET}
                     44:        @rm -f x.c
                     45: .endif
                     46:
                     47: .if defined(PROG)
                     48: .if defined(SRCS)
                     49:
                     50: OBJS+=  ${SRCS:R:S/$/.o/g}
                     51:
1.4       nate       52: .if defined(LDONLY)
                     53:
                     54: ${PROG}: ${LIBCRT0} ${LIBC} ${OBJS} ${DPADD}
                     55:        ${LD} ${LDFLAGS} -o ${.TARGET} ${LIBCRT0} ${OBJS} ${LIBC} ${LDADD}
                     56:
                     57: .else defined(LDONLY)
                     58:
1.1       cgd        59: ${PROG}: ${OBJS} ${LIBC} ${DPADD}
                     60:        ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
                     61:
1.4       nate       62: .endif
                     63:
1.1       cgd        64: .else defined(PROG)
                     65:
                     66: SRCS= ${PROG}.c
                     67:
                     68: ${PROG}: ${SRCS} ${LIBC} ${DPADD}
                     69:        ${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD}
                     70:
                     71: MKDEP= -p
                     72:
                     73: .endif
                     74:
                     75: .if    !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
                     76:        !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
                     77:        !defined(MAN7) && !defined(MAN8) && !defined(NOMAN)
                     78: MAN1=  ${PROG}.0
                     79: .endif
                     80: .endif
                     81: MANALL=        ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
                     82:
                     83: _PROGSUBDIR: .USE
                     84: .if defined(SUBDIR) && !empty(SUBDIR)
                     85:        @for entry in ${SUBDIR}; do \
                     86:                (echo "===> $$entry"; \
                     87:                if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
                     88:                        cd ${.CURDIR}/$${entry}.${MACHINE}; \
                     89:                else \
                     90:                        cd ${.CURDIR}/$${entry}; \
                     91:                fi; \
                     92:                ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \
                     93:        done
                     94: .endif
                     95:
                     96: .MAIN: all
                     97: all: ${PROG} ${MANALL} _PROGSUBDIR
                     98:
                     99: .if !target(clean)
                    100: clean: _PROGSUBDIR
                    101:        rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
                    102: .endif
                    103:
                    104: .if !target(cleandir)
                    105: cleandir: _PROGSUBDIR
1.8     ! cgd       106:        rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
1.1       cgd       107:        rm -f .depend ${MANALL}
                    108: .endif
                    109:
                    110: # some of the rules involve .h sources, so remove them from mkdep line
                    111: .if !target(depend)
                    112: depend: .depend _PROGSUBDIR
                    113: .depend: ${SRCS}
                    114: .if defined(PROG)
                    115:        mkdep ${MKDEP} ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c}
                    116: .endif
                    117: .endif
                    118:
                    119: .if !target(install)
                    120: .if !target(beforeinstall)
                    121: beforeinstall:
1.8     ! cgd       122:        @if [ ! -d "${DESTDIR}${BINDIR}" ]; then \
1.7       cgd       123:                 /bin/rm -f ${DESTDIR}${BINDIR} ; \
1.6       cgd       124:                 mkdir -p ${DESTDIR}${BINDIR} ; \
                    125:                 chown root.wheel ${DESTDIR}${BINDIR} ; \
                    126:                 chmod 755 ${DESTDIR}${BINDIR} ; \
                    127:         else \
                    128:                 true ; \
                    129:         fi
1.1       cgd       130: .endif
                    131: .if !target(afterinstall)
                    132: afterinstall:
                    133: .endif
                    134:
                    135: realinstall: _PROGSUBDIR
                    136: .if defined(PROG)
1.4       nate      137:        install -c ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
1.1       cgd       138:            ${PROG} ${DESTDIR}${BINDIR}
                    139: .endif
                    140: .if defined(HIDEGAME)
                    141:        (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
                    142:            chown games.bin ${PROG})
                    143: .endif
                    144: .if defined(LINKS) && !empty(LINKS)
                    145:        @set ${LINKS}; \
                    146:        while test $$# -ge 2; do \
                    147:                l=${DESTDIR}$$1; \
                    148:                shift; \
                    149:                t=${DESTDIR}$$1; \
                    150:                shift; \
                    151:                echo $$t -\> $$l; \
                    152:                rm -f $$t; \
                    153:                ln $$l $$t; \
                    154:        done; true
                    155: .endif
                    156:
                    157: install: maninstall
                    158: maninstall: afterinstall
                    159: afterinstall: realinstall
                    160: realinstall: beforeinstall
                    161: .endif
                    162:
                    163: .if !target(lint)
                    164: lint: ${SRCS} _PROGSUBDIR
                    165: .if defined(PROG)
                    166:        @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1
                    167: .endif
                    168: .endif
                    169:
                    170: .if !target(obj)
                    171: .if defined(NOOBJ)
                    172: obj: _PROGSUBDIR
                    173: .else
                    174: obj: _PROGSUBDIR
1.3       cgd       175:        @cd ${.CURDIR}; rm -f obj > /dev/null 2>&1 || true; \
1.2       cgd       176:        here=`pwd`; subdir=`echo $$here | sed 's,^/usr/src/,,'`; \
                    177:        if test $$here != $$subdir ; then \
                    178:                dest=/usr/obj/$$subdir ; \
                    179:                echo "$$here -> $$dest"; ln -s $$dest obj; \
                    180:                if test -d /usr/obj -a ! -d $$dest; then \
                    181:                        mkdir -p $$dest; \
                    182:                else \
                    183:                        true; \
                    184:                fi; \
1.1       cgd       185:        else \
1.2       cgd       186:                true ; \
                    187:                dest=$$here/obj ; \
                    188:                echo "making $$here/obj" ; \
                    189:                if test ! -d obj ; then \
                    190:                        mkdir $$here/obj; \
                    191:                fi ; \
1.1       cgd       192:        fi;
                    193: .endif
                    194: .endif
                    195:
                    196: .if !target(tags)
                    197: tags: ${SRCS} _PROGSUBDIR
                    198: .if defined(PROG)
                    199:        -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \
                    200:            sed "s;\${.CURDIR}/;;" > tags
                    201: .endif
                    202: .endif
                    203:
                    204: .if !defined(NOMAN)
                    205: .include <bsd.man.mk>
                    206: .endif

CVSweb <webmaster@jp.NetBSD.org>