Deleted Added
sdiff udiff text old ( 96462 ) new ( 96512 )
full compact
1# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
2# $FreeBSD: head/share/mk/bsd.lib.mk 96462 2002-05-12 16:01:00Z ru $
3#
4
5.include <bsd.init.mk>
6
7.if exists(${.CURDIR}/shlib_version)
8SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
9.if ${OBJFORMAT} == aout
10SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
11.endif
12.endif
13
14# Set up the variables controlling shared libraries. After this section,
15# SHLIB_NAME will be defined only if we are to create a shared library.
16# SHLIB_LINK will be defined only if we are to create a link to it.
17# INSTALL_PIC_ARCHIVE will be defined only if we are to create a PIC archive.
18.if defined(NOPIC)
19.undef SHLIB_NAME
20.undef INSTALL_PIC_ARCHIVE
21.else

--- 22 unchanged lines hidden (view full) ---

44.include <bsd.libnames.mk>
45.endif
46
47# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
48# .So used for PIC object files
49.SUFFIXES:
50.SUFFIXES: .out .o .po .So .S .s .asm .c .cc .cpp .cxx .m .C .f .y .l .ln
51
52.c.ln:
53 ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
54 touch ${.TARGET}
55
56.cc.ln .C.ln .cpp.ln .cxx.ln:
57 ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \
58 touch ${.TARGET}
59

--- 86 unchanged lines hidden (view full) ---

146 @mv ${.TARGET}.tmp ${.TARGET}
147
148.S.So:
149 ${CC} ${PICFLAG} -DPIC ${CFLAGS:M-[BID]*} ${AINC} -c ${.IMPSRC} \
150 -o ${.TARGET}
151 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
152 @mv ${.TARGET}.tmp ${.TARGET}
153
154.if !defined(INTERNALLIB) || defined(INTERNALSTATICLIB)
155.if !defined(NOPROFILE) && !defined(INTERNALLIB)
156_LIBS=lib${LIB}.a lib${LIB}_p.a
157.else
158_LIBS=lib${LIB}.a
159.endif
160.endif
161
162.if defined(SHLIB_NAME)
163_LIBS+=${SHLIB_NAME}
164.endif
165.if defined(INSTALL_PIC_ARCHIVE)
166_LIBS+=lib${LIB}_pic.a
167.endif
168
169.if !defined(PICFLAG)
170.if ${MACHINE_ARCH} == "sparc64"
171PICFLAG=-fPIC
172.else
173PICFLAG=-fpic
174.endif
175.endif
176
177LINTOBJS+= ${SRCS:M*.c:C/\..+$/.ln/}
178
179.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && !empty(LINTOBJS)
180LINTLIB=llib-l${LIB}.ln
181_LIBS+=${LINTLIB}
182.endif
183
184all: objwarn ${_LIBS}
185
186.if !defined(NOMAN)
187all: _manpages
188.endif
189
190OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
191
192lib${LIB}.a:: ${OBJS} ${STATICOBJS}
193 @${ECHO} building static ${LIB} library
194 @rm -f lib${LIB}.a
195 @${AR} cq lib${LIB}.a `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
196 ${RANLIB} lib${LIB}.a
197
198POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
199.if !defined(NOPROFILE)
200lib${LIB}_p.a:: ${POBJS}
201 @${ECHO} building profiled ${LIB} library
202 @rm -f lib${LIB}_p.a
203 @${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort -q` ${ARADD}
204 ${RANLIB} lib${LIB}_p.a
205.endif
206
207SOBJS+= ${OBJS:.o=.So}
208
209.if defined(SHLIB_NAME)
210${SHLIB_NAME}: ${SOBJS}
211 @${ECHO} building shared library ${SHLIB_NAME}
212 @rm -f ${SHLIB_NAME} ${SHLIB_LINK}
213.if defined(SHLIB_LINK)
214 @ln -sf ${SHLIB_NAME} ${SHLIB_LINK}
215.endif
216.if ${OBJFORMAT} == aout
217 @${CC} -shared -Wl,-x,-assert,pure-text \
218 -o ${SHLIB_NAME} \
219 `lorder ${SOBJS} | tsort -q` ${LDADD}
220.else
221 @${CC} ${LDFLAGS} -shared -Wl,-x \
222 -o ${SHLIB_NAME} -Wl,-soname,${SONAME} \
223 `lorder ${SOBJS} | tsort -q` ${LDADD}
224.endif
225.endif
226
227.if defined(INSTALL_PIC_ARCHIVE)
228lib${LIB}_pic.a:: ${SOBJS}
229 @${ECHO} building special pic ${LIB} library
230 @rm -f lib${LIB}_pic.a
231 @${AR} cq lib${LIB}_pic.a ${SOBJS} ${ARADD}
232 ${RANLIB} lib${LIB}_pic.a
233.endif
234
235.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && !empty(LINTOBJS)
236${LINTLIB}: ${LINTOBJS}
237 @${ECHO} building lint library ${LINTLIB}
238 @rm -f ${LINTLIB}
239 ${LINT} ${LINTLIBFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
240.endif
241
242.if !target(clean)
243clean:
244 rm -f a.out ${OBJS} ${STATICOBJS} ${OBJS:S/$/.tmp/} ${CLEANFILES}
245 rm -f lib${LIB}.a
246 rm -f ${POBJS} ${POBJS:S/$/.tmp/} lib${LIB}_p.a
247 rm -f ${SOBJS} ${SOBJS:.So=.so} ${SOBJS:S/$/.tmp/} \
248 ${SHLIB_NAME} ${SHLIB_LINK} \
249 lib${LIB}.so.* lib${LIB}.so lib${LIB}_pic.a
250 rm -f ${LINTOBJS} ${LINTLIB}
251.if defined(CLEANDIRS) && !empty(CLEANDIRS)
252 rm -rf ${CLEANDIRS}
253.endif
254.endif
255
256_EXTRADEPEND:
257 @TMP=_depend$$$$; \
258 sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.So:/' < ${DEPENDFILE} \
259 > $$TMP; \
260 mv $$TMP ${DEPENDFILE}
261.if !defined(NOEXTRADEPEND) && defined(SHLIB_NAME)
262.if ${OBJFORMAT} == aout

--- 17 unchanged lines hidden (view full) ---

280.for ie in ${INSTALLFLAGS_EDIT}
281_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
282.endfor
283_SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS}
284.for ie in ${INSTALLFLAGS_EDIT}
285_SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}}
286.endfor
287
288realinstall: _libinstall
289_libinstall:
290.if !defined(INTERNALLIB)
291 ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
292 ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
293.if !defined(NOPROFILE)
294 ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
295 ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
296.endif
297.endif
298.if defined(SHLIB_NAME)
299 ${INSTALL} ${COPY} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
300 ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
301 ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
302.if defined(SHLIB_LINK)
303 ln -sf ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIB_LINK}
304.endif
305.endif
306.if defined(INSTALL_PIC_ARCHIVE)
307 ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
308 ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
309.endif
310.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && !empty(LINTOBJS)
311 ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
312 ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
313.endif
314
315realinstall:
316.if defined(LINKS) && !empty(LINKS)
317 @set ${LINKS}; \
318 while test $$# -ge 2; do \
319 l=${DESTDIR}$$1; \
320 shift; \
321 t=${DESTDIR}$$1; \

--- 30 unchanged lines hidden (view full) ---

352.include <bsd.incs.mk>
353
354.if !defined(NOMAN)
355.include <bsd.man.mk>
356.endif
357
358.include <bsd.dep.mk>
359
360.if !exists(${.OBJDIR}/${DEPENDFILE})
361${OBJS} ${STATICOBJS} ${POBJS} ${SOBJS}: ${SRCS:M*.h}
362.endif
363
364.include <bsd.obj.mk>
365
366.include <bsd.sys.mk>