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
} != ""
34 OBJS
+= ${SRCS
:N
*.h
:N
*.patch
:R
:S
/$/.o
/g
}
40 ${CXX_LINK} ${CXXFLAGS} ${LDFLAGS} -o
${.TARGET
} ${OBJS} ${LDADD}
42 ${CC_LINK} ${CFLAGS} ${LDFLAGS} -o
${.TARGET
} ${OBJS} ${LDADD}
46 .
else # !defined(SRCS)
55 # Always make an intermediate object file because:
56 # - it saves time rebuilding when only the library has changed
57 # - the name of the object gets put into the executable symbol table instead of
58 # the name of a variable temporary object.
59 # - it's useful to keep objects around for crunching.
64 ${CXX_LINK} ${CXXFLAGS} ${LDFLAGS} -o
${.TARGET
} ${OBJS} ${LDADD}
66 ${CC_LINK} ${CFLAGS} ${LDFLAGS} -o
${.TARGET
} ${OBJS} ${LDADD}
72 .if
!defined
(NOMAN
) && !defined
(MAN
) && \
73 !defined
(MAN1
) && !defined
(MAN2
) && !defined
(MAN3
) && \
74 !defined
(MAN4
) && !defined
(MAN5
) && !defined
(MAN6
) && \
75 !defined
(MAN7
) && !defined
(MAN8
) && !defined
(MAN9
)
81 all: objwarn
${PROG} ${SCRIPTS}
86 CLEANFILES
+= ${PROG} ${OBJS}
90 echo
${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
92 echo
${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
98 _INSTALLFLAGS
:= ${INSTALLFLAGS}
99 .for ie in
${INSTALLFLAGS_EDIT}
100 _INSTALLFLAGS
:= ${_INSTALLFLAGS
${ie}}
103 .if
!target
(realinstall
) && !defined
(INTERNALPROG
)
104 realinstall
: _proginstall
105 .ORDER
: beforeinstall _proginstall
108 .if defined
(PROGNAME
)
109 ${INSTALL} ${STRIP} -o
${BINOWN} -g
${BINGRP} -m
${BINMODE} \
110 ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
112 ${INSTALL} ${STRIP} -o
${BINOWN} -g
${BINGRP} -m
${BINMODE} \
113 ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
116 .if defined
(HIDEGAME
)
117 (cd
${DESTDIR}${ORIGBINDIR}; ${LN} -fs dm
${PROG}; \
118 chown
-h
${BINOWN}:${ORIGBINGRP} ${PROG})
120 .
endif # !target(realinstall) && !defined(INTERNALPROG)
122 .if defined
(SCRIPTS
) && !empty
(SCRIPTS
)
123 realinstall
: _scriptsinstall
124 .ORDER
: beforeinstall _scriptsinstall
126 SCRIPTSDIR?
= ${BINDIR}
127 SCRIPTSOWN?
= ${BINOWN}
128 SCRIPTSGRP?
= ${BINGRP}
129 SCRIPTSMODE?
= ${BINMODE}
131 .for script in
${SCRIPTS}
132 .if defined
(SCRIPTSNAME
)
133 SCRIPTSNAME_
${script
:T
}?
= ${SCRIPTSNAME}
135 SCRIPTSNAME_
${script
:T
}?
= ${script
:T
:R
}
137 SCRIPTSDIR_
${script
:T
}?
= ${SCRIPTSDIR}
138 SCRIPTSOWN_
${script
:T
}?
= ${SCRIPTSOWN}
139 SCRIPTSGRP_
${script
:T
}?
= ${SCRIPTSGRP}
140 SCRIPTSMODE_
${script
:T
}?
= ${SCRIPTSMODE}
141 _scriptsinstall
: _SCRIPTSINS_
${script
:T
}
142 _SCRIPTSINS_
${script
:T
}: ${script}
143 ${INSTALL} -o
${SCRIPTSOWN_
${.ALLSRC
:T
}} \
144 -g
${SCRIPTSGRP_
${.ALLSRC
:T
}} -m
${SCRIPTSMODE_
${.ALLSRC
:T
}} \
146 ${DESTDIR}${SCRIPTSDIR_
${.ALLSRC
:T
}}/${SCRIPTSNAME_
${.ALLSRC
:T
}}
152 .
include <bsd.nls.mk
>
153 .
include <bsd.files.mk
>
154 .
include <bsd.incs.mk
>
155 .
include <bsd.links.mk
>
158 realinstall
: _maninstall
159 .ORDER
: beforeinstall _maninstall
167 -@
${LINT} ${LINTFLAGS} ${CFLAGS
:M-I
*:S
/-I
/-I
/g
} ${.ALLSRC
}
172 .
include <bsd.man.mk
>
175 .if
${OBJFORMAT} != aout || make
(checkdpadd
) || defined
(NEED_LIBNAMES
)
176 .
include <bsd.libnames.mk
>
179 .
include <bsd.dep.mk
>
181 .if defined
(PROG
) && !exists
(${.OBJDIR
}/${DEPENDFILE})
182 ${OBJS}: ${SRCS
:M
*.h
}
185 .
include <bsd.obj.mk
>
187 .
include <bsd.sys.mk
>