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