jcs's openbsd hax
openbsd
1# $OpenBSD: Makefile,v 1.43 2025/08/10 11:36:07 miod 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# needed by a few files in gen/ and string/ to reach other directories, and
28# by sys/stack-protector.c to reach ../csu
29CFLAGS+=-I${LIBCSRCDIR}
30.include "${LIBCSRCDIR}/Makefile.inc"
31
32all: tags
33tags: ${SRCS}
34 ctags -w ${.ALLSRC:M*.c}
35 egrep "^SYSENTRY(.*)|^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" \
36 /dev/null ${.ALLSRC:M*.S} | \
37 sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
38 >> tags; sort -o tags tags
39
40beforeinstall:
41 ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 tags \
42 ${DESTDIR}/var/db/lib${LIB}.tags
43
44${VERSION_SCRIPT}: ${SYMBOL_LISTS}
45 { printf '{\n\tglobal:\n'; \
46 sed '/^[._a-zA-Z]/s/$$/;/; s/^/ /' ${SYMBOL_LISTS}; \
47 printf '\n\tlocal:\n\t\t*;\n};\n'; } >$@.tmp && mv $@.tmp $@
48
49.include <bsd.lib.mk>