Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/share/mk/bsd.lib.mk,v rcsdiff: /ftp/cvs/cvsroot/src/share/mk/bsd.lib.mk,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.26 retrieving revision 1.29 diff -u -p -r1.26 -r1.29 --- src/share/mk/bsd.lib.mk 1993/08/16 01:41:01 1.26 +++ src/share/mk/bsd.lib.mk 1993/10/06 17:54:01 1.29 @@ -1,5 +1,5 @@ # from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 -# $Id: bsd.lib.mk,v 1.26 1993/08/16 01:41:01 mycroft Exp $ +# $Id: bsd.lib.mk,v 1.29 1993/10/06 17:54:01 pk Exp $ .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" @@ -8,8 +8,9 @@ .MAIN: all # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries +# .so used for PIC object files .SUFFIXES: -.SUFFIXES: .out .o .po .s .c .cc .C .f .y .l .0 .1 .2 .3 .4 .5 .6 .7 .8 +.SUFFIXES: .out .o .po .so .s .c .cc .C .f .y .l .0 .1 .2 .3 .4 .5 .6 .7 .8 .c.o: ${CC} ${CFLAGS} -c ${.IMPSRC} @@ -21,6 +22,9 @@ @${LD} -X -r ${.TARGET} @mv a.out ${.TARGET} +.c.so: + ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + .cc.o .C.o: ${CXX} ${CXXFLAGS} -c ${.IMPSRC} @${LD} -x -r ${.TARGET} @@ -31,6 +35,11 @@ @${LD} -X -r ${.TARGET} @mv a.out ${.TARGET} +.cc.so .C.so: + ${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + @${LD} -X -r ${.TARGET} + @mv a.out ${.TARGET} + .s.o: ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ ${AS} -o ${.TARGET} @@ -43,12 +52,24 @@ @${LD} -X -r ${.TARGET} @mv a.out ${.TARGET} +.s.so: + ${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ + ${AS} -k -o ${.TARGET} + .if !defined(NOPROFILE) _LIBS=lib${LIB}.a lib${LIB}_p.a .else _LIBS=lib${LIB}.a .endif +.if !defined(NOPIC) +_LIBS+=lib${LIB}_pic.a +.endif + +.if !defined(PICFLAG) +PICFLAG=-fpic +.endif + all: ${_LIBS} # llib-l${LIB}.ln OBJS+= ${SRCS:N*.h:R:S/$/.o/g} @@ -66,6 +87,13 @@ lib${LIB}_p.a:: ${POBJS} @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD} ${RANLIB} lib${LIB}_p.a +SOBJS+= ${OBJS:.o=.so} +lib${LIB}_pic.a:: ${SOBJS} + @echo building shared object ${LIB} library + @rm -f lib${LIB}_pic.a + @${AR} cTq lib${LIB}_pic.a `lorder ${SOBJS} | tsort` ${LDADD} + ${RANLIB} lib${LIB}_pic.a + llib-l${LIB}.ln: ${SRCS} ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} @@ -74,6 +102,7 @@ clean: rm -f a.out Errs errs mklog core ${CLEANFILES} rm -f ${OBJS} rm -f ${POBJS} profiled/*.o + rm -f ${SOBJS} shared/*.o rm -f lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln .endif @@ -82,7 +111,7 @@ cleandir: clean .if defined(SRCS) afterdepend: @(TMP=/tmp/_depend$$$$; \ - sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po:/' < .depend > $$TMP; \ + sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' < .depend > $$TMP; \ mv $$TMP .depend) .endif