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

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

CVSweb <webmaster@jp.NetBSD.org>