Annotation of src/share/mk/bsd.prog.mk, Revision 1.43
1.43 ! espie 1: # $OpenBSD: bsd.prog.mk,v 1.42 2004/10/20 09:28:17 espie Exp $
1.3 deraadt 2: # $NetBSD: bsd.prog.mk,v 1.55 1996/04/08 21:19:26 jtc Exp $
1.1 deraadt 3: # @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
4:
5: .if exists(${.CURDIR}/../Makefile.inc)
6: .include "${.CURDIR}/../Makefile.inc"
7: .endif
8:
9: .include <bsd.own.mk>
10:
1.14 deraadt 11: .SUFFIXES: .out .o .c .cc .C .cxx .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0
1.1 deraadt 12:
1.24 espie 13: .if ${WARNINGS:L} == "yes"
14: CFLAGS+= ${CDIAGFLAGS}
15: CXXFLAGS+= ${CXXDIAGFLAGS}
16: .endif
1.18 millert 17: CFLAGS+= ${COPTS}
1.24 espie 18: CXXFLAGS+= ${CXXOPTS}
1.1 deraadt 19:
1.35 espie 20: .if (${ELF_TOOLCHAIN:L} == "yes")
1.8 niklas 21: CRTBEGIN?= ${DESTDIR}/usr/lib/crtbegin.o
22: CRTEND?= ${DESTDIR}/usr/lib/crtend.o
23: .endif
24:
1.1 deraadt 25: LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o
1.31 espie 26: LIB45?= ${DESTDIR}/usr/lib/lib45.a
27: LIBACL?= ${DESTDIR}/usr/lib/libacl.a
28: LIBASN1?= ${DESTDIR}/usr/lib/libasn1.a
1.1 deraadt 29: LIBC?= ${DESTDIR}/usr/lib/libc.a
30: LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a
1.31 espie 31: LIBCRYPTO?= ${DESTDIR}/usr/lib/libcrypto.a
1.1 deraadt 32: LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a
33: LIBDES?= ${DESTDIR}/usr/lib/libdes.a
34: LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a
1.32 millert 35: LIBEVENT?= ${DESTDIR}/usr/lib/libevent.a
1.1 deraadt 36: LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a
1.37 jakob 37: LIBGSSAPI?= ${DESTDIR}/usr/lib/libgssapi.a
1.31 espie 38: LIBHDB?= ${DESTDIR}/usr/lib/libhdb.a
39: LIBKADM?= ${DESTDIR}/usr/lib/libkadm.a
40: LIBKADM5CLNT?= ${DESTDIR}/usr/lib/libkadm5clnt.a
41: LIBKADM5SRV?= ${DESTDIR}/usr/lib/libkadm5srv.a
42: LIBKAFS?= ${DESTDIR}/usr/lib/libkafs.a
1.1 deraadt 43: LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a
1.21 ho 44: LIBKEYNOTE?= ${DESTDIR}/usr/lib/libkeynote.a
1.1 deraadt 45: LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a
1.31 espie 46: LIBKRB5?= ${DESTDIR}/usr/lib/libkrb5.a
1.1 deraadt 47: LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a
1.3 deraadt 48: LIBL?= ${DESTDIR}/usr/lib/libl.a
1.1 deraadt 49: LIBM?= ${DESTDIR}/usr/lib/libm.a
1.4 tholo 50: LIBOLDCURSES?= ${DESTDIR}/usr/lib/libocurses.a
1.31 espie 51: LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a
1.20 millert 52: LIBPERL?= ${DESTDIR}/usr/lib/libperl.a
1.1 deraadt 53: LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a
1.31 espie 54: LIBSECTOK?= ${DESTDIR}/usr/lib/libsectok.a
1.1 deraadt 55: LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a
1.19 beck 56: LIBSSL?= ${DESTDIR}/usr/lib/libssl.a
1.12 deraadt 57: LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a
1.1 deraadt 58: LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a
1.4 tholo 59: LIBTERMLIB?= ${DESTDIR}/usr/lib/libtermlib.a
1.31 espie 60: LIBUSB?= ${DESTDIR}/usr/lib/libusbhid.a
1.1 deraadt 61: LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a
1.11 downsj 62: LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a
1.3 deraadt 63: LIBY?= ${DESTDIR}/usr/lib/liby.a
1.9 mickey 64: LIBZ?= ${DESTDIR}/usr/lib/libz.a
1.31 espie 65:
1.39 miod 66: .if (${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "amd64" || \
67: ${MACHINE_ARCH} == "i386")
68: LIBARCH?= ${DESTDIR}/usr/lib/lib${MACHINE_ARCH}.a
1.31 espie 69: .else
70: LIBARCH?=
71: .endif
72:
73: # old stuff
74: LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a
75: LIBMP?= ${DESTDIR}/usr/lib/libmp.a
76: LIBPC?= ${DESTDIR}/usr/lib/libpc.a
77: LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a
78: LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a
1.1 deraadt 79:
80: .if defined(SHAREDSTRINGS)
81: CLEANFILES+=strings
82: .c.o:
83: ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
84: @${CC} ${CFLAGS} -c x.c -o ${.TARGET}
85: @rm -f x.c
86:
87: .cc.o:
88: ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
89: @mv -f x.c x.cc
90: @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
91: @rm -f x.cc
92:
93: .C.o:
94: ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
95: @mv -f x.c x.C
96: @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
97: @rm -f x.C
1.14 deraadt 98:
99: .cxx.o:
100: ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
101: @mv -f x.c x.cxx
102: @${CXX} ${CXXFLAGS} -c x.cxx -o ${.TARGET}
103: @rm -f x.cxx
1.1 deraadt 104: .endif
105:
106:
107: .if defined(PROG)
108: SRCS?= ${PROG}.c
1.42 espie 109: . if !empty(SRCS:N*.h:N*.sh)
1.1 deraadt 110: OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
111: LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
1.42 espie 112: . endif
1.1 deraadt 113:
1.42 espie 114: . if defined(OBJS) && !empty(OBJS)
115: . if !empty(SRCS:M*.C) || !empty(SRCS:M*.cc) || !empty(SRCS:M*.cxx)
1.8 niklas 116: ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD}
1.42 espie 117: ${CXX} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
118: . else
1.8 niklas 119: ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD}
1.41 espie 120: ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
1.42 espie 121: . endif
122: . endif # defined(OBJS) && !empty(OBJS)
1.41 espie 123:
1.42 espie 124: . if !defined(MAN)
1.1 deraadt 125: MAN= ${PROG}.1
1.42 espie 126: . endif # !defined(MAN)
1.1 deraadt 127: .endif # defined(PROG)
128:
129: .MAIN: all
130: all: ${PROG} _SUBDIRUSE
131:
132: .if !target(clean)
133: clean: _SUBDIRUSE
134: rm -f a.out [Ee]rrs mklog core *.core \
135: ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
136: .endif
137:
138: cleandir: _SUBDIRUSE clean
139:
140: .if !target(install)
141: .if !target(beforeinstall)
142: beforeinstall:
143: .endif
144: .if !target(afterinstall)
145: afterinstall:
146: .endif
147:
148: .if !target(realinstall)
149: realinstall:
150: .if defined(PROG)
1.13 millert 151: ${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} \
1.43 ! espie 152: -m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}/${PROG}
1.1 deraadt 153: .endif
154: .endif
155:
156: install: maninstall _SUBDIRUSE
157: .if defined(LINKS) && !empty(LINKS)
1.28 espie 158: . for lnk file in ${LINKS}
159: @l=${DESTDIR}${lnk}; \
160: t=${DESTDIR}${file}; \
161: echo $$t -\> $$l; \
162: rm -f $$t; ln $$l $$t
163: . endfor
1.1 deraadt 164: .endif
165:
166: maninstall: afterinstall
167: afterinstall: realinstall
168: realinstall: beforeinstall
169: .endif
170:
171: .if !target(lint)
172: lint: ${LOBJS}
173: .if defined(LOBJS) && !empty(LOBJS)
174: @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
175: .endif
176: .endif
177:
178: .if !defined(NOMAN)
179: .include <bsd.man.mk>
180: .endif
181:
182: .if !defined(NONLS)
183: .include <bsd.nls.mk>
184: .endif
185:
186: .include <bsd.obj.mk>
187: .include <bsd.dep.mk>
188: .include <bsd.subdir.mk>
1.3 deraadt 189: .include <bsd.sys.mk>