1 # from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
2 # $FreeBSD: src/share/mk/bsd.prog.mk,v 1.86.2.17 2002/12/23 16:33:37 ru Exp $
6 .SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .s .S
8 CFLAGS+=${COPTS} ${DEBUG_FLAGS}
10 .if !defined(DEBUG_FLAGS)
14 .if defined(NOSHARED) && ( ${NOSHARED} != "no" && ${NOSHARED} != "NO" )
22 .include <bsd.patch.mk>
27 # If there are Objective C sources, link with Objective C libraries.
28 .if ${SRCS:M*.m} != ""
33 OBJS+= ${SRCS:N*.h:N*.patch:R:S/$/.o/g}
38 ${CXX_LINK} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
40 ${CC_LINK} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
44 .else # !defined(SRCS)
53 # Always make an intermediate object file because:
54 # - it saves time rebuilding when only the library has changed
55 # - the name of the object gets put into the executable symbol table instead of
56 # the name of a variable temporary object.
57 # - it's useful to keep objects around for crunching.
62 ${CXX_LINK} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
64 ${CC_LINK} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
70 .if !defined(NOMAN) && !defined(MAN) && \
71 !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
72 !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
73 !defined(MAN7) && !defined(MAN8) && !defined(MAN9)
79 all: objwarn ${PROG} ${SCRIPTS}
84 CLEANFILES+= ${PROG} ${OBJS}
88 echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
90 echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
96 _INSTALLFLAGS:= ${INSTALLFLAGS}
97 .for ie in ${INSTALLFLAGS_EDIT}
98 _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
101 .if !target(realinstall)
102 realinstall: _proginstall
103 .ORDER: beforeinstall _proginstall
106 .if defined(PROGNAME)
107 ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
108 ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
110 ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
111 ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
114 .if defined(HIDEGAME)
115 (cd ${DESTDIR}${ORIGBINDIR}; ${LN} -fs dm ${PROG}; \
116 chown -h ${BINOWN}:${ORIGBINGRP} ${PROG})
118 .endif # !target(realinstall)
120 .if defined(SCRIPTS) && !empty(SCRIPTS)
121 realinstall: _scriptsinstall
122 .ORDER: beforeinstall _scriptsinstall
124 SCRIPTSDIR?= ${BINDIR}
125 SCRIPTSOWN?= ${BINOWN}
126 SCRIPTSGRP?= ${BINGRP}
127 SCRIPTSMODE?= ${BINMODE}
129 .for script in ${SCRIPTS}
130 .if defined(SCRIPTSNAME)
131 SCRIPTSNAME_${script:T}?= ${SCRIPTSNAME}
133 SCRIPTSNAME_${script:T}?= ${script:T:R}
135 SCRIPTSDIR_${script:T}?= ${SCRIPTSDIR}
136 SCRIPTSOWN_${script:T}?= ${SCRIPTSOWN}
137 SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP}
138 SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE}
139 _scriptsinstall: _SCRIPTSINS_${script:T}
140 _SCRIPTSINS_${script:T}: ${script}
141 ${INSTALL} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
142 -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
144 ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}}
150 .include <bsd.nls.mk>
151 .include <bsd.files.mk>
152 .include <bsd.incs.mk>
153 .include <bsd.links.mk>
156 realinstall: _maninstall
157 .ORDER: beforeinstall _maninstall
165 -@${LINT} ${LINTFLAGS} ${CFLAGS:M-I*:S/-I/-I /g} ${.ALLSRC}
170 .include <bsd.man.mk>
173 .if ${OBJFORMAT} != aout || make(checkdpadd) || defined(NEED_LIBNAMES)
174 .include <bsd.libnames.mk>
177 .include <bsd.dep.mk>
179 .if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE})
180 ${OBJS}: ${SRCS:M*.h}
183 .include <bsd.obj.mk>
185 .include <bsd.sys.mk>