Annotation of src/share/mk/bsd.lib.mk, Revision 1.374
1.374 ! christos 1: # $NetBSD: bsd.lib.mk,v 1.373 2018/06/05 00:56:51 christos Exp $
1.92 mikel 2: # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
1.1 cgd 3:
1.188 tv 4: .include <bsd.init.mk>
1.207 thorpej 5: .include <bsd.shlib.mk>
1.219 thorpej 6: .include <bsd.gcc.mk>
1.227 lukem 7: # Pull in <bsd.sys.mk> here so we can override its .c.o rule
8: .include <bsd.sys.mk>
1.97 mycroft 9:
1.282 lukem 10: LIBISMODULE?= no
1.281 lukem 11: LIBISPRIVATE?= no
1.291 mrg 12: LIBISCXX?= no
1.281 lukem 13:
1.282 lukem 14: .if ${LIBISMODULE} != "no"
1.330 christos 15: _LIB_PREFIX?= # empty
1.282 lukem 16: MKDEBUGLIB:= no
17: MKLINT:= no
18: MKPICINSTALL:= no
19: MKPROFILE:= no
20: MKSTATICLIB:= no
1.330 christos 21: .else
22: _LIB_PREFIX?= lib
1.282 lukem 23: .endif
24:
1.281 lukem 25: .if ${LIBISPRIVATE} != "no"
1.280 lukem 26: MKDEBUGLIB:= no
27: MKLINT:= no
1.290 cube 28: MKPICINSTALL:= no
29: . if defined(NOSTATICLIB) && ${MKPICLIB} != "no"
30: MKSTATICLIB:= no
31: . else
1.280 lukem 32: MKPIC:= no
1.290 cube 33: . endif
1.280 lukem 34: MKPROFILE:= no
35: .endif
36:
1.188 tv 37: ##### Basic targets
1.246 lukem 38: .PHONY: checkver libinstall
1.143 erh 39: realinstall: checkver libinstall
1.232 erh 40:
41: ##### LIB specific flags.
1.287 christos 42: # XXX: This is needed for programs that link with .a libraries
43: # Perhaps a more correct solution is to always generate _pic.a
44: # files or always have a shared library.
1.371 christos 45: # Another fix is to provide rcrt0.o like OpenBSD does and
46: # do relocations for static PIE.
1.366 christos 47: .if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE)
48: CFLAGS+= ${PIE_CFLAGS}
49: AFLAGS+= ${PIE_AFLAGS}
50: .endif
1.1 cgd 51:
1.256 lukem 52: ##### Libraries that this may depend upon.
53: .if defined(LIBDPLIBS) && ${MKPIC} != "no" # {
54: .for _lib _dir in ${LIBDPLIBS}
55: .if !defined(LIBDO.${_lib})
1.303 christos 56: LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR}
1.256 lukem 57: .MAKEOVERRIDES+=LIBDO.${_lib}
58: .endif
1.325 pooka 59: .if ${LIBDO.${_lib}} == "_external"
60: LDADD+= -l${_lib}
61: .else
1.256 lukem 62: LDADD+= -L${LIBDO.${_lib}} -l${_lib}
1.327 christos 63: DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so # Don't use _LIB_PREFIX
1.325 pooka 64: .endif
1.256 lukem 65: .endfor
66: .endif # }
67:
1.188 tv 68: ##### Build and install rules
1.356 erh 69: MKDEP_SUFFIXES?= .o .po .pico .go .ln .d
1.292 pooka 70:
1.252 lukem 71: .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # {
1.154 simonb 72: SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
73: SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
1.171 christos 74: SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
1.143 erh 75:
1.295 he 76: DPADD+= ${SHLIB_VERSION_FILE}
77:
1.143 erh 78: # Check for higher installed library versions.
1.145 erh 79: .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
1.201 lukem 80: exists(${NETBSDSRCDIR}/lib/checkver)
1.143 erh 81: checkver:
1.303 christos 82: @(cd "${.CURDIR}" && \
1.289 apb 83: HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
1.239 lukem 84: ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
1.327 christos 85: -d ${_DEST.OBJ} ${LIB})
1.173 christos 86: .endif
1.252 lukem 87: .endif # }
1.173 christos 88:
89: .if !target(checkver)
1.143 erh 90: checkver:
91: .endif
1.173 christos 92:
1.169 thorpej 93: print-shlib-major:
1.185 tv 94: .if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
1.169 thorpej 95: @echo ${SHLIB_MAJOR}
1.173 christos 96: .else
97: @false
98: .endif
1.169 thorpej 99:
100: print-shlib-minor:
1.185 tv 101: .if defined(SHLIB_MINOR) && ${MKPIC} != "no"
1.169 thorpej 102: @echo ${SHLIB_MINOR}
1.173 christos 103: .else
104: @false
105: .endif
1.171 christos 106:
107: print-shlib-teeny:
1.185 tv 108: .if defined(SHLIB_TEENY) && ${MKPIC} != "no"
1.171 christos 109: @echo ${SHLIB_TEENY}
1.143 erh 110: .else
1.169 thorpej 111: @false
1.173 christos 112: .endif
1.169 thorpej 113:
1.252 lukem 114: .if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR) # {
1.173 christos 115: .if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
116: .if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
117: SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
118: .else
119: SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
120: .endif
121: .else
122: SHLIB_FULLVERSION=${SHLIB_MAJOR}
123: .endif
1.252 lukem 124: .endif # }
1.1 cgd 125:
1.101 mycroft 126: # add additional suffixes not exported.
127: # .po is used for profiling object files.
1.304 njoly 128: # .pico is used for PIC object files.
129: .SUFFIXES: .out .a .ln .pico .po .go .o .s .S .c .cc .cpp .cxx .C .m .F .f .r .y .l .cl .p .h
1.118 lukem 130: .SUFFIXES: .sh .m4 .m
1.82 mikel 131:
1.86 jonathan 132:
133: # Set PICFLAGS to cc flags for producing position-independent code,
1.338 joerg 134: # if not already set.
1.86 jonathan 135:
1.164 simonb 136: # Data-driven table using make variables to control how shared libraries
1.86 jonathan 137: # are built for different platforms and object formats.
1.302 abs 138: # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
139: # numbers of shared library
1.164 simonb 140: # SHLIB_SOVERSION: version number to be compiled into a shared library
141: # via -soname. Usualy ${SHLIB_MAJOR} on ELF.
1.173 christos 142: # NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
143: # [.${SHLIB_TEENY}]]
1.164 simonb 144: # SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
1.123 jonathan 145: # with ELF, also set shared-lib version for ld.so.
146: # SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
147: # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
1.86 jonathan 148:
1.338 joerg 149: PICFLAGS ?= -fPIC
1.160 simonb 150:
1.205 yamt 151: .if ${MKPICLIB} != "no"
1.338 joerg 152: CSHLIBFLAGS+= ${PICFLAGS}
1.205 yamt 153: .endif
154:
155: .if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
156: MKSHLIBOBJS= yes
157: .else
158: MKSHLIBOBJS= no
159: .endif
160:
1.364 christos 161: .if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) || \
1.335 riastrad 162: (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
163: # We only add -g to the shared library objects
164: # because we don't currently split .a archives.
165: CSHLIBFLAGS+= -g
166: .if ${LIBISPRIVATE} == "yes"
167: CFLAGS+= -g
168: .endif
169: .endif
170:
1.123 jonathan 171: # Platform-independent linker flags for ELF shared libraries
1.182 mrg 172: SHLIB_SOVERSION= ${SHLIB_MAJOR}
1.327 christos 173: SHLIB_SHFLAGS= -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION}
1.354 pooka 174: .if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no"
1.272 christos 175: SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel
1.354 pooka 176: .endif
1.337 pooka 177: .if !defined(SHLIB_MKMAP) || ${SHLIB_MKMAP} != "no"
1.336 matt 178: SHLIB_SHFLAGS+= -Wl,-Map=${_LIB}.so.${SHLIB_SOVERSION}.map
1.337 pooka 179: .endif
1.336 matt 180: CLEANFILES+= ${_LIB}.so.${SHLIB_SOVERSION}.map
1.322 christos 181: SHLIB_LDSTARTFILE?= ${_GCC_CRTI} ${_GCC_CRTBEGINS}
182: SHLIB_LDENDFILE?= ${_GCC_CRTENDS} ${_GCC_CRTN}
1.86 jonathan 183:
1.82 mikel 184: CFLAGS+= ${COPTS}
1.267 mrg 185: OBJCFLAGS+= ${OBJCOPTS}
1.257 simonb 186: AFLAGS+= ${COPTS}
1.179 dmcmahil 187: FFLAGS+= ${FOPTS}
1.1 cgd 188:
1.305 darran 189: .if defined(CTFCONVERT)
190: .if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
191: CTFFLAGS+= -g
1.367 mrg 192: .if defined(HAVE_GCC)
1.348 christos 193: #CFLAGS+= -gdwarf-2
1.347 christos 194: .endif
1.305 darran 195: .endif
196: .endif
197:
1.333 christos 198: LIBSTRIPAOBJS= yes
199: .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
200: LIBSTRIPCOBJS= yes
201: .endif
202: .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
203: LIBSTRIPOBJCOBJS= yes
204: .endif
205: .if !defined(FFLAGS) || empty(FFLAGS:M*-g*)
206: LIBSTRIPFOBJS= yes
207: .endif
208: .if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*)
209: LIBSTRIPSHLIBOBJS= yes
210: .endif
211:
1.1 cgd 212: .c.o:
1.238 lukem 213: ${_MKTARGET_COMPILE}
1.263 dsl 214: ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 215: .if defined(CTFCONVERT)
216: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
217: .endif
1.333 christos 218: .if defined(LIBSTRIPCOBJS)
1.320 christos 219: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 220: .endif
1.1 cgd 221:
222: .c.po:
1.238 lukem 223: ${_MKTARGET_COMPILE}
1.372 christos 224: ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
1.305 darran 225: .if defined(CTFCONVERT)
226: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
227: .endif
1.333 christos 228: .if defined(LIBSTRIPCOBJS)
1.320 christos 229: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 230: .endif
1.17 mycroft 231:
1.266 christos 232: .c.go:
233: ${_MKTARGET_COMPILE}
234: ${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
235:
1.304 njoly 236: .c.pico:
1.238 lukem 237: ${_MKTARGET_COMPILE}
1.263 dsl 238: ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333 christos 239: .if defined(LIBSTRIPSHLIBOBJS)
1.320 christos 240: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 241: .endif
1.27 pk 242:
1.223 lukem 243: .cc.o .cpp.o .cxx.o .C.o:
1.238 lukem 244: ${_MKTARGET_COMPILE}
1.263 dsl 245: ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 246: .if defined(LIBSTRIPCOBJS)
1.320 christos 247: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 248: .endif
1.17 mycroft 249:
1.266 christos 250: .cc.po .cpp.po .cxx.po .C.po:
1.238 lukem 251: ${_MKTARGET_COMPILE}
1.263 dsl 252: ${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
1.333 christos 253: .if defined(LIBSTRIPCOBJS)
1.320 christos 254: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 255: .endif
1.28 cgd 256:
1.266 christos 257: .cc.go .cpp.go .cxx.go .C.go:
258: ${_MKTARGET_COMPILE}
259: ${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
260:
1.304 njoly 261: .cc.pico .cpp.pico .cxx.pico .C.pico:
1.238 lukem 262: ${_MKTARGET_COMPILE}
1.263 dsl 263: ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333 christos 264: .if defined(LIBSTRIPSHLIBOBJS)
1.320 christos 265: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 266: .endif
1.118 lukem 267:
1.179 dmcmahil 268: .f.o:
1.238 lukem 269: ${_MKTARGET_COMPILE}
1.263 dsl 270: ${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
1.305 darran 271: .if defined(CTFCONVERT)
272: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
273: .endif
1.333 christos 274: .if defined(LIBSTRIPFOBJS)
1.320 christos 275: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179 dmcmahil 276: .endif
277:
278: .f.po:
1.238 lukem 279: ${_MKTARGET_COMPILE}
1.263 dsl 280: ${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
1.305 darran 281: .if defined(CTFCONVERT)
282: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
283: .endif
1.333 christos 284: .if defined(LIBSTRIPFOBJS)
1.320 christos 285: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179 dmcmahil 286: .endif
287:
1.266 christos 288: .f.go:
289: ${_MKTARGET_COMPILE}
290: ${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
291:
1.304 njoly 292: .f.pico:
1.238 lukem 293: ${_MKTARGET_COMPILE}
1.338 joerg 294: ${COMPILE.f} ${PICFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333 christos 295: .if defined(LIBSTRIPFOBJS)
1.320 christos 296: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179 dmcmahil 297: .endif
298:
299: .f.ln:
1.238 lukem 300: ${_MKTARGET_COMPILE}
1.217 wiz 301: @echo Skipping lint for Fortran libraries.
1.179 dmcmahil 302:
1.118 lukem 303: .m.o:
1.238 lukem 304: ${_MKTARGET_COMPILE}
1.267 mrg 305: ${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 306: .if defined(CTFCONVERT)
307: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
308: .endif
1.333 christos 309: .if defined(LIBSTRIPOBJCOBJS)
1.320 christos 310: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 311: .endif
1.118 lukem 312:
313: .m.po:
1.238 lukem 314: ${_MKTARGET_COMPILE}
1.267 mrg 315: ${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 316: .if defined(CTFCONVERT)
317: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
318: .endif
1.333 christos 319: .if defined(LIBSTRIPOBJCOBJS)
1.320 christos 320: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 321: .endif
1.118 lukem 322:
1.266 christos 323: .m.go:
324: ${_MKTARGET_COMPILE}
1.267 mrg 325: ${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 326: .if defined(LIBSTRIPOBJCOBJS)
1.320 christos 327: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.266 christos 328: .endif
329:
1.304 njoly 330: .m.pico:
1.238 lukem 331: ${_MKTARGET_COMPILE}
1.267 mrg 332: ${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 333: .if defined(LIBSTRIPOBJCOBJS)
1.320 christos 334: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 335: .endif
1.1 cgd 336:
1.251 lukem 337: .s.o:
1.238 lukem 338: ${_MKTARGET_COMPILE}
1.263 dsl 339: ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 340: .if defined(CTFCONVERT)
341: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
342: .endif
1.333 christos 343: .if defined(LIBSTRIPAOBJS)
1.320 christos 344: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 345: .endif
1.1 cgd 346:
1.251 lukem 347: .S.o:
348: ${_MKTARGET_COMPILE}
1.263 dsl 349: ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 350: .if defined(CTFCONVERT)
351: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
352: .endif
1.333 christos 353: .if defined(LIBSTRIPAOBJS)
1.320 christos 354: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 355: .endif
1.251 lukem 356:
357: .s.po:
358: ${_MKTARGET_COMPILE}
1.263 dsl 359: ${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 360: .if defined(CTFCONVERT)
361: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
362: .endif
1.333 christos 363: .if defined(LIBSTRIPAOBJS)
1.320 christos 364: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 365: .endif
1.251 lukem 366:
367: .S.po:
1.238 lukem 368: ${_MKTARGET_COMPILE}
1.263 dsl 369: ${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 370: .if defined(CTFCONVERT)
371: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
372: .endif
1.333 christos 373: .if defined(LIBSTRIPAOBJS)
1.320 christos 374: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 375: .endif
1.1 cgd 376:
1.266 christos 377: .s.go:
378: ${_MKTARGET_COMPILE}
379: ${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
380:
381: .S.go:
382: ${_MKTARGET_COMPILE}
383: ${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
384:
1.304 njoly 385: .s.pico:
1.251 lukem 386: ${_MKTARGET_COMPILE}
1.338 joerg 387: ${COMPILE.s} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 388: .if defined(LIBSTRIPAOBJS)
1.320 christos 389: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 390: .endif
1.251 lukem 391:
1.304 njoly 392: .S.pico:
1.238 lukem 393: ${_MKTARGET_COMPILE}
1.338 joerg 394: ${COMPILE.S} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 395: .if defined(LIBSTRIPAOBJS)
1.320 christos 396: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 397: .endif
1.27 pk 398:
1.327 christos 399: # Declare a few variables to make our life easier later.
400: _LIB:=${_LIB_PREFIX}${LIB}
401: _LIB.a:=${_LIB}.a
402: _LIB_p.a:=${_LIB}_p.a
403: _LIB_g.a:=${_LIB}_g.a
404: _LIB_pic.a:=${_LIB}_pic.a
405: _LIB.ln:=llib-l${LIB}.ln
406:
407: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
408: _LIB.so:=${_LIB}.so
409: _LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR}
410: _LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION}
1.358 mrg 411: _LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link
1.364 christos 412: .if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG)
1.327 christos 413: _LIB.so.debug:=${_LIB.so.full}.debug
414: .endif
415: .endif
416:
417: _DEST.LIB:=${DESTDIR}${LIBDIR}
418: _DEST.OBJ:=${DESTDIR}${_LIBSODIR}
419: _DEST.LINT:=${DESTDIR}${LINTLIBDIR}
420: _DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR}
1.334 christos 421: _DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR}
1.327 christos 422:
1.252 lukem 423: .if defined(LIB) # {
1.234 lukem 424: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
425: || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.327 christos 426: _LIBS=${_LIB.a}
1.130 tv 427: .else
428: _LIBS=
429: .endif
1.58 cgd 430:
1.321 matt 431: .if ${LIBISPRIVATE} != "no" \
432: && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \
433: && !defined(NOCOMBINE)) # {
434: .for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g}
435: COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
436: .if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f)
437: COMBINESRCS+= ${f}
438: NODPSRCS+= ${f}
439: .else
440: OBJS+= ${f:R:S/$/.o/}
441: .endif
442: .endfor
443:
444: .if !empty(COMBINESRCS)
1.327 christos 445: OBJS+= ${_LIB}_combine.o
446: ${_LIB}_combine.o: ${COMBINESRCS}
1.321 matt 447: ${_MKTARGET_COMPILE}
448: ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET}
1.333 christos 449: .if defined(LIBSTRIPOBJS)
1.349 matt 450: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.321 matt 451: .endif
452:
1.327 christos 453: CLEANFILES+= ${_LIB}_combine.d
1.321 matt 454:
1.327 christos 455: .if exists("${_LIB}_combine.d")
456: .include "${_LIB}_combine.d"
1.321 matt 457: .endif
458: .endif # empty(XSRCS.${LIB})
459: .else # } {
1.167 matt 460: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.321 matt 461: .endif # }
1.158 christos 462:
1.255 thorpej 463: STOBJS+=${OBJS}
464:
1.280 lukem 465: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
466:
1.281 lukem 467: .if ${LIBISPRIVATE} != "no"
1.252 lukem 468: # No installation is required
469: libinstall::
1.306 lukem 470: .endif
1.252 lukem 471:
1.268 lukem 472: .if ${MKDEBUGLIB} != "no"
1.327 christos 473: _LIBS+=${_LIB_g.a}
1.266 christos 474: GOBJS+=${OBJS:.o=.go}
475: DEBUGFLAGS?=-DDEBUG
476: .endif
477:
1.149 lukem 478: .if ${MKPROFILE} != "no"
1.327 christos 479: _LIBS+=${_LIB_p.a}
1.167 matt 480: POBJS+=${OBJS:.o=.po}
1.262 christos 481: PROFFLAGS?=-DGPROF -DPROF
1.1 cgd 482: .endif
483:
1.252 lukem 484: .if ${MKPIC} != "no" # {
1.160 simonb 485: .if ${MKPICLIB} == "no"
1.205 yamt 486: .if ${MKSHLIBOBJS} != "no"
487: # make _pic.a, which isn't really pic,
488: # since it's needed for making shared lib.
489: # but don't install it.
1.327 christos 490: SOLIB=${_LIB_pic.a}
1.304 njoly 491: SOBJS+=${OBJS:.o=.pico}
1.205 yamt 492: .else
1.327 christos 493: SOLIB=${_LIB.a}
1.205 yamt 494: .endif
1.160 simonb 495: .else
1.327 christos 496: SOLIB=${_LIB_pic.a}
1.160 simonb 497: _LIBS+=${SOLIB}
1.304 njoly 498: SOBJS+=${OBJS:.o=.pico}
1.160 simonb 499: .endif
1.171 christos 500: .if defined(SHLIB_FULLVERSION)
1.327 christos 501: _LIBS+=${_LIB.so.full}
1.27 pk 502: .endif
1.252 lukem 503: .endif # }
1.27 pk 504:
1.279 lukem 505: .if ${MKLINT} != "no" && !empty(LOBJS)
1.327 christos 506: _LIBS+=${_LIB.ln}
1.215 christos 507: .endif
1.27 pk 508:
1.234 lukem 509: ALLOBJS=
510: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
511: || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.255 thorpej 512: ALLOBJS+=${STOBJS}
1.179 dmcmahil 513: .endif
1.234 lukem 514: ALLOBJS+=${POBJS} ${SOBJS}
1.279 lukem 515: .if ${MKLINT} != "no" && !empty(LOBJS)
1.179 dmcmahil 516: ALLOBJS+=${LOBJS}
1.216 christos 517: .endif
1.252 lukem 518: .else # !defined(LIB) # } {
1.216 christos 519: LOBJS=
520: SOBJS=
1.252 lukem 521: .endif # !defined(LIB) # }
1.186 tv 522:
1.254 lukem 523: _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.253 christos 524:
525: .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
1.158 christos 526:
1.327 christos 527: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug}
1.1 cgd 528:
1.296 perry 529: .if ${MKARZERO} == "yes"
530: _ARFL=crsD
1.297 perry 531: _ARRANFL=sD
1.296 perry 532: _INSTRANLIB=
533: .else
534: _ARFL=crs
1.297 perry 535: _ARRANFL=s
1.296 perry 536: _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
537: .endif
538:
1.293 pooka 539: # If you change this, please consider reflecting the change in
540: # the override in sys/rump/Makefile.rump.
1.243 rtr 541: .if !target(__archivebuild)
1.90 christos 542: __archivebuild: .USE
1.238 lukem 543: ${_MKTARGET_BUILD}
1.373 christos 544: @rm -f ${.TARGET}
1.360 tsutsui 545: ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.243 rtr 546: .endif
1.89 christos 547:
1.243 rtr 548: .if !target(__archiveinstall)
1.89 christos 549: __archiveinstall: .USE
1.238 lukem 550: ${_MKTARGET_INSTALL}
1.198 lukem 551: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.296 perry 552: ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
1.243 rtr 553: .endif
1.89 christos 554:
1.197 mycroft 555: __archivesymlinkpic: .USE
1.238 lukem 556: ${_MKTARGET_INSTALL}
1.264 jwise 557: ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
1.197 mycroft 558:
1.373 christos 559: .if !target(__buildstdlib)
560: __buildstdlib: .USE
561: @echo building standard ${.TARGET:T:S/.o//:S/lib//} library
562: @rm -f ${.TARGET}
1.374 ! christos 563: @${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.373 christos 564: .endif
565:
566: .if !target(__buildproflib)
567: __buildproflib: .USE
568: @echo building profiled ${.TARGET:T:S/.o//:S/lib//} library
569: ${_MKTARGET_BUILD}
570: @rm -f ${.TARGET}
1.374 ! christos 571: @${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*po} | ${TSORT}`
1.373 christos 572: .endif
573:
1.253 christos 574: DPSRCS+= ${_YLSRCS}
575: CLEANFILES+= ${_YLSRCS}
1.230 lukem 576:
1.362 uebayasi 577: ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
1.103 mycroft 578:
1.362 uebayasi 579: ${_LIB.a}:: ${STOBJS} __archivebuild
1.1 cgd 580:
1.362 uebayasi 581: ${_LIB_p.a}:: ${POBJS} __archivebuild
1.1 cgd 582:
1.362 uebayasi 583: ${_LIB_pic.a}:: ${SOBJS} __archivebuild
1.27 pk 584:
1.362 uebayasi 585: ${_LIB_g.a}:: ${GOBJS} __archivebuild
1.266 christos 586:
1.235 lukem 587:
588: _LIBLDOPTS=
589: .if ${SHLIBDIR} != "/usr/lib"
1.324 joerg 590: _LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
591: -L=${SHLIBDIR}
592: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
593: _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
594: -L=${SHLIBINSTALLDIR}
1.235 lukem 595: .endif
1.369 ozaki-r 596: .if ${MKSTRIPSYM:Uyes} == "yes"
597: _LIBLDOPTS+= -Wl,-x
598: .else
599: _LIBLDOPTS+= -Wl,-X
600: .endif
1.235 lukem 601:
1.277 christos 602: # gcc -shared now adds -lc automatically. For libraries other than libc and
603: # libgcc* we add as a dependency the installed shared libc. For libc and
604: # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
605: # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
606: # to add standard libraries, not the linker.
1.276 christos 607: .if !defined(LIB)
1.312 matt 608: .if !empty(LIBC_SO)
1.274 christos 609: DPLIBC ?= ${DESTDIR}${LIBC_SO}
1.312 matt 610: .endif
1.276 christos 611: .else
1.278 simonb 612: .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
1.312 matt 613: .if !empty(LIBC_SO)
1.276 christos 614: DPLIBC ?= ${DESTDIR}${LIBC_SO}
1.312 matt 615: .endif
1.277 christos 616: .else
1.278 simonb 617: LDLIBC ?= -nodefaultlibs
1.341 joerg 618: .if ${HAVE_LIBGCC} == "yes" && ${LIB} == "c"
1.318 mrg 619: LDADD+= -lgcc
1.278 simonb 620: .endif
1.276 christos 621: .endif
1.274 christos 622: .endif
623:
1.291 mrg 624: .if ${LIBISCXX} != "no"
625: LIBCC:= ${CXX}
1.339 joerg 626: . if ${MKLIBCXX} == "yes"
627: LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib
628: . else
1.346 mrg 629: LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3
1.339 joerg 630: . endif
1.291 mrg 631: .else
632: LIBCC:= ${CC}
633: .endif
634:
1.327 christos 635: _LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}}
636: _LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}}
1.300 uebayasi 637:
1.358 mrg 638: _MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \
639: ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
640:
641: .if defined(_LIB.so.debug)
642: ${_LIB.so.debug}: ${_LIB.so.link}
643: ${_MKTARGET_CREATE}
644: ( ${OBJCOPY} --only-keep-debug \
645: ${_LIB.so.link} ${_LIB.so.debug} \
646: ) || (rm -f ${.TARGET}; false)
647: ${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug}
648: ${_MKTARGET_CREATE}
649: ( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
650: --add-gnu-debuglink=${_LIB.so.debug} \
1.370 chs 651: ${_LIB.so.link} ${_LIB.so.full}.tmp && \
652: mv -f ${_LIB.so.full}.tmp ${_LIB.so.full} \
1.358 mrg 653: ) || (rm -f ${.TARGET}; false)
654: ${_LIB.so.link}: ${_MAINLIBDEPS}
655: .else # aka no MKDEBUG
656: ${_LIB.so.full}: ${_MAINLIBDEPS}
657: .endif
1.238 lukem 658: ${_MKTARGET_BUILD}
1.327 christos 659: rm -f ${.TARGET}
1.369 ozaki-r 660: ${LIBCC} ${LDLIBC} -shared ${SHLIB_SHFLAGS} \
1.370 chs 661: ${_LDFLAGS.${_LIB}} -o ${.TARGET}.tmp ${_LIBLDOPTS} \
1.327 christos 662: -Wl,--whole-archive ${SOLIB} \
1.328 matt 663: -Wl,--no-whole-archive ${_LDADD.${_LIB}}
1.370 chs 664: .if ${MKSTRIPIDENT} != "no"
665: ${OBJCOPY} -R .ident ${.TARGET}.tmp
666: .endif
667: mv -f ${.TARGET}.tmp ${.TARGET}
1.196 lukem 668: # We don't use INSTALL_SYMLINK here because this is just
669: # happening inside the build directory/objdir. XXX Why does
670: # this spend so much effort on libraries that aren't live??? XXX
1.358 mrg 671: # XXX Also creates dead symlinks until the .full rule runs
672: # above and creates the main link
1.284 lukem 673: .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
674: "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
1.327 christos 675: ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp
676: mv -f ${_LIB.so.major}.tmp ${_LIB.so.major}
1.283 lukem 677: .endif
1.327 christos 678: ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
679: mv -f ${_LIB.so}.tmp ${_LIB.so}
1.35 pk 680:
1.252 lukem 681: .if !empty(LOBJS) # {
1.103 mycroft 682: LLIBS?= -lc
1.327 christos 683: ${_LIB.ln}: ${LOBJS}
1.238 lukem 684: ${_MKTARGET_COMPILE}
1.327 christos 685: rm -f ${.TARGET}
1.206 thorpej 686: .if defined(DESTDIR)
1.228 lukem 687: ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
1.206 thorpej 688: .else
1.228 lukem 689: ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.206 thorpej 690: .endif
1.252 lukem 691: .endif # }
1.1 cgd 692:
1.280 lukem 693: lint: ${LOBJS}
694: .if defined(LOBJS) && !empty(LOBJS)
695: ${LINT} ${LINTFLAGS} ${LOBJS}
696: .endif
697:
1.327 christos 698:
1.317 apb 699: # If the number of entries in CLEANFILES is too large, then the
700: # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
701: # failed (Argument list too long)". Avoid that by splitting the
702: # files to clean into several lists using different variable names.
703: # __cleanuse is an internal target in bsd.clean.mk; the way we
704: # use it here mimics the way it's used by the clean target in
705: # bsd.clean.mk.
706: #
707: clean: libclean1 libclean2 libclean3 libclean4 libclean5
708: libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
709: libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
710: libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
711: libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
712: libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
1.316 apb 713: CLEANFILES+= a.out [Ee]rrs mklog core *.core
1.327 christos 714: LIBCLEANFILES1+= ${_LIB.a} ${STOBJS} ${STOBJS:=.tmp}
715: LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS} ${POBJS:=.tmp}
716: LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS} ${GOBJS:=.tmp}
717: LIBCLEANFILES4+= ${_LIB_pic.a}
718: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
719: LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug}
720: .endif
1.317 apb 721: LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
1.327 christos 722: LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS}
1.252 lukem 723:
724: .if !target(libinstall) # {
1.148 lukem 725: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139 tv 726: libinstall::
727:
1.234 lukem 728: .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
1.327 christos 729: libinstall:: ${_DEST.LIB}/${_LIB.a}
730: .PRECIOUS: ${_DEST.LIB}/${_LIB.a}
1.197 mycroft 731:
1.269 dbj 732: .if ${MKUPDATE} == "no"
1.327 christos 733: .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
734: ${_DEST.LIB}/${_LIB.a}! .MADE
1.89 christos 735: .endif
1.327 christos 736: ${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall
1.197 mycroft 737: .else
1.327 christos 738: .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
739: ${_DEST.LIB}/${_LIB.a}: .MADE
1.89 christos 740: .endif
1.327 christos 741: ${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall
1.130 tv 742: .endif
1.197 mycroft 743: .endif
1.89 christos 744:
1.149 lukem 745: .if ${MKPROFILE} != "no"
1.327 christos 746: libinstall:: ${_DEST.LIB}/${_LIB_p.a}
747: .PRECIOUS: ${_DEST.LIB}/${_LIB_p.a}
1.197 mycroft 748:
1.269 dbj 749: .if ${MKUPDATE} == "no"
1.327 christos 750: .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
751: ${_DEST.LIB}/${_LIB_p.a}! .MADE
1.32 pk 752: .endif
1.327 christos 753: ${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall
1.197 mycroft 754: .else
1.327 christos 755: .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
756: ${_DEST.LIB}/${_LIB_p.a}: .MADE
1.89 christos 757: .endif
1.327 christos 758: ${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall
1.89 christos 759: .endif
1.197 mycroft 760: .endif
1.89 christos 761:
1.268 lukem 762: .if ${MKDEBUGLIB} != "no"
1.327 christos 763: libinstall:: ${_DEST.LIB}/${_LIB_g.a}
764: .PRECIOUS: ${_DEST.LIB}/${_LIB_g.a}
1.266 christos 765:
1.269 dbj 766: .if ${MKUPDATE} == "no"
1.329 spz 767: .if !defined(BUILD) && !make(all) && !make(${_LIB_g.a})
1.327 christos 768: ${_DEST.LIB}/${_LIB_g.a}! .MADE
1.266 christos 769: .endif
1.327 christos 770: ${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall
1.266 christos 771: .else
1.327 christos 772: .if !defined(BUILD) && !make(all) && !make(${LIB_g.a})
773: ${_DEST.LIB}/${_LIB_g.a}: .MADE
1.266 christos 774: .endif
1.327 christos 775: ${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall
1.266 christos 776: .endif
777: .endif
778:
1.149 lukem 779: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.327 christos 780: libinstall:: ${_DEST.LIB}/${_LIB_pic.a}
781: .PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a}
1.197 mycroft 782:
1.269 dbj 783: .if ${MKUPDATE} == "no"
1.327 christos 784: .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
785: ${_DEST.LIB}/${_LIB_pic.a}! .MADE
1.89 christos 786: .endif
1.197 mycroft 787: .if ${MKPICLIB} == "no"
1.331 nakayama 788: ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic
1.197 mycroft 789: .else
1.327 christos 790: ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall
1.197 mycroft 791: .endif
792: .else
1.327 christos 793: .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
794: ${_DEST.LIB}/${_LIB_pic.a}: .MADE
1.33 pk 795: .endif
1.160 simonb 796: .if ${MKPICLIB} == "no"
1.331 nakayama 797: ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic
1.160 simonb 798: .else
1.327 christos 799: ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall
1.160 simonb 800: .endif
1.89 christos 801: .endif
1.197 mycroft 802: .endif
1.89 christos 803:
1.171 christos 804: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.282 lukem 805:
1.327 christos 806: libinstall:: ${_DEST.OBJ}/${_LIB.so.full}
807: .PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full}
1.197 mycroft 808:
1.269 dbj 809: .if ${MKUPDATE} == "no"
1.327 christos 810: .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
811: ${_DEST.OBJ}/${_LIB.so.full}! .MADE
1.89 christos 812: .endif
1.327 christos 813: ${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full}
1.197 mycroft 814: .else
1.327 christos 815: .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
816: ${_DEST.OBJ}/${_LIB.so.full}: .MADE
1.89 christos 817: .endif
1.327 christos 818: ${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full}
1.197 mycroft 819: .endif
1.238 lukem 820: ${_MKTARGET_INSTALL}
1.188 tv 821: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.327 christos 822: ${.ALLSRC} ${.TARGET}
1.195 lukem 823: .if ${_LIBSODIR} != ${LIBDIR}
1.327 christos 824: ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
825: ${_DEST.LIB}/${_LIB.so.full}
1.195 lukem 826: .endif
1.284 lukem 827: .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
828: "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
1.327 christos 829: ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major}
1.195 lukem 830: .if ${_LIBSODIR} != ${LIBDIR}
1.327 christos 831: ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
832: ${_DEST.LIB}/${_LIB.so.major}
1.195 lukem 833: .endif
1.284 lukem 834: .endif
1.148 lukem 835: .if ${MKLINKLIB} != "no"
1.327 christos 836: ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so}
1.195 lukem 837: .if ${_LIBSODIR} != ${LIBDIR}
1.327 christos 838: ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
839: ${_DEST.LIB}/${_LIB.so}
1.195 lukem 840: .endif
1.83 cgd 841: .endif
1.12 cgd 842: .endif
1.89 christos 843:
1.327 christos 844: .if defined(_LIB.so.debug)
845: libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug}
846: .PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug}
1.307 lukem 847:
1.327 christos 848: ${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug}
1.307 lukem 849: ${_MKTARGET_INSTALL}
850: ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
1.327 christos 851: ${.ALLSRC} ${.TARGET}
1.334 christos 852: .if ${_LIBSODIR} != ${LIBDIR}
853: ${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \
854: ${_DEST.ODEBUG}/${_LIB.so.debug}
855: .endif
1.307 lukem 856: .endif
857:
1.279 lukem 858: .if ${MKLINT} != "no" && !empty(LOBJS)
1.327 christos 859: libinstall:: ${_DEST.LINT}/${_LIB.ln}
860: .PRECIOUS: ${_DEST.LINT}/${_LIB.ln}
1.197 mycroft 861:
1.269 dbj 862: .if ${MKUPDATE} == "no"
1.327 christos 863: .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
864: ${_DEST.LINT}/${_LIB.ln}! .MADE
1.89 christos 865: .endif
1.327 christos 866: ${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln}
1.197 mycroft 867: .else
1.327 christos 868: .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
869: ${_DEST.LINT}/${_LIB.ln}: .MADE
1.89 christos 870: .endif
1.327 christos 871: ${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln}
1.197 mycroft 872: .endif
1.238 lukem 873: ${_MKTARGET_INSTALL}
1.188 tv 874: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.327 christos 875: ${.ALLSRC} ${_DEST.LINT}
1.58 cgd 876: .endif
1.252 lukem 877: .endif # !target(libinstall) # }
1.1 cgd 878:
1.188 tv 879: ##### Pull in related .mk logic
1.298 apb 880: LINKSOWN?= ${LIBOWN}
881: LINKSGRP?= ${LIBGRP}
882: LINKSMODE?= ${LIBMODE}
1.1 cgd 883: .include <bsd.man.mk>
1.57 jtc 884: .include <bsd.nls.mk>
1.91 christos 885: .include <bsd.files.mk>
1.89 christos 886: .include <bsd.inc.mk>
1.109 cjs 887: .include <bsd.links.mk>
1.24 mycroft 888: .include <bsd.dep.mk>
1.315 joerg 889: .include <bsd.clang-analyze.mk>
1.316 apb 890: .include <bsd.clean.mk>
1.117 mycroft 891:
1.188 tv 892: ${TARGETS}: # ensure existence
CVSweb <webmaster@jp.NetBSD.org>