1 # $NetBSD: bsd.lib.mk,v 1.299 2009/11/27 11:44:36 tsutsui 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
14 # Build shared libraries if not set to no by now
17 # If we're making a library but aren't making shared
18 # libraries and it's because there's a non-shared-aware clang
19 # installed, warn the user that that's the reason.
20 .if
$(MKPIC
) == "no" && defined
(NONPICCLANG
)
21 .warning Old clang
, not building shared.
26 .if
${LIBISMODULE} != "no"
35 .if
${LIBISPRIVATE} != "no"
39 . if defined
(NOSTATICLIB
) && ${MKPICLIB} != "no"
48 .PHONY
: checkver libinstall
49 realinstall
: checkver libinstall
52 ##### LIB specific flags.
53 # XXX: This is needed for programs that link with .a libraries
54 # Perhaps a more correct solution is to always generate _pic.a
55 # files or always have a shared library.
56 .if defined
(MKPIE
) && (${MKPIE} != "no")
57 CFLAGS
+= ${PIE_CFLAGS}
58 AFLAGS
+= ${PIE_AFLAGS}
60 COPTS
+= ${COPTS.lib
${LIB}}
61 CPPFLAGS
+= ${CPPFLAGS.lib
${LIB}}
62 CXXFLAGS
+= ${CXXFLAGS.lib
${LIB}}
63 OBJCOPTS
+= ${OBJCOPTS.lib
${LIB}}
64 LDADD
+= ${LDADD.lib
${LIB}}
65 LDFLAGS
+= ${LDFLAGS.lib
${LIB}}
66 LDSTATIC
+= ${LDSTATIC.lib
${LIB}}
68 ##### Libraries that this may depend upon.
69 .if defined
(LIBDPLIBS
) && ${MKPIC} != "no" # {
70 .for _lib _dir in
${LIBDPLIBS}
71 .if
!defined
(LIBDO.
${_lib})
72 LIBDO.
${_lib}!= cd
${_dir} && ${PRINTOBJDIR}
73 .MAKEOVERRIDES
+=LIBDO.
${_lib}
75 LDADD
+= -L
${LIBDO.
${_lib}} -l
${_lib}
76 DPADD
+= ${LIBDO.
${_lib}}/lib
${_lib}.so
80 ##### Build and install rules
81 MKDEP_SUFFIXES?
= .o .po .so .go .ln
83 # Use purely kernel private headers in rump builds
84 .if
!defined
(RUMPKERNEL
)
85 .if empty
(CPPFLAGS
:M-nostdinc
)
86 CPPFLAGS
+= ${DESTDIR
:D-nostdinc
${CPPFLAG_ISYSTEM} ${DESTDIR}/usr
/include}
88 .if empty
(CXXFLAGS
:M-nostdinc
++)
89 CXXFLAGS
+= ${DESTDIR
:D-nostdinc
++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr
/include/g
++}
93 .if
!defined
(SHLIB_MAJOR
) && exists
(${SHLIB_VERSION_FILE}) # {
94 SHLIB_MAJOR
!= .
${SHLIB_VERSION_FILE} ; echo
$$major
95 SHLIB_MINOR
!= .
${SHLIB_VERSION_FILE} ; echo
$$minor
96 SHLIB_TEENY
!= .
${SHLIB_VERSION_FILE} ; echo
$$teeny
98 DPADD
+= ${SHLIB_VERSION_FILE}
100 # Check for higher installed library versions.
101 .if
!defined
(NOCHECKVER
) && !defined
(NOCHECKVER_
${LIB}) && \
102 exists
(${NETBSDSRCDIR}/lib
/checkver
)
105 HOST_SH
=${HOST_SH
:Q
} AWK
=${TOOL_AWK
:Q
} \
106 ${HOST_SH} ${NETBSDSRCDIR}/lib
/checkver
-v
${SHLIB_VERSION_FILE} \
107 -d
${DESTDIR}${_LIBSODIR} ${LIB})
111 .if
!target
(checkver
)
116 .if defined
(SHLIB_MAJOR
) && ${MKPIC} != "no"
123 .if defined
(SHLIB_MINOR
) && ${MKPIC} != "no"
130 .if defined
(SHLIB_TEENY
) && ${MKPIC} != "no"
136 .if defined
(SHLIB_MAJOR
) && !empty
(SHLIB_MAJOR
) # {
137 .if defined
(SHLIB_MINOR
) && !empty
(SHLIB_MINOR
)
138 .if defined
(SHLIB_TEENY
) && !empty
(SHLIB_TEENY
)
139 SHLIB_FULLVERSION
=${SHLIB_MAJOR}.
${SHLIB_MINOR}.
${SHLIB_TEENY}
141 SHLIB_FULLVERSION
=${SHLIB_MAJOR}.
${SHLIB_MINOR}
144 SHLIB_FULLVERSION
=${SHLIB_MAJOR}
148 # add additional suffixes not exported.
149 # .po is used for profiling object files.
150 # .so is used for PIC object files.
151 .SUFFIXES
: .out .a .ln .so .po .go .o .s .S .c .
cc .
cpp .
cxx .C .m .F .f .r .y .l .cl .p .h
152 .SUFFIXES
: .sh .m4 .m
155 # Set PICFLAGS to cc flags for producing position-independent code,
156 # if not already set. Includes -DPIC, if required.
158 # Data-driven table using make variables to control how shared libraries
159 # are built for different platforms and object formats.
160 # OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
161 # SHLIB_SOVERSION: version number to be compiled into a shared library
162 # via -soname. Usualy ${SHLIB_MAJOR} on ELF.
163 # NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
165 # SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
166 # with ELF, also set shared-lib version for ld.so.
167 # SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
168 # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
169 # FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
170 # CPPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
171 # CPICFLAGS: flags for ${CC} to compile .[cC] files to pic objects.
172 # CSHLIBFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
173 # (usually includes ${CPICFLAGS})
174 # CAPICFLAGS: flags for ${CC} to compiling .[Ss] files
175 # (usually just ${CPPPICFLAGS} ${CPICFLAGS})
176 # APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
178 .if
${MACHINE_ARCH} == "alpha" # {
181 CPICFLAGS ?
= -fPIC
-DPIC
183 CAPICFLAGS?
= ${CPPPICFLAGS} ${CPICFLAGS}
186 .elif
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64") && \
187 ${OBJECT_FMT} == "ELF" # } {
189 # If you use -fPIC you need to define BIGPIC to turn on 32-bit
190 # relocations in asm code
192 CPICFLAGS ?
= -fPIC
-DPIC
193 CPPPICFLAGS?
= -DPIC
-DBIGPIC
194 CAPICFLAGS?
= ${CPPPICFLAGS} ${CPICFLAGS}
199 # Platform-independent flags for NetBSD shared libraries
200 SHLIB_SOVERSION
=${SHLIB_FULLVERSION}
203 CPICFLAGS?
= -fPIC
-DPIC
205 CAPICFLAGS?
= ${CPPPICFLAGS} ${CPICFLAGS}
210 .if
${MKPICLIB} != "no"
211 CSHLIBFLAGS
+= ${CPICFLAGS}
214 .if defined
(CSHLIBFLAGS
) && !empty
(CSHLIBFLAGS
)
220 # Platform-independent linker flags for ELF shared libraries
221 .if
${OBJECT_FMT} == "ELF"
222 SHLIB_SOVERSION
= ${SHLIB_MAJOR}
223 SHLIB_SHFLAGS
= -Wl
,-soname
,${_LIB_PREFIX}${LIB}.so.
${SHLIB_SOVERSION}
224 SHLIB_SHFLAGS
+= -Wl
,--warn-shared-textrel
225 SHLIB_LDSTARTFILE?
= ${DESTDIR}/usr
/lib
/crti.o
${_GCC_CRTBEGINS}
226 SHLIB_LDENDFILE?
= ${_GCC_CRTENDS} ${DESTDIR}/usr
/lib
/crtn.o
230 OBJCFLAGS
+= ${OBJCOPTS}
236 ${COMPILE.c
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
237 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
238 ${OBJCOPY} -x
${.TARGET
}
243 ${COMPILE.c
} ${PROFFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} -pg
${.IMPSRC
} -o
${.TARGET
}
244 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
245 ${OBJCOPY} -X
${.TARGET
}
250 ${COMPILE.c
} ${DEBUGFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} -g
${.IMPSRC
} -o
${.TARGET
}
254 ${COMPILE.c
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${CSHLIBFLAGS} ${.IMPSRC
} -o
${.TARGET
}
255 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
256 ${OBJCOPY} -x
${.TARGET
}
259 .
cc.o .
cpp.o .
cxx.o .C.o
:
261 ${COMPILE.
cc} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
262 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
263 ${OBJCOPY} -x
${.TARGET
}
266 .
cc.po .
cpp.po .
cxx.po .C.po
:
268 ${COMPILE.
cc} ${PROFFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} -pg
${.IMPSRC
} -o
${.TARGET
}
269 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
270 ${OBJCOPY} -X
${.TARGET
}
273 .
cc.go .
cpp.go .
cxx.go .C.go
:
275 ${COMPILE.
cc} ${DEBUGFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} -g
${.IMPSRC
} -o
${.TARGET
}
277 .
cc.so .
cpp.so .
cxx.so .C.so
:
279 ${COMPILE.
cc} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${CSHLIBFLAGS} ${.IMPSRC
} -o
${.TARGET
}
280 .if
!defined
(CFLAGS
) || empty
(CFLAGS
:M
*-g
*)
281 ${OBJCOPY} -x
${.TARGET
}
286 ${COMPILE.f
} ${.IMPSRC
} -o
${.TARGET
}
287 .if
!defined
(FOPTS
) || empty
(FOPTS
:M
*-g
*)
288 ${OBJCOPY} -x
${.TARGET
}
293 ${COMPILE.f
} ${PROFFLAGS} -pg
${.IMPSRC
} -o
${.TARGET
}
294 .if
!defined
(FOPTS
) || empty
(FOPTS
:M
*-g
*)
295 ${OBJCOPY} -X
${.TARGET
}
300 ${COMPILE.f
} ${DEBUGFLAGS} -g
${.IMPSRC
} -o
${.TARGET
}
304 ${COMPILE.f
} ${FPICFLAGS} ${.IMPSRC
} -o
${.TARGET
}
305 .if
!defined
(FOPTS
) || empty
(FOPTS
:M
*-g
*)
306 ${OBJCOPY} -x
${.TARGET
}
311 @echo Skipping lint for Fortran libraries.
315 ${COMPILE.m
} ${OBJCOPTS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
316 .if
!defined
(OBJCFLAGS
) || empty
(OBJCFLAGS
:M
*-g
*)
317 ${OBJCOPY} -x
${.TARGET
}
322 ${COMPILE.m
} ${PROFFLAGS} -pg
${OBJCOPTS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
323 .if
!defined
(OBJCFLAGS
) || empty
(OBJCFLAGS
:M
*-g
*)
324 ${OBJCOPY} -X
${.TARGET
}
329 ${COMPILE.m
} ${DEBUGFLAGS} -g
${OBJCOPTS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
330 .if
!defined
(OBJCFLAGS
) || empty
(OBJCFLAGS
:M
*-g
*)
331 ${OBJCOPY} -X
${.TARGET
}
336 ${COMPILE.m
} ${CSHLIBFLAGS} ${OBJCOPTS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
337 .if
!defined
(OBJCFLAGS
) || empty
(OBJCFLAGS
:M
*-g
*)
338 ${OBJCOPY} -x
${.TARGET
}
343 ${COMPILE.s
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
344 ${OBJCOPY} -x
${.TARGET
}
348 ${COMPILE.S
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
349 ${OBJCOPY} -x
${.TARGET
}
353 ${COMPILE.s
} ${PROFFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
354 ${OBJCOPY} -X
${.TARGET
}
358 ${COMPILE.S
} ${PROFFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
359 ${OBJCOPY} -X
${.TARGET
}
363 ${COMPILE.s
} ${DEBUGFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
367 ${COMPILE.S
} ${DEBUGFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
371 ${COMPILE.s
} ${CAPICFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
372 ${OBJCOPY} -x
${.TARGET
}
376 ${COMPILE.S
} ${CAPICFLAGS} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
377 ${OBJCOPY} -x
${.TARGET
}
380 .if
(${MKPIC} == "no" ||
(defined
(LDSTATIC
) && ${LDSTATIC} != "") \
381 ||
${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
387 OBJS
+=${SRCS
:N
*.h
:N
*.sh
:R
:S
/$/.o
/g
}
391 LOBJS
+=${LSRCS
:.c
=.ln
} ${SRCS
:M
*.c
:.c
=.ln
}
393 .if
${LIBISPRIVATE} != "no"
394 # No installation is required
396 .
endif # ${LIBISPRIVATE} == "no" # {
398 .if
${MKDEBUGLIB} != "no"
400 GOBJS
+=${OBJS
:.o
=.go
}
404 .if
${MKPROFILE} != "no"
406 POBJS
+=${OBJS
:.o
=.po
}
407 PROFFLAGS?
=-DGPROF
-DPROF
410 .if
${MKPIC} != "no" # {
411 .if
${MKPICLIB} == "no"
412 .if
${MKSHLIBOBJS} != "no"
413 # make _pic.a, which isn't really pic,
414 # since it's needed for making shared lib.
415 # but don't install it.
416 SOLIB
=lib
${LIB}_pic.a
417 SOBJS
+=${OBJS
:.o
=.so
}
422 SOLIB
=lib
${LIB}_pic.a
424 SOBJS
+=${OBJS
:.o
=.so
}
426 .if defined
(SHLIB_FULLVERSION
)
427 _LIBS
+=lib
${LIB}.so.
${SHLIB_FULLVERSION}
431 .if
${MKLINT} != "no" && !empty
(LOBJS
)
432 _LIBS
+=llib-l
${LIB}.ln
436 .if
(${MKPIC} == "no" ||
(defined
(LDSTATIC
) && ${LDSTATIC} != "") \
437 ||
${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
440 ALLOBJS
+=${POBJS} ${SOBJS}
441 .if
${MKLINT} != "no" && !empty
(LOBJS
)
444 .
else # !defined(LIB) # } {
447 .
endif # !defined(LIB) # }
449 _YLSRCS
= ${SRCS
:M
*.
[ly
]:C
/\..
$/.c
/} ${YHEADER
:D
${SRCS
:M
*.y
:.y
=.h
}}
451 .NOPATH
: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
453 realall
: ${SRCS} ${ALLOBJS
:O
} ${_LIBS}
457 .if
${MKARZERO} == "yes"
464 #_INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
467 # If you change this, please consider reflecting the change in
468 # the override in sys/rump/Makefile.rump.
469 .if
!target
(__archivebuild
)
473 # ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
474 ${AR} ${_ARFL} ${.TARGET
} ${.ALLSRC
:M
*o
}
477 .if
!target
(__archiveinstall
)
478 __archiveinstall
: .USE
480 ${INSTALL_FILE} -o
${LIBOWN} -g
${LIBGRP} -m
${LIBMODE} \
481 ${_INSTRANLIB} ${.ALLSRC
} ${.TARGET
}
484 __archivesymlinkpic
: .USE
486 ${INSTALL_SYMLINK} ${.ALLSRC
} ${.TARGET
}
489 CLEANFILES
+= ${_YLSRCS}
491 ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
493 lib
${LIB}.a
:: ${STOBJS} __archivebuild
495 lib
${LIB}_p.a
:: ${POBJS} __archivebuild
497 lib
${LIB}_pic.a
:: ${SOBJS} __archivebuild
499 lib
${LIB}_g.a
:: ${GOBJS} __archivebuild
503 #.if ${SHLIBDIR} != "/usr/lib"
504 #_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
506 # -L${DESTDIR}${SHLIBDIR}
507 #.elif ${SHLIBINSTALLDIR} != "/usr/lib"
508 #_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \
509 # -L${DESTDIR}${SHLIBINSTALLDIR}
512 # gcc -shared now adds -lc automatically. For libraries other than libc and
513 # libgcc* we add as a dependency the installed shared libc. For libc and
514 # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
515 # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
516 # to add standard libraries, not the linker.
518 DPLIBC ?
= ${DESTDIR}${LIBC_SO}
520 .if
${LIB} != "c" && ${LIB
:Mgcc
*} == ""
521 DPLIBC ?
= ${DESTDIR}${LIBC_SO}
523 LDLIBC ?
= -nodefaultlibs
530 .if
${LIBISCXX} != "no"
536 lib
${LIB}.so.
${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} ${DPLIBC} \
537 ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
539 rm -f lib
${LIB}.so.
${SHLIB_FULLVERSION}
541 ${LIBCC} ${LDLIBC} -Wl
,-nostdlib
-B
${_GCC_CRTDIR}/ -B
${DESTDIR}/usr
/lib
/ \
542 -Wl
,-x
-shared
${SHLIB_SHFLAGS} -o
${.TARGET
} \
543 -Wl
,--whole-archive
${SOLIB} \
544 -Wl
,--no-whole-archive
${LDADD} \
545 ${_LIBLDOPTS} ${LDFLAGS} \
548 ${LIBCC} ${LDLIBC} -Wl
,-x
-shared
${SHLIB_SHFLAGS} ${LDFLAGS} \
549 -o
${.TARGET
} ${_LIBLDOPTS} \
550 -Wl
,--whole-archive
${SOLIB} -Wl
,--no-whole-archive
${LDADD}
552 .if
${OBJECT_FMT} == "ELF"
553 # We don't use INSTALL_SYMLINK here because this is just
554 # happening inside the build directory/objdir. XXX Why does
555 # this spend so much effort on libraries that aren't live??? XXX
556 .if defined
(SHLIB_FULLVERSION
) && defined
(SHLIB_MAJOR
) && \
557 "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
558 ${HOST_LN} -sf lib
${LIB}.so.
${SHLIB_FULLVERSION} lib
${LIB}.so.
${SHLIB_MAJOR}.tmp
559 mv
-f lib
${LIB}.so.
${SHLIB_MAJOR}.tmp lib
${LIB}.so.
${SHLIB_MAJOR}
561 ${HOST_LN} -sf lib
${LIB}.so.
${SHLIB_FULLVERSION} lib
${LIB}.so.tmp
562 mv
-f lib
${LIB}.so.tmp lib
${LIB}.so
564 .if
${MKSTRIPIDENT} != "no"
565 ${OBJCOPY} -R .ident
${.TARGET
}
568 .if
!empty
(LOBJS
) # {
570 llib-l
${LIB}.ln
: ${LOBJS}
572 rm -f llib-l
${LIB}.ln
574 ${LINT} -C
${LIB} ${.ALLSRC
} -L
${DESTDIR}/usr
/libdata
${LLIBS}
576 ${LINT} -C
${LIB} ${.ALLSRC
} ${LLIBS}
581 .if defined
(LOBJS
) && !empty
(LOBJS
)
582 ${LINT} ${LINTFLAGS} ${LOBJS}
586 rm -f a.out
[Ee
]rrs mklog core
*.core
${CLEANFILES}
587 rm -f lib
${LIB}.a
${STOBJS}
588 rm -f lib
${LIB}_p.a
${POBJS}
589 rm -f lib
${LIB}_g.a
${GOBJS}
590 rm -f lib
${LIB}_pic.a lib
${LIB}.so.
* lib
${LIB}.so
${SOBJS}
591 rm -f
${STOBJS
:=.tmp
} ${POBJS
:=.tmp
} ${SOBJS
:=.tmp
} ${GOBJS
:=.tmp
}
592 rm -f llib-l
${LIB}.ln
${LOBJS}
595 .if
!target
(libinstall
) # {
596 # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
599 .if
${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
600 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}.a
601 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}.a
603 .if
${MKUPDATE} == "no"
604 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.a
)
605 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
! .MADE
607 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
! lib
${LIB}.a __archiveinstall
609 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.a
)
610 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
: .MADE
612 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
: lib
${LIB}.a __archiveinstall
616 .if
${MKPROFILE} != "no"
617 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
618 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
620 .if
${MKUPDATE} == "no"
621 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_p.a
)
622 ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
! .MADE
624 ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
! lib
${LIB}_p.a __archiveinstall
626 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_p.a
)
627 ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
: .MADE
629 ${DESTDIR}${LIBDIR}/lib
${LIB}_p.a
: lib
${LIB}_p.a __archiveinstall
633 .if
${MKDEBUGLIB} != "no"
634 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
635 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
637 .if
${MKUPDATE} == "no"
638 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_g.a
)
639 ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
! .MADE
641 ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
! lib
${LIB}_g.a __archiveinstall
643 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_g.a
)
644 ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
: .MADE
646 ${DESTDIR}${LIBDIR}/lib
${LIB}_g.a
: lib
${LIB}_g.a __archiveinstall
650 .if
${MKPIC} != "no" && ${MKPICINSTALL} != "no"
651 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
652 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
654 .if
${MKUPDATE} == "no"
655 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_pic.a
)
656 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
! .MADE
658 .if
${MKPICLIB} == "no"
659 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
! lib
${LIB}.a __archivesymlinkpic
661 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
! lib
${LIB}_pic.a __archiveinstall
664 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}_pic.a
)
665 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
: .MADE
667 .if
${MKPICLIB} == "no"
668 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
: lib
${LIB}.a __archivesymlinkpic
670 ${DESTDIR}${LIBDIR}/lib
${LIB}_pic.a
: lib
${LIB}_pic.a __archiveinstall
675 .if
${MKPIC} != "no" && defined
(SHLIB_FULLVERSION
)
676 _LIB_SO_TGT
= ${DESTDIR}${_LIBSODIR}/${_LIB_PREFIX}${LIB}.so
677 _LIB_SO_TGTLIBDIR
= ${DESTDIR}${LIBDIR}/${_LIB_PREFIX}${LIB}.so
679 libinstall
:: ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}
680 .PRECIOUS
: ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}
682 .if
${MKUPDATE} == "no"
683 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.so.
${SHLIB_FULLVERSION})
684 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}! .MADE
686 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}! lib
${LIB}.so.
${SHLIB_FULLVERSION}
688 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.so.
${SHLIB_FULLVERSION})
689 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}: .MADE
691 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION}: lib
${LIB}.so.
${SHLIB_FULLVERSION}
694 ${INSTALL_FILE} -o
${LIBOWN} -g
${LIBGRP} -m
${LIBMODE} \
695 ${.ALLSRC
} ${.TARGET
}
696 .if
${_LIBSODIR} != ${LIBDIR}
697 ${INSTALL_SYMLINK} -l r \
698 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION} \
699 ${_LIB_SO_TGTLIBDIR}.
${SHLIB_FULLVERSION}
701 .if
${OBJECT_FMT} == "a.out" && !defined
(DESTDIR
)
702 /sbin
/ldconfig
-m
${_LIBSODIR} ${LIBDIR}
704 .if
${OBJECT_FMT} == "ELF"
705 .if defined
(SHLIB_FULLVERSION
) && defined
(SHLIB_MAJOR
) && \
706 "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
708 ${_LIB_PREFIX}${LIB}.so.
${SHLIB_FULLVERSION} \
709 ${_LIB_SO_TGT}.
${SHLIB_MAJOR}
710 .if
${_LIBSODIR} != ${LIBDIR}
711 ${INSTALL_SYMLINK} -l r \
712 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION} \
713 ${_LIB_SO_TGTLIBDIR}.
${SHLIB_MAJOR}
716 .if
${MKLINKLIB} != "no"
718 ${_LIB_PREFIX}${LIB}.so.
${SHLIB_FULLVERSION} \
720 .if
${_LIBSODIR} != ${LIBDIR}
721 ${INSTALL_SYMLINK} -l r \
722 ${_LIB_SO_TGT}.
${SHLIB_FULLVERSION} \
729 .if
${MKLINT} != "no" && !empty
(LOBJS
)
730 libinstall
:: ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
731 .PRECIOUS
: ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
733 .if
${MKUPDATE} == "no"
734 .if
!defined
(BUILD
) && !make
(all) && !make
(llib-l
${LIB}.ln
)
735 ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
! .MADE
737 ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
! llib-l
${LIB}.ln
739 .if
!defined
(BUILD
) && !make
(all) && !make
(llib-l
${LIB}.ln
)
740 ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
: .MADE
742 ${DESTDIR}${LINTLIBDIR}/llib-l
${LIB}.ln
: llib-l
${LIB}.ln
745 ${INSTALL_FILE} -o
${LIBOWN} -g
${LIBGRP} -m
${LIBMODE} \
746 ${.ALLSRC
} ${DESTDIR}${LINTLIBDIR}
748 .
endif # !target(libinstall) # }
750 ##### Pull in related .mk logic
753 LINKSMODE?
= ${LIBMODE}
754 .
include <bsd.man.mk
>
755 #.include <bsd.nls.mk>
756 .
include <bsd.files.mk
>
757 .
include <bsd.inc.mk
>
758 .
include <bsd.links.mk
>
759 .
include <bsd.dep.mk
>
760 .
include <minix.gcc.mk
>
762 ${TARGETS}: # ensure existence