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.101 retrieving revision 1.124 diff -u -p -r1.101 -r1.124 --- src/share/mk/bsd.lib.mk 1997/05/09 06:19:55 1.101 +++ src/share/mk/bsd.lib.mk 1998/02/18 08:14:31 1.124 @@ -1,15 +1,18 @@ -# $NetBSD: bsd.lib.mk,v 1.101 1997/05/09 06:19:55 mycroft Exp $ +# $NetBSD: bsd.lib.mk,v 1.124 1998/02/18 08:14:31 jonathan Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 +.if !target(__initialized__) +__initialized__: .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" .endif - .include - +.include .MAIN: all +.endif + .PHONY: cleanlib libinstall -install: libinstall +realinstall: libinstall clean cleandir: cleanlib .if exists(${.CURDIR}/shlib_version) @@ -20,7 +23,8 @@ SHLIB_MINOR != . ${.CURDIR}/shlib_versio # add additional suffixes not exported. # .po is used for profiling object files. # .so is used for PIC object files. -.SUFFIXES: .out .a .ln .so .po .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh .m4 +.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h +.SUFFIXES: .sh .m4 .m # Set PICFLAGS to cc flags for producing position-independent code, @@ -32,27 +36,34 @@ SHLIB_MINOR != . ${.CURDIR}/shlib_versio # SHLIB_SOVERSION: version number to be compiled into a shared library # via -soname. Usualy ${SHLIB_MAJOR} on ELF. # NetBSD/pmax used to use ${SHLIB_MAJOR}.{SHLIB-MINOR}. -# SHLIB_LDSTARTFILE: ??? -# SHLIB_LDENDTILE: ?? -# CPICFLAGS: flags to compile .c files for .so objects. -# APICFLAGS: flags to assemble .S files for .so objects. +# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library. +# with ELF, also set shared-lib version for ld.so. +# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors +# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors +# SHLIB_WHOLE: turn on whole-archive +# SHLIB_NOWHOLE: turn off whole-archive +# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS} +# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects. +# CAPICFLAGS flags for {$CC} to compiling .[Ss] files +# (usually just ${CPPPICFLAGS} ${CPICFLAGS}) +# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects. .if (${MACHINE_ARCH} == "alpha") - + # Alpha-specific shared library flags SHLIB_TYPE=ELF SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/crtbeginS.o SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crtendS.o -SHLIB_SOVERSION=${SHLIB_MAJOR} -CPICFLAGS ?= -fpic -DPIC -APICFLAGS ?= -DPIC +CPICFLAGS ?= -fpic -DPIC +CPPPICFLAGS?= -DPIC +CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} +APICFLAGS ?= .elif (${MACHINE_ARCH} == "mips") - + # mips-specific shared library flags SHLIB_TYPE=ELF -# still use gnu-derived ld.so on pmax; don't have or need lib<>.so support. +# Still use gnu-derived ld.so on pmax; don't have or need lib<>.so support. SHLIB_LDSTARTFILE= SHLIB_LDENDFILE= -SHLIB_SOVERSION=${SHLIB_MAJOR} # On mips, all libs need to be compiled with ABIcalls, not just sharedlibs. CPICFLAGS?= @@ -68,21 +79,34 @@ AS+= -KPIC .else +# Platform-independent flags for NetBSD a.out shared libraries SHLIB_TYPE=a.out SHLIB_LDSTARTFILE= SHLIB_LDENDFILE= +SHLIB_SHFLAGS= -Bshareable -Bforcearchive SHLIB_SOVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} +SHLIB_WHOLE= +SHLIB_NOWHOLE= CPICFLAGS?= -fpic -DPIC -APICFLAGS?= -fpic -DPIC +CPPPICFLAGS?= -DPIC +CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} +APICFLAGS?= -k .endif +# Platform-independent linker flags for ELF shared libraries +.if (${SHLIB_TYPE} == "ELF") +SHLIB_WHOLE=--whole-archive +SHLIB_NOWHOLE=--no-whole-archive +SHLIB_SOVERSION=${SHLIB_MAJOR} +SHLIB_SHFLAGS=-shared -soname lib${LIB}.so.${SHLIB_SOVERSION} +.endif CFLAGS+= ${COPTS} .c.o: @echo ${COMPILE.c:Q} ${.IMPSRC} - @${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o + @${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o @@ -99,7 +123,7 @@ CFLAGS+= ${COPTS} @rm -f ${.TARGET}.o .c.ln: - ${LINT} ${LINTFLAGS} ${CFLAGS:M-[IDU]*} -i ${.IMPSRC} + ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} .cc.o .C.o: @echo ${COMPILE.cc:Q} ${.IMPSRC} @@ -119,6 +143,24 @@ CFLAGS+= ${COPTS} @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o +.m.o: + @echo ${COMPILE.m:Q} ${.IMPSRC} + @${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.m.po: + @echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET} + @${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.m.so: + @echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} + @${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + .S.o .s.o: @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o @@ -132,8 +174,8 @@ CFLAGS+= ${COPTS} @rm -f ${.TARGET}.o .S.so .s.so: - @echo ${COMPILE.S:Q} ${APICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} - @${COMPILE.S} ${APICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o + @echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} + @${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o @${LD} -x -r ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o @@ -155,14 +197,11 @@ _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHL _LIBS+=llib-l${LIB}.ln .endif -all depend: ${SRCS} -all: ${_LIBS} - -OBJS+= ${SRCS:N*.h:R:S/$/.o/g} +all: ${SRCS} ${_LIBS} __archivebuild: .USE @rm -f ${.TARGET} - @${AR} cq ${.TARGET} `NM=${NM} lorder ${.ALLSRC} | tsort -q` + @${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC} | ${TSORT}` ${RANLIB} ${.TARGET} __archiveinstall: .USE @@ -171,14 +210,18 @@ __archiveinstall: .USE ${RANLIB} -t ${.TARGET} chmod ${LIBMODE} ${.TARGET} +DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c} +CLEANFILES+= ${DPSRCS} + +OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} lib${LIB}.a:: ${OBJS} __archivebuild @echo building standard ${LIB} library -POBJS+= ${OBJS:.o=.po} +POBJS+= ${OBJS:.o=.po} lib${LIB}_p.a:: ${POBJS} __archivebuild @echo building profiled ${LIB} library -SOBJS+= ${OBJS:.o=.so} +SOBJS+= ${OBJS:.o=.so} lib${LIB}_pic.a:: ${SOBJS} __archivebuild @echo building shared object ${LIB} library @@ -186,18 +229,13 @@ lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINO ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\) @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -.if (${SHLIB_TYPE} == "a.out") - $(LD) -x -Bshareable -Bforcearchive \ - -o ${.TARGET} lib${LIB}_pic.a ${LDADD} -.elif (${SHLIB_TYPE} == "ELF") - $(LD) -x -shared -o ${.TARGET} \ - -soname lib${LIB}.so.${SHLIB_SOVERSION} ${SHLIB_LDSTARTFILE} \ - --whole-archive lib${LIB}_pic.a --no-whole-archive ${LDADD} \ + $(LD) -x ${SHLIB_SHFLAGS} -o ${.TARGET} \ + ${SHLIB_LDSTARTFILE} \ + ${SHLIB_WHOLE} lib${LIB}_pic.a ${SHLIB_NOWHOLE} ${LDADD} \ ${SHLIB_LDENDFILE} -.endif -LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} -LLIBS?= -lc +LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} +LLIBS?= -lc llib-l${LIB}.ln: ${LOBJS} @echo building llib-l${LIB}.ln @rm -f llib-l${LIB}.ln @@ -295,18 +333,13 @@ ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .endif .endif -.if !defined(NOMAN) .include -.endif - -.if !defined(NONLS) .include -.endif - -.include -.include .include .include +.include .include -.include .include + +# Make sure all of the standard targets are defined, even if they do nothing. +lint regress: