Annotation of src/share/mk/bsd.prog.mk, Revision 1.1
1.1 ! deraadt 1: # $NetBSD: bsd.prog.mk,v 1.53 1995/06/25 22:29:02 cgd Exp $
! 2: # @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
! 3:
! 4: .if exists(${.CURDIR}/../Makefile.inc)
! 5: .include "${.CURDIR}/../Makefile.inc"
! 6: .endif
! 7:
! 8: .include <bsd.own.mk>
! 9:
! 10: .SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0
! 11:
! 12: CFLAGS+= ${COPTS}
! 13:
! 14: LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o
! 15: LIBC?= ${DESTDIR}/usr/lib/libc.a
! 16: LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a
! 17: LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a
! 18: LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a
! 19: LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a
! 20: LIBDES?= ${DESTDIR}/usr/lib/libdes.a
! 21: LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a
! 22: LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a
! 23: LIBL?= ${DESTDIR}/usr/lib/libl.a
! 24: LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a
! 25: LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a
! 26: LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a
! 27: LIBM?= ${DESTDIR}/usr/lib/libm.a
! 28: LIBMP?= ${DESTDIR}/usr/lib/libmp.a
! 29: LIBPC?= ${DESTDIR}/usr/lib/libpc.a
! 30: LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a
! 31: LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a
! 32: LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a
! 33: LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a
! 34: LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a
! 35: LIBUTIL?= ${DESTDIR}/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:
! 44: .cc.o:
! 45: ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
! 46: @mv -f x.c x.cc
! 47: @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
! 48: @rm -f x.cc
! 49:
! 50: .C.o:
! 51: ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
! 52: @mv -f x.c x.C
! 53: @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
! 54: @rm -f x.C
! 55: .endif
! 56:
! 57:
! 58: .if defined(PROG)
! 59: SRCS?= ${PROG}.c
! 60: .if !empty(SRCS:N*.h:N*.sh)
! 61: OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
! 62: LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
! 63: .endif
! 64:
! 65: .if defined(OBJS) && !empty(OBJS)
! 66: .if defined(DESTDIR)
! 67:
! 68: ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! 69: ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc
! 70:
! 71: .else
! 72:
! 73: ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! 74: ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
! 75:
! 76: .endif # defined(DESTDIR)
! 77: .endif # defined(OBJS) && !empty(OBJS)
! 78:
! 79: .if !defined(MAN)
! 80: MAN= ${PROG}.1
! 81: .endif # !defined(MAN)
! 82: .endif # defined(PROG)
! 83:
! 84: .MAIN: all
! 85: all: ${PROG} _SUBDIRUSE
! 86:
! 87: .if !target(clean)
! 88: clean: _SUBDIRUSE
! 89: rm -f a.out [Ee]rrs mklog core *.core \
! 90: ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
! 91: .endif
! 92:
! 93: cleandir: _SUBDIRUSE clean
! 94:
! 95: .if !target(install)
! 96: .if !target(beforeinstall)
! 97: beforeinstall:
! 98: .endif
! 99: .if !target(afterinstall)
! 100: afterinstall:
! 101: .endif
! 102:
! 103: .if !target(realinstall)
! 104: realinstall:
! 105: .if defined(PROG)
! 106: install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
! 107: ${PROG} ${DESTDIR}${BINDIR}
! 108: .endif
! 109: .if defined(HIDEGAME)
! 110: (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG})
! 111: .endif
! 112: .endif
! 113:
! 114: install: maninstall _SUBDIRUSE
! 115: .if defined(LINKS) && !empty(LINKS)
! 116: @set ${LINKS}; \
! 117: while test $$# -ge 2; do \
! 118: l=${DESTDIR}$$1; \
! 119: shift; \
! 120: t=${DESTDIR}$$1; \
! 121: shift; \
! 122: echo $$t -\> $$l; \
! 123: rm -f $$t; \
! 124: ln $$l $$t; \
! 125: done; true
! 126: .endif
! 127:
! 128: maninstall: afterinstall
! 129: afterinstall: realinstall
! 130: realinstall: beforeinstall
! 131: .endif
! 132:
! 133: .if !target(lint)
! 134: lint: ${LOBJS}
! 135: .if defined(LOBJS) && !empty(LOBJS)
! 136: @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
! 137: .endif
! 138: .endif
! 139:
! 140: .if !defined(NOMAN)
! 141: .include <bsd.man.mk>
! 142: .endif
! 143:
! 144: .if !defined(NONLS)
! 145: .include <bsd.nls.mk>
! 146: .endif
! 147:
! 148: .include <bsd.obj.mk>
! 149: .include <bsd.dep.mk>
! 150: .include <bsd.subdir.mk>