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 $
3 # $DragonFly: src/share/mk/bsd.prog.mk,v 1.14 2008/05/19 10:26:02 corecode Exp $
7 .SUFFIXES
: .out .o .c .
cc .
cpp .
cxx .C .m .y .l .s .S
9 CFLAGS
+=${COPTS} ${DEBUG_FLAGS}
11 .if
!defined
(DEBUG_FLAGS
)
15 .if defined
(NOSHARED
) && ( ${NOSHARED} != "no" && ${NOSHARED} != "NO" )
23 .
include <bsd.patch.mk
>
28 # If there are Objective C sources, link with Objective C libraries.
29 .if
${SRCS
:M
*.m
} != ""
34 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}
43 .
else # !defined(SRCS)
52 # Always make an intermediate object file because:
53 # - it saves time rebuilding when only the library has changed
54 # - the name of the object gets put into the executable symbol table instead of
55 # the name of a variable temporary object.
56 # - it's useful to keep objects around for crunching.
61 ${CXX_LINK} ${CXXFLAGS} ${LDFLAGS} -o
${.TARGET
} ${OBJS} ${LDADD}
63 ${CC_LINK} ${CFLAGS} ${LDFLAGS} -o
${.TARGET
} ${OBJS} ${LDADD}
69 .if
!defined
(NOMAN
) && !defined
(MAN
) && \
70 !defined
(MAN1
) && !defined
(MAN2
) && !defined
(MAN3
) && \
71 !defined
(MAN4
) && !defined
(MAN5
) && !defined
(MAN6
) && \
72 !defined
(MAN7
) && !defined
(MAN8
) && !defined
(MAN9
)
78 all: objwarn
${PROG} ${SCRIPTS}
83 CLEANFILES
+= ${PROG} ${OBJS}
87 echo
${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
89 echo
${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
95 _INSTALLFLAGS
:= ${INSTALLFLAGS}
96 .for ie in
${INSTALLFLAGS_EDIT}
97 _INSTALLFLAGS
:= ${_INSTALLFLAGS
${ie}}
100 .if
!target
(realinstall
)
101 realinstall
: _proginstall
102 .ORDER
: beforeinstall _proginstall
105 .if defined
(PROGNAME
)
106 ${INSTALL} ${STRIP} -o
${BINOWN} -g
${BINGRP} -m
${BINMODE} \
107 ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
109 ${INSTALL} ${STRIP} -o
${BINOWN} -g
${BINGRP} -m
${BINMODE} \
110 ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
113 .if defined
(HIDEGAME
)
114 (cd
${DESTDIR}${ORIGBINDIR}; ${LN} -fs dm
${PROG}; \
115 chown
-h
${BINOWN}:${ORIGBINGRP} ${PROG})
117 .
endif # !target(realinstall)
119 .if defined
(SCRIPTS
) && !empty
(SCRIPTS
)
120 realinstall
: _scriptsinstall
121 .ORDER
: beforeinstall _scriptsinstall
123 SCRIPTSDIR?
= ${BINDIR}
124 SCRIPTSOWN?
= ${BINOWN}
125 SCRIPTSGRP?
= ${BINGRP}
126 SCRIPTSMODE?
= ${BINMODE}
128 .for script in
${SCRIPTS}
129 .if defined
(SCRIPTSNAME
)
130 SCRIPTSNAME_
${script
:T
}?
= ${SCRIPTSNAME}
132 SCRIPTSNAME_
${script
:T
}?
= ${script
:T
:R
}
134 SCRIPTSDIR_
${script
:T
}?
= ${SCRIPTSDIR}
135 SCRIPTSOWN_
${script
:T
}?
= ${SCRIPTSOWN}
136 SCRIPTSGRP_
${script
:T
}?
= ${SCRIPTSGRP}
137 SCRIPTSMODE_
${script
:T
}?
= ${SCRIPTSMODE}
138 _scriptsinstall
: _SCRIPTSINS_
${script
:T
}
139 _SCRIPTSINS_
${script
:T
}: ${script}
140 ${INSTALL} -o
${SCRIPTSOWN_
${.ALLSRC
:T
}} \
141 -g
${SCRIPTSGRP_
${.ALLSRC
:T
}} -m
${SCRIPTSMODE_
${.ALLSRC
:T
}} \
143 ${DESTDIR}${SCRIPTSDIR_
${.ALLSRC
:T
}}/${SCRIPTSNAME_
${.ALLSRC
:T
}}
149 .
include <bsd.nls.mk
>
150 .
include <bsd.files.mk
>
151 .
include <bsd.incs.mk
>
152 .
include <bsd.links.mk
>
155 realinstall
: _maninstall
156 .ORDER
: beforeinstall _maninstall
164 @
${LINT} ${LINTFLAGS} ${.ALLSRC
} | more
2>&1
169 .
include <bsd.man.mk
>
172 .if
${OBJFORMAT} != aout || make
(checkdpadd
) || defined
(NEED_LIBNAMES
)
173 .
include <bsd.libnames.mk
>
176 .
include <bsd.dep.mk
>
178 .if defined
(PROG
) && !exists
(${.OBJDIR
}/${DEPENDFILE})
179 ${OBJS}: ${SRCS
:M
*.h
}
182 .
include <bsd.obj.mk
>
184 .
include <bsd.sys.mk
>