]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/Makefile
Add two missing eventhandler.h headers
[FreeBSD/FreeBSD.git] / lib / libc / Makefile
1 #       @(#)Makefile    8.2 (Berkeley) 2/3/94
2 # $FreeBSD$
3
4 PACKAGE=        clibs
5 SHLIBDIR?= /lib
6
7 .include <src.opts.mk>
8
9 # Force building of libc_pic.a
10 MK_TOOLCHAIN=   yes
11
12 LIBC_SRCTOP?= ${.CURDIR}
13
14 # Pick the current architecture directory for libc. In general, this is
15 # named MACHINE_CPUARCH, but some ABIs are different enough to require
16 # their own libc, so allow a directory named MACHINE_ARCH to override this.
17
18 .if exists(${LIBC_SRCTOP}/${MACHINE_ARCH})
19 LIBC_ARCH=${MACHINE_ARCH}
20 .else
21 LIBC_ARCH=${MACHINE_CPUARCH}
22 .endif
23
24 # All library objects contain FreeBSD revision strings by default; they may be
25 # excluded as a space-saving measure.  To produce a library that does
26 # not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
27 # below.  Note: there are no IDs for syscall stubs whose sources are generated.
28 # To include legacy CSRG SCCS ID strings, remove -DNO__SCCSID from CFLAGS.
29 # To include RCS ID strings from other BSD projects, remove -DNO__RCSID from CFLAGS.
30 CFLAGS+=-DNO__SCCSID -DNO__RCSID
31
32 LIB=c
33 SHLIB_MAJOR= 7
34 .if ${MK_SSP} != "no"
35 SHLIB_LDSCRIPT=libc.ldscript
36 .else
37 SHLIB_LDSCRIPT=libc_nossp.ldscript
38 .endif
39 SHLIB_LDSCRIPT_LINKS=libxnet.so
40 WARNS?= 2
41 CFLAGS+=-I${LIBC_SRCTOP}/include -I${SRCTOP}/include
42 CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
43 .if ${MK_NLS} != "no"
44 CFLAGS+=-DNLS
45 .endif
46 CLEANFILES+=tags
47 INSTALL_PIC_ARCHIVE=
48 BUILD_NOSSP_PIC_ARCHIVE=
49 PRECIOUSLIB=
50
51 .ifndef NO_THREAD_STACK_UNWIND
52 CANCELPOINTS_CFLAGS=-fexceptions
53 CFLAGS+=${CANCELPOINTS_CFLAGS}
54 .endif
55
56 #
57 # Link with static libcompiler_rt.a.
58 #
59 LDFLAGS+= -nodefaultlibs
60 LIBADD+=        compiler_rt
61
62 .if ${MK_SSP} != "no"
63 LIBADD+=        ssp_nonshared
64 .endif
65
66 # Extras that live in either libc.a or libc_nonshared.a
67 LIBC_NONSHARED_SRCS=
68
69 # Define (empty) variables so that make doesn't give substitution
70 # errors if the included makefiles don't change these:
71 MDSRCS=
72 MISRCS=
73 MDASM=
74 MIASM=
75 NOASM=
76
77 .include "${LIBC_SRCTOP}/${LIBC_ARCH}/Makefile.inc"
78 .include "${LIBC_SRCTOP}/db/Makefile.inc"
79 .include "${LIBC_SRCTOP}/compat-43/Makefile.inc"
80 .include "${LIBC_SRCTOP}/gdtoa/Makefile.inc"
81 .include "${LIBC_SRCTOP}/gen/Makefile.inc"
82 .include "${LIBC_SRCTOP}/gmon/Makefile.inc"
83 .if ${MK_ICONV} != "no"
84 .include "${LIBC_SRCTOP}/iconv/Makefile.inc"
85 .endif
86 .include "${LIBC_SRCTOP}/inet/Makefile.inc"
87 .include "${LIBC_SRCTOP}/isc/Makefile.inc"
88 .include "${LIBC_SRCTOP}/locale/Makefile.inc"
89 .include "${LIBC_SRCTOP}/md/Makefile.inc"
90 .include "${LIBC_SRCTOP}/nameser/Makefile.inc"
91 .include "${LIBC_SRCTOP}/net/Makefile.inc"
92 .include "${LIBC_SRCTOP}/nls/Makefile.inc"
93 .include "${LIBC_SRCTOP}/posix1e/Makefile.inc"
94 .if ${LIBC_ARCH} != "aarch64" && \
95     ${LIBC_ARCH} != "amd64" && \
96     ${LIBC_ARCH} != "powerpc64" && \
97     ${LIBC_ARCH} != "riscv" && \
98     ${LIBC_ARCH} != "sparc64" && \
99     ${MACHINE_ARCH:Mmipsn32*} == "" && \
100     ${MACHINE_ARCH:Mmips64*} == ""
101 .include "${LIBC_SRCTOP}/quad/Makefile.inc"
102 .endif
103 .include "${LIBC_SRCTOP}/regex/Makefile.inc"
104 .include "${LIBC_SRCTOP}/resolv/Makefile.inc"
105 .include "${LIBC_SRCTOP}/stdio/Makefile.inc"
106 .include "${LIBC_SRCTOP}/stdlib/Makefile.inc"
107 .include "${LIBC_SRCTOP}/stdlib/jemalloc/Makefile.inc"
108 .include "${LIBC_SRCTOP}/stdtime/Makefile.inc"
109 .include "${LIBC_SRCTOP}/string/Makefile.inc"
110 .include "${LIBC_SRCTOP}/sys/Makefile.inc"
111 .include "${LIBC_SRCTOP}/secure/Makefile.inc"
112 .include "${LIBC_SRCTOP}/rpc/Makefile.inc"
113 .include "${LIBC_SRCTOP}/uuid/Makefile.inc"
114 .include "${LIBC_SRCTOP}/xdr/Makefile.inc"
115 .if (${LIBC_ARCH} == "arm" && \
116         (${MACHINE_ARCH:Marmv[67]*} == "" || (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))) || \
117     (${LIBC_ARCH} == "mips" && ${MACHINE_ARCH:Mmips*hf} == "") || \
118     (${LIBC_ARCH} == "riscv" && ${MACHINE_ARCH:Mriscv*sf} != "")
119 .include "${LIBC_SRCTOP}/softfloat/Makefile.inc"
120 .endif
121 .if ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "amd64"
122 .include "${LIBC_SRCTOP}/x86/sys/Makefile.inc"
123 .include "${LIBC_SRCTOP}/x86/gen/Makefile.inc"
124 .endif
125 .if ${MK_NIS} != "no"
126 CFLAGS+= -DYP
127 .include "${LIBC_SRCTOP}/yp/Makefile.inc"
128 .endif
129 .include "${LIBC_SRCTOP}/capability/Makefile.inc"
130 .if ${MK_HESIOD} != "no"
131 CFLAGS+= -DHESIOD
132 .endif
133 .if ${MK_FP_LIBC} == "no"
134 CFLAGS+= -DNO_FLOATING_POINT
135 .endif
136 .if ${MK_NS_CACHING} != "no"
137 CFLAGS+= -DNS_CACHING
138 .endif
139 .if defined(_FREEFALL_CONFIG)
140 CFLAGS+=-D_FREEFALL_CONFIG
141 .endif
142
143 STATICOBJS+=${LIBC_NONSHARED_SRCS:S/.c$/.o/}
144
145 VERSION_DEF=${LIBC_SRCTOP}/Versions.def
146 SYMBOL_MAPS=${SYM_MAPS}
147 CFLAGS+= -DSYMBOL_VERSIONING
148
149 # If there are no machine dependent sources, append all the
150 # machine-independent sources:
151 .if empty(MDSRCS)
152 SRCS+=  ${MISRCS}
153 .else
154 # Append machine-dependent sources, then append machine-independent sources
155 # for which there is no machine-dependent variant.
156 SRCS+=  ${MDSRCS}
157 .for _src in ${MISRCS}
158 .if ${MDSRCS:R:M${_src:R}} == ""
159 SRCS+=  ${_src}
160 .endif
161 .endfor
162 .endif
163
164 KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
165         lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
166         subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
167 KSRCS=  bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \
168         strcmp.c strcpy.c strlen.c strncpy.c strrchr.c
169
170 libkern: libkern.gen libkern.${LIBC_ARCH}
171
172 libkern.gen: ${KQSRCS} ${KSRCS}
173         ${CP} ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
174
175 libkern.${LIBC_ARCH}:: ${KMSRCS}
176 .if defined(KMSRCS) && !empty(KMSRCS)
177         ${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
178 .endif
179
180 HAS_TESTS=
181 SUBDIR.${MK_TESTS}+= tests
182
183 .include <bsd.lib.mk>
184
185 .if (${LIBC_ARCH} == amd64 || ${LIBC_ARCH} == i386) && \
186     ${.TARGETS:Mall} == all && \
187     defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
188 .error ${LIBC_ARCH} libc requires linker ifunc support
189 .endif
190
191 .if !defined(_SKIP_BUILD)
192 # We need libutil.h, get it directly to avoid
193 # recording a build dependency
194 CFLAGS+= -I${SRCTOP}/lib/libutil
195 # Same issue with libm
196 MSUN_ARCH_SUBDIR != ${MAKE} -B -C ${SRCTOP}/lib/msun -V ARCH_SUBDIR
197 # unfortunately msun/src contains both private and public headers
198 CFLAGS+= -I${SRCTOP}/lib/msun/${MSUN_ARCH_SUBDIR}
199 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
200 CFLAGS+= -I${SRCTOP}/lib/msun/x86
201 .endif
202 CFLAGS+= -I${SRCTOP}/lib/msun/src
203 # and we do not want to record a dependency on msun
204 .if ${.MAKE.LEVEL} > 0
205 GENDIRDEPS_FILTER+= N${RELDIR:H}/msun
206 .endif
207 .endif
208
209 # Disable warnings in contributed sources.
210 CWARNFLAGS:=    ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
211 # Disable stack protection for SSP symbols.
212 SSP_CFLAGS:=    ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
213 # Generate stack unwinding tables for cancellation points
214 CANCELPOINTS_CFLAGS:=   ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//}