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