xref: /netbsd-src/share/mk/compare-lib-lists (revision 249752ac155158bd356d2beaa995dce775fa17b5)
1#!/bin/sh
2# $NetBSD: compare-lib-lists,v 1.3 2019/11/18 16:23:28 christos Exp $
3#
4# Q+D script to print the library lists for comparison between whats in the
5# bsd.prog.mk file and bsd.README (this matches)
6#
7# Also compare the list of LIB variables we create against the actually
8# installed archives (this does *not* match -- yet)
9
10prog=$(basename "$0")
11
12RD=/tmp/${prog}.rd.$$
13MK=/tmp/${prog}.mk.$$
14IN=/tmp/${prog}.in.$$
15LB=/tmp/${prog}.lb.$$
16
17trap "rm -f ${MK} ${RD} ${IN} ${LB}" 0 1 2 3 15
18
19make -f - all << \EOF > ${MK}
20.include <bsd.prog.mk>
21
22all:
23.for l in ${_LIBLIST}
24	@echo $l
25.endfor
26.for l in crt0.o crti.o crti.o crtn.o
27	@echo $l
28.endfor
29.for l in ${_X11LIBLIST}
30	@echo $l
31.endfor
32EOF
33
34grep '	LIB' bsd.README | \
35    grep DESTDIR | \
36    sed -e 's/.*lib\([a-zA-Z0-9_+\-]*\)\.a$/\1/' > ${RD}
37
38paste ${MK} ${RD}
39
40echo "------"
41
42cat << \EOF | make -f - xall | sort > ${IN}
43.include <bsd.prog.mk>
44
45xall:
46.for _lib in ${_LIBLIST}
47	@echo ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
48.endfor
49.for _lib in ${_X11LIBLIST}
50	@echo ${DESTDIR}${X11USRLIBDIR}/lib${_lib}.a
51.endfor
52EOF
53
54ls -1 /usr/lib/*.a /usr/X11R7/lib/*.a | \
55    egrep -v '(_p|_pic|_g)\.a' | sort > ${LB}
56
57paste ${IN} ${LB}
58