tests: print error locations verbosely
[minix3.git] / share / mk / bsd.prog.mk
blob54d40873920e4c7cdd2f33a76598e68883c04bd0
1 # $NetBSD: bsd.prog.mk,v 1.278 2012/08/24 20:26:24 jmmv Exp $
2 # @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
4 .ifndef HOSTPROG
6 .include <bsd.init.mk>
7 .include <bsd.shlib.mk>
8 .include <bsd.gcc.mk>
9 .include <minix.gcov.mk>
12 # Definitions and targets shared among all programs built by a single
13 # Makefile.
16 ##### Basic targets
17 realinstall: proginstall scriptsinstall
19 .gdbinit:
20 rm -f .gdbinit
21 .if defined(DESTDIR) && !empty(DESTDIR)
22 echo "set solib-absolute-prefix ${DESTDIR}" > .gdbinit
23 .else
24 touch .gdbinit
25 .endif
26 .for __gdbinit in ${GDBINIT}
27 echo "source ${__gdbinit}" >> .gdbinit
28 .endfor
30 CLEANFILES+= a.out [Ee]rrs mklog core *.core .gdbinit
32 .if defined(SHAREDSTRINGS)
33 CLEANFILES+=strings
34 .c.o:
35 ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c -
36 @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET}
37 @rm -f x.c
39 .cc.o .cpp.o .cxx.o .C.o:
40 ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
41 @mv -f x.c x.cc
42 @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}
43 @rm -f x.cc
44 .endif
46 .if defined(MKPIE) && (${MKPIE} != "no")
47 CFLAGS+= ${PIE_CFLAGS}
48 AFLAGS+= ${PIE_AFLAGS}
49 LDFLAGS+= ${PIE_LDFLAGS}
50 .endif
52 CFLAGS+= ${COPTS}
53 OBJCFLAGS+= ${OBJCOPTS}
54 MKDEP_SUFFIXES?= .o .ln
56 # CTF preserve debug symbols
57 .if defined(MKDTRACE) && (${MKDTRACE} != "no") && (${CFLAGS:M-g} != "")
58 CTFFLAGS+= -g
59 CTFMFLAGS+= -g
60 .endif
62 # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
63 .ifndef LIBCRTBEGIN
64 LIBCRTBEGIN= ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN}
65 .MADE: ${LIBCRTBEGIN}
66 .endif
67 .ifndef LIBCRTEND
68 LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o
69 .MADE: ${LIBCRTEND}
70 .endif
71 _SHLINKER= ${SHLINKDIR}/ld.elf_so
73 .ifndef LIBCRT0
74 LIBCRT0= ${DESTDIR}/usr/lib/crt0.o
75 .MADE: ${LIBCRT0}
76 .endif
78 ##### Installed system library definitions
80 # E.g.
81 # LIBC?=${DESTDIR}/usr/lib/libc.a
82 # LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a
83 # etc..
84 # NB: If you are a library here, add it in bsd.README
86 .for _lib in \
87 audiodriver \
88 blockdriver \
89 chardriver \
90 netdriver \
91 c \
92 curses \
93 edit \
94 expat \
95 end \
96 sys \
97 timers \
98 util \
99 bz2 \
102 exec \
103 ddekit \
104 devman \
105 usb \
106 elf \
107 bdev \
108 sffs \
109 hgfs \
110 vboxfs \
111 minc \
112 minlib \
113 min\
116 .ifndef LIB${_lib:tu}
117 LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
118 .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
119 .endif
120 .endfor
122 # PAM applications, if linked statically, need more libraries
123 .if (${MKPIC} == "no")
124 .if (${MKCRYPTO} != "no")
125 PAM_STATIC_LDADD+= -lssh
126 PAM_STATIC_DPADD+= ${LIBSSH}
127 .endif
128 .if (${MKKERBEROS} != "no")
129 PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
130 -lroken -lcom_err -lheimbase -lcrypto
131 PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \
132 ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO}
133 .endif
134 .if (${MKSKEY} != "no")
135 PAM_STATIC_LDADD+= -lskey
136 PAM_STATIC_DPADD+= ${LIBSKEY}
137 .endif
138 PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil
139 PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL}
140 .else
141 PAM_STATIC_LDADD=
142 PAM_STATIC_DPADD=
143 .endif
145 # NB: If you are a library here, add it in bsd.README
146 .for _lib in \
147 FS \
148 GL \
149 GLU \
150 ICE \
151 SM \
152 X11 \
153 XTrap \
154 Xau \
155 Xaw \
156 Xdmcp \
157 Xext \
158 Xfont \
159 Xft \
160 Xi \
161 Xinerama \
162 Xmu \
163 Xmuu \
164 Xpm \
165 Xrandr \
166 Xrender \
167 Xss \
168 Xt \
169 Xtst \
170 Xv \
171 Xxf86dga \
172 Xxf86misc \
173 Xxf86vm \
174 dps \
175 fntstubs \
176 fontcache \
177 fontconfig \
178 fontenc \
179 freetype \
180 lbxutil \
181 xkbfile
182 .ifndef LIB${_lib:tu}
183 LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
184 .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
185 .endif
186 .endfor
188 .if defined(RESCUEDIR)
189 CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\"
190 .endif
192 _PROGLDOPTS=
193 .if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves
194 _PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER}
195 .endif
196 .if ${SHLIBDIR} != "/usr/lib"
197 _PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
198 -L=${SHLIBDIR}
199 .elif ${SHLIBINSTALLDIR} != "/usr/lib"
200 _PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
201 -L=${SHLIBINSTALLDIR}
202 .endif
204 __proginstall: .USE
205 ${_MKTARGET_INSTALL}
206 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
207 ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
209 __progrumpinstall: .USE
210 ${_MKTARGET_INSTALL}
211 ${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \
212 ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
214 __progdebuginstall: .USE
215 ${_MKTARGET_INSTALL}
216 ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
217 ${.ALLSRC} ${.TARGET}
222 # Backwards compatibility with Makefiles that assume that bsd.prog.mk
223 # can only build a single binary.
226 _APPEND_MANS=yes
227 _APPEND_SRCS=yes
229 _CCLINKFLAGS=
231 .if defined(PROG_CXX)
232 PROG= ${PROG_CXX}
233 _CCLINK= ${CXX} ${_CCLINKFLAGS}
234 .endif
236 .if defined(RUMPPRG)
237 PROG= ${RUMPPRG}
238 . ifndef CRUNCHEDPROG
239 . if (${MKRUMP} != "no")
240 PROGS= ${RUMPPRG} rump.${RUMPPRG}
241 . else
242 PROGS= ${RUMPPRG}
243 . endif
244 . if defined(SRCS)
245 . if (${MKRUMP} != "no")
246 SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
247 . endif
248 SRCS+= ${PROG}_hostops.c
249 . else
250 SRCS= ${PROG}.c ${PROG}_hostops.c
251 . if (${MKRUMP} != "no")
252 SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
253 . endif
254 . endif
255 . if (${MKRUMP} != "no")
256 DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS}
257 LDADD.rump.${PROG}+= -lrumpclient
258 DPADD.rump.${PROG}+= ${LIBRUMPCLIENT}
259 MAN.rump.${PROG}= # defined but feeling empty
260 _RUMPINSTALL.rump.${PROG}=# defined
261 . endif
262 . else # CRUNCHEDPROG
263 PROGS= ${PROG}
264 CPPFLAGS+= -DCRUNCHOPS
265 . endif
266 .endif
268 .if defined(PROG)
269 _CCLINK?= ${CC} ${_CCLINKFLAGS}
270 . if defined(MAN)
271 MAN.${PROG}= ${MAN}
272 _APPEND_MANS= no
273 . endif
274 . if !defined(OBJS)
275 OBJS= ${OBJS.${PROG}}
276 . endif
277 . if defined(PROGNAME)
278 PROGNAME.${PROG}= ${PROGNAME}
279 . endif
280 . if defined(SRCS)
281 SRCS.${PROG}= ${SRCS}
282 _APPEND_SRCS= no
283 . endif
284 .endif
286 # Turn the single-program PROG and PROG_CXX variables into their multi-word
287 # counterparts, PROGS and PROGS_CXX.
288 .if !defined(RUMPPRG)
289 . if defined(PROG_CXX) && !defined(PROGS_CXX)
290 PROGS_CXX= ${PROG_CXX}
291 . elif defined(PROG) && !defined(PROGS)
292 PROGS= ${PROG}
293 . endif
294 .endif
297 # Per-program definitions and targets.
300 _CCLINK.CDEFAULT= ${CC} ${_CCLINKFLAGS}
301 # Definitions specific to C programs.
302 .for _P in ${PROGS}
303 SRCS.${_P}?= ${_P}.c
304 _CCLINK.${_P}= ${CC} ${_CCLINKFLAGS}
305 _CFLAGS.${_P}= ${CFLAGS} ${CPUFLAGS}
306 _CPPFLAGS.${_P}= ${CPPFLAGS}
307 _COPTS.${_P}= ${COPTS}
308 .endfor
310 _CCLINK.CXXDEFAULT= ${CXX} ${_CCLINKFLAGS}
311 # Definitions specific to C++ programs.
312 .for _P in ${PROGS_CXX}
313 SRCS.${_P}?= ${_P}.cc
314 _CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS}
315 .endfor
317 # Language-independent definitions.
318 .for _P in ${PROGS} ${PROGS_CXX} # {
320 BINDIR.${_P}?= ${BINDIR}
321 PROGNAME.${_P}?= ${_P}
323 .if ${MKDEBUG} != "no" && !commands(${_P})
324 _PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug
325 .endif
327 .if defined(PAXCTL_FLAGS)
328 PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
329 .endif
331 ##### PROG specific flags.
333 _DPADD.${_P}= ${DPADD} ${DPADD.${_P}}
334 _LDADD.${_P}= ${LDADD} ${LDADD.${_P}}
335 _LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}}
336 _LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}}
338 ##### Build and install rules
339 .if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
340 SRCS+= ${SRCS.${_P}} # For bsd.dep.mk
341 .endif
343 _YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}
345 DPSRCS+= ${_YPSRCS.${_P}}
346 CLEANFILES+= ${_YPSRCS.${_P}}
348 .if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)
349 OBJS.${_P}+= ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
350 LOBJS.${_P}+= ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}
351 .endif
353 .if defined(OBJS.${_P}) && !empty(OBJS.${_P}) # {
354 .NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}
356 .if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \
357 && (${_CCLINK.${_P}} == ${_CCLINK.CDEFAULT} \
358 || ${_CCLINK.${_P}} == ${_CCLINK.CXXDEFAULT}) \
359 && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE))
360 .for f in ${SRCS.${_P}:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g}
361 #_XFLAGS.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} \
362 # ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
363 .if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \
364 || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \
365 || ${CXXFLAGS.$f:D5} == "5") \
366 || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/}))
367 XOBJS.${_P}+= ${f:R:S/$/.o/}
368 .else
369 XSRCS.${_P}+= ${f}
370 NODPSRCS+= ${f}
371 .endif
372 .endfor
374 ${_P}: .gdbinit ${LIBCRT0} ${XOBJS.${_P}} ${SRCS.${_P}} ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}}
375 ${_MKTARGET_LINK}
376 .if defined(DESTDIR)
377 ${_CCLINK.${_P}} -Wl,-nostdlib \
378 ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
379 -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
380 -MD --combine ${_CPPFLAGS.${_P}} ${_CFLAGS.${_P}} ${_COPTS.${_P}} \
381 ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
382 ${_LDADD.${_P}} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib
383 .else
384 ${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
385 -MD --combine ${_CPPFLAGS.${_P}} ${_COPTS.${_P}}
386 ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
387 ${_LDADD.${_P}}
388 .endif # defined(DESTDIR)
389 .if defined(CTFMERGE)
390 ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
391 .endif
392 .if defined(PAXCTL_FLAGS.${_P})
393 ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
394 .endif
395 .if ${MKSTRIPIDENT} != "no"
396 ${OBJCOPY} -R .ident ${.TARGET}
397 .endif
399 CLEANFILES+= ${_P}.d
400 .if exists(${_P}.d)
401 .include "${_P}.d" # include -MD depend for program.
402 .endif
403 .else # USE_COMBINE
405 ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
407 ${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}}
408 .if !commands(${_P})
409 ${_MKTARGET_LINK}
410 ${_CCLINK.${_P}} \
411 ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \
412 ${OBJS.${_P}} ${_LDADD.${_P}} \
413 ${_PROGLDOPTS}
414 .if defined(CTFMERGE)
415 ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
416 .endif
417 .if defined(PAXCTL_FLAGS.${_P})
418 ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
419 .endif
420 .if ${MKSTRIPIDENT} != "no"
421 ${OBJCOPY} -R .ident ${.TARGET}
422 .endif
423 .endif # !commands(${_P})
424 .endif # USE_COMBINE
426 ${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}}
427 ${_MKTARGET_LINK}
428 ${CC} ${LDFLAGS} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
430 .if defined(_PROGDEBUG.${_P})
431 ${_PROGDEBUG.${_P}}: ${_P}
432 ${_MKTARGET_CREATE}
433 ( ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \
434 && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
435 --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
436 ) || (rm -f ${_PROGDEBUG.${_P}}; false)
437 .endif
439 .endif # defined(OBJS.${_P}) && !empty(OBJS.${_P}) # }
441 .if !defined(MAN.${_P})
442 MAN.${_P}= ${_P}.1
443 .endif # !defined(MAN.${_P})
444 .if !empty(_APPEND_MANS:M[Yy][Ee][Ss])
445 MAN+= ${MAN.${_P}}
446 .endif
448 realall: ${_P} ${_PROGDEBUG.${_P}}
450 CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}}
452 .if defined(OBJS.${_P}) && !empty(OBJS.${_P})
453 CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}}
454 .endif
456 _PROG_INSTALL+= proginstall-${_P}
458 .if !target(proginstall-${_P}) # {
459 proginstall-${_P}:: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
460 ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
461 .PRECIOUS: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
462 ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
464 .if ${MKUPDATE} == "no"
465 .if defined(_RUMPINSTALL.${_P})
466 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall
467 .else
468 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall
469 .endif
470 .if !defined(BUILD) && !make(all) && !make(${_P})
471 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE
472 .endif
473 .if defined(_PROGDEBUG.${_P})
474 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall
475 .if !defined(BUILD) && !make(all) && !make(${_P})
476 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE
477 .endif
478 .endif # define(_PROGDEBUG.${_P})
479 .else # MKUPDATE != no
480 .if defined(_RUMPINSTALL.${_P})
481 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall
482 .else
483 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall
484 .endif
485 .if !defined(BUILD) && !make(all) && !make(${_P})
486 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE
487 .endif
488 .if defined(_PROGDEBUG.${_P})
489 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall
490 .if !defined(BUILD) && !make(all) && !make(${_P})
491 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE
492 .endif
493 .endif # defined(_PROGDEBUG.${_P})
494 .endif # MKUPDATE != no
496 .endif # !target(proginstall-${_P}) # }
498 lint: lint-${_P}
499 lint-${_P}: ${LOBJS.${_P}}
500 .if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})
501 ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}
502 .endif
504 .endfor # _P in ${PROGS} ${PROGS_CXX} # }
506 .if defined(OBJS) && !empty(OBJS) && \
507 (empty(PROGS) && empty(PROGS_CXX))
508 CLEANFILES+= ${OBJS} ${LOBJS}
509 .endif
511 .if !target(proginstall)
512 proginstall:: ${_PROG_INSTALL}
513 .endif
514 .PHONY: proginstall
518 realall: ${SCRIPTS}
519 .if defined(SCRIPTS) && !target(scriptsinstall) # {
520 SCRIPTSDIR?=${BINDIR}
521 SCRIPTSOWN?=${BINOWN}
522 SCRIPTSGRP?=${BINGRP}
523 SCRIPTSMODE?=${BINMODE}
525 scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
526 .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
528 __scriptinstall: .USE
529 ${_MKTARGET_INSTALL}
530 ${INSTALL_FILE} \
531 -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
532 -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
533 -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
534 ${.ALLSRC} ${.TARGET}
536 .for S in ${SCRIPTS:O:u}
537 .if ${MKUPDATE} == "no"
538 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
539 .if !defined(BUILD) && !make(all) && !make(${S})
540 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
541 .endif
542 .else
543 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
544 .if !defined(BUILD) && !make(all) && !make(${S})
545 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
546 .endif
547 .endif
548 .endfor
549 .endif # }
551 .if !target(scriptsinstall)
552 scriptsinstall::
553 .endif
554 .PHONY: scriptsinstall
556 ##### Pull in related .mk logic
557 LINKSOWN?= ${BINOWN}
558 LINKSGRP?= ${BINGRP}
559 LINKSMODE?= ${BINMODE}
560 .include <bsd.man.mk>
561 .include <bsd.nls.mk>
562 .include <bsd.files.mk>
563 .include <bsd.inc.mk>
564 .include <bsd.links.mk>
565 .include <bsd.sys.mk>
566 .include <bsd.dep.mk>
567 .include <bsd.clang-analyze.mk>
568 .include <bsd.clean.mk>
570 ${TARGETS}: # ensure existence
572 .endif # HOSTPROG