1#	$OpenBSD: Makefile,v 1.42 2019/11/12 04:38:27 guenther Exp $
2#
3# The YP functions are always in libc. To choose that getpwent() and friends
4# actually call the YP functions, put -DYP on the CFLAGS line below.
5
6.include <bsd.own.mk>
7
8LIB=c
9LIBREBUILD=y
10CLEANFILES+=tags Symbols.map
11CFLAGS+=-Wimplicit
12#CFLAGS+=-Werror
13LDADD=-nostdlib
14.if ${COMPILER_VERSION:L} == "clang"
15LDADD+=-lcompiler_rt
16.else
17LDADD+=-lgcc
18.endif
19LDADD+=-Wl,-zinitfirst,-znow
20
21VERSION_SCRIPT=	Symbols.map
22SYMBOL_LISTS=	${LIBCSRCDIR}/Symbols.list \
23		${LIBCSRCDIR}/arch/${MACHINE_CPU}/Symbols.list
24
25
26LIBCSRCDIR=${.CURDIR}
27.include "${LIBCSRCDIR}/Makefile.inc"
28
29all: tags
30tags: ${SRCS}
31	ctags -w ${.ALLSRC:M*.c}
32	egrep "^SYSENTRY(.*)|^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" \
33	    /dev/null ${.ALLSRC:M*.S} | \
34	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3	\1	/^\2(\3\4$$/;" \
35	    >> tags; sort -o tags tags
36
37beforeinstall:
38	${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 tags \
39		${DESTDIR}/var/db/lib${LIB}.tags
40
41${VERSION_SCRIPT}: ${SYMBOL_LISTS}
42	{ printf '{\n\tglobal:\n'; \
43	  sed '/^[._a-zA-Z]/s/$$/;/; s/^/		/' ${SYMBOL_LISTS}; \
44	  printf '\n\tlocal:\n\t\t*;\n};\n'; } >$@.tmp && mv $@.tmp $@
45
46.include <bsd.lib.mk>
47