bsd.prog.mk revision 1.270 1 1.270 christos # $NetBSD: bsd.prog.mk,v 1.270 2011/11/05 22:56:31 christos Exp $
2 1.67 mikel # @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
3 1.1 cgd
4 1.166 lukem .ifndef HOSTPROG
5 1.166 lukem
6 1.138 tv .include <bsd.init.mk>
7 1.159 thorpej .include <bsd.shlib.mk>
8 1.167 thorpej .include <bsd.gcc.mk>
9 1.74 mycroft
10 1.223 jmmv #
11 1.223 jmmv # Definitions and targets shared among all programs built by a single
12 1.223 jmmv # Makefile.
13 1.223 jmmv #
14 1.223 jmmv
15 1.223 jmmv ##### Basic targets
16 1.223 jmmv realinstall: proginstall scriptsinstall
17 1.223 jmmv
18 1.223 jmmv .gdbinit:
19 1.223 jmmv rm -f .gdbinit
20 1.223 jmmv .if defined(DESTDIR) && !empty(DESTDIR)
21 1.223 jmmv echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
22 1.223 jmmv .else
23 1.223 jmmv touch .gdbinit
24 1.185 erh .endif
25 1.223 jmmv .for __gdbinit in ${GDBINIT}
26 1.223 jmmv echo "source ${__gdbinit}" >> .gdbinit
27 1.223 jmmv .endfor
28 1.185 erh
29 1.267 apb CLEANFILES+= a.out [Ee]rrs mklog core *.core .gdbinit
30 1.223 jmmv
31 1.223 jmmv .if defined(SHAREDSTRINGS)
32 1.223 jmmv CLEANFILES+=strings
33 1.223 jmmv .c.o:
34 1.223 jmmv ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c -
35 1.223 jmmv @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET}
36 1.223 jmmv @rm -f x.c
37 1.1 cgd
38 1.223 jmmv .cc.o .cpp.o .cxx.o .C.o:
39 1.223 jmmv ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
40 1.223 jmmv @mv -f x.c x.cc
41 1.223 jmmv @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}
42 1.223 jmmv @rm -f x.cc
43 1.223 jmmv .endif
44 1.185 erh
45 1.237 christos .if defined(MKPIE) && (${MKPIE} != "no")
46 1.238 christos CFLAGS+= ${PIE_CFLAGS}
47 1.239 christos AFLAGS+= ${PIE_AFLAGS}
48 1.238 christos LDFLAGS+= ${PIE_LDFLAGS}
49 1.237 christos .endif
50 1.237 christos
51 1.25 mycroft CFLAGS+= ${COPTS}
52 1.212 mrg OBJCFLAGS+= ${OBJCOPTS}
53 1.193 dsl MKDEP_SUFFIXES?= .o .ln
54 1.1 cgd
55 1.247 darran # CTF preserve debug symbols
56 1.247 darran .if defined(MKDTRACE) && (${MKDTRACE} != "no") && (${CFLAGS:M-g} != "")
57 1.247 darran CTFFLAGS+= -g
58 1.247 darran CTFMFLAGS+= -g
59 1.247 darran .endif
60 1.247 darran
61 1.162 thorpej # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
62 1.153 pk .ifndef LIBCRTBEGIN
63 1.167 thorpej LIBCRTBEGIN= ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN}
64 1.152 christos .MADE: ${LIBCRTBEGIN}
65 1.153 pk .endif
66 1.153 pk .ifndef LIBCRTEND
67 1.167 thorpej LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o
68 1.152 christos .MADE: ${LIBCRTEND}
69 1.153 pk .endif
70 1.144 lukem _SHLINKER= ${SHLINKDIR}/ld.elf_so
71 1.69 thorpej
72 1.153 pk .ifndef LIBCRT0
73 1.153 pk LIBCRT0= ${DESTDIR}/usr/lib/crt0.o
74 1.152 christos .MADE: ${LIBCRT0}
75 1.153 pk .endif
76 1.95 ross
77 1.202 lukem ##### Installed system library definitions
78 1.202 lukem #
79 1.202 lukem # E.g.
80 1.202 lukem # LIBC?=${DESTDIR}/usr/lib/libc.a
81 1.234 mrg # LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a
82 1.202 lukem # etc..
83 1.269 christos # NB: If you are a library here, add it in bsd.README
84 1.202 lukem
85 1.202 lukem .for _lib in \
86 1.268 christos archive \
87 1.268 christos asn1 \
88 1.269 christos atf_c \
89 1.269 christos atf_cxx \
90 1.268 christos bind9 \
91 1.268 christos bluetooth \
92 1.268 christos bsdmalloc \
93 1.268 christos bz2 \
94 1.268 christos c \
95 1.268 christos c_pic \
96 1.268 christos com_err \
97 1.268 christos compat \
98 1.268 christos crt0 \
99 1.268 christos crypt \
100 1.268 christos crypto \
101 1.268 christos crypto_idea \
102 1.268 christos crypto_mdc2 \
103 1.268 christos crypto_rc5 \
104 1.268 christos curses \
105 1.268 christos dbm \
106 1.268 christos des \
107 1.268 christos dns \
108 1.268 christos edit \
109 1.268 christos event \
110 1.268 christos fetch \
111 1.268 christos fl \
112 1.268 christos form \
113 1.268 christos g2c \
114 1.268 christos gcc \
115 1.268 christos gnumalloc \
116 1.268 christos gssapi \
117 1.268 christos hdb \
118 1.268 christos heimbase \
119 1.268 christos heimntlm \
120 1.268 christos hx509 \
121 1.268 christos intl \
122 1.268 christos ipsec \
123 1.268 christos isc \
124 1.268 christos isccc \
125 1.268 christos isccfg \
126 1.268 christos kadm5clnt \
127 1.268 christos kadm5srv \
128 1.268 christos kafs \
129 1.268 christos krb5 \
130 1.268 christos kvm \
131 1.268 christos l \
132 1.268 christos lber \
133 1.268 christos ldap \
134 1.268 christos ldap_r \
135 1.268 christos lua \
136 1.268 christos lwres \
137 1.268 christos m \
138 1.268 christos magic \
139 1.268 christos menu \
140 1.268 christos objc \
141 1.268 christos ossaudio \
142 1.268 christos pam \
143 1.268 christos pcap \
144 1.268 christos pci \
145 1.268 christos pmc \
146 1.268 christos posix \
147 1.268 christos pthread \
148 1.268 christos pthread_dbg \
149 1.268 christos puffs \
150 1.268 christos quota \
151 1.268 christos radius \
152 1.268 christos resolv \
153 1.268 christos rmt \
154 1.268 christos roken \
155 1.268 christos rpcsvc \
156 1.268 christos rt \
157 1.268 christos rump \
158 1.268 christos rumpfs_cd9660fs \
159 1.268 christos rumpfs_efs \
160 1.268 christos rumpfs_ext2fs \
161 1.268 christos rumpfs_ffs \
162 1.268 christos rumpfs_hfs \
163 1.268 christos rumpfs_lfs \
164 1.268 christos rumpfs_msdosfs \
165 1.268 christos rumpfs_nfs \
166 1.268 christos rumpfs_ntfs \
167 1.268 christos rumpfs_syspuffs \
168 1.268 christos rumpfs_tmpfs \
169 1.268 christos rumpfs_udf \
170 1.268 christos rumpfs_ufs \
171 1.268 christos rumpuser \
172 1.268 christos saslc \
173 1.268 christos skey \
174 1.268 christos sl \
175 1.268 christos sqlite3 \
176 1.268 christos ss \
177 1.268 christos ssh \
178 1.268 christos ssl \
179 1.268 christos ssp \
180 1.269 christos stdcxx \
181 1.269 christos supcxx \
182 1.268 christos terminfo \
183 1.270 christos tre \
184 1.268 christos usbhid \
185 1.268 christos util \
186 1.268 christos wind \
187 1.268 christos wrap \
188 1.268 christos y \
189 1.268 christos z
190 1.202 lukem .ifndef LIB${_lib:tu}
191 1.269 christos LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
192 1.202 lukem .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
193 1.202 lukem .endif
194 1.202 lukem .endfor
195 1.269 christos
196 1.206 he # PAM applications, if linked statically, need more libraries
197 1.206 he .if (${MKPIC} == "no")
198 1.208 christos .if (${MKCRYPTO} != "no")
199 1.208 christos PAM_STATIC_LDADD+= -lssh
200 1.208 christos PAM_STATIC_DPADD+= ${LIBSSH}
201 1.208 christos .endif
202 1.208 christos .if (${MKKERBEROS} != "no")
203 1.265 he PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
204 1.265 he -lroken -lcom_err -lheimbase -lcrypto
205 1.265 he PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \
206 1.265 he ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO}
207 1.208 christos .endif
208 1.208 christos .if (${MKSKEY} != "no")
209 1.208 christos PAM_STATIC_LDADD+= -lskey
210 1.208 christos PAM_STATIC_DPADD+= ${LIBSKEY}
211 1.208 christos .endif
212 1.208 christos PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil
213 1.208 christos PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL}
214 1.206 he .else
215 1.206 he PAM_STATIC_LDADD=
216 1.206 he PAM_STATIC_DPADD=
217 1.206 he .endif
218 1.206 he
219 1.269 christos # NB: If you are a library here, add it in bsd.README
220 1.202 lukem .for _lib in \
221 1.268 christos FS \
222 1.268 christos GL \
223 1.268 christos GLU \
224 1.268 christos ICE \
225 1.268 christos SM \
226 1.268 christos X11 \
227 1.268 christos XTrap \
228 1.268 christos Xau \
229 1.268 christos Xaw \
230 1.268 christos Xdmcp \
231 1.268 christos Xext \
232 1.268 christos Xfont \
233 1.268 christos Xft \
234 1.268 christos Xi \
235 1.268 christos Xinerama \
236 1.268 christos Xmu \
237 1.268 christos Xmuu \
238 1.268 christos Xpm \
239 1.268 christos Xrandr \
240 1.268 christos Xrender \
241 1.268 christos Xss \
242 1.268 christos Xt \
243 1.268 christos Xtst \
244 1.268 christos Xv \
245 1.268 christos Xxf86dga \
246 1.268 christos Xxf86misc \
247 1.268 christos Xxf86vm \
248 1.268 christos dps \
249 1.268 christos expat \
250 1.268 christos fntstubs \
251 1.268 christos fontcache \
252 1.268 christos fontconfig \
253 1.268 christos fontenc \
254 1.268 christos freetype \
255 1.268 christos lbxutil \
256 1.268 christos xkbfile
257 1.202 lukem .ifndef LIB${_lib:tu}
258 1.233 rtr LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
259 1.202 lukem .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
260 1.202 lukem .endif
261 1.202 lukem .endfor
262 1.202 lukem
263 1.204 lukem .if defined(RESCUEDIR)
264 1.204 lukem CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\"
265 1.204 lukem .endif
266 1.204 lukem
267 1.144 lukem _PROGLDOPTS=
268 1.144 lukem .if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves
269 1.144 lukem _PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER}
270 1.161 itohy .endif
271 1.187 lukem .if ${SHLIBDIR} != "/usr/lib"
272 1.264 joerg _PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
273 1.263 joerg -L=${SHLIBDIR}
274 1.187 lukem .elif ${SHLIBINSTALLDIR} != "/usr/lib"
275 1.264 joerg _PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
276 1.263 joerg -L=${SHLIBINSTALLDIR}
277 1.144 lukem .endif
278 1.144 lukem
279 1.223 jmmv __proginstall: .USE
280 1.223 jmmv ${_MKTARGET_INSTALL}
281 1.223 jmmv ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
282 1.223 jmmv ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
283 1.223 jmmv
284 1.255 pooka __progrumpinstall: .USE
285 1.255 pooka ${_MKTARGET_INSTALL}
286 1.255 pooka ${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \
287 1.255 pooka ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
288 1.255 pooka
289 1.223 jmmv __progdebuginstall: .USE
290 1.223 jmmv ${_MKTARGET_INSTALL}
291 1.223 jmmv ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
292 1.223 jmmv ${.ALLSRC} ${.TARGET}
293 1.223 jmmv
294 1.223 jmmv
295 1.223 jmmv
296 1.223 jmmv #
297 1.223 jmmv # Backwards compatibility with Makefiles that assume that bsd.prog.mk
298 1.223 jmmv # can only build a single binary.
299 1.223 jmmv #
300 1.223 jmmv
301 1.223 jmmv _APPEND_MANS=yes
302 1.223 jmmv _APPEND_SRCS=yes
303 1.223 jmmv
304 1.231 lukem _CCLINKFLAGS=
305 1.231 lukem
306 1.145 thorpej .if defined(PROG_CXX)
307 1.223 jmmv PROG= ${PROG_CXX}
308 1.231 lukem _CCLINK= ${CXX} ${_CCLINKFLAGS}
309 1.223 jmmv .endif
310 1.223 jmmv
311 1.255 pooka .if defined(RUMPPRG)
312 1.255 pooka PROG= ${RUMPPRG}
313 1.256 pooka .ifndef CRUNCHEDPROG
314 1.255 pooka PROGS= ${RUMPPRG} rump.${RUMPPRG}
315 1.255 pooka . if defined(SRCS)
316 1.255 pooka SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
317 1.255 pooka SRCS+= ${PROG}_hostops.c
318 1.255 pooka . else
319 1.255 pooka SRCS= ${PROG}.c ${PROG}_hostops.c
320 1.255 pooka SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
321 1.255 pooka . endif
322 1.257 pooka DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS}
323 1.255 pooka LDADD.rump.${PROG}+= -lrumpclient
324 1.255 pooka DPADD.rump.${PROG}+= ${LIBRUMPCLIENT}
325 1.255 pooka MAN.rump.${PROG}= # defined but feeling empty
326 1.255 pooka _RUMPINSTALL.rump.${PROG}=# defined
327 1.256 pooka .else # CRUNCHEDPROG
328 1.256 pooka PROGS= ${PROG}
329 1.256 pooka CPPFLAGS+= -DCRUNCHOPS
330 1.256 pooka .endif
331 1.255 pooka .endif
332 1.255 pooka
333 1.223 jmmv .if defined(PROG)
334 1.231 lukem _CCLINK?= ${CC} ${_CCLINKFLAGS}
335 1.223 jmmv . if defined(MAN)
336 1.223 jmmv MAN.${PROG}= ${MAN}
337 1.223 jmmv _APPEND_MANS= no
338 1.223 jmmv . endif
339 1.223 jmmv . if !defined(OBJS)
340 1.223 jmmv OBJS= ${OBJS.${PROG}}
341 1.223 jmmv . endif
342 1.223 jmmv . if defined(PROGNAME)
343 1.223 jmmv PROGNAME.${PROG}= ${PROGNAME}
344 1.223 jmmv . endif
345 1.223 jmmv . if defined(SRCS)
346 1.223 jmmv SRCS.${PROG}= ${SRCS}
347 1.223 jmmv _APPEND_SRCS= no
348 1.223 jmmv . endif
349 1.223 jmmv .endif
350 1.223 jmmv
351 1.223 jmmv # Turn the single-program PROG and PROG_CXX variables into their multi-word
352 1.223 jmmv # counterparts, PROGS and PROGS_CXX.
353 1.255 pooka .if !defined(RUMPPRG)
354 1.255 pooka . if defined(PROG_CXX) && !defined(PROGS_CXX)
355 1.223 jmmv PROGS_CXX= ${PROG_CXX}
356 1.262 jmmv . elif defined(PROG) && !defined(PROGS)
357 1.223 jmmv PROGS= ${PROG}
358 1.255 pooka . endif
359 1.223 jmmv .endif
360 1.223 jmmv
361 1.223 jmmv #
362 1.223 jmmv # Per-program definitions and targets.
363 1.223 jmmv #
364 1.223 jmmv
365 1.223 jmmv # Definitions specific to C programs.
366 1.223 jmmv .for _P in ${PROGS}
367 1.223 jmmv SRCS.${_P}?= ${_P}.c
368 1.231 lukem _CCLINK.${_P}= ${CC} ${_CCLINKFLAGS}
369 1.223 jmmv .endfor
370 1.223 jmmv
371 1.223 jmmv # Definitions specific to C++ programs.
372 1.223 jmmv .for _P in ${PROGS_CXX}
373 1.223 jmmv SRCS.${_P}?= ${_P}.cc
374 1.231 lukem _CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS}
375 1.223 jmmv .endfor
376 1.223 jmmv
377 1.223 jmmv # Language-independent definitions.
378 1.223 jmmv .for _P in ${PROGS} ${PROGS_CXX} # {
379 1.223 jmmv
380 1.223 jmmv BINDIR.${_P}?= ${BINDIR}
381 1.223 jmmv PROGNAME.${_P}?= ${_P}
382 1.223 jmmv
383 1.249 mrg .if ${MKDEBUG} != "no" && !commands(${_P})
384 1.223 jmmv _PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug
385 1.145 thorpej .endif
386 1.145 thorpej
387 1.223 jmmv .if defined(PAXCTL_FLAGS)
388 1.223 jmmv PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
389 1.215 lukem .endif
390 1.215 lukem
391 1.223 jmmv ##### PROG specific flags.
392 1.244 uebayasi
393 1.223 jmmv _LDADD.${_P}= ${LDADD} ${LDADD.${_P}}
394 1.223 jmmv _LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}}
395 1.223 jmmv _LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}}
396 1.223 jmmv
397 1.223 jmmv ##### Build and install rules
398 1.223 jmmv .if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
399 1.223 jmmv SRCS+= ${SRCS.${_P}} # For bsd.dep.mk
400 1.223 jmmv .endif
401 1.223 jmmv
402 1.223 jmmv _YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}
403 1.223 jmmv
404 1.223 jmmv DPSRCS+= ${_YPSRCS.${_P}}
405 1.223 jmmv CLEANFILES+= ${_YPSRCS.${_P}}
406 1.223 jmmv
407 1.223 jmmv .if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)
408 1.223 jmmv OBJS.${_P}+= ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
409 1.223 jmmv LOBJS.${_P}+= ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}
410 1.157 thorpej .endif
411 1.157 thorpej
412 1.223 jmmv .if defined(OBJS.${_P}) && !empty(OBJS.${_P}) # {
413 1.223 jmmv .NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}
414 1.223 jmmv
415 1.223 jmmv ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
416 1.182 lukem
417 1.223 jmmv ${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
418 1.223 jmmv .if !commands(${_P})
419 1.194 lukem ${_MKTARGET_LINK}
420 1.231 lukem ${_CCLINK.${_P}} \
421 1.232 lukem ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \
422 1.232 lukem ${OBJS.${_P}} ${_LDADD.${_P}} \
423 1.232 lukem ${_PROGLDOPTS}
424 1.247 darran .if defined(CTFMERGE)
425 1.247 darran ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
426 1.247 darran .endif
427 1.223 jmmv .if defined(PAXCTL_FLAGS.${_P})
428 1.223 jmmv ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
429 1.218 christos .endif
430 1.235 joerg .if ${MKSTRIPIDENT} != "no"
431 1.235 joerg ${OBJCOPY} -R .ident ${.TARGET}
432 1.235 joerg .endif
433 1.223 jmmv .endif # !commands(${_P})
434 1.183 dsl
435 1.223 jmmv ${_P}.ro: ${OBJS.${_P}} ${DPADD}
436 1.207 dsl ${_MKTARGET_LINK}
437 1.254 joerg ${CC} ${LDFLAGS} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
438 1.1 cgd
439 1.223 jmmv .if defined(_PROGDEBUG.${_P})
440 1.224 jmmv ${_PROGDEBUG.${_P}}: ${_P}
441 1.215 lukem ${_MKTARGET_CREATE}
442 1.251 lukem ( ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \
443 1.251 lukem && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
444 1.251 lukem --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
445 1.251 lukem ) || (rm -f ${_PROGDEBUG.${_P}}; false)
446 1.215 lukem .endif
447 1.215 lukem
448 1.223 jmmv .endif # defined(OBJS.${_P}) && !empty(OBJS.${_P}) # }
449 1.1 cgd
450 1.223 jmmv .if !defined(MAN.${_P})
451 1.223 jmmv MAN.${_P}= ${_P}.1
452 1.223 jmmv .endif # !defined(MAN.${_P})
453 1.223 jmmv .if !empty(_APPEND_MANS:M[Yy][Ee][Ss])
454 1.223 jmmv MAN+= ${MAN.${_P}}
455 1.223 jmmv .endif
456 1.11 mycroft
457 1.223 jmmv realall: ${_P} ${_PROGDEBUG.${_P}}
458 1.1 cgd
459 1.267 apb CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}}
460 1.134 tls
461 1.223 jmmv .if defined(OBJS.${_P}) && !empty(OBJS.${_P})
462 1.267 apb CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}}
463 1.59 cgd .endif
464 1.27 mycroft
465 1.223 jmmv _PROG_INSTALL+= proginstall-${_P}
466 1.114 mycroft
467 1.223 jmmv .if !target(proginstall-${_P}) # {
468 1.223 jmmv proginstall-${_P}:: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
469 1.223 jmmv ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
470 1.223 jmmv .PRECIOUS: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
471 1.223 jmmv ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
472 1.215 lukem
473 1.172 lukem .if ${MKUPDATE} == "no"
474 1.255 pooka .if defined(_RUMPINSTALL.${_P})
475 1.255 pooka ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall
476 1.255 pooka .else
477 1.223 jmmv ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall
478 1.255 pooka .endif
479 1.223 jmmv .if !defined(BUILD) && !make(all) && !make(${_P})
480 1.223 jmmv ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE
481 1.223 jmmv .endif
482 1.223 jmmv .if defined(_PROGDEBUG.${_P})
483 1.223 jmmv ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall
484 1.223 jmmv .if !defined(BUILD) && !make(all) && !make(${_P})
485 1.223 jmmv ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE
486 1.215 lukem .endif
487 1.223 jmmv .endif # define(_PROGDEBUG.${_P})
488 1.215 lukem .else # MKUPDATE != no
489 1.255 pooka .if defined(_RUMPINSTALL.${_P})
490 1.255 pooka ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall
491 1.255 pooka .else
492 1.223 jmmv ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall
493 1.255 pooka .endif
494 1.223 jmmv .if !defined(BUILD) && !make(all) && !make(${_P})
495 1.223 jmmv ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE
496 1.223 jmmv .endif
497 1.223 jmmv .if defined(_PROGDEBUG.${_P})
498 1.223 jmmv ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall
499 1.223 jmmv .if !defined(BUILD) && !make(all) && !make(${_P})
500 1.223 jmmv ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE
501 1.154 mycroft .endif
502 1.223 jmmv .endif # defined(_PROGDEBUG.${_P})
503 1.215 lukem .endif # MKUPDATE != no
504 1.215 lukem
505 1.223 jmmv .endif # !target(proginstall-${_P}) # }
506 1.223 jmmv
507 1.223 jmmv lint: lint-${_P}
508 1.223 jmmv lint-${_P}: ${LOBJS.${_P}}
509 1.223 jmmv .if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})
510 1.223 jmmv ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}
511 1.223 jmmv .endif
512 1.223 jmmv
513 1.223 jmmv .endfor # _P in ${PROGS} ${PROGS_CXX} # }
514 1.23 mycroft
515 1.225 jmmv .if defined(OBJS) && !empty(OBJS) && \
516 1.225 jmmv (empty(PROGS) && empty(PROGS_CXX))
517 1.267 apb CLEANFILES+= ${OBJS} ${LOBJS}
518 1.225 jmmv .endif
519 1.225 jmmv
520 1.74 mycroft .if !target(proginstall)
521 1.223 jmmv proginstall:: ${_PROG_INSTALL}
522 1.74 mycroft .endif
523 1.197 lukem .PHONY: proginstall
524 1.74 mycroft
525 1.223 jmmv
526 1.223 jmmv
527 1.223 jmmv realall: ${SCRIPTS}
528 1.215 lukem .if defined(SCRIPTS) && !target(scriptsinstall) # {
529 1.65 mycroft SCRIPTSDIR?=${BINDIR}
530 1.65 mycroft SCRIPTSOWN?=${BINOWN}
531 1.65 mycroft SCRIPTSGRP?=${BINGRP}
532 1.65 mycroft SCRIPTSMODE?=${BINMODE}
533 1.113 mycroft
534 1.113 mycroft scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
535 1.114 mycroft .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
536 1.113 mycroft
537 1.115 mycroft __scriptinstall: .USE
538 1.192 lukem ${_MKTARGET_INSTALL}
539 1.139 tv ${INSTALL_FILE} \
540 1.116 mycroft -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
541 1.116 mycroft -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
542 1.116 mycroft -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
543 1.209 jwise ${.ALLSRC} ${.TARGET}
544 1.115 mycroft
545 1.130 sommerfe .for S in ${SCRIPTS:O:u}
546 1.172 lukem .if ${MKUPDATE} == "no"
547 1.154 mycroft ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
548 1.154 mycroft .if !defined(BUILD) && !make(all) && !make(${S})
549 1.154 mycroft ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
550 1.154 mycroft .endif
551 1.154 mycroft .else
552 1.154 mycroft ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
553 1.103 fredb .if !defined(BUILD) && !make(all) && !make(${S})
554 1.113 mycroft ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
555 1.63 christos .endif
556 1.154 mycroft .endif
557 1.63 christos .endfor
558 1.215 lukem .endif # }
559 1.1 cgd
560 1.74 mycroft .if !target(scriptsinstall)
561 1.74 mycroft scriptsinstall::
562 1.1 cgd .endif
563 1.197 lukem .PHONY: scriptsinstall
564 1.1 cgd
565 1.138 tv ##### Pull in related .mk logic
566 1.241 apb LINKSOWN?= ${BINOWN}
567 1.241 apb LINKSGRP?= ${BINGRP}
568 1.241 apb LINKSMODE?= ${BINMODE}
569 1.1 cgd .include <bsd.man.mk>
570 1.50 jtc .include <bsd.nls.mk>
571 1.66 christos .include <bsd.files.mk>
572 1.63 christos .include <bsd.inc.mk>
573 1.83 mycroft .include <bsd.links.mk>
574 1.180 lukem .include <bsd.sys.mk>
575 1.26 mycroft .include <bsd.dep.mk>
576 1.266 joerg .include <bsd.clang-analyze.mk>
577 1.267 apb .include <bsd.clean.mk>
578 1.240 cube
579 1.138 tv ${TARGETS}: # ensure existence
580 1.166 lukem
581 1.166 lukem .endif # HOSTPROG
582