1 # $NetBSD: bsd.lib.mk,v 1.301 2009/12/12 21:33:50 mrg Exp $
2 # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
5 .
include <bsd.shlib.mk
>
7 # Pull in <bsd.sys.mk> here so we can override its .c.o rule
16 .if
${LIBISMODULE} != "no"
25 .if
${LIBISPRIVATE} != "no"
29 . if defined
(NOSTATICLIB
) && ${MKPICLIB} != "no"
38 .PHONY
: checkver libinstall
39 realinstall
: checkver libinstall
42 ##### LIB specific flags.
43 # XXX: This is needed for programs that link with .a libraries
44 # Perhaps a more correct solution is to always generate _pic.a
45 # files or always have a shared library.
46 .if defined
(MKPIE
) && (${MKPIE} != "no")
47 CFLAGS
+= ${PIE_CFLAGS}
48 AFLAGS
+= ${PIE_AFLAGS}
51 ##### Libraries that this may depend upon.
52 .if defined
(LIBDPLIBS
) && ${MKPIC} != "no" # {
53 .for _lib _dir in
${LIBDPLIBS}
54 .if
!defined
(LIBDO.
${_lib})
55 LIBDO.
${_lib}!= cd
${_dir} && ${PRINTOBJDIR}
56 .MAKEOVERRIDES
+=LIBDO.
${_lib}
58 LDADD
+= -L
${LIBDO.
${_lib}} -l
${_lib}
59 DPADD
+= ${LIBDO.
${_lib}}/lib
${_lib}.so
63 ##### Build and install rules
64 MKDEP_SUFFIXES?
= .o .po .so .go .ln
66 # Use purely kernel private headers in rump builds
67 .if
!defined
(RUMPKERNEL
)
68 .if empty
(CPPFLAGS
:M-nostdinc
)
69 CPPFLAGS
+= ${DESTDIR
:D-nostdinc
${CPPFLAG_ISYSTEM} ${DESTDIR}/usr
/include}
71 .if empty
(CXXFLAGS
:M-nostdinc
++)
72 CXXFLAGS
+= ${DESTDIR
:D-nostdinc
++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr
/include/g
++}
76 .if
!defined
(SHLIB_MAJOR
) && exists
(${SHLIB_VERSION_FILE}) # {
77 SHLIB_MAJOR
!= .
${SHLIB_VERSION_FILE} ; echo
$$major
78 SHLIB_MINOR
!= .
${SHLIB_VERSION_FILE} ; echo
$$minor
79 SHLIB_TEENY
!= .
${SHLIB_VERSION_FILE} ; echo
$$teeny
81 DPADD
+= ${SHLIB_VERSION_FILE}
83 # Check for higher installed library versions.
84 .if
!defined
(NOCHECKVER
) && !defined
(NOCHECKVER_
${LIB}) && \
85 exists
(${NETBSDSRCDIR}/lib
/checkver
)
88 HOST_SH
=${HOST_SH
:Q
} AWK
=${TOOL_AWK
:Q
} \
89 ${HOST_SH} ${NETBSDSRCDIR}/lib
/checkver
-v
${SHLIB_VERSION_FILE} \
90 -d
${DESTDIR}${_LIBSODIR} ${LIB})
99 .if defined
(SHLIB_MAJOR
) && ${MKPIC} != "no"
106 .if defined
(SHLIB_MINOR
) && ${MKPIC} != "no"
113 .if defined
(SHLIB_TEENY
) && ${MKPIC} != "no"
119 .if defined
(SHLIB_MAJOR
) && !empty
(SHLIB_MAJOR
) # {
120 .if defined
(SHLIB_MINOR
) && !empty
(SHLIB_MINOR
)
121 .if defined
(SHLIB_TEENY
) && !empty
(SHLIB_TEENY
)
122 SHLIB_FULLVERSION
=${SHLIB_MAJOR}.
${SHLIB_MINOR}.
${SHLIB_TEENY}
124 SHLIB_FULLVERSION
=${SHLIB_MAJOR}.
${SHLIB_MINOR}
127 SHLIB_FULLVERSION
=${SHLIB_MAJOR}
131 # add additional suffixes not exported.
132 # .po is used for profiling object files.
133 # .so is used for PIC object files.
134 .SUFFIXES
: .out .a .ln .so .po .go .o .s .S .c .
cc .
cpp .
cxx .C .m .F .f .r .y .l .cl .p .h
135 .SUFFIXES
: .sh .m4 .m
138 # Set PICFLAGS to cc flags for producing position-independent code,
139 # if not already set. Includes -DPIC, if required.
141 # Data-driven table using make variables to control how shared libraries
142 # are built for different platforms and object formats.
143 # OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
144 # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
145 # numbers of shared library
146 # SHLIB_SOVERSION: version number to be compiled into a shared library
147 # via -soname. Usualy ${SHLIB_MAJOR} on ELF.
148 # NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
150 # SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
151 # with ELF, also set shared-lib version for ld.so.
152 # SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
153 # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
154 # FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
155 # CPPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
156 # CPICFLAGS: flags for ${CC} to compile .[cC] files to pic objects.
157 # CSHLIBFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
158 # (usually includes ${CPICFLAGS})
159 # CAPICFLAGS: flags for ${CC} to compiling .[Ss] files
160 # (usually just ${CPPPICFLAGS} ${CPICFLAGS})
161 # APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
163 .if
${MACHINE_ARCH} == "alpha" # {
166 CPICFLAGS ?
= -fPIC
-DPIC
168 CAPICFLAGS?
= ${CPPPICFLAGS} ${CPICFLAGS}
171 .elif
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64") && \
172 ${OBJECT_FMT} == "ELF" # } {
174 # If you use -fPIC you need to define BIGPIC to turn on 32-bit
175 # relocations in asm code
177 CPICFLAGS ?
= -fPIC
-DPIC
178 CPPPICFLAGS?
= -DPIC
-DBIGPIC
179 CAPICFLAGS?
= ${CPPPICFLAGS} ${CPICFLAGS}
184 # Platform-independent flags for NetBSD shared libraries
185 SHLIB_SOVERSION
=${SHLIB_FULLVERSION}
188 CPICFLAGS?
= -fPIC
-DPIC
190 CAPICFLAGS?
= ${CPPPICFLAGS} ${CPICFLAGS}
195 .if
${MKPICLIB} != "no"
196 CSHLIBFLAGS
+= ${CPICFLAGS}
199 .if defined
(CSHLIBFLAGS
) && !empty
(CSHLIBFLAGS
)
205 # Platform-independent linker flags for ELF shared libraries
206 .if
${OBJECT_FMT} == "ELF"
207 SHLIB_SOVERSION
= ${SHLIB_MAJOR}
208 SHLIB_SHFLAGS
= -Wl
,-soname
,${_LIB_PREFIX}${LIB}.so.
${SHLIB_SOVERSION}
209 SHLIB_SHFLAGS
+= -Wl
,--warn-shared-textrel
210 SHLIB_LDSTARTFILE?
= ${_GCC_CRTDIR}/crti.o
${_GCC_CRTBEGINS}
211 SHLIB_LDENDFILE?
= ${_GCC_CRTENDS} ${_GCC_CRTDIR}/crtn.o
215 OBJCFLAGS
+= ${OBJCOPTS}
221 ${COMPILE.c
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
222 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
223 ${OBJCOPY} -x
${.TARGET
}
228 ${COMPILE.c
} ${PROFFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} -pg
${.IMPSRC
} -o
${.TARGET
}
229 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
230 ${OBJCOPY} -X
${.TARGET
}
235 ${COMPILE.c
} ${DEBUGFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} -g
${.IMPSRC
} -o
${.TARGET
}
239 ${COMPILE.c
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${CSHLIBFLAGS} ${.IMPSRC
} -o
${.TARGET
}
240 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
241 ${OBJCOPY} -x
${.TARGET
}
244 .
cc.o .
cpp.o .
cxx.o .C.o
:
246 ${COMPILE.
cc} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
247 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
248 ${OBJCOPY} -x
${.TARGET
}
251 .
cc.po .
cpp.po .
cxx.po .C.po
:
253 ${COMPILE.
cc} ${PROFFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} -pg
${.IMPSRC
} -o
${.TARGET
}
254 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
255 ${OBJCOPY} -X
${.TARGET
}
258 .
cc.go .
cpp.go .
cxx.go .C.go
:
260 ${COMPILE.
cc} ${DEBUGFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} -g
${.IMPSRC
} -o
${.TARGET
}
262 .
cc.so .
cpp.so .
cxx.so .C.so
:
264 ${COMPILE.
cc} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${CSHLIBFLAGS} ${.IMPSRC
} -o
${.TARGET
}
265 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
266 ${OBJCOPY} -x
${.TARGET
}
271 ${COMPILE.f
} ${.IMPSRC
} -o
${.TARGET
}
272 .if
!defined
(FOPTS
) || empty
(FOPTS
:M
*-g
*)
273 ${OBJCOPY} -x
${.TARGET
}
278 ${COMPILE.f
} ${PROFFLAGS} -pg
${.IMPSRC
} -o
${.TARGET
}
279 .if
!defined
(FOPTS
) || empty
(FOPTS
:M
*-g
*)
280 ${OBJCOPY} -X
${.TARGET
}
285 ${COMPILE.f
} ${DEBUGFLAGS} -g
${.IMPSRC
} -o
${.TARGET
}
289 ${COMPILE.f
} ${FPICFLAGS} ${.IMPSRC
} -o
${.TARGET
}
290 .if
!defined
(FOPTS
) || empty
(FOPTS
:M
*-g
*)
291 ${OBJCOPY} -x
${.TARGET
}
296 @echo Skipping lint for Fortran libraries.
300 ${COMPILE.m
} ${OBJCOPTS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
301 .if
!defined
(OBJCFLAGS
) || empty
(OBJCFLAGS
:M
*-g
*)
302 ${OBJCOPY} -x
${.TARGET
}
307 ${COMPILE.m
} ${PROFFLAGS} -pg
${OBJCOPTS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
308 .if
!defined
(OBJCFLAGS
) || empty
(OBJCFLAGS
:M
*-g
*)
309 ${OBJCOPY} -X
${.TARGET
}
314 ${COMPILE.m
} ${DEBUGFLAGS} -g
${OBJCOPTS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
315 .if
!defined
(OBJCFLAGS
) || empty
(OBJCFLAGS
:M
*-g
*)
316 ${OBJCOPY} -X
${.TARGET
}
321 ${COMPILE.m
} ${CSHLIBFLAGS} ${OBJCOPTS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
322 .if
!defined
(OBJCFLAGS
) || empty
(OBJCFLAGS
:M
*-g
*)
323 ${OBJCOPY} -x
${.TARGET
}
328 ${COMPILE.s
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
329 ${OBJCOPY} -x
${.TARGET
}
333 ${COMPILE.S
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
334 ${OBJCOPY} -x
${.TARGET
}
338 ${COMPILE.s
} ${PROFFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
339 ${OBJCOPY} -X
${.TARGET
}
343 ${COMPILE.S
} ${PROFFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
344 ${OBJCOPY} -X
${.TARGET
}
348 ${COMPILE.s
} ${DEBUGFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
352 ${COMPILE.S
} ${DEBUGFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
356 ${COMPILE.s
} ${CAPICFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
357 ${OBJCOPY} -x
${.TARGET
}
361 ${COMPILE.S
} ${CAPICFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
362 ${OBJCOPY} -x
${.TARGET
}
365 .if
(${MKPIC} == "no" ||
(defined
(LDSTATIC
) && ${LDSTATIC} != "") \
366 ||
${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
372 OBJS
+=${SRCS
:N
*.h
:N
*.sh
:R
:S
/$/.o
/g
}
376 LOBJS
+=${LSRCS
:.c
=.ln
} ${SRCS
:M
*.c
:.c
=.ln
}
378 .if
${LIBISPRIVATE} != "no"
379 # No installation is required
381 .
endif # ${LIBISPRIVATE} == "no" # {
383 .if
${MKDEBUGLIB} != "no"
385 GOBJS
+=${OBJS
:.o
=.go
}
389 .if
${MKPROFILE} != "no"
391 POBJS
+=${OBJS
:.o
=.po
}
392 PROFFLAGS?
=-DGPROF
-DPROF
395 .if
${MKPIC} != "no" # {
396 .if
${MKPICLIB} == "no"
397 .if
${MKSHLIBOBJS} != "no"
398 # make _pic.a, which isn't really pic,
399 # since it's needed for making shared lib.
400 # but don't install it.
401 SOLIB
=lib
${LIB}_pic.a
402 SOBJS
+=${OBJS
:.o
=.so
}
407 SOLIB
=lib
${LIB}_pic.a
409 SOBJS
+=${OBJS
:.o
=.so
}
411 .if defined
(SHLIB_FULLVERSION
)
412 _LIBS
+=lib
${LIB}.so.
${SHLIB_FULLVERSION}
416 .if
${MKLINT} != "no" && !empty
(LOBJS
)
417 _LIBS
+=llib-l
${LIB}.ln
421 .if
(${MKPIC} == "no" ||
(defined
(LDSTATIC
) && ${LDSTATIC} != "") \
422 ||
${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
425 ALLOBJS
+=${POBJS} ${SOBJS}
426 .if
${MKLINT} != "no" && !empty
(LOBJS
)
429 .
else # !defined(LIB) # } {
432 .
endif # !defined(LIB) # }
434 _YLSRCS
= ${SRCS
:M
*.
[ly
]:C
/\..
$/.c
/} ${YHEADER
:D
${SRCS
:M
*.y
:.y
=.h
}}
436 .NOPATH
: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
438 realall
: ${SRCS} ${ALLOBJS
:O
} ${_LIBS}
442 .if
${MKARZERO} == "yes"
449 _INSTRANLIB
=${empty
(PRESERVE
):?
-a
"${RANLIB} -t":}
452 # If you change this, please consider reflecting the change in
453 # the override in sys/rump/Makefile.rump.
454 .if
!target
(__archivebuild
)
458 ${AR} ${_ARFL} ${.TARGET
} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
461 .if
!target
(__archiveinstall
)
462 __archiveinstall
: .USE
464 ${INSTALL_FILE} -o
${LIBOWN} -g
${LIBGRP} -m
${LIBMODE} \
465 ${_INSTRANLIB} ${.ALLSRC
} ${.TARGET
}
468 __archivesymlinkpic
: .USE
470 ${INSTALL_SYMLINK} ${.ALLSRC
} ${.TARGET
}
473 CLEANFILES
+= ${_YLSRCS}
475 ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
477 lib
${LIB}.a
:: ${STOBJS} __archivebuild
479 lib
${LIB}_p.a
:: ${POBJS} __archivebuild
481 lib
${LIB}_pic.a
:: ${SOBJS} __archivebuild
483 lib
${LIB}_g.a
:: ${GOBJS} __archivebuild
487 .if
${SHLIBDIR} != "/usr/lib"
488 _LIBLDOPTS
+= -Wl
,-rpath-link
,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr
/lib \
490 -L
${DESTDIR}${SHLIBDIR}
491 .elif
${SHLIBINSTALLDIR} != "/usr/lib"
492 _LIBLDOPTS
+= -Wl
,-rpath-link
,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr
/lib \
493 -L
${DESTDIR}${SHLIBINSTALLDIR}
496 # gcc -shared now adds -lc automatically. For libraries other than libc and
497 # libgcc* we add as a dependency the installed shared libc. For libc and
498 # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
499 # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
500 # to add standard libraries, not the linker.
502 DPLIBC ?
= ${DESTDIR}${LIBC_SO}
504 .if
${LIB} != "c" && ${LIB
:Mgcc
*} == ""
505 DPLIBC ?
= ${DESTDIR}${LIBC_SO}
507 LDLIBC ?
= -nodefaultlibs
514 .if
${LIBISCXX} != "no"
520 _LDADD.lib
${LIB}= ${LDADD} ${LDADD.lib
${LIB}}
521 _LDFLAGS.lib
${LIB}= ${LDFLAGS} ${LDFLAGS.lib
${LIB}}
523 lib
${LIB}.so.
${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} ${DPLIBC} \
524 ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
526 rm -f lib
${LIB}.so.
${SHLIB_FULLVERSION}
528 ${LIBCC} ${LDLIBC} -Wl
,-nostdlib
-B
${_GCC_CRTDIR}/ -B
${DESTDIR}${SHLIBDIR}/ \
529 -Wl
,-x
-shared
${SHLIB_SHFLAGS} -o
${.TARGET
} \
530 -Wl
,--whole-archive
${SOLIB} \
531 -Wl
,--no-whole-archive
${_LDADD.lib
${LIB}} \
532 ${_LIBLDOPTS} ${_LDFLAGS.lib
${LIB}} \
535 ${LIBCC} ${LDLIBC} -Wl
,-x
-shared
${SHLIB_SHFLAGS} ${_LDFLAGS.lib
${LIB}} \
536 -o
${.TARGET
} ${_LIBLDOPTS} \
537 -Wl
,--whole-archive
${SOLIB} -Wl
,--no-whole-archive
${_LDADD.lib
${LIB}}
539 .if
${OBJECT_FMT} == "ELF"
540 # We don't use INSTALL_SYMLINK here because this is just
541 # happening inside the build directory/objdir. XXX Why does
542 # this spend so much effort on libraries that aren't live??? XXX
543 .if defined
(SHLIB_FULLVERSION
) && defined
(SHLIB_MAJOR
) && \
544 "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
545 ${HOST_LN} -sf lib
${LIB}.so.
${SHLIB_FULLVERSION} lib
${LIB}.so.
${SHLIB_MAJOR}.tmp
546 mv
-f lib
${LIB}.so.
${SHLIB_MAJOR}.tmp lib
${LIB}.so.
${SHLIB_MAJOR}
548 ${HOST_LN} -sf lib
${LIB}.so.
${SHLIB_FULLVERSION} lib
${LIB}.so.tmp
549 mv
-f lib
${LIB}.so.tmp lib
${LIB}.so
551 .if
${MKSTRIPIDENT} != "no"
552 ${OBJCOPY} -R .ident
${.TARGET
}
555 .if
!empty
(LOBJS
) # {
557 llib-l
${LIB}.ln
: ${LOBJS}
559 rm -f llib-l
${LIB}.ln
561 ${LINT} -C
${LIB} ${.ALLSRC
} -L
${DESTDIR}/usr
/libdata
${LLIBS}
563 ${LINT} -C
${LIB} ${.ALLSRC
} ${LLIBS}
568 .if defined
(LOBJS
) && !empty
(LOBJS
)
569 ${LINT} ${LINTFLAGS} ${LOBJS}
573 rm -f a.out
[Ee
]rrs mklog core
*.core
${CLEANFILES}
574 rm -f lib
${LIB}.a
${STOBJS}
575 rm -f lib
${LIB}_p.a
${POBJS}
576 rm -f lib
${LIB}_g.a
${GOBJS}
577 rm -f lib
${LIB}_pic.a lib
${LIB}.so.
* lib
${LIB}.so
${SOBJS}
578 rm -f
${STOBJS
:=.tmp
} ${POBJS
:=.tmp
} ${SOBJS
:=.tmp
} ${GOBJS
:=.tmp
}
579 rm -f llib-l
${LIB}.ln
${LOBJS}
582 .if
!target
(libinstall
) # {
583 # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
586 .if
${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
587 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}.a
588 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}.a
590 .if
${MKUPDATE} == "no"
591 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.a
)
592 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
! .MADE
594 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
! lib
${LIB}.a __archiveinstall
596 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.a
)
597 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
: .MADE
599 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
: lib
${LIB}.a __archiveinstall
603 .if
${MKPROFILE} != "no"
604 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
605 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
607 .if
${MKUPDATE} == "no"
608 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_p.a
)
609 ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
! .MADE
611 ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
! lib
${LIB}_p.a __archiveinstall
613 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_p.a
)
614 ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
: .MADE
616 ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
: lib
${LIB}_p.a __archiveinstall
620 .if
${MKDEBUGLIB} != "no"
621 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
622 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
624 .if
${MKUPDATE} == "no"
625 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_g.a
)
626 ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
! .MADE
628 ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
! lib
${LIB}_g.a __archiveinstall
630 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_g.a
)
631 ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
: .MADE
633 ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
: lib
${LIB}_g.a __archiveinstall
637 .if
${MKPIC} != "no" && ${MKPICINSTALL} != "no"
638 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
639 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
641 .if
${MKUPDATE} == "no"
642 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_pic.a
)
643 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
! .MADE
645 .if
${MKPICLIB} == "no"
646 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
! lib
${LIB}.a __archivesymlinkpic
648 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
! lib
${LIB}_pic.a __archiveinstall
651 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_pic.a
)
652 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
: .MADE
654 .if
${MKPICLIB} == "no"
655 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
: lib
${LIB}.a __archivesymlinkpic
657 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
: lib
${LIB}_pic.a __archiveinstall
662 .if
${MKPIC} != "no" && defined
(SHLIB_FULLVERSION
)
663 _LIB_SO_TGT
= ${DESTDIR}${_LIBSODIR}/${_LIB_PREFIX}${LIB}.so
664 _LIB_SO_TGTLIBDIR
= ${DESTDIR}${LIBDIR}/${_LIB_PREFIX}${LIB}.so
666 libinstall
:: ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}
667 .PRECIOUS
: ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}
669 .if
${MKUPDATE} == "no"
670 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.so.
${SHLIB_FULLVERSION})
671 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}! .MADE
673 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}! lib
${LIB}.so.
${SHLIB_FULLVERSION}
675 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.so.
${SHLIB_FULLVERSION})
676 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}: .MADE
678 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}: lib
${LIB}.so.
${SHLIB_FULLVERSION}
681 ${INSTALL_FILE} -o
${LIBOWN} -g
${LIBGRP} -m
${LIBMODE} \
682 ${.ALLSRC
} ${.TARGET
}
683 .if
${_LIBSODIR} != ${LIBDIR}
684 ${INSTALL_SYMLINK} -l r \
685 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION} \
686 ${_LIB_SO_TGTLIBDIR}.
${SHLIB_FULLVERSION}
688 .if
${OBJECT_FMT} == "a.out" && !defined
(DESTDIR
)
689 /sbin
/ldconfig
-m
${_LIBSODIR} ${LIBDIR}
691 .if
${OBJECT_FMT} == "ELF"
692 .if defined
(SHLIB_FULLVERSION
) && defined
(SHLIB_MAJOR
) && \
693 "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
695 ${_LIB_PREFIX}${LIB}.so.
${SHLIB_FULLVERSION} \
696 ${_LIB_SO_TGT}.
${SHLIB_MAJOR}
697 .if
${_LIBSODIR} != ${LIBDIR}
698 ${INSTALL_SYMLINK} -l r \
699 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION} \
700 ${_LIB_SO_TGTLIBDIR}.
${SHLIB_MAJOR}
703 .if
${MKLINKLIB} != "no"
705 ${_LIB_PREFIX}${LIB}.so.
${SHLIB_FULLVERSION} \
707 .if
${_LIBSODIR} != ${LIBDIR}
708 ${INSTALL_SYMLINK} -l r \
709 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION} \
716 .if
${MKLINT} != "no" && !empty
(LOBJS
)
717 libinstall
:: ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
718 .PRECIOUS
: ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
720 .if
${MKUPDATE} == "no"
721 .if
!defined
(BUILD
) && !make
(all) && !make
(llib-l
${LIB}.ln
)
722 ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
! .MADE
724 ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
! llib-l
${LIB}.ln
726 .if
!defined
(BUILD
) && !make
(all) && !make
(llib-l
${LIB}.ln
)
727 ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
: .MADE
729 ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
: llib-l
${LIB}.ln
732 ${INSTALL_FILE} -o
${LIBOWN} -g
${LIBGRP} -m
${LIBMODE} \
733 ${.ALLSRC
} ${DESTDIR}${LINTLIBDIR}
735 .
endif # !target(libinstall) # }
737 ##### Pull in related .mk logic
740 LINKSMODE?
= ${LIBMODE}
741 .
include <bsd.man.mk
>
742 .
include <bsd.nls.mk
>
743 .
include <bsd.files.mk
>
744 .
include <bsd.inc.mk
>
745 .
include <bsd.links.mk
>
746 .
include <bsd.dep.mk
>
748 ${TARGETS}: # ensure existence