]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/Makefile
Make armv6 hard float abi by default. Kill armv6hf.
[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 sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS
29 # to CFLAGS below.  -DSYSLIBC_SCCS affects just the system call stubs.
30 LIB=c
31 SHLIB_MAJOR= 7
32 SHLIB_LDSCRIPT=libc.ldscript
33 SHLIB_LDSCRIPT_LINKS=libxnet.so
34 WARNS?= 2
35 CFLAGS+=-I${LIBC_SRCTOP}/include -I${LIBC_SRCTOP}/../../include
36 CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
37 .if ${MK_NLS} != "no"
38 CFLAGS+=-DNLS
39 .endif
40 CLEANFILES+=tags
41 INSTALL_PIC_ARCHIVE=
42 PRECIOUSLIB=
43
44 .ifndef NO_THREAD_STACK_UNWIND
45 CANCELPOINTS_CFLAGS=-fexceptions
46 CFLAGS+=${CANCELPOINTS_CFLAGS}
47 .endif
48
49 #
50 # Link with static libcompiler_rt.a.
51 #
52 LDFLAGS+= -nodefaultlibs
53 LIBADD+=        compiler_rt
54
55 .if ${MK_SSP} != "no"
56 LIBADD+=        ssp_nonshared
57 .endif
58
59 # Extras that live in either libc.a or libc_nonshared.a
60 LIBC_NONSHARED_SRCS=
61
62 # Define (empty) variables so that make doesn't give substitution
63 # errors if the included makefiles don't change these:
64 MDSRCS=
65 MISRCS=
66 MDASM=
67 MIASM=
68 NOASM=
69
70 .include "${LIBC_SRCTOP}/${LIBC_ARCH}/Makefile.inc"
71 .include "${LIBC_SRCTOP}/db/Makefile.inc"
72 .include "${LIBC_SRCTOP}/compat-43/Makefile.inc"
73 .include "${LIBC_SRCTOP}/gdtoa/Makefile.inc"
74 .include "${LIBC_SRCTOP}/gen/Makefile.inc"
75 .include "${LIBC_SRCTOP}/gmon/Makefile.inc"
76 .if ${MK_ICONV} != "no"
77 .include "${LIBC_SRCTOP}/iconv/Makefile.inc"
78 .endif
79 .include "${LIBC_SRCTOP}/inet/Makefile.inc"
80 .include "${LIBC_SRCTOP}/isc/Makefile.inc"
81 .include "${LIBC_SRCTOP}/locale/Makefile.inc"
82 .include "${LIBC_SRCTOP}/md/Makefile.inc"
83 .include "${LIBC_SRCTOP}/nameser/Makefile.inc"
84 .include "${LIBC_SRCTOP}/net/Makefile.inc"
85 .include "${LIBC_SRCTOP}/nls/Makefile.inc"
86 .include "${LIBC_SRCTOP}/posix1e/Makefile.inc"
87 .if ${LIBC_ARCH} != "aarch64" && \
88     ${LIBC_ARCH} != "amd64" && \
89     ${LIBC_ARCH} != "powerpc64" && \
90     ${LIBC_ARCH} != "riscv" && \
91     ${LIBC_ARCH} != "sparc64" && \
92     ${MACHINE_ARCH:Mmipsn32*} == "" && \
93     ${MACHINE_ARCH:Mmips64*} == ""
94 .include "${LIBC_SRCTOP}/quad/Makefile.inc"
95 .endif
96 .include "${LIBC_SRCTOP}/regex/Makefile.inc"
97 .include "${LIBC_SRCTOP}/resolv/Makefile.inc"
98 .include "${LIBC_SRCTOP}/stdio/Makefile.inc"
99 .include "${LIBC_SRCTOP}/stdlib/Makefile.inc"
100 .include "${LIBC_SRCTOP}/stdlib/jemalloc/Makefile.inc"
101 .include "${LIBC_SRCTOP}/stdtime/Makefile.inc"
102 .include "${LIBC_SRCTOP}/string/Makefile.inc"
103 .include "${LIBC_SRCTOP}/sys/Makefile.inc"
104 .include "${LIBC_SRCTOP}/secure/Makefile.inc"
105 .include "${LIBC_SRCTOP}/rpc/Makefile.inc"
106 .include "${LIBC_SRCTOP}/uuid/Makefile.inc"
107 .include "${LIBC_SRCTOP}/xdr/Makefile.inc"
108 .if (${LIBC_ARCH} == "arm" && \
109         (${MACHINE_ARCH:Marmv6*} == "" || (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))) || \
110      ${LIBC_ARCH} == "mips"
111 .include "${LIBC_SRCTOP}/softfloat/Makefile.inc"
112 .endif
113 .if ${MK_NIS} != "no"
114 CFLAGS+= -DYP
115 .include "${LIBC_SRCTOP}/yp/Makefile.inc"
116 .endif
117 .include "${LIBC_SRCTOP}/capability/Makefile.inc"
118 .if ${MK_HESIOD} != "no"
119 CFLAGS+= -DHESIOD
120 .endif
121 .if ${MK_FP_LIBC} == "no"
122 CFLAGS+= -DNO_FLOATING_POINT
123 .endif
124 .if ${MK_NS_CACHING} != "no"
125 CFLAGS+= -DNS_CACHING
126 .endif
127 .if defined(_FREEFALL_CONFIG)
128 CFLAGS+=-D_FREEFALL_CONFIG
129 .endif
130
131 STATICOBJS+=${LIBC_NONSHARED_SRCS:S/.c$/.o/}
132
133 VERSION_DEF=${LIBC_SRCTOP}/Versions.def
134 SYMBOL_MAPS=${SYM_MAPS}
135 CFLAGS+= -DSYMBOL_VERSIONING
136
137 # If there are no machine dependent sources, append all the
138 # machine-independent sources:
139 .if empty(MDSRCS)
140 SRCS+=  ${MISRCS}
141 .else
142 # Append machine-dependent sources, then append machine-independent sources
143 # for which there is no machine-dependent variant.
144 SRCS+=  ${MDSRCS}
145 .for _src in ${MISRCS}
146 .if ${MDSRCS:R:M${_src:R}} == ""
147 SRCS+=  ${_src}
148 .endif
149 .endfor
150 .endif
151
152 KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
153         lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
154         subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
155 KSRCS=  bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \
156         strcmp.c strcpy.c strlen.c strncpy.c strrchr.c
157
158 libkern: libkern.gen libkern.${LIBC_ARCH}
159
160 libkern.gen: ${KQSRCS} ${KSRCS}
161         ${CP} ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
162
163 libkern.${LIBC_ARCH}:: ${KMSRCS}
164 .if defined(KMSRCS) && !empty(KMSRCS)
165         ${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
166 .endif
167
168 .if ${MK_TESTS} != "no"
169 SUBDIR+=        tests
170 .endif
171
172 .include <bsd.lib.mk>
173
174 .if !defined(_SKIP_BUILD)
175 # We need libutil.h, get it directly to avoid
176 # recording a build dependency
177 CFLAGS+= -I${SRCTOP}/lib/libutil
178 # Same issue with libm
179 MSUN_ARCH_SUBDIR != ${MAKE} -B -C ${SRCTOP}/lib/msun -V ARCH_SUBDIR
180 # unfortunately msun/src contains both private and public headers
181 CFLAGS+= -I${SRCTOP}/lib/msun/${MSUN_ARCH_SUBDIR}
182 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
183 CFLAGS+= -I${SRCTOP}/lib/msun/x86
184 .endif
185 CFLAGS+= -I${SRCTOP}/lib/msun/src
186 # and we do not want to record a dependency on msun
187 .if ${.MAKE.LEVEL} > 0
188 GENDIRDEPS_FILTER+= N${RELDIR:H}/msun
189 .endif
190 .endif
191
192 # Disable warnings in contributed sources.
193 CWARNFLAGS:=    ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
194 # XXX For now, we don't allow libc to be compiled with
195 # -fstack-protector-all because it breaks rtld.  We may want to make a librtld
196 # in the future to circumvent this.
197 SSP_CFLAGS:=    ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/}
198 # Disable stack protection for SSP symbols.
199 SSP_CFLAGS:=    ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
200 # Generate stack unwinding tables for cancellation points
201 CANCELPOINTS_CFLAGS:=   ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//}