Annotation of src/share/mk/bsd.lib.mk, Revision 1.372.8.1
1.372.8.1! pgoyette 1: # $NetBSD: bsd.lib.mk,v 1.375 2018/06/21 11:24:38 kamil 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.372.8.1! pgoyette 152: CSHLIBFLAGS+= ${PICFLAGS} ${SANITIZERFLAGS}
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.372.8.1! pgoyette 174: SHLIB_SHFLAGS+= ${SANITIZERFLAGS}
1.354 pooka 175: .if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no"
1.272 christos 176: SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel
1.354 pooka 177: .endif
1.337 pooka 178: .if !defined(SHLIB_MKMAP) || ${SHLIB_MKMAP} != "no"
1.336 matt 179: SHLIB_SHFLAGS+= -Wl,-Map=${_LIB}.so.${SHLIB_SOVERSION}.map
1.337 pooka 180: .endif
1.336 matt 181: CLEANFILES+= ${_LIB}.so.${SHLIB_SOVERSION}.map
1.322 christos 182: SHLIB_LDSTARTFILE?= ${_GCC_CRTI} ${_GCC_CRTBEGINS}
183: SHLIB_LDENDFILE?= ${_GCC_CRTENDS} ${_GCC_CRTN}
1.86 jonathan 184:
1.82 mikel 185: CFLAGS+= ${COPTS}
1.267 mrg 186: OBJCFLAGS+= ${OBJCOPTS}
1.257 simonb 187: AFLAGS+= ${COPTS}
1.179 dmcmahil 188: FFLAGS+= ${FOPTS}
1.1 cgd 189:
1.305 darran 190: .if defined(CTFCONVERT)
191: .if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
192: CTFFLAGS+= -g
1.367 mrg 193: .if defined(HAVE_GCC)
1.348 christos 194: #CFLAGS+= -gdwarf-2
1.347 christos 195: .endif
1.305 darran 196: .endif
197: .endif
198:
1.333 christos 199: LIBSTRIPAOBJS= yes
200: .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
201: LIBSTRIPCOBJS= yes
202: .endif
203: .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
204: LIBSTRIPOBJCOBJS= yes
205: .endif
206: .if !defined(FFLAGS) || empty(FFLAGS:M*-g*)
207: LIBSTRIPFOBJS= yes
208: .endif
209: .if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*)
210: LIBSTRIPSHLIBOBJS= yes
211: .endif
212:
1.1 cgd 213: .c.o:
1.238 lukem 214: ${_MKTARGET_COMPILE}
1.263 dsl 215: ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 216: .if defined(CTFCONVERT)
217: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
218: .endif
1.333 christos 219: .if defined(LIBSTRIPCOBJS)
1.320 christos 220: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 221: .endif
1.1 cgd 222:
223: .c.po:
1.238 lukem 224: ${_MKTARGET_COMPILE}
1.372 christos 225: ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
1.305 darran 226: .if defined(CTFCONVERT)
227: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
228: .endif
1.333 christos 229: .if defined(LIBSTRIPCOBJS)
1.320 christos 230: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 231: .endif
1.17 mycroft 232:
1.266 christos 233: .c.go:
234: ${_MKTARGET_COMPILE}
235: ${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
236:
1.304 njoly 237: .c.pico:
1.238 lukem 238: ${_MKTARGET_COMPILE}
1.263 dsl 239: ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333 christos 240: .if defined(LIBSTRIPSHLIBOBJS)
1.320 christos 241: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 242: .endif
1.27 pk 243:
1.223 lukem 244: .cc.o .cpp.o .cxx.o .C.o:
1.238 lukem 245: ${_MKTARGET_COMPILE}
1.263 dsl 246: ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 247: .if defined(LIBSTRIPCOBJS)
1.320 christos 248: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 249: .endif
1.17 mycroft 250:
1.266 christos 251: .cc.po .cpp.po .cxx.po .C.po:
1.238 lukem 252: ${_MKTARGET_COMPILE}
1.263 dsl 253: ${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
1.333 christos 254: .if defined(LIBSTRIPCOBJS)
1.320 christos 255: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 256: .endif
1.28 cgd 257:
1.266 christos 258: .cc.go .cpp.go .cxx.go .C.go:
259: ${_MKTARGET_COMPILE}
260: ${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
261:
1.304 njoly 262: .cc.pico .cpp.pico .cxx.pico .C.pico:
1.238 lukem 263: ${_MKTARGET_COMPILE}
1.263 dsl 264: ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333 christos 265: .if defined(LIBSTRIPSHLIBOBJS)
1.320 christos 266: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 267: .endif
1.118 lukem 268:
1.179 dmcmahil 269: .f.o:
1.238 lukem 270: ${_MKTARGET_COMPILE}
1.263 dsl 271: ${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
1.305 darran 272: .if defined(CTFCONVERT)
273: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
274: .endif
1.333 christos 275: .if defined(LIBSTRIPFOBJS)
1.320 christos 276: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179 dmcmahil 277: .endif
278:
279: .f.po:
1.238 lukem 280: ${_MKTARGET_COMPILE}
1.263 dsl 281: ${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
1.305 darran 282: .if defined(CTFCONVERT)
283: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
284: .endif
1.333 christos 285: .if defined(LIBSTRIPFOBJS)
1.320 christos 286: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179 dmcmahil 287: .endif
288:
1.266 christos 289: .f.go:
290: ${_MKTARGET_COMPILE}
291: ${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
292:
1.304 njoly 293: .f.pico:
1.238 lukem 294: ${_MKTARGET_COMPILE}
1.338 joerg 295: ${COMPILE.f} ${PICFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333 christos 296: .if defined(LIBSTRIPFOBJS)
1.320 christos 297: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179 dmcmahil 298: .endif
299:
300: .f.ln:
1.238 lukem 301: ${_MKTARGET_COMPILE}
1.217 wiz 302: @echo Skipping lint for Fortran libraries.
1.179 dmcmahil 303:
1.118 lukem 304: .m.o:
1.238 lukem 305: ${_MKTARGET_COMPILE}
1.267 mrg 306: ${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 307: .if defined(CTFCONVERT)
308: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
309: .endif
1.333 christos 310: .if defined(LIBSTRIPOBJCOBJS)
1.320 christos 311: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 312: .endif
1.118 lukem 313:
314: .m.po:
1.238 lukem 315: ${_MKTARGET_COMPILE}
1.267 mrg 316: ${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 317: .if defined(CTFCONVERT)
318: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
319: .endif
1.333 christos 320: .if defined(LIBSTRIPOBJCOBJS)
1.320 christos 321: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 322: .endif
1.118 lukem 323:
1.266 christos 324: .m.go:
325: ${_MKTARGET_COMPILE}
1.267 mrg 326: ${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 327: .if defined(LIBSTRIPOBJCOBJS)
1.320 christos 328: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.266 christos 329: .endif
330:
1.304 njoly 331: .m.pico:
1.238 lukem 332: ${_MKTARGET_COMPILE}
1.267 mrg 333: ${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 334: .if defined(LIBSTRIPOBJCOBJS)
1.320 christos 335: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153 christos 336: .endif
1.1 cgd 337:
1.251 lukem 338: .s.o:
1.238 lukem 339: ${_MKTARGET_COMPILE}
1.263 dsl 340: ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 341: .if defined(CTFCONVERT)
342: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
343: .endif
1.333 christos 344: .if defined(LIBSTRIPAOBJS)
1.320 christos 345: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 346: .endif
1.1 cgd 347:
1.251 lukem 348: .S.o:
349: ${_MKTARGET_COMPILE}
1.263 dsl 350: ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 351: .if defined(CTFCONVERT)
352: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
353: .endif
1.333 christos 354: .if defined(LIBSTRIPAOBJS)
1.320 christos 355: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 356: .endif
1.251 lukem 357:
358: .s.po:
359: ${_MKTARGET_COMPILE}
1.263 dsl 360: ${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 361: .if defined(CTFCONVERT)
362: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
363: .endif
1.333 christos 364: .if defined(LIBSTRIPAOBJS)
1.320 christos 365: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 366: .endif
1.251 lukem 367:
368: .S.po:
1.238 lukem 369: ${_MKTARGET_COMPILE}
1.263 dsl 370: ${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305 darran 371: .if defined(CTFCONVERT)
372: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
373: .endif
1.333 christos 374: .if defined(LIBSTRIPAOBJS)
1.320 christos 375: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 376: .endif
1.1 cgd 377:
1.266 christos 378: .s.go:
379: ${_MKTARGET_COMPILE}
380: ${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
381:
382: .S.go:
383: ${_MKTARGET_COMPILE}
384: ${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
385:
1.304 njoly 386: .s.pico:
1.251 lukem 387: ${_MKTARGET_COMPILE}
1.338 joerg 388: ${COMPILE.s} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 389: .if defined(LIBSTRIPAOBJS)
1.320 christos 390: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 391: .endif
1.251 lukem 392:
1.304 njoly 393: .S.pico:
1.238 lukem 394: ${_MKTARGET_COMPILE}
1.338 joerg 395: ${COMPILE.S} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333 christos 396: .if defined(LIBSTRIPAOBJS)
1.320 christos 397: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333 christos 398: .endif
1.27 pk 399:
1.327 christos 400: # Declare a few variables to make our life easier later.
401: _LIB:=${_LIB_PREFIX}${LIB}
402: _LIB.a:=${_LIB}.a
403: _LIB_p.a:=${_LIB}_p.a
404: _LIB_g.a:=${_LIB}_g.a
405: _LIB_pic.a:=${_LIB}_pic.a
406: _LIB.ln:=llib-l${LIB}.ln
407:
408: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
409: _LIB.so:=${_LIB}.so
410: _LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR}
411: _LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION}
1.358 mrg 412: _LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link
1.364 christos 413: .if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG)
1.327 christos 414: _LIB.so.debug:=${_LIB.so.full}.debug
415: .endif
416: .endif
417:
418: _DEST.LIB:=${DESTDIR}${LIBDIR}
419: _DEST.OBJ:=${DESTDIR}${_LIBSODIR}
420: _DEST.LINT:=${DESTDIR}${LINTLIBDIR}
421: _DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR}
1.334 christos 422: _DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR}
1.327 christos 423:
1.252 lukem 424: .if defined(LIB) # {
1.234 lukem 425: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
426: || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.327 christos 427: _LIBS=${_LIB.a}
1.130 tv 428: .else
429: _LIBS=
430: .endif
1.58 cgd 431:
1.321 matt 432: .if ${LIBISPRIVATE} != "no" \
433: && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \
434: && !defined(NOCOMBINE)) # {
435: .for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g}
436: COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
437: .if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f)
438: COMBINESRCS+= ${f}
439: NODPSRCS+= ${f}
440: .else
441: OBJS+= ${f:R:S/$/.o/}
442: .endif
443: .endfor
444:
445: .if !empty(COMBINESRCS)
1.327 christos 446: OBJS+= ${_LIB}_combine.o
447: ${_LIB}_combine.o: ${COMBINESRCS}
1.321 matt 448: ${_MKTARGET_COMPILE}
449: ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET}
1.333 christos 450: .if defined(LIBSTRIPOBJS)
1.349 matt 451: ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.321 matt 452: .endif
453:
1.327 christos 454: CLEANFILES+= ${_LIB}_combine.d
1.321 matt 455:
1.327 christos 456: .if exists("${_LIB}_combine.d")
457: .include "${_LIB}_combine.d"
1.321 matt 458: .endif
459: .endif # empty(XSRCS.${LIB})
460: .else # } {
1.167 matt 461: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.321 matt 462: .endif # }
1.158 christos 463:
1.255 thorpej 464: STOBJS+=${OBJS}
465:
1.280 lukem 466: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
467:
1.281 lukem 468: .if ${LIBISPRIVATE} != "no"
1.252 lukem 469: # No installation is required
470: libinstall::
1.306 lukem 471: .endif
1.252 lukem 472:
1.268 lukem 473: .if ${MKDEBUGLIB} != "no"
1.327 christos 474: _LIBS+=${_LIB_g.a}
1.266 christos 475: GOBJS+=${OBJS:.o=.go}
476: DEBUGFLAGS?=-DDEBUG
477: .endif
478:
1.149 lukem 479: .if ${MKPROFILE} != "no"
1.327 christos 480: _LIBS+=${_LIB_p.a}
1.167 matt 481: POBJS+=${OBJS:.o=.po}
1.262 christos 482: PROFFLAGS?=-DGPROF -DPROF
1.1 cgd 483: .endif
484:
1.252 lukem 485: .if ${MKPIC} != "no" # {
1.160 simonb 486: .if ${MKPICLIB} == "no"
1.205 yamt 487: .if ${MKSHLIBOBJS} != "no"
488: # make _pic.a, which isn't really pic,
489: # since it's needed for making shared lib.
490: # but don't install it.
1.327 christos 491: SOLIB=${_LIB_pic.a}
1.304 njoly 492: SOBJS+=${OBJS:.o=.pico}
1.205 yamt 493: .else
1.327 christos 494: SOLIB=${_LIB.a}
1.205 yamt 495: .endif
1.160 simonb 496: .else
1.327 christos 497: SOLIB=${_LIB_pic.a}
1.160 simonb 498: _LIBS+=${SOLIB}
1.304 njoly 499: SOBJS+=${OBJS:.o=.pico}
1.160 simonb 500: .endif
1.171 christos 501: .if defined(SHLIB_FULLVERSION)
1.327 christos 502: _LIBS+=${_LIB.so.full}
1.27 pk 503: .endif
1.252 lukem 504: .endif # }
1.27 pk 505:
1.279 lukem 506: .if ${MKLINT} != "no" && !empty(LOBJS)
1.327 christos 507: _LIBS+=${_LIB.ln}
1.215 christos 508: .endif
1.27 pk 509:
1.234 lukem 510: ALLOBJS=
511: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
512: || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.255 thorpej 513: ALLOBJS+=${STOBJS}
1.179 dmcmahil 514: .endif
1.234 lukem 515: ALLOBJS+=${POBJS} ${SOBJS}
1.279 lukem 516: .if ${MKLINT} != "no" && !empty(LOBJS)
1.179 dmcmahil 517: ALLOBJS+=${LOBJS}
1.216 christos 518: .endif
1.252 lukem 519: .else # !defined(LIB) # } {
1.216 christos 520: LOBJS=
521: SOBJS=
1.252 lukem 522: .endif # !defined(LIB) # }
1.186 tv 523:
1.254 lukem 524: _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.253 christos 525:
526: .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
1.158 christos 527:
1.327 christos 528: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug}
1.1 cgd 529:
1.296 perry 530: .if ${MKARZERO} == "yes"
531: _ARFL=crsD
1.297 perry 532: _ARRANFL=sD
1.296 perry 533: _INSTRANLIB=
534: .else
535: _ARFL=crs
1.297 perry 536: _ARRANFL=s
1.296 perry 537: _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
538: .endif
539:
1.293 pooka 540: # If you change this, please consider reflecting the change in
541: # the override in sys/rump/Makefile.rump.
1.243 rtr 542: .if !target(__archivebuild)
1.90 christos 543: __archivebuild: .USE
1.238 lukem 544: ${_MKTARGET_BUILD}
1.372.8.1! pgoyette 545: @rm -f ${.TARGET}
1.360 tsutsui 546: ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.243 rtr 547: .endif
1.89 christos 548:
1.243 rtr 549: .if !target(__archiveinstall)
1.89 christos 550: __archiveinstall: .USE
1.238 lukem 551: ${_MKTARGET_INSTALL}
1.198 lukem 552: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.296 perry 553: ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
1.243 rtr 554: .endif
1.89 christos 555:
1.197 mycroft 556: __archivesymlinkpic: .USE
1.238 lukem 557: ${_MKTARGET_INSTALL}
1.264 jwise 558: ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
1.197 mycroft 559:
1.372.8.1! pgoyette 560: .if !target(__buildstdlib)
! 561: __buildstdlib: .USE
! 562: @echo building standard ${.TARGET:T:S/.o//:S/lib//} library
! 563: @rm -f ${.TARGET}
! 564: @${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
! 565: .endif
! 566:
! 567: .if !target(__buildproflib)
! 568: __buildproflib: .USE
! 569: @echo building profiled ${.TARGET:T:S/.o//:S/lib//} library
! 570: ${_MKTARGET_BUILD}
! 571: @rm -f ${.TARGET}
! 572: @${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*po} | ${TSORT}`
! 573: .endif
! 574:
1.253 christos 575: DPSRCS+= ${_YLSRCS}
576: CLEANFILES+= ${_YLSRCS}
1.230 lukem 577:
1.362 uebayasi 578: ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
1.103 mycroft 579:
1.362 uebayasi 580: ${_LIB.a}:: ${STOBJS} __archivebuild
1.1 cgd 581:
1.362 uebayasi 582: ${_LIB_p.a}:: ${POBJS} __archivebuild
1.1 cgd 583:
1.362 uebayasi 584: ${_LIB_pic.a}:: ${SOBJS} __archivebuild
1.27 pk 585:
1.362 uebayasi 586: ${_LIB_g.a}:: ${GOBJS} __archivebuild
1.266 christos 587:
1.235 lukem 588:
589: _LIBLDOPTS=
590: .if ${SHLIBDIR} != "/usr/lib"
1.324 joerg 591: _LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
592: -L=${SHLIBDIR}
593: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
594: _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
595: -L=${SHLIBINSTALLDIR}
1.235 lukem 596: .endif
1.369 ozaki-r 597: .if ${MKSTRIPSYM:Uyes} == "yes"
598: _LIBLDOPTS+= -Wl,-x
599: .else
600: _LIBLDOPTS+= -Wl,-X
601: .endif
1.235 lukem 602:
1.277 christos 603: # gcc -shared now adds -lc automatically. For libraries other than libc and
604: # libgcc* we add as a dependency the installed shared libc. For libc and
605: # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
606: # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
607: # to add standard libraries, not the linker.
1.276 christos 608: .if !defined(LIB)
1.312 matt 609: .if !empty(LIBC_SO)
1.274 christos 610: DPLIBC ?= ${DESTDIR}${LIBC_SO}
1.312 matt 611: .endif
1.276 christos 612: .else
1.278 simonb 613: .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
1.312 matt 614: .if !empty(LIBC_SO)
1.276 christos 615: DPLIBC ?= ${DESTDIR}${LIBC_SO}
1.312 matt 616: .endif
1.277 christos 617: .else
1.278 simonb 618: LDLIBC ?= -nodefaultlibs
1.341 joerg 619: .if ${HAVE_LIBGCC} == "yes" && ${LIB} == "c"
1.318 mrg 620: LDADD+= -lgcc
1.278 simonb 621: .endif
1.276 christos 622: .endif
1.274 christos 623: .endif
624:
1.291 mrg 625: .if ${LIBISCXX} != "no"
626: LIBCC:= ${CXX}
1.339 joerg 627: . if ${MKLIBCXX} == "yes"
628: LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib
629: . else
1.346 mrg 630: LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3
1.339 joerg 631: . endif
1.291 mrg 632: .else
633: LIBCC:= ${CC}
634: .endif
635:
1.327 christos 636: _LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}}
637: _LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}}
1.300 uebayasi 638:
1.358 mrg 639: _MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \
640: ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
641:
642: .if defined(_LIB.so.debug)
643: ${_LIB.so.debug}: ${_LIB.so.link}
644: ${_MKTARGET_CREATE}
645: ( ${OBJCOPY} --only-keep-debug \
646: ${_LIB.so.link} ${_LIB.so.debug} \
647: ) || (rm -f ${.TARGET}; false)
648: ${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug}
649: ${_MKTARGET_CREATE}
650: ( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
651: --add-gnu-debuglink=${_LIB.so.debug} \
1.370 chs 652: ${_LIB.so.link} ${_LIB.so.full}.tmp && \
653: mv -f ${_LIB.so.full}.tmp ${_LIB.so.full} \
1.358 mrg 654: ) || (rm -f ${.TARGET}; false)
655: ${_LIB.so.link}: ${_MAINLIBDEPS}
656: .else # aka no MKDEBUG
657: ${_LIB.so.full}: ${_MAINLIBDEPS}
658: .endif
1.238 lukem 659: ${_MKTARGET_BUILD}
1.327 christos 660: rm -f ${.TARGET}
1.369 ozaki-r 661: ${LIBCC} ${LDLIBC} -shared ${SHLIB_SHFLAGS} \
1.370 chs 662: ${_LDFLAGS.${_LIB}} -o ${.TARGET}.tmp ${_LIBLDOPTS} \
1.327 christos 663: -Wl,--whole-archive ${SOLIB} \
1.328 matt 664: -Wl,--no-whole-archive ${_LDADD.${_LIB}}
1.370 chs 665: .if ${MKSTRIPIDENT} != "no"
666: ${OBJCOPY} -R .ident ${.TARGET}.tmp
667: .endif
668: mv -f ${.TARGET}.tmp ${.TARGET}
1.196 lukem 669: # We don't use INSTALL_SYMLINK here because this is just
670: # happening inside the build directory/objdir. XXX Why does
671: # this spend so much effort on libraries that aren't live??? XXX
1.358 mrg 672: # XXX Also creates dead symlinks until the .full rule runs
673: # above and creates the main link
1.284 lukem 674: .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
675: "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
1.327 christos 676: ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp
677: mv -f ${_LIB.so.major}.tmp ${_LIB.so.major}
1.283 lukem 678: .endif
1.327 christos 679: ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
680: mv -f ${_LIB.so}.tmp ${_LIB.so}
1.35 pk 681:
1.252 lukem 682: .if !empty(LOBJS) # {
1.103 mycroft 683: LLIBS?= -lc
1.327 christos 684: ${_LIB.ln}: ${LOBJS}
1.238 lukem 685: ${_MKTARGET_COMPILE}
1.327 christos 686: rm -f ${.TARGET}
1.206 thorpej 687: .if defined(DESTDIR)
1.228 lukem 688: ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
1.206 thorpej 689: .else
1.228 lukem 690: ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.206 thorpej 691: .endif
1.252 lukem 692: .endif # }
1.1 cgd 693:
1.280 lukem 694: lint: ${LOBJS}
695: .if defined(LOBJS) && !empty(LOBJS)
696: ${LINT} ${LINTFLAGS} ${LOBJS}
697: .endif
698:
1.327 christos 699:
1.317 apb 700: # If the number of entries in CLEANFILES is too large, then the
701: # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
702: # failed (Argument list too long)". Avoid that by splitting the
703: # files to clean into several lists using different variable names.
704: # __cleanuse is an internal target in bsd.clean.mk; the way we
705: # use it here mimics the way it's used by the clean target in
706: # bsd.clean.mk.
707: #
708: clean: libclean1 libclean2 libclean3 libclean4 libclean5
709: libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
710: libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
711: libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
712: libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
713: libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
1.316 apb 714: CLEANFILES+= a.out [Ee]rrs mklog core *.core
1.327 christos 715: LIBCLEANFILES1+= ${_LIB.a} ${STOBJS} ${STOBJS:=.tmp}
716: LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS} ${POBJS:=.tmp}
717: LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS} ${GOBJS:=.tmp}
718: LIBCLEANFILES4+= ${_LIB_pic.a}
719: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
720: LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug}
721: .endif
1.317 apb 722: LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
1.327 christos 723: LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS}
1.252 lukem 724:
725: .if !target(libinstall) # {
1.148 lukem 726: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139 tv 727: libinstall::
728:
1.234 lukem 729: .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
1.327 christos 730: libinstall:: ${_DEST.LIB}/${_LIB.a}
731: .PRECIOUS: ${_DEST.LIB}/${_LIB.a}
1.197 mycroft 732:
1.269 dbj 733: .if ${MKUPDATE} == "no"
1.327 christos 734: .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
735: ${_DEST.LIB}/${_LIB.a}! .MADE
1.89 christos 736: .endif
1.327 christos 737: ${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall
1.197 mycroft 738: .else
1.327 christos 739: .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
740: ${_DEST.LIB}/${_LIB.a}: .MADE
1.89 christos 741: .endif
1.327 christos 742: ${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall
1.130 tv 743: .endif
1.197 mycroft 744: .endif
1.89 christos 745:
1.149 lukem 746: .if ${MKPROFILE} != "no"
1.327 christos 747: libinstall:: ${_DEST.LIB}/${_LIB_p.a}
748: .PRECIOUS: ${_DEST.LIB}/${_LIB_p.a}
1.197 mycroft 749:
1.269 dbj 750: .if ${MKUPDATE} == "no"
1.327 christos 751: .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
752: ${_DEST.LIB}/${_LIB_p.a}! .MADE
1.32 pk 753: .endif
1.327 christos 754: ${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall
1.197 mycroft 755: .else
1.327 christos 756: .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
757: ${_DEST.LIB}/${_LIB_p.a}: .MADE
1.89 christos 758: .endif
1.327 christos 759: ${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall
1.89 christos 760: .endif
1.197 mycroft 761: .endif
1.89 christos 762:
1.268 lukem 763: .if ${MKDEBUGLIB} != "no"
1.327 christos 764: libinstall:: ${_DEST.LIB}/${_LIB_g.a}
765: .PRECIOUS: ${_DEST.LIB}/${_LIB_g.a}
1.266 christos 766:
1.269 dbj 767: .if ${MKUPDATE} == "no"
1.329 spz 768: .if !defined(BUILD) && !make(all) && !make(${_LIB_g.a})
1.327 christos 769: ${_DEST.LIB}/${_LIB_g.a}! .MADE
1.266 christos 770: .endif
1.327 christos 771: ${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall
1.266 christos 772: .else
1.327 christos 773: .if !defined(BUILD) && !make(all) && !make(${LIB_g.a})
774: ${_DEST.LIB}/${_LIB_g.a}: .MADE
1.266 christos 775: .endif
1.327 christos 776: ${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall
1.266 christos 777: .endif
778: .endif
779:
1.149 lukem 780: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.327 christos 781: libinstall:: ${_DEST.LIB}/${_LIB_pic.a}
782: .PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a}
1.197 mycroft 783:
1.269 dbj 784: .if ${MKUPDATE} == "no"
1.327 christos 785: .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
786: ${_DEST.LIB}/${_LIB_pic.a}! .MADE
1.89 christos 787: .endif
1.197 mycroft 788: .if ${MKPICLIB} == "no"
1.331 nakayama 789: ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic
1.197 mycroft 790: .else
1.327 christos 791: ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall
1.197 mycroft 792: .endif
793: .else
1.327 christos 794: .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
795: ${_DEST.LIB}/${_LIB_pic.a}: .MADE
1.33 pk 796: .endif
1.160 simonb 797: .if ${MKPICLIB} == "no"
1.331 nakayama 798: ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic
1.160 simonb 799: .else
1.327 christos 800: ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall
1.160 simonb 801: .endif
1.89 christos 802: .endif
1.197 mycroft 803: .endif
1.89 christos 804:
1.171 christos 805: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.282 lukem 806:
1.327 christos 807: libinstall:: ${_DEST.OBJ}/${_LIB.so.full}
808: .PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full}
1.197 mycroft 809:
1.269 dbj 810: .if ${MKUPDATE} == "no"
1.327 christos 811: .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
812: ${_DEST.OBJ}/${_LIB.so.full}! .MADE
1.89 christos 813: .endif
1.327 christos 814: ${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full}
1.197 mycroft 815: .else
1.327 christos 816: .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
817: ${_DEST.OBJ}/${_LIB.so.full}: .MADE
1.89 christos 818: .endif
1.327 christos 819: ${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full}
1.197 mycroft 820: .endif
1.238 lukem 821: ${_MKTARGET_INSTALL}
1.188 tv 822: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.327 christos 823: ${.ALLSRC} ${.TARGET}
1.195 lukem 824: .if ${_LIBSODIR} != ${LIBDIR}
1.327 christos 825: ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
826: ${_DEST.LIB}/${_LIB.so.full}
1.195 lukem 827: .endif
1.284 lukem 828: .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
829: "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
1.327 christos 830: ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major}
1.195 lukem 831: .if ${_LIBSODIR} != ${LIBDIR}
1.327 christos 832: ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
833: ${_DEST.LIB}/${_LIB.so.major}
1.195 lukem 834: .endif
1.284 lukem 835: .endif
1.148 lukem 836: .if ${MKLINKLIB} != "no"
1.327 christos 837: ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so}
1.195 lukem 838: .if ${_LIBSODIR} != ${LIBDIR}
1.327 christos 839: ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
840: ${_DEST.LIB}/${_LIB.so}
1.195 lukem 841: .endif
1.83 cgd 842: .endif
1.12 cgd 843: .endif
1.89 christos 844:
1.327 christos 845: .if defined(_LIB.so.debug)
846: libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug}
847: .PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug}
1.307 lukem 848:
1.327 christos 849: ${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug}
1.307 lukem 850: ${_MKTARGET_INSTALL}
851: ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
1.327 christos 852: ${.ALLSRC} ${.TARGET}
1.334 christos 853: .if ${_LIBSODIR} != ${LIBDIR}
854: ${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \
855: ${_DEST.ODEBUG}/${_LIB.so.debug}
856: .endif
1.307 lukem 857: .endif
858:
1.279 lukem 859: .if ${MKLINT} != "no" && !empty(LOBJS)
1.327 christos 860: libinstall:: ${_DEST.LINT}/${_LIB.ln}
861: .PRECIOUS: ${_DEST.LINT}/${_LIB.ln}
1.197 mycroft 862:
1.269 dbj 863: .if ${MKUPDATE} == "no"
1.327 christos 864: .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
865: ${_DEST.LINT}/${_LIB.ln}! .MADE
1.89 christos 866: .endif
1.327 christos 867: ${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln}
1.197 mycroft 868: .else
1.327 christos 869: .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
870: ${_DEST.LINT}/${_LIB.ln}: .MADE
1.89 christos 871: .endif
1.327 christos 872: ${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln}
1.197 mycroft 873: .endif
1.238 lukem 874: ${_MKTARGET_INSTALL}
1.188 tv 875: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.327 christos 876: ${.ALLSRC} ${_DEST.LINT}
1.58 cgd 877: .endif
1.252 lukem 878: .endif # !target(libinstall) # }
1.1 cgd 879:
1.188 tv 880: ##### Pull in related .mk logic
1.298 apb 881: LINKSOWN?= ${LIBOWN}
882: LINKSGRP?= ${LIBGRP}
883: LINKSMODE?= ${LIBMODE}
1.1 cgd 884: .include <bsd.man.mk>
1.57 jtc 885: .include <bsd.nls.mk>
1.91 christos 886: .include <bsd.files.mk>
1.89 christos 887: .include <bsd.inc.mk>
1.109 cjs 888: .include <bsd.links.mk>
1.24 mycroft 889: .include <bsd.dep.mk>
1.315 joerg 890: .include <bsd.clang-analyze.mk>
1.316 apb 891: .include <bsd.clean.mk>
1.117 mycroft 892:
1.188 tv 893: ${TARGETS}: # ensure existence
CVSweb <webmaster@jp.NetBSD.org>