From 2a53f3fb3500971b94d25af1bbc7b3db720316df Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Mon, 13 May 2002 10:53:24 +0000 Subject: [PATCH] Major cleanup of bsd.lib.mk. Get rid of the INTERNALSTATICLIB knob and just use plain INTERNALLIB. INTERNALLIB now means to build static library only and don't install anything. Added a NOINSTALLLIB knob for libpam/modules. To not build any library at all, just do not set LIB. --- gnu/lib/csu/Makefile | 2 - gnu/lib/libiberty/Makefile | 5 +- lib/csu/alpha/Makefile | 4 - lib/csu/amd64/Makefile | 5 - lib/csu/i386-elf/Makefile | 5 - lib/csu/ia64/Makefile | 4 - lib/csu/powerpc/Makefile | 5 - lib/csu/sparc64/Makefile | 4 - lib/libpam/modules/Makefile.inc | 4 +- share/mk/bsd.lib.mk | 152 +++++++++++++++---------------- sys/boot/alpha/libalpha/Makefile | 4 - sys/boot/arc/lib/Makefile | 4 - sys/boot/i386/btx/lib/Makefile | 4 - sys/boot/pc98/btx/lib/Makefile | 4 - 14 files changed, 75 insertions(+), 131 deletions(-) diff --git a/gnu/lib/csu/Makefile b/gnu/lib/csu/Makefile index 9925bc7da2ed..5c6b4123804b 100644 --- a/gnu/lib/csu/Makefile +++ b/gnu/lib/csu/Makefile @@ -1,7 +1,5 @@ # $FreeBSD$ -INTERNALLIB= true - GCCDIR= ${.CURDIR}/../../../contrib/gcc .PATH: ${GCCDIR} diff --git a/gnu/lib/libiberty/Makefile b/gnu/lib/libiberty/Makefile index 7dd6ef0dc597..17228f85b94f 100644 --- a/gnu/lib/libiberty/Makefile +++ b/gnu/lib/libiberty/Makefile @@ -4,10 +4,7 @@ SRCDIR= ${.CURDIR}/../../../contrib/binutils/libiberty .PATH: ${SRCDIR} ${SRCDIR}/../include -LIB= iberty -NOPIC= true -INTERNALLIB= true -NOMAN= sorry +#LIB= iberty # miniumally required sources SRCS= argv.c choose-temp.c concat.c cplus-dem.c fdmatch.c fnmatch.c getopt.c \ diff --git a/lib/csu/alpha/Makefile b/lib/csu/alpha/Makefile index 5528e4e02d22..6d96e43b01e9 100644 --- a/lib/csu/alpha/Makefile +++ b/lib/csu/alpha/Makefile @@ -8,10 +8,6 @@ OBJS+= gcrt1.o CFLAGS+= -Wall -Wno-unused \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include -NOMAN= true -NOPIC= true -NOPROFILE= true -INTERNALLIB= true all: ${OBJS} ${SOBJS} diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile index 630872c7cc20..91dc74d74b41 100644 --- a/lib/csu/amd64/Makefile +++ b/lib/csu/amd64/Makefile @@ -9,11 +9,6 @@ CFLAGS+= -elf -Wall \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include LDFLAGS+= -elf -NOMAN= true -NOPIC= true -NOPROFILE= true -INTERNALLIB= true - all: ${OBJS} ${SOBJS} diff --git a/lib/csu/i386-elf/Makefile b/lib/csu/i386-elf/Makefile index 630872c7cc20..91dc74d74b41 100644 --- a/lib/csu/i386-elf/Makefile +++ b/lib/csu/i386-elf/Makefile @@ -9,11 +9,6 @@ CFLAGS+= -elf -Wall \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include LDFLAGS+= -elf -NOMAN= true -NOPIC= true -NOPROFILE= true -INTERNALLIB= true - all: ${OBJS} ${SOBJS} diff --git a/lib/csu/ia64/Makefile b/lib/csu/ia64/Makefile index 5528e4e02d22..6d96e43b01e9 100644 --- a/lib/csu/ia64/Makefile +++ b/lib/csu/ia64/Makefile @@ -8,10 +8,6 @@ OBJS+= gcrt1.o CFLAGS+= -Wall -Wno-unused \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include -NOMAN= true -NOPIC= true -NOPROFILE= true -INTERNALLIB= true all: ${OBJS} ${SOBJS} diff --git a/lib/csu/powerpc/Makefile b/lib/csu/powerpc/Makefile index 44f1f3a0440d..6d96e43b01e9 100644 --- a/lib/csu/powerpc/Makefile +++ b/lib/csu/powerpc/Makefile @@ -8,11 +8,6 @@ OBJS+= gcrt1.o CFLAGS+= -Wall -Wno-unused \ -I${.CURDIR}/../common \ -I${.CURDIR}/../../libc/include -NOMAN= true -NOPIC= true -NOPROFILE= true -INTERNALLIB= true - all: ${OBJS} ${SOBJS} diff --git a/lib/csu/sparc64/Makefile b/lib/csu/sparc64/Makefile index 9d4f5c3b40e2..ae4905ce8f34 100644 --- a/lib/csu/sparc64/Makefile +++ b/lib/csu/sparc64/Makefile @@ -6,10 +6,6 @@ SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= gcrt1.o CFLAGS+= -I${.CURDIR}/../common -I${.CURDIR}/../../libc/include -NOMAN= true -NOPIC= true -NOPROFILE= true -INTERNALLIB= true all: ${OBJS} ${SOBJS} diff --git a/lib/libpam/modules/Makefile.inc b/lib/libpam/modules/Makefile.inc index 745991558872..2b06deadb404 100644 --- a/lib/libpam/modules/Makefile.inc +++ b/lib/libpam/modules/Makefile.inc @@ -2,8 +2,8 @@ PAMDIR= ${.CURDIR}/../../../../contrib/openpam -INTERNALLIB= yes -INTERNALSTATICLIB=yes +NOINSTALLLIB= yes +NOPROFILE= yes SHLIB_NAME?= ${LIB}.so.${SHLIB_MAJOR} CFLAGS+= -I${PAMDIR}/include diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index a007f595b641..ad7728763377 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -4,13 +4,6 @@ .include -.if exists(${.CURDIR}/shlib_version) -SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major -.if ${OBJFORMAT} == aout -SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor -.endif -.endif - # Set up the variables controlling shared libraries. After this section, # SHLIB_NAME will be defined only if we are to create a shared library. # SHLIB_LINK will be defined only if we are to create a link to it. @@ -49,6 +42,14 @@ STRIP?= -s .SUFFIXES: .SUFFIXES: .out .o .po .So .S .s .asm .c .cc .cpp .cxx .m .C .f .y .l .ln +.if !defined(PICFLAG) +.if ${MACHINE_ARCH} == "sparc64" +PICFLAG=-fPIC +.else +PICFLAG=-fpic +.endif +.endif + .c.ln: ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \ touch ${.TARGET} @@ -151,106 +152,93 @@ STRIP?= -s @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} @mv ${.TARGET}.tmp ${.TARGET} -.if !defined(INTERNALLIB) || defined(INTERNALSTATICLIB) -.if !defined(NOPROFILE) && !defined(INTERNALLIB) -_LIBS=lib${LIB}.a lib${LIB}_p.a -.else -_LIBS=lib${LIB}.a -.endif -.endif +all: objwarn -.if defined(SHLIB_NAME) -_LIBS+=${SHLIB_NAME} -.endif -.if defined(INSTALL_PIC_ARCHIVE) -_LIBS+=lib${LIB}_pic.a -.endif +.if defined(LIB) && !empty(LIB) +_LIBS= lib${LIB}.a +OBJS+= ${SRCS:N*.h:R:S/$/.o/} -.if !defined(PICFLAG) -.if ${MACHINE_ARCH} == "sparc64" -PICFLAG=-fPIC -.else -PICFLAG=-fpic -.endif -.endif - -LINTOBJS+= ${SRCS:M*.c:C/\..+$/.ln/} - -.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && !empty(LINTOBJS) -LINTLIB=llib-l${LIB}.ln -_LIBS+=${LINTLIB} -.endif - -all: objwarn ${_LIBS} - -.if !defined(NOMAN) -all: _manpages -.endif - -OBJS+= ${SRCS:N*.h:R:S/$/.o/g} - -lib${LIB}.a:: ${OBJS} ${STATICOBJS} +lib${LIB}.a: ${OBJS} ${STATICOBJS} @${ECHO} building static ${LIB} library - @rm -f lib${LIB}.a - @${AR} cq lib${LIB}.a `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} - ${RANLIB} lib${LIB}.a + @rm -f ${.TARGET} + @${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} + ${RANLIB} ${.TARGET} + +CLEANFILES+= a.out ${OBJS} ${OBJS:S/$/.tmp/} ${STATICOBJS} + +.if !defined(INTERNALLIB) -POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} .if !defined(NOPROFILE) -lib${LIB}_p.a:: ${POBJS} +_LIBS+= lib${LIB}_p.a +POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} + +lib${LIB}_p.a: ${POBJS} @${ECHO} building profiled ${LIB} library - @rm -f lib${LIB}_p.a - @${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort -q` ${ARADD} - ${RANLIB} lib${LIB}_p.a + @rm -f ${.TARGET} + @${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD} + ${RANLIB} ${.TARGET} + +CLEANFILES+= ${POBJS} ${POBJS:S/$/.tmp/} .endif -SOBJS+= ${OBJS:.o=.So} +SOBJS+= ${OBJS:.o=.So} + +CLEANFILES+= ${SOBJS} ${SOBJS:.So=.so} ${SOBJS:S/$/.tmp/} .if defined(SHLIB_NAME) +_LIBS+= ${SHLIB_NAME} + ${SHLIB_NAME}: ${SOBJS} @${ECHO} building shared library ${SHLIB_NAME} - @rm -f ${SHLIB_NAME} ${SHLIB_LINK} + @rm -f ${.TARGET} ${SHLIB_LINK} .if defined(SHLIB_LINK) - @ln -sf ${SHLIB_NAME} ${SHLIB_LINK} + @ln -fs ${.TARGET} ${SHLIB_LINK} .endif .if ${OBJFORMAT} == aout @${CC} -shared -Wl,-x,-assert,pure-text \ - -o ${SHLIB_NAME} \ + -o ${.TARGET} \ `lorder ${SOBJS} | tsort -q` ${LDADD} .else @${CC} ${LDFLAGS} -shared -Wl,-x \ - -o ${SHLIB_NAME} -Wl,-soname,${SONAME} \ + -o ${.TARGET} -Wl,-soname,${SONAME} \ `lorder ${SOBJS} | tsort -q` ${LDADD} .endif + +CLEANFILES+= ${SHLIB_LINK} lib${LIB}.so.* lib${LIB}.so .endif .if defined(INSTALL_PIC_ARCHIVE) -lib${LIB}_pic.a:: ${SOBJS} +_LIBS+= lib${LIB}_pic.a + +lib${LIB}_pic.a: ${SOBJS} @${ECHO} building special pic ${LIB} library - @rm -f lib${LIB}_pic.a - @${AR} cq lib${LIB}_pic.a ${SOBJS} ${ARADD} - ${RANLIB} lib${LIB}_pic.a + @rm -f ${.TARGET} + @${AR} cq ${.TARGET} ${SOBJS} ${ARADD} + ${RANLIB} ${.TARGET} .endif -.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && !empty(LINTOBJS) +.if defined(WANT_LINT) +LINTLIB= llib-l${LIB}.ln +_LIBS+= ${LINTLIB} +LINTOBJS+= ${SRCS:M*.c:.c=.ln} + ${LINTLIB}: ${LINTOBJS} - @${ECHO} building lint library ${LINTLIB} - @rm -f ${LINTLIB} + @${ECHO} building lint library ${.TARGET} + @rm -f ${.TARGET} ${LINT} ${LINTLIBFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC} + +CLEANFILES+= ${LINTOBJS} .endif -.if !target(clean) -clean: - rm -f a.out ${OBJS} ${STATICOBJS} ${OBJS:S/$/.tmp/} ${CLEANFILES} - rm -f lib${LIB}.a - rm -f ${POBJS} ${POBJS:S/$/.tmp/} lib${LIB}_p.a - rm -f ${SOBJS} ${SOBJS:.So=.so} ${SOBJS:S/$/.tmp/} \ - ${SHLIB_NAME} ${SHLIB_LINK} \ - lib${LIB}.so.* lib${LIB}.so lib${LIB}_pic.a - rm -f ${LINTOBJS} ${LINTLIB} -.if defined(CLEANDIRS) && !empty(CLEANDIRS) - rm -rf ${CLEANDIRS} -.endif +.endif !defined(INTERNALLIB) + +all: ${_LIBS} + +CLEANFILES+= ${_LIBS} +.endif defined(LIB) && !empty(LIB) + +.if !defined(NOMAN) +all: _manpages .endif _EXTRADEPEND: @@ -285,32 +273,34 @@ _SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS} _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} .endfor +.if defined(LIB) && !empty(LIB) && !defined(INTERNALLIB) realinstall: _libinstall _libinstall: -.if !defined(INTERNALLIB) +.if !defined(NOINSTALLLIB) ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR} +.endif .if !defined(NOPROFILE) ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR} .endif -.endif .if defined(SHLIB_NAME) ${INSTALL} ${COPY} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR} .if defined(SHLIB_LINK) - ln -sf ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIB_LINK} + ln -fs ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIB_LINK} .endif .endif .if defined(INSTALL_PIC_ARCHIVE) ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR} .endif -.if defined(WANT_LINT) && defined(LIB) && defined(LINTOBJS) && !empty(LINTOBJS) +.if defined(WANT_LINT) ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR} .endif +.endif defined(LIB) && !empty(LIB) && !defined(INTERNALLIB) realinstall: .if defined(LINKS) && !empty(LINKS) @@ -357,9 +347,11 @@ lint: ${SRCS:M*.c} .include +.if defined(LIB) && !empty(LIB) .if !exists(${.OBJDIR}/${DEPENDFILE}) ${OBJS} ${STATICOBJS} ${POBJS} ${SOBJS}: ${SRCS:M*.h} .endif +.endif .include diff --git a/sys/boot/alpha/libalpha/Makefile b/sys/boot/alpha/libalpha/Makefile index a3fe81835924..7bb07cf9d934 100644 --- a/sys/boot/alpha/libalpha/Makefile +++ b/sys/boot/alpha/libalpha/Makefile @@ -1,8 +1,6 @@ # $FreeBSD$ LIB= alpha -NOPIC= true -NOPROFILE= true INTERNALLIB= true CFLAGS+= -ffreestanding @@ -23,8 +21,6 @@ SRCS= OSFpal.c elf_freebsd.c prom.c prom_disp.S prom_swpal.S \ pal.S reboot.c delay.c time.c alpha_module.c devicename.c \ srmdisk.c srmnet.c getsecs.c alpha_copy.c bootinfo.c -all: libalpha.a - machine: ln -sf ${.CURDIR}/../../../alpha/include machine diff --git a/sys/boot/arc/lib/Makefile b/sys/boot/arc/lib/Makefile index fbbfeb8356b9..7944374909d2 100644 --- a/sys/boot/arc/lib/Makefile +++ b/sys/boot/arc/lib/Makefile @@ -1,8 +1,6 @@ # $FreeBSD$ LIB= arc -NOPIC= true -NOPROFILE= true INTERNALLIB= true CFLAGS+= -ffreestanding @@ -27,8 +25,6 @@ SRCS= delay.c time.c abort.c setjmperr.c copy.c devicename.c module.c \ SRCS+= rpb.c .endif -all: libarc.a - CLEANFILES+= machine machine: diff --git a/sys/boot/i386/btx/lib/Makefile b/sys/boot/i386/btx/lib/Makefile index 40c65657ea7a..441c6adb8fc5 100644 --- a/sys/boot/i386/btx/lib/Makefile +++ b/sys/boot/i386/btx/lib/Makefile @@ -4,10 +4,6 @@ OBJS= btxcsu.o btxsys.o btxv86.o AFLAGS+= -elf LDFLAGS+= -elf CLEANFILES+= crt0.o -INTERNALLIB= true -NOMAN= true -NOPIC= true -NOPROFILE= true all: crt0.o diff --git a/sys/boot/pc98/btx/lib/Makefile b/sys/boot/pc98/btx/lib/Makefile index 40c65657ea7a..441c6adb8fc5 100644 --- a/sys/boot/pc98/btx/lib/Makefile +++ b/sys/boot/pc98/btx/lib/Makefile @@ -4,10 +4,6 @@ OBJS= btxcsu.o btxsys.o btxv86.o AFLAGS+= -elf LDFLAGS+= -elf CLEANFILES+= crt0.o -INTERNALLIB= true -NOMAN= true -NOPIC= true -NOPROFILE= true all: crt0.o