1 1.175 riastrad # $NetBSD: Makefile,v 1.175 2025/03/30 16:17:04 riastradh Exp $ 2 1.36 cgd # @(#)Makefile 8.2 (Berkeley) 2/3/94 3 1.1 cgd # 4 1.1 cgd # All library objects contain sccsid strings by default; they may be 5 1.1 cgd # excluded as a space-saving measure. To produce a library that does 6 1.1 cgd # not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS 7 1.71 lukem # from CPPFLAGS below. To remove these strings from just the system call 8 1.71 lukem # stubs, remove just -DSYSLIBC_SCCS from CPPFLAGS. 9 1.28 jtc # 10 1.28 jtc # The NLS (message catalog) functions are always in libc. To choose that 11 1.28 jtc # strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS 12 1.71 lukem # functions, put -DNLS on the CPPFLAGS line below. 13 1.4 deraadt # 14 1.6 deraadt # The YP functions are always in libc. To choose that getpwent() and friends 15 1.71 lukem # actually call the YP functions, put -DYP on the CPPFLAGS line below. 16 1.79 lukem # 17 1.79 lukem # The Hesiod functions are always in libc. To choose that getpwent() and friends 18 1.79 lukem # actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below. 19 1.4 deraadt 20 1.172 kamil 21 1.172 kamil # generated code depends on RTTI 22 1.172 kamil LIBCSANITIZERFLAGS+= ${${ACTIVE_CC} == "clang":? -fno-sanitize=function :} 23 1.171 kamil 24 1.127 christos .include "Makefile.inc" 25 1.107 lukem 26 1.82 tv LIB= c 27 1.117 christos CPPFLAGS+= -I${.CURDIR}/include -I${.CURDIR} 28 1.104 thorpej 29 1.136 mrg LIBCDIR= ${.CURDIR} 30 1.136 mrg 31 1.82 tv .if exists (${ARCHDIR}/Makefile.inc) 32 1.82 tv .PATH: ${ARCHDIR} 33 1.82 tv .include "${ARCHDIR}/Makefile.inc" 34 1.9 deraadt .endif 35 1.127 christos 36 1.114 matt .if exists (${ARCHDIR}/genassym.cf) 37 1.114 matt DPSRCS+= assym.h 38 1.114 matt CLEANFILES+= assym.h assym.h.tmp 39 1.114 matt 40 1.122 thorpej assym.h: ${ARCHDIR}/genassym.cf 41 1.114 matt ${_MKTARGET_CREATE} 42 1.165 joerg ${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} \ 43 1.121 matt ${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \ 44 1.165 joerg ${GENASSYM_CPPFLAGS} < ${ARCHDIR}/genassym.cf > assym.h.tmp && \ 45 1.114 matt mv -f assym.h.tmp assym.h 46 1.114 matt .endif 47 1.1 cgd 48 1.127 christos # The following controls how to build compatibility code for old NetBSD 49 1.150 joerg # binaries. If BUILD_LEGACY is yes, then we build a separate library; otherwise 50 1.127 christos # we include the code in libc. 51 1.150 joerg BUILD_LEGACY?= no 52 1.150 joerg .if "${BUILD_LEGACY}" == "yes" 53 1.127 christos SUBDIR=compat 54 1.127 christos .include <bsd.subdir.mk> 55 1.127 christos .else 56 1.127 christos COMPATDIR=${.CURDIR}/compat 57 1.127 christos .include "${.CURDIR}/compat/Makefile.inc" 58 1.150 joerg # Marker for compat code that can't be easily isolated 59 1.150 joerg CPPFLAGS+= -D__BUILD_LEGACY 60 1.127 christos .endif 61 1.127 christos 62 1.125 christos .include "${.CURDIR}/../../common/lib/libc/Makefile.inc" 63 1.135 ad .include "${.CURDIR}/atomic/Makefile.inc" 64 1.141 joerg .include "${.CURDIR}/cdb/Makefile.inc" 65 1.7 cgd .include "${.CURDIR}/db/Makefile.inc" 66 1.111 tshiozak .include "${.CURDIR}/citrus/Makefile.inc" 67 1.1 cgd .include "${.CURDIR}/compat-43/Makefile.inc" 68 1.159 joerg .include "${.CURDIR}/compiler_rt/Makefile.inc" 69 1.88 minoura .include "${.CURDIR}/dlfcn/Makefile.inc" 70 1.126 kleink .include "${.CURDIR}/gdtoa/Makefile.inc" 71 1.1 cgd .include "${.CURDIR}/gen/Makefile.inc" 72 1.24 cgd .include "${.CURDIR}/gmon/Makefile.inc" 73 1.81 explorer .include "${.CURDIR}/hash/Makefile.inc" 74 1.111 tshiozak .include "${.CURDIR}/iconv/Makefile.inc" 75 1.117 christos .include "${.CURDIR}/inet/Makefile.inc" 76 1.117 christos .include "${.CURDIR}/isc/Makefile.inc" 77 1.1 cgd .include "${.CURDIR}/locale/Makefile.inc" 78 1.52 thorpej .include "${.CURDIR}/md/Makefile.inc" 79 1.132 ad .include "${.CURDIR}/misc/Makefile.inc" 80 1.1 cgd .include "${.CURDIR}/net/Makefile.inc" 81 1.117 christos .include "${.CURDIR}/nameser/Makefile.inc" 82 1.25 jtc .include "${.CURDIR}/nls/Makefile.inc" 83 1.173 christos .include "${.CURDIR}/posix1e/Makefile.inc" 84 1.24 cgd .include "${.CURDIR}/regex/Makefile.inc" 85 1.117 christos .include "${.CURDIR}/resolv/Makefile.inc" 86 1.24 cgd .include "${.CURDIR}/rpc/Makefile.inc" 87 1.131 tls .include "${.CURDIR}/ssp/Makefile.inc" 88 1.1 cgd .include "${.CURDIR}/stdio/Makefile.inc" 89 1.1 cgd .include "${.CURDIR}/stdlib/Makefile.inc" 90 1.1 cgd .include "${.CURDIR}/string/Makefile.inc" 91 1.40 jtc .include "${.CURDIR}/termios/Makefile.inc" 92 1.108 thorpej .include "${.CURDIR}/thread-stub/Makefile.inc" 93 1.38 jtc .include "${.CURDIR}/time/Makefile.inc" 94 1.167 pooka .if ${RUMPRUN} != "yes" 95 1.144 joerg .include "${.CURDIR}/tls/Makefile.inc" 96 1.167 pooka .endif 97 1.1 cgd .include "${.CURDIR}/sys/Makefile.inc" 98 1.162 joerg .if ${HAVE_LIBGCC_EH} == "no" 99 1.159 joerg .include "${NETBSDSRCDIR}/sys/lib/libunwind/Makefile.inc" 100 1.159 joerg .endif 101 1.119 thorpej .include "${.CURDIR}/uuid/Makefile.inc" 102 1.104 thorpej .if (${MKYP} != "no") 103 1.4 deraadt .include "${.CURDIR}/yp/Makefile.inc" 104 1.104 thorpej .endif 105 1.41 jtc 106 1.138 dsl # Remove from SRCS the .c files for any .S files added by the MD makefiles, 107 1.138 dsl # also remove from SRCS the .c files for the .S and .c files in NO_SRCS. 108 1.138 dsl # Add the .c file for .S files (in both variables) to LSRCS so that the 109 1.138 dsl # 'normal' .c file for assembly files is used for the lint librray. 110 1.138 dsl # 111 1.138 dsl # Usage: 112 1.174 lukem # Add .S files to NO_SRCS when another .S file provides the entry points. 113 1.174 lukem # Add .c files to NO_SRCS when another .c file provides the entry points. 114 1.138 dsl # (lint is run on all .c files in SRCS) 115 1.138 dsl 116 1.138 dsl .for check_file in ${SRCS:M*.S} ${NO_SRCS} 117 1.138 dsl unwanted_file := ${SRCS:M${check_file:.S=.c}} 118 1.137 dsl .if "${unwanted_file}" != "" 119 1.137 dsl SRCS := ${SRCS:N${unwanted_file}} 120 1.138 dsl .if "${unwanted_file}" != "${check_file}" 121 1.138 dsl LSRCS := ${LSRCS} ${unwanted_file} 122 1.138 dsl .endif 123 1.137 dsl .endif 124 1.137 dsl .endfor 125 1.137 dsl 126 1.109 jmmv NLS= C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \ 127 1.110 salo no.msg pl.msg sk.msg sv.msg 128 1.1 cgd 129 1.163 apb .if ${MKREPRO:Uno} == "yes" 130 1.163 apb REGEX_SPECIALS=[][)(^$$.?*\\;] 131 1.163 apb MKREPRO_SED= -e 's;${NETBSDSRCDIR:C/${REGEX_SPECIALS}/\\\\&/g};/usr/src;' 132 1.163 apb .endif 133 1.163 apb 134 1.169 christos .if !defined(MLIBDIR) && ${RUMPRUN} != "yes" 135 1.140 uebayasi realall: tags 136 1.145 drochner tags: ${SRCS} 137 1.118 lukem ${_MKTARGET_CREATE} 138 1.163 apb -${TOOL_CTAGS} -f ${.TARGET}.tmp -w ${.ALLSRC:M*.c} 139 1.115 ross -egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \ 140 1.36 cgd sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \ 141 1.163 apb >> ${.TARGET}.tmp 142 1.163 apb .if ${MKREPRO:Uno} == "yes" 143 1.163 apb sed ${MKREPRO_SED} <${.TARGET}.tmp | sort -o ${.TARGET} 144 1.163 apb .else 145 1.163 apb sort -o ${.TARGET} ${.TARGET}.tmp 146 1.163 apb .endif 147 1.163 apb rm -f ${.TARGET}.tmp 148 1.65 christos 149 1.145 drochner FILES= tags 150 1.82 tv FILESNAME= libc.tags 151 1.82 tv FILESDIR= /var/db 152 1.167 pooka .endif 153 1.32 cgd 154 1.97 itojun 155 1.103 tshiozak # workaround for I18N stuffs: build singlebyte setlocale() for libc.a, 156 1.97 itojun # multibyte for libc.so. the quirk should be removed when we support 157 1.97 itojun # dlopen() from within statically linked binaries. 158 1.130 tnozaki CSHLIBFLAGS+= -D_I18N_DYNAMIC 159 1.105 yamt 160 1.175 riastrad # Tell ctype(3) that this is a dynamic libc, so if appropriate it 161 1.175 riastrad # should allocate a guard page. 162 1.175 riastrad CSHLIBFLAGS+= -D_CTYPE_DYNAMIC 163 1.175 riastrad 164 1.105 yamt .include <bsd.lib.mk> 165 1.133 ad 166 1.133 ad # force the dynamic linker to initialize libc first 167 1.134 he SHLIB_SHFLAGS+= -Wl,-z,initfirst 168 1.160 joerg .if ${HAVE_LIBGCC} == "no" 169 1.159 joerg SHLIB_SHFLAGS+= -Wl,-z,defs 170 1.159 joerg .endif 171