Remove building with NOCRYPTO option
[minix.git] / share / mk / bsd.prog.mk
blobce10cf5d990ef6a90ebe4b9b0f589b8cb4477a83
1 # $NetBSD: bsd.prog.mk,v 1.292 2015/06/07 15:04:28 matt 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 .if defined(CTFCONVERT)
38 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
39 .endif
40 @rm -f x.c
42 .cc.o .cpp.o .cxx.o .C.o:
43 ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c -
44 @mv -f x.c x.cc
45 @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET}
46 .if defined(CTFCONVERT)
47 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
48 .endif
49 @rm -f x.cc
50 .endif
52 .if defined(MKPIE) && (${MKPIE} != "no")
53 CFLAGS+= ${PIE_CFLAGS}
54 AFLAGS+= ${PIE_AFLAGS}
55 LDFLAGS+= ${PIE_LDFLAGS}
56 .endif
58 CFLAGS+= ${COPTS}
59 .if defined(MKDEBUG) && (${MKDEBUG} != "no")
60 CFLAGS+= -g
61 .endif
62 OBJCFLAGS+= ${OBJCOPTS}
63 MKDEP_SUFFIXES?= .o .ln .d
65 # CTF preserve debug symbols
66 .if (${MKCTF:Uno} != "no") && (${CFLAGS:M-g} != "")
67 CTFFLAGS+= -g
68 CTFMFLAGS+= -g
69 .if defined(HAVE_GCC) && ${HAVE_GCC} >= 48
70 #CFLAGS+=-gdwarf-2
71 .endif
72 .endif
74 # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
75 .ifndef LIBCRTBEGIN
76 LIBCRTBEGIN= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o ${_GCC_CRTBEGIN}
77 .MADE: ${LIBCRTBEGIN}
78 .endif
79 .ifndef LIBCRTEND
80 LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o
81 .MADE: ${LIBCRTEND}
82 .endif
83 _SHLINKER= ${SHLINKDIR}/ld.elf_so
85 .ifndef LIBCRT0
86 LIBCRT0= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crt0.o
87 .MADE: ${LIBCRT0}
88 .endif
90 .ifndef LIBCRTI
91 LIBCRTI= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o
92 .MADE: ${LIBCRTI}
93 .endif
95 ##### Installed system library definitions
97 # E.g.
98 # LIBC?=${DESTDIR}/usr/lib/libc.a
99 # LIBX11?=${DESTDIR}/usr/X11R7/lib/libX11.a
100 # etc..
101 # NB: If you are a library here, add it in bsd.README
103 .for _lib in \
104 archive \
105 asn1 \
106 atf_c \
107 atf_cxx \
108 bind9 \
109 bluetooth \
110 bsdmalloc \
111 bz2 \
113 c_pic \
114 com_err \
115 compat \
116 crypt \
117 crypto \
118 crypto_idea \
119 crypto_mdc2 \
120 crypto_rc5 \
121 curses \
122 dbm \
123 des \
124 dns \
125 edit \
126 event \
127 expat \
128 fetch \
129 fl \
130 form \
131 g2c \
132 gcc \
133 gnumalloc \
134 gssapi \
135 hdb \
136 heimbase \
137 heimntlm \
138 hx509 \
139 intl \
140 ipsec \
141 isc \
142 isccc \
143 isccfg \
144 kadm5clnt \
145 kadm5srv \
146 kafs \
147 krb5 \
148 kvm \
150 lber \
151 ldap \
152 ldap_r \
153 lua \
154 lwres \
156 magic \
157 menu \
158 objc \
159 ossaudio \
160 pam \
161 pcap \
162 pci \
163 pmc \
164 posix \
165 pthread \
166 pthread_dbg \
167 puffs \
168 quota \
169 radius \
170 resolv \
171 rmt \
172 roken \
173 rpcsvc \
174 rt \
175 rump \
176 rumpfs_cd9660fs \
177 rumpfs_efs \
178 rumpfs_ext2fs \
179 rumpfs_ffs \
180 rumpfs_hfs \
181 rumpfs_lfs \
182 rumpfs_msdosfs \
183 rumpfs_nfs \
184 rumpfs_ntfs \
185 rumpfs_syspuffs \
186 rumpfs_tmpfs \
187 rumpfs_udf \
188 rumpfs_ufs \
189 rumpuser \
190 saslc \
191 skey \
192 sl \
193 sqlite3 \
194 ss \
195 ssh \
196 ssl \
197 ssp \
198 stdcxx \
199 supcxx \
200 terminfo \
201 tre \
202 usbhid \
203 util \
204 wind \
205 wrap \
209 .ifndef LIB${_lib:tu}
210 LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
211 .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
212 .endif
213 .endfor
215 # Minix libraries
216 .for _lib in \
217 audiodriver \
218 bdev \
219 blockdriver \
220 chardriver \
221 clkconf \
222 ddekit \
223 ddekit_usb_client \
224 ddekit_usb_server \
225 devman \
226 elf \
227 exec \
228 fsdriver \
229 gpio \
230 hgfs \
231 i2cdriver \
232 inputdriver \
233 lwip \
234 minc \
235 minixfs \
236 mthread \
237 netdriver \
238 sffs \
239 sockdriver \
240 sockevent \
241 sys \
242 timers \
243 usb \
244 vboxfs \
245 virtio \
246 vtreefs
247 .ifndef LIB${_lib:tu}
248 LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
249 .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
250 .endif
251 .endfor
253 # PAM applications, if linked statically, need more libraries
254 .if (${MKPIC} == "no")
255 .if (${MKCRYPTO} != "no")
256 PAM_STATIC_LDADD+= -lssh
257 PAM_STATIC_DPADD+= ${LIBSSH}
258 .endif
259 .if (${MKKERBEROS} != "no")
260 PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
261 -lroken -lcom_err -lheimbase -lcrypto
262 PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \
263 ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO}
264 .endif
265 .if (${MKSKEY} != "no")
266 PAM_STATIC_LDADD+= -lskey
267 PAM_STATIC_DPADD+= ${LIBSKEY}
268 .endif
269 PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil
270 PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL}
271 .else
272 PAM_STATIC_LDADD=
273 PAM_STATIC_DPADD=
274 .endif
276 .if defined(__MINIX) && ${MACHINE_ARCH} == "earm"
277 # LSC: On ARM, when compiling statically, with gcc, lgcc_eh is required
278 LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:}
279 .endif # defined(__MINIX) && ${MACHINE_ARCH} == "earm"
281 # NB: If you are a library here, add it in bsd.README
282 .for _lib in \
283 FS \
284 GL \
285 GLU \
286 ICE \
287 SM \
288 X11 \
289 XTrap \
290 Xau \
291 Xaw \
292 Xdmcp \
293 Xext \
294 Xfont \
295 Xft \
296 Xi \
297 Xinerama \
298 Xmu \
299 Xmuu \
300 Xpm \
301 Xrandr \
302 Xrender \
303 Xss \
304 Xt \
305 Xtst \
306 Xv \
307 Xxf86dga \
308 Xxf86misc \
309 Xxf86vm \
310 dps \
311 fntstubs \
312 fontcache \
313 fontconfig \
314 fontenc \
315 freetype \
316 lbxutil \
317 xkbfile
318 .ifndef LIB${_lib:tu}
319 LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
320 .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
321 .endif
322 .endfor
324 # Ugly one-offs
325 LIBX11_XCB= ${DESTDIR}${X11USRLIBDIR}/libX11-xcb.a
326 LIBXCB= ${DESTDIR}${X11USRLIBDIR}/libxcb.a
328 .if defined(RESCUEDIR)
329 CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\"
330 .endif
332 _PROGLDOPTS=
333 .if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves
334 _PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER}
335 .endif
336 .if ${SHLIBDIR} != "/usr/lib"
337 _PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
338 -L=${SHLIBDIR}
339 .elif ${SHLIBINSTALLDIR} != "/usr/lib"
340 _PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
341 -L=${SHLIBINSTALLDIR}
342 .endif
344 __proginstall: .USE
345 ${_MKTARGET_INSTALL}
346 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
347 ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
349 __progrumpinstall: .USE
350 ${_MKTARGET_INSTALL}
351 ${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \
352 ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
354 __progdebuginstall: .USE
355 ${_MKTARGET_INSTALL}
356 ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
357 ${.ALLSRC} ${.TARGET}
362 # Backwards compatibility with Makefiles that assume that bsd.prog.mk
363 # can only build a single binary.
366 _APPEND_MANS=yes
367 _APPEND_SRCS=yes
369 _CCLINKFLAGS=
371 .if defined(PROG_CXX)
372 PROG= ${PROG_CXX}
373 _CCLINK= ${CXX} ${_CCLINKFLAGS}
375 .if defined(__MINIX)
376 # BJG - stack unwinding (for C++ exceptions) doesn't work on static executables when built with llvm.
377 LDSTATIC= -dynamic
378 .endif # defined(__MINIX)
379 .endif
381 .if defined(RUMPPRG)
382 PROG= ${RUMPPRG}
383 . ifndef CRUNCHEDPROG
384 . if (${MKRUMP} != "no")
385 PROGS= ${RUMPPRG} rump.${RUMPPRG}
386 . else
387 PROGS= ${RUMPPRG}
388 . endif
389 . if defined(SRCS)
390 . if (${MKRUMP} != "no")
391 SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
392 . endif
393 SRCS+= ${PROG}_hostops.c
394 . else
395 SRCS= ${PROG}.c ${PROG}_hostops.c
396 . if (${MKRUMP} != "no")
397 SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
398 . endif
399 . endif
400 . if (${MKRUMP} != "no")
401 DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS}
402 LDADD.rump.${PROG}+= -lrumpclient
403 DPADD.rump.${PROG}+= ${LIBRUMPCLIENT}
404 MAN.rump.${PROG}= # defined but feeling empty
405 _RUMPINSTALL.rump.${PROG}=# defined
406 . endif
407 . else # CRUNCHEDPROG
408 PROGS= ${PROG}
409 CPPFLAGS+= -DCRUNCHOPS
410 . endif
411 .endif
413 .if defined(PROG)
414 _CCLINK?= ${CC} ${_CCLINKFLAGS}
415 . if defined(MAN)
416 MAN.${PROG}= ${MAN}
417 _APPEND_MANS= no
418 . endif
419 . if !defined(OBJS)
420 OBJS= ${OBJS.${PROG}}
421 . endif
422 . if defined(PROGNAME)
423 PROGNAME.${PROG}= ${PROGNAME}
424 . endif
425 . if defined(SRCS)
426 SRCS.${PROG}= ${SRCS}
427 _APPEND_SRCS= no
428 . endif
429 .endif
431 # Turn the single-program PROG and PROG_CXX variables into their multi-word
432 # counterparts, PROGS and PROGS_CXX.
433 .if !defined(RUMPPRG)
434 . if defined(PROG_CXX) && !defined(PROGS_CXX)
435 PROGS_CXX= ${PROG_CXX}
436 . elif defined(PROG) && !defined(PROGS)
437 PROGS= ${PROG}
438 . endif
439 .endif
441 ##### Libraries that this may depend upon.
442 .if defined(PROGDPLIBS) # {
443 .for _lib _dir in ${PROGDPLIBS}
444 .if !defined(BINDO.${_lib})
445 PROGDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR}
446 .MAKEOVERRIDES+=PROGDO.${_lib}
447 .endif
448 LDADD+= -L${PROGDO.${_lib}} -l${_lib}
449 .if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a)
450 DPADD+= ${PROGDO.${_lib}}/lib${_lib}_pic.a
451 .elif exists(${PROGDO.${_lib}}/lib${_lib}.so)
452 DPADD+= ${PROGDO.${_lib}}/lib${_lib}.so
453 .else
454 DPADD+= ${PROGDO.${_lib}}/lib${_lib}.a
455 .endif
456 .endfor
457 .endif # }
459 # Per-program definitions and targets.
462 _CCLINK.CDEFAULT= ${CC} ${_CCLINKFLAGS}
463 # Definitions specific to C programs.
464 .for _P in ${PROGS}
465 SRCS.${_P}?= ${_P}.c
466 _CCLINK.${_P}= ${CC} ${_CCLINKFLAGS}
467 _CFLAGS.${_P}= ${CFLAGS} ${CPUFLAGS}
468 _CPPFLAGS.${_P}= ${CPPFLAGS}
469 _COPTS.${_P}= ${COPTS}
470 .endfor
472 _CCLINK.CXXDEFAULT= ${CXX} ${_CCLINKFLAGS}
473 # Definitions specific to C++ programs.
474 .for _P in ${PROGS_CXX}
475 SRCS.${_P}?= ${_P}.cc
476 _CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS}
477 .endfor
479 # Language-independent definitions.
480 .if defined(__MINIX)
481 .if ${USE_BITCODE:Uno} == "yes"
482 CFLAGS+= -flto
483 .endif # ${USE_BITCODE:Uno} == "yes"
485 .if ${USE_BITCODE:Uyes} == "no"
486 #LSC Gold linker seems to require the library directory to be set up if
487 # a sysroot parameter has been given.
488 LDFLAGS+= -L ${DESTDIR}/usr/lib
489 .endif # ${USE_BITCODE:U} == "no"
490 .endif # defined(__MINIX)
492 .for _P in ${PROGS} ${PROGS_CXX} # {
494 BINDIR.${_P}?= ${BINDIR}
495 PROGNAME.${_P}?= ${_P}
497 .if ${MKDEBUG} != "no" && !commands(${_P})
498 _PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug
499 .endif
501 .if defined(PAXCTL_FLAGS)
502 PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
503 .endif
505 ##### PROG specific flags.
507 _DPADD.${_P}= ${DPADD} ${DPADD.${_P}}
508 _LDADD.${_P}= ${LDADD} ${LDADD.${_P}}
509 _LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}}
510 _LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}}
512 ##### Build and install rules
513 .if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
514 SRCS+= ${SRCS.${_P}} # For bsd.dep.mk
515 .endif
517 _YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}
519 DPSRCS+= ${_YPSRCS.${_P}}
520 CLEANFILES+= ${_YPSRCS.${_P}}
522 .if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)
523 OBJS.${_P}+= ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
524 LOBJS.${_P}+= ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}
525 .endif
527 .if defined(OBJS.${_P}) && !empty(OBJS.${_P}) # {
528 .NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}
530 .if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \
531 && (${_CCLINK.${_P}} == ${_CCLINK.CDEFAULT} \
532 || ${_CCLINK.${_P}} == ${_CCLINK.CXXDEFAULT}) \
533 && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE))
534 .for f in ${SRCS.${_P}:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g}
535 #_XFLAGS.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} \
536 # ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
537 .if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \
538 || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \
539 || ${CXXFLAGS.$f:D5} == "5") \
540 || ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/}))
541 XOBJS.${_P}+= ${f:R:S/$/.o/}
542 .else
543 XSRCS.${_P}+= ${f}
544 NODPSRCS+= ${f}
545 .endif
546 .endfor
548 ${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${XOBJS.${_P}} ${SRCS.${_P}} \
549 ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}}
550 ${_MKTARGET_LINK}
551 .if defined(DESTDIR)
552 ${_CCLINK.${_P}} -Wl,-nostdlib \
553 ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
554 -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
555 -MD --combine ${_CPPFLAGS.${_P}} ${_CFLAGS.${_P}} ${_COPTS.${_P}} \
556 ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
557 ${_LDADD.${_P}} -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib
558 .else
559 ${_CCLINK.${_P}} ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} ${_PROGLDOPTS} \
560 -MD --combine ${_CPPFLAGS.${_P}} ${_COPTS.${_P}}
561 ${XSRCS.${_P}:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} ${XOBJS.${_P}} \
562 ${_LDADD.${_P}}
563 .endif # defined(DESTDIR)
564 .if defined(CTFMERGE)
565 ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
566 .endif
567 .if defined(PAXCTL_FLAGS.${_P})
568 ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
569 .endif
570 .if ${MKSTRIPIDENT} != "no"
571 ${OBJCOPY} -R .ident ${.TARGET}
572 .endif
574 CLEANFILES+= ${_P}.d
575 .if exists(${_P}.d)
576 .include "${_P}.d" # include -MD depend for program.
577 .endif
578 .else # USE_COMBINE
580 ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
582 .if defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
583 CLEANFILES+= ${_P}.opt.bcl ${_P}.bcl ${_P}.bcl.o
585 OPTFLAGS.${_P}?= ${OPTFLAGS}
586 BITCODE_LD_FLAGS_1ST.${_P}+= ${BITCODE_LD_FLAGS_1ST}
587 BITCODE_LD_FLAGS_2ND.${_P}+= ${BITCODE_LD_FLAGS_2ND}
589 ${_P}.bcl: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \
590 ${LIBCRTEND} ${_DPADD.${_P}}
591 ${_MKTARGET_LINK}
592 ${_CCLINK.${_P}} \
593 -o ${.TARGET} \
594 -nostartfiles \
595 -L${DESTDIR}/usr/lib/bc \
596 ${OBJS.${_P}} ${LLVM_LINK_ARGS} ${_LDADD.${_P}:N-shared} \
597 ${_LDSTATIC.${_P}} ${_PROGLDOPTS} \
598 -Wl,-r \
599 ${BITCODE_LD_FLAGS_1ST.${_P}} \
600 -Wl,-plugin-opt=emit-llvm
602 ${_P}.opt.bcl: ${_P}.bcl ${LLVM_PASS}
603 ${_MKTARGET_LINK}
604 ${OPT} ${OPTFLAGS.${_P}} -o ${.TARGET} ${_P}.bcl
606 ${_P}.bcl.o: ${_P}.opt.bcl
607 ${_MKTARGET_LINK}
608 ${LLC} -O1 -march=x86 -mcpu=i586 -filetype=obj -o ${.TARGET} ${.ALLSRC}
610 ${_P}: ${_P}.bcl.o
611 .if !commands(${_P})
612 ${_MKTARGET_LINK}
613 ${_CCLINK.${_P}} \
614 ${_LDFLAGS.${_P}} \
615 -L${DESTDIR}/usr/lib \
616 ${_LDSTATIC.${_P}} -o ${.TARGET} \
617 ${.TARGET}.bcl.o ${_PROGLDOPTS} ${_LDADD.${_P}} \
618 ${BITCODE_LD_FLAGS_2ND.${_P}} \
619 -Wl,--allow-multiple-definition
620 .endif # !commands(${_P})
622 .else
623 ${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \
624 ${LIBCRTEND} ${_DPADD.${_P}}
625 .if !commands(${_P})
626 ${_MKTARGET_LINK}
627 ${_CCLINK.${_P}} \
628 ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \
629 ${OBJS.${_P}} ${_PROGLDOPTS} ${_LDADD.${_P}}
630 .if defined(CTFMERGE)
631 ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
632 .endif
633 .if defined(PAXCTL_FLAGS.${_P})
634 ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
635 .endif
636 .if ${MKSTRIPIDENT} != "no"
637 ${OBJCOPY} -R .ident ${.TARGET}
638 .endif
639 .endif # !commands(${_P})
640 .endif # defined(__MINIX) && ${USE_BITCODE:Uno} == "yes"
641 .endif # USE_COMBINE
643 ${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}}
644 ${_MKTARGET_LINK}
645 ${CC} ${LDFLAGS:N-Wl,-pie} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
647 .if defined(_PROGDEBUG.${_P})
648 ${_PROGDEBUG.${_P}}: ${_P}
649 ${_MKTARGET_CREATE}
650 ( ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \
651 && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
652 --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
653 ) || (rm -f ${_PROGDEBUG.${_P}}; false)
654 .endif
656 .endif # defined(OBJS.${_P}) && !empty(OBJS.${_P}) # }
658 .if !defined(MAN.${_P})
659 MAN.${_P}= ${_P}.1
660 .endif # !defined(MAN.${_P})
661 .if !empty(_APPEND_MANS:M[Yy][Ee][Ss])
662 MAN+= ${MAN.${_P}}
663 .endif
665 realall: ${_P} ${_PROGDEBUG.${_P}}
667 CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}}
669 .if defined(OBJS.${_P}) && !empty(OBJS.${_P})
670 CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}}
671 .endif
673 _PROG_INSTALL+= proginstall-${_P}
675 .if !target(proginstall-${_P}) # {
676 proginstall-${_P}:: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
677 ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
678 .PRECIOUS: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
679 ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
681 .if ${MKUPDATE} == "no"
682 .if defined(_RUMPINSTALL.${_P})
683 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall
684 .else
685 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall
686 .endif
687 .if !defined(BUILD) && !make(all) && !make(${_P})
688 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE
689 .endif
690 .if defined(_PROGDEBUG.${_P})
691 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall
692 .if !defined(BUILD) && !make(all) && !make(${_P})
693 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE
694 .endif
695 .endif # define(_PROGDEBUG.${_P})
696 .else # MKUPDATE != no
697 .if defined(_RUMPINSTALL.${_P})
698 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall
699 .else
700 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall
701 .endif
702 .if !defined(BUILD) && !make(all) && !make(${_P})
703 ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE
704 .endif
705 .if defined(_PROGDEBUG.${_P})
706 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall
707 .if !defined(BUILD) && !make(all) && !make(${_P})
708 ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE
709 .endif
710 .endif # defined(_PROGDEBUG.${_P})
711 .endif # MKUPDATE != no
713 .endif # !target(proginstall-${_P}) # }
715 lint: lint-${_P}
716 lint-${_P}: ${LOBJS.${_P}}
717 .if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})
718 ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}
719 .endif
721 .endfor # _P in ${PROGS} ${PROGS_CXX} # }
723 .if defined(OBJS) && !empty(OBJS) && \
724 (empty(PROGS) && empty(PROGS_CXX))
725 CLEANFILES+= ${OBJS} ${LOBJS}
726 .endif
728 .if !target(proginstall)
729 proginstall:: ${_PROG_INSTALL}
730 .endif
731 .PHONY: proginstall
735 realall: ${SCRIPTS}
736 .if defined(SCRIPTS) && !target(scriptsinstall) # {
737 SCRIPTSDIR?=${BINDIR}
738 SCRIPTSOWN?=${BINOWN}
739 SCRIPTSGRP?=${BINGRP}
740 SCRIPTSMODE?=${BINMODE}
742 scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
743 .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
745 __scriptinstall: .USE
746 ${_MKTARGET_INSTALL}
747 ${INSTALL_FILE} \
748 -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
749 -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
750 -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
751 ${.ALLSRC} ${.TARGET}
753 .for S in ${SCRIPTS:O:u}
754 .if ${MKUPDATE} == "no"
755 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
756 .if !defined(BUILD) && !make(all) && !make(${S})
757 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
758 .endif
759 .else
760 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
761 .if !defined(BUILD) && !make(all) && !make(${S})
762 ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
763 .endif
764 .endif
765 .endfor
766 .endif # }
768 .if !target(scriptsinstall)
769 scriptsinstall::
770 .endif
771 .PHONY: scriptsinstall
773 ##### Pull in related .mk logic
774 LINKSOWN?= ${BINOWN}
775 LINKSGRP?= ${BINGRP}
776 LINKSMODE?= ${BINMODE}
777 .include <bsd.man.mk>
778 .include <bsd.nls.mk>
779 .include <bsd.files.mk>
780 .include <bsd.inc.mk>
781 .include <bsd.links.mk>
782 .include <bsd.sys.mk>
783 .include <bsd.dep.mk>
784 .include <bsd.clang-analyze.mk>
785 .include <bsd.clean.mk>
787 ${TARGETS}: # ensure existence
789 .endif # HOSTPROG