Annotation of src/share/mk/bsd.prog.mk, Revision 1.55
1.55 ! pascal 1: # $OpenBSD: bsd.prog.mk,v 1.54 2012/08/22 19:41:56 pascal 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.53 jsg 11: .SUFFIXES: .out .o .c .cc .C .cxx .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0
1.54 pascal 12:
13: .if defined(LDSTATIC) || defined(NOPIE)
14: CFLAGS+= ${NOPIE_FLAGS}
15: AFLAGS+= ${NOPIE_FLAGS}
1.55 ! pascal 16: LDFLAGS+= -nopie
1.54 pascal 17: .endif
1.1 deraadt 18:
1.24 espie 19: .if ${WARNINGS:L} == "yes"
20: CFLAGS+= ${CDIAGFLAGS}
21: CXXFLAGS+= ${CXXDIAGFLAGS}
22: .endif
1.18 millert 23: CFLAGS+= ${COPTS}
1.24 espie 24: CXXFLAGS+= ${CXXOPTS}
1.1 deraadt 25:
1.48 brad 26: .if ${ELF_TOOLCHAIN:L} == "yes"
1.8 niklas 27: CRTBEGIN?= ${DESTDIR}/usr/lib/crtbegin.o
28: CRTEND?= ${DESTDIR}/usr/lib/crtend.o
29: .endif
30:
1.1 deraadt 31: LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o
1.31 espie 32: LIBASN1?= ${DESTDIR}/usr/lib/libasn1.a
1.1 deraadt 33: LIBC?= ${DESTDIR}/usr/lib/libc.a
34: LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a
1.50 miod 35: LIBCOM_ERR?= ${DESTDIR}/usr/lib/libcom_err.a
1.31 espie 36: LIBCRYPTO?= ${DESTDIR}/usr/lib/libcrypto.a
1.1 deraadt 37: LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a
38: LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a
1.32 millert 39: LIBEVENT?= ${DESTDIR}/usr/lib/libevent.a
1.50 miod 40: LIBEXPAT?= ${DESTDIR}/usr/lib/libexpat.a
41: LIBFORM?= ${DESTDIR}/usr/lib/libform.a
42: LIBFORMW?= ${DESTDIR}/usr/lib/libformw.a
1.37 jakob 43: LIBGSSAPI?= ${DESTDIR}/usr/lib/libgssapi.a
1.31 espie 44: LIBHDB?= ${DESTDIR}/usr/lib/libhdb.a
45: LIBKADM5CLNT?= ${DESTDIR}/usr/lib/libkadm5clnt.a
46: LIBKADM5SRV?= ${DESTDIR}/usr/lib/libkadm5srv.a
47: LIBKAFS?= ${DESTDIR}/usr/lib/libkafs.a
1.21 ho 48: LIBKEYNOTE?= ${DESTDIR}/usr/lib/libkeynote.a
1.31 espie 49: LIBKRB5?= ${DESTDIR}/usr/lib/libkrb5.a
1.1 deraadt 50: LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a
1.3 deraadt 51: LIBL?= ${DESTDIR}/usr/lib/libl.a
1.1 deraadt 52: LIBM?= ${DESTDIR}/usr/lib/libm.a
1.50 miod 53: LIBMENU?= ${DESTDIR}/usr/lib/libmenu.a
54: LIBMENUW?= ${DESTDIR}/usr/lib/libmenuw.a
1.4 tholo 55: LIBOLDCURSES?= ${DESTDIR}/usr/lib/libocurses.a
1.50 miod 56: LIBOSSAUDIO?= ${DESTDIR}/usr/lib/libossaudio.a
57: LIBPANEL?= ${DESTDIR}/usr/lib/libpanel.a
58: LIBPANELW?= ${DESTDIR}/usr/lib/libpanelw.a
1.31 espie 59: LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a
1.20 millert 60: LIBPERL?= ${DESTDIR}/usr/lib/libperl.a
1.50 miod 61: LIBPTHREAD?= ${DESTDIR}/usr/lib/libpthread.a
1.1 deraadt 62: LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a
63: LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a
1.50 miod 64: LIBSNDIO?= ${DESTDIR}/usr/lib/libsndio.a
1.19 beck 65: LIBSSL?= ${DESTDIR}/usr/lib/libssl.a
1.1 deraadt 66: LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a
1.4 tholo 67: LIBTERMLIB?= ${DESTDIR}/usr/lib/libtermlib.a
1.31 espie 68: LIBUSB?= ${DESTDIR}/usr/lib/libusbhid.a
1.1 deraadt 69: LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a
1.11 downsj 70: LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a
1.3 deraadt 71: LIBY?= ${DESTDIR}/usr/lib/liby.a
1.9 mickey 72: LIBZ?= ${DESTDIR}/usr/lib/libz.a
1.31 espie 73:
1.48 brad 74: .if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "amd64" || \
1.50 miod 75: ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "i386"
1.39 miod 76: LIBARCH?= ${DESTDIR}/usr/lib/lib${MACHINE_ARCH}.a
1.31 espie 77: .else
78: LIBARCH?=
79: .endif
1.1 deraadt 80:
81: .if defined(PROG)
82: SRCS?= ${PROG}.c
1.42 espie 83: . if !empty(SRCS:N*.h:N*.sh)
1.51 guenther 84: OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/}
1.49 otto 85: _LEXINTM+=${SRCS:M*.l:.l=.c}
86: _YACCINTM+=${SRCS:M*.y:.y=.c}
1.42 espie 87: . endif
1.1 deraadt 88:
1.42 espie 89: . if defined(OBJS) && !empty(OBJS)
90: . if !empty(SRCS:M*.C) || !empty(SRCS:M*.cc) || !empty(SRCS:M*.cxx)
1.8 niklas 91: ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD}
1.42 espie 92: ${CXX} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
93: . else
1.8 niklas 94: ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD}
1.41 espie 95: ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
1.42 espie 96: . endif
97: . endif # defined(OBJS) && !empty(OBJS)
1.41 espie 98:
1.42 espie 99: . if !defined(MAN)
1.1 deraadt 100: MAN= ${PROG}.1
1.42 espie 101: . endif # !defined(MAN)
1.1 deraadt 102: .endif # defined(PROG)
103:
104: .MAIN: all
105: all: ${PROG} _SUBDIRUSE
106:
107: .if !target(clean)
108: clean: _SUBDIRUSE
1.49 otto 109: rm -f a.out [Ee]rrs mklog core *.core y.tab.h \
1.53 jsg 110: ${PROG} ${OBJS} ${_LEXINTM} ${_YACCINTM} ${CLEANFILES}
1.1 deraadt 111: .endif
112:
113: cleandir: _SUBDIRUSE clean
114:
115: .if !target(install)
116: .if !target(beforeinstall)
117: beforeinstall:
118: .endif
119: .if !target(afterinstall)
120: afterinstall:
121: .endif
122:
123: .if !target(realinstall)
124: realinstall:
125: .if defined(PROG)
1.52 guenther 126: ${INSTALL} ${INSTALL_COPY} -S ${INSTALL_STRIP} \
127: -o ${BINOWN} -g ${BINGRP} \
1.43 espie 128: -m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}/${PROG}
1.1 deraadt 129: .endif
1.46 espie 130: .endif
131:
132: install: maninstall _SUBDIRUSE
1.1 deraadt 133: .if defined(LINKS) && !empty(LINKS)
1.28 espie 134: . for lnk file in ${LINKS}
135: @l=${DESTDIR}${lnk}; \
136: t=${DESTDIR}${file}; \
137: echo $$t -\> $$l; \
138: rm -f $$t; ln $$l $$t
139: . endfor
1.1 deraadt 140: .endif
141:
142: maninstall: afterinstall
143: afterinstall: realinstall
144: realinstall: beforeinstall
145: .endif
146:
147: .if !defined(NOMAN)
148: .include <bsd.man.mk>
149: .endif
150:
151: .if !defined(NONLS)
152: .include <bsd.nls.mk>
153: .endif
154:
155: .include <bsd.obj.mk>
156: .include <bsd.dep.mk>
157: .include <bsd.subdir.mk>
1.3 deraadt 158: .include <bsd.sys.mk>