[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.3

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

CVSweb <webmaster@jp.NetBSD.org>