bsd.prog.mk revision 1.269 1 1.269 christos # $NetBSD: bsd.prog.mk,v 1.269 2011/10/16 01:24:05 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.268 christos usbhid \
184 1.268 christos util \
185 1.268 christos wind \
186 1.268 christos wrap \
187 1.268 christos y \
188 1.268 christos z
189 1.202 lukem .ifndef LIB${_lib:tu}
190 1.269 christos LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
191 1.202 lukem .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
192 1.202 lukem .endif
193 1.202 lukem .endfor
194 1.269 christos
195 1.206 he # PAM applications, if linked statically, need more libraries
196 1.206 he .if (${MKPIC} == "no")
197 1.208 christos .if (${MKCRYPTO} != "no")
198 1.208 christos PAM_STATIC_LDADD+= -lssh
199 1.208 christos PAM_STATIC_DPADD+= ${LIBSSH}
200 1.208 christos .endif
201 1.208 christos .if (${MKKERBEROS} != "no")
202 1.265 he PAM_STATIC_LDADD+= -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
203 1.265 he -lroken -lcom_err -lheimbase -lcrypto
204 1.265 he PAM_STATIC_DPADD+= ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN1} \
205 1.265 he ${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO}
206 1.208 christos .endif
207 1.208 christos .if (${MKSKEY} != "no")
208 1.208 christos PAM_STATIC_LDADD+= -lskey
209 1.208 christos PAM_STATIC_DPADD+= ${LIBSKEY}
210 1.208 christos .endif
211 1.208 christos PAM_STATIC_LDADD+= -lradius -lcrypt -lrpcsvc -lutil
212 1.208 christos PAM_STATIC_DPADD+= ${LIBRADIUS} ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL}
213 1.206 he .else
214 1.206 he PAM_STATIC_LDADD=
215 1.206 he PAM_STATIC_DPADD=
216 1.206 he .endif
217 1.206 he
218 1.269 christos # NB: If you are a library here, add it in bsd.README
219 1.202 lukem .for _lib in \
220 1.268 christos FS \
221 1.268 christos GL \
222 1.268 christos GLU \
223 1.268 christos ICE \
224 1.268 christos SM \
225 1.268 christos X11 \
226 1.268 christos XTrap \
227 1.268 christos Xau \
228 1.268 christos Xaw \
229 1.268 christos Xdmcp \
230 1.268 christos Xext \
231 1.268 christos Xfont \
232 1.268 christos Xft \
233 1.268 christos Xi \
234 1.268 christos Xinerama \
235 1.268 christos Xmu \
236 1.268 christos Xmuu \
237 1.268 christos Xpm \
238 1.268 christos Xrandr \
239 1.268 christos Xrender \
240 1.268 christos Xss \
241 1.268 christos Xt \
242 1.268 christos Xtst \
243 1.268 christos Xv \
244 1.268 christos Xxf86dga \
245 1.268 christos Xxf86misc \
246 1.268 christos Xxf86vm \
247 1.268 christos dps \
248 1.268 christos expat \
249 1.268 christos fntstubs \
250 1.268 christos fontcache \
251 1.268 christos fontconfig \
252 1.268 christos fontenc \
253 1.268 christos freetype \
254 1.268 christos lbxutil \
255 1.268 christos xkbfile
256 1.202 lukem .ifndef LIB${_lib:tu}
257 1.233 rtr LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
258 1.202 lukem .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
259 1.202 lukem .endif
260 1.202 lukem .endfor
261 1.202 lukem
262 1.204 lukem .if defined(RESCUEDIR)
263 1.204 lukem CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\"
264 1.204 lukem .endif
265 1.204 lukem
266 1.144 lukem _PROGLDOPTS=
267 1.144 lukem .if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves
268 1.144 lukem _PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER}
269 1.161 itohy .endif
270 1.187 lukem .if ${SHLIBDIR} != "/usr/lib"
271 1.264 joerg _PROGLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
272 1.263 joerg -L=${SHLIBDIR}
273 1.187 lukem .elif ${SHLIBINSTALLDIR} != "/usr/lib"
274 1.264 joerg _PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
275 1.263 joerg -L=${SHLIBINSTALLDIR}
276 1.144 lukem .endif
277 1.144 lukem
278 1.223 jmmv __proginstall: .USE
279 1.223 jmmv ${_MKTARGET_INSTALL}
280 1.223 jmmv ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
281 1.223 jmmv ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
282 1.223 jmmv
283 1.255 pooka __progrumpinstall: .USE
284 1.255 pooka ${_MKTARGET_INSTALL}
285 1.255 pooka ${INSTALL_FILE} -o ${RUMPBINOWN} -g ${RUMPBINGRP} -m ${RUMPBINMODE} \
286 1.255 pooka ${STRIPFLAG} ${.ALLSRC} ${.TARGET}
287 1.255 pooka
288 1.223 jmmv __progdebuginstall: .USE
289 1.223 jmmv ${_MKTARGET_INSTALL}
290 1.223 jmmv ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
291 1.223 jmmv ${.ALLSRC} ${.TARGET}
292 1.223 jmmv
293 1.223 jmmv
294 1.223 jmmv
295 1.223 jmmv #
296 1.223 jmmv # Backwards compatibility with Makefiles that assume that bsd.prog.mk
297 1.223 jmmv # can only build a single binary.
298 1.223 jmmv #
299 1.223 jmmv
300 1.223 jmmv _APPEND_MANS=yes
301 1.223 jmmv _APPEND_SRCS=yes
302 1.223 jmmv
303 1.231 lukem _CCLINKFLAGS=
304 1.231 lukem
305 1.145 thorpej .if defined(PROG_CXX)
306 1.223 jmmv PROG= ${PROG_CXX}
307 1.231 lukem _CCLINK= ${CXX} ${_CCLINKFLAGS}
308 1.223 jmmv .endif
309 1.223 jmmv
310 1.255 pooka .if defined(RUMPPRG)
311 1.255 pooka PROG= ${RUMPPRG}
312 1.256 pooka .ifndef CRUNCHEDPROG
313 1.255 pooka PROGS= ${RUMPPRG} rump.${RUMPPRG}
314 1.255 pooka . if defined(SRCS)
315 1.255 pooka SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS}
316 1.255 pooka SRCS+= ${PROG}_hostops.c
317 1.255 pooka . else
318 1.255 pooka SRCS= ${PROG}.c ${PROG}_hostops.c
319 1.255 pooka SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS}
320 1.255 pooka . endif
321 1.257 pooka DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS}
322 1.255 pooka LDADD.rump.${PROG}+= -lrumpclient
323 1.255 pooka DPADD.rump.${PROG}+= ${LIBRUMPCLIENT}
324 1.255 pooka MAN.rump.${PROG}= # defined but feeling empty
325 1.255 pooka _RUMPINSTALL.rump.${PROG}=# defined
326 1.256 pooka .else # CRUNCHEDPROG
327 1.256 pooka PROGS= ${PROG}
328 1.256 pooka CPPFLAGS+= -DCRUNCHOPS
329 1.256 pooka .endif
330 1.255 pooka .endif
331 1.255 pooka
332 1.223 jmmv .if defined(PROG)
333 1.231 lukem _CCLINK?= ${CC} ${_CCLINKFLAGS}
334 1.223 jmmv . if defined(MAN)
335 1.223 jmmv MAN.${PROG}= ${MAN}
336 1.223 jmmv _APPEND_MANS= no
337 1.223 jmmv . endif
338 1.223 jmmv . if !defined(OBJS)
339 1.223 jmmv OBJS= ${OBJS.${PROG}}
340 1.223 jmmv . endif
341 1.223 jmmv . if defined(PROGNAME)
342 1.223 jmmv PROGNAME.${PROG}= ${PROGNAME}
343 1.223 jmmv . endif
344 1.223 jmmv . if defined(SRCS)
345 1.223 jmmv SRCS.${PROG}= ${SRCS}
346 1.223 jmmv _APPEND_SRCS= no
347 1.223 jmmv . endif
348 1.223 jmmv .endif
349 1.223 jmmv
350 1.223 jmmv # Turn the single-program PROG and PROG_CXX variables into their multi-word
351 1.223 jmmv # counterparts, PROGS and PROGS_CXX.
352 1.255 pooka .if !defined(RUMPPRG)
353 1.255 pooka . if defined(PROG_CXX) && !defined(PROGS_CXX)
354 1.223 jmmv PROGS_CXX= ${PROG_CXX}
355 1.262 jmmv . elif defined(PROG) && !defined(PROGS)
356 1.223 jmmv PROGS= ${PROG}
357 1.255 pooka . endif
358 1.223 jmmv .endif
359 1.223 jmmv
360 1.223 jmmv #
361 1.223 jmmv # Per-program definitions and targets.
362 1.223 jmmv #
363 1.223 jmmv
364 1.223 jmmv # Definitions specific to C programs.
365 1.223 jmmv .for _P in ${PROGS}
366 1.223 jmmv SRCS.${_P}?= ${_P}.c
367 1.231 lukem _CCLINK.${_P}= ${CC} ${_CCLINKFLAGS}
368 1.223 jmmv .endfor
369 1.223 jmmv
370 1.223 jmmv # Definitions specific to C++ programs.
371 1.223 jmmv .for _P in ${PROGS_CXX}
372 1.223 jmmv SRCS.${_P}?= ${_P}.cc
373 1.231 lukem _CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS}
374 1.223 jmmv .endfor
375 1.223 jmmv
376 1.223 jmmv # Language-independent definitions.
377 1.223 jmmv .for _P in ${PROGS} ${PROGS_CXX} # {
378 1.223 jmmv
379 1.223 jmmv BINDIR.${_P}?= ${BINDIR}
380 1.223 jmmv PROGNAME.${_P}?= ${_P}
381 1.223 jmmv
382 1.249 mrg .if ${MKDEBUG} != "no" && !commands(${_P})
383 1.223 jmmv _PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug
384 1.145 thorpej .endif
385 1.145 thorpej
386 1.223 jmmv .if defined(PAXCTL_FLAGS)
387 1.223 jmmv PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS}
388 1.215 lukem .endif
389 1.215 lukem
390 1.223 jmmv ##### PROG specific flags.
391 1.244 uebayasi
392 1.223 jmmv _LDADD.${_P}= ${LDADD} ${LDADD.${_P}}
393 1.223 jmmv _LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}}
394 1.223 jmmv _LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}}
395 1.223 jmmv
396 1.223 jmmv ##### Build and install rules
397 1.223 jmmv .if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
398 1.223 jmmv SRCS+= ${SRCS.${_P}} # For bsd.dep.mk
399 1.223 jmmv .endif
400 1.223 jmmv
401 1.223 jmmv _YPSRCS.${_P}= ${SRCS.${_P}:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS.${_P}:M*.y:.y=.h}}
402 1.223 jmmv
403 1.223 jmmv DPSRCS+= ${_YPSRCS.${_P}}
404 1.223 jmmv CLEANFILES+= ${_YPSRCS.${_P}}
405 1.223 jmmv
406 1.223 jmmv .if !empty(SRCS.${_P}:N*.h:N*.sh:N*.fth)
407 1.223 jmmv OBJS.${_P}+= ${SRCS.${_P}:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
408 1.223 jmmv LOBJS.${_P}+= ${LSRCS:.c=.ln} ${SRCS.${_P}:M*.c:.c=.ln}
409 1.157 thorpej .endif
410 1.157 thorpej
411 1.223 jmmv .if defined(OBJS.${_P}) && !empty(OBJS.${_P}) # {
412 1.223 jmmv .NOPATH: ${OBJS.${_P}} ${_P} ${_YPSRCS.${_P}}
413 1.223 jmmv
414 1.223 jmmv ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS}
415 1.182 lukem
416 1.223 jmmv ${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
417 1.223 jmmv .if !commands(${_P})
418 1.194 lukem ${_MKTARGET_LINK}
419 1.231 lukem ${_CCLINK.${_P}} \
420 1.232 lukem ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \
421 1.232 lukem ${OBJS.${_P}} ${_LDADD.${_P}} \
422 1.232 lukem ${_PROGLDOPTS}
423 1.247 darran .if defined(CTFMERGE)
424 1.247 darran ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
425 1.247 darran .endif
426 1.223 jmmv .if defined(PAXCTL_FLAGS.${_P})
427 1.223 jmmv ${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
428 1.218 christos .endif
429 1.235 joerg .if ${MKSTRIPIDENT} != "no"
430 1.235 joerg ${OBJCOPY} -R .ident ${.TARGET}
431 1.235 joerg .endif
432 1.223 jmmv .endif # !commands(${_P})
433 1.183 dsl
434 1.223 jmmv ${_P}.ro: ${OBJS.${_P}} ${DPADD}
435 1.207 dsl ${_MKTARGET_LINK}
436 1.254 joerg ${CC} ${LDFLAGS} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}}
437 1.1 cgd
438 1.223 jmmv .if defined(_PROGDEBUG.${_P})
439 1.224 jmmv ${_PROGDEBUG.${_P}}: ${_P}
440 1.215 lukem ${_MKTARGET_CREATE}
441 1.251 lukem ( ${OBJCOPY} --only-keep-debug ${_P} ${_PROGDEBUG.${_P}} \
442 1.251 lukem && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
443 1.251 lukem --add-gnu-debuglink=${_PROGDEBUG.${_P}} ${_P} \
444 1.251 lukem ) || (rm -f ${_PROGDEBUG.${_P}}; false)
445 1.215 lukem .endif
446 1.215 lukem
447 1.223 jmmv .endif # defined(OBJS.${_P}) && !empty(OBJS.${_P}) # }
448 1.1 cgd
449 1.223 jmmv .if !defined(MAN.${_P})
450 1.223 jmmv MAN.${_P}= ${_P}.1
451 1.223 jmmv .endif # !defined(MAN.${_P})
452 1.223 jmmv .if !empty(_APPEND_MANS:M[Yy][Ee][Ss])
453 1.223 jmmv MAN+= ${MAN.${_P}}
454 1.223 jmmv .endif
455 1.11 mycroft
456 1.223 jmmv realall: ${_P} ${_PROGDEBUG.${_P}}
457 1.1 cgd
458 1.267 apb CLEANFILES+= ${_P} ${_PROGDEBUG.${_P}}
459 1.134 tls
460 1.223 jmmv .if defined(OBJS.${_P}) && !empty(OBJS.${_P})
461 1.267 apb CLEANFILES+= ${OBJS.${_P}} ${LOBJS.${_P}}
462 1.59 cgd .endif
463 1.27 mycroft
464 1.223 jmmv _PROG_INSTALL+= proginstall-${_P}
465 1.114 mycroft
466 1.223 jmmv .if !target(proginstall-${_P}) # {
467 1.223 jmmv proginstall-${_P}:: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
468 1.223 jmmv ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
469 1.223 jmmv .PRECIOUS: ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}} \
470 1.223 jmmv ${_PROGDEBUG.${_P}:D${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}}
471 1.215 lukem
472 1.172 lukem .if ${MKUPDATE} == "no"
473 1.255 pooka .if defined(_RUMPINSTALL.${_P})
474 1.255 pooka ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __progrumpinstall
475 1.255 pooka .else
476 1.223 jmmv ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! ${_P} __proginstall
477 1.255 pooka .endif
478 1.223 jmmv .if !defined(BUILD) && !make(all) && !make(${_P})
479 1.223 jmmv ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}! .MADE
480 1.223 jmmv .endif
481 1.223 jmmv .if defined(_PROGDEBUG.${_P})
482 1.223 jmmv ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! ${_PROGDEBUG.${_P}} __progdebuginstall
483 1.223 jmmv .if !defined(BUILD) && !make(all) && !make(${_P})
484 1.223 jmmv ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}! .MADE
485 1.215 lukem .endif
486 1.223 jmmv .endif # define(_PROGDEBUG.${_P})
487 1.215 lukem .else # MKUPDATE != no
488 1.255 pooka .if defined(_RUMPINSTALL.${_P})
489 1.255 pooka ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __progrumpinstall
490 1.255 pooka .else
491 1.223 jmmv ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: ${_P} __proginstall
492 1.255 pooka .endif
493 1.223 jmmv .if !defined(BUILD) && !make(all) && !make(${_P})
494 1.223 jmmv ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}: .MADE
495 1.223 jmmv .endif
496 1.223 jmmv .if defined(_PROGDEBUG.${_P})
497 1.223 jmmv ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: ${_PROGDEBUG.${_P}} __progdebuginstall
498 1.223 jmmv .if !defined(BUILD) && !make(all) && !make(${_P})
499 1.223 jmmv ${DESTDIR}${DEBUGDIR}${BINDIR.${_P}}/${_PROGDEBUG.${_P}}: .MADE
500 1.154 mycroft .endif
501 1.223 jmmv .endif # defined(_PROGDEBUG.${_P})
502 1.215 lukem .endif # MKUPDATE != no
503 1.215 lukem
504 1.223 jmmv .endif # !target(proginstall-${_P}) # }
505 1.223 jmmv
506 1.223 jmmv lint: lint-${_P}
507 1.223 jmmv lint-${_P}: ${LOBJS.${_P}}
508 1.223 jmmv .if defined(LOBJS.${_P}) && !empty(LOBJS.${_P})
509 1.223 jmmv ${LINT} ${LINTFLAGS} ${_LDFLAGS.${_P}:C/-L[ ]*/-L/Wg:M-L*} ${LOBJS.${_P}} ${_LDADD.${_P}}
510 1.223 jmmv .endif
511 1.223 jmmv
512 1.223 jmmv .endfor # _P in ${PROGS} ${PROGS_CXX} # }
513 1.23 mycroft
514 1.225 jmmv .if defined(OBJS) && !empty(OBJS) && \
515 1.225 jmmv (empty(PROGS) && empty(PROGS_CXX))
516 1.267 apb CLEANFILES+= ${OBJS} ${LOBJS}
517 1.225 jmmv .endif
518 1.225 jmmv
519 1.74 mycroft .if !target(proginstall)
520 1.223 jmmv proginstall:: ${_PROG_INSTALL}
521 1.74 mycroft .endif
522 1.197 lukem .PHONY: proginstall
523 1.74 mycroft
524 1.223 jmmv
525 1.223 jmmv
526 1.223 jmmv realall: ${SCRIPTS}
527 1.215 lukem .if defined(SCRIPTS) && !target(scriptsinstall) # {
528 1.65 mycroft SCRIPTSDIR?=${BINDIR}
529 1.65 mycroft SCRIPTSOWN?=${BINOWN}
530 1.65 mycroft SCRIPTSGRP?=${BINGRP}
531 1.65 mycroft SCRIPTSMODE?=${BINMODE}
532 1.113 mycroft
533 1.113 mycroft scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
534 1.114 mycroft .PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
535 1.113 mycroft
536 1.115 mycroft __scriptinstall: .USE
537 1.192 lukem ${_MKTARGET_INSTALL}
538 1.139 tv ${INSTALL_FILE} \
539 1.116 mycroft -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
540 1.116 mycroft -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
541 1.116 mycroft -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
542 1.209 jwise ${.ALLSRC} ${.TARGET}
543 1.115 mycroft
544 1.130 sommerfe .for S in ${SCRIPTS:O:u}
545 1.172 lukem .if ${MKUPDATE} == "no"
546 1.154 mycroft ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! ${S} __scriptinstall
547 1.154 mycroft .if !defined(BUILD) && !make(all) && !make(${S})
548 1.154 mycroft ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}! .MADE
549 1.154 mycroft .endif
550 1.154 mycroft .else
551 1.154 mycroft ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
552 1.103 fredb .if !defined(BUILD) && !make(all) && !make(${S})
553 1.113 mycroft ${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
554 1.63 christos .endif
555 1.154 mycroft .endif
556 1.63 christos .endfor
557 1.215 lukem .endif # }
558 1.1 cgd
559 1.74 mycroft .if !target(scriptsinstall)
560 1.74 mycroft scriptsinstall::
561 1.1 cgd .endif
562 1.197 lukem .PHONY: scriptsinstall
563 1.1 cgd
564 1.138 tv ##### Pull in related .mk logic
565 1.241 apb LINKSOWN?= ${BINOWN}
566 1.241 apb LINKSGRP?= ${BINGRP}
567 1.241 apb LINKSMODE?= ${BINMODE}
568 1.1 cgd .include <bsd.man.mk>
569 1.50 jtc .include <bsd.nls.mk>
570 1.66 christos .include <bsd.files.mk>
571 1.63 christos .include <bsd.inc.mk>
572 1.83 mycroft .include <bsd.links.mk>
573 1.180 lukem .include <bsd.sys.mk>
574 1.26 mycroft .include <bsd.dep.mk>
575 1.266 joerg .include <bsd.clang-analyze.mk>
576 1.267 apb .include <bsd.clean.mk>
577 1.240 cube
578 1.138 tv ${TARGETS}: # ensure existence
579 1.166 lukem
580 1.166 lukem .endif # HOSTPROG
581