]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/Makefile
Update mandoc to cvs snaphot from 20150302
[FreeBSD/FreeBSD.git] / lib / libc / Makefile
1 #       @(#)Makefile    8.2 (Berkeley) 2/3/94
2 # $FreeBSD$
3
4 SHLIBDIR?= /lib
5
6 .include <src.opts.mk>
7
8 LIBC_SRCTOP?= ${.CURDIR}
9
10 # Pick the current architecture directory for libc. In general, this is
11 # named MACHINE_CPUARCH, but some ABIs are different enough to require
12 # their own libc, so allow a directory named MACHINE_ARCH to override this.
13
14 .if exists(${LIBC_SRCTOP}/${MACHINE_ARCH})
15 LIBC_ARCH=${MACHINE_ARCH}
16 .else
17 LIBC_ARCH=${MACHINE_CPUARCH}
18 .endif
19
20 # All library objects contain FreeBSD revision strings by default; they may be
21 # excluded as a space-saving measure.  To produce a library that does
22 # not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
23 # below.  Note: there are no IDs for syscall stubs whose sources are generated.
24 # To include legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS
25 # to CFLAGS below.  -DSYSLIBC_SCCS affects just the system call stubs.
26 LIB=c
27 SHLIB_MAJOR= 7
28 SHLIB_LDSCRIPT=libc.ldscript
29 WARNS?= 2
30 CFLAGS+=-I${LIBC_SRCTOP}/include -I${LIBC_SRCTOP}/../../include
31 CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
32 .if ${MK_NLS} != "no"
33 CFLAGS+=-DNLS
34 .endif
35 CLEANFILES+=tags
36 INSTALL_PIC_ARCHIVE=
37 PRECIOUSLIB=
38
39 .ifndef NO_THREAD_STACK_UNWIND
40 CANCELPOINTS_CFLAGS=-fexceptions
41 CFLAGS+=${CANCELPOINTS_CFLAGS}
42 .endif
43
44 #
45 # Link with static libcompiler_rt.a.
46 #
47 LDFLAGS+= -nodefaultlibs
48 LIBADD+=        compiler_rt
49
50 .if ${MK_SSP} != "no"
51 LIBADD+=        ssp_nonshared
52 .endif
53
54 # Extras that live in either libc.a or libc_nonshared.a
55 LIBC_NONSHARED_SRCS=
56
57 # Define (empty) variables so that make doesn't give substitution
58 # errors if the included makefiles don't change these:
59 MDSRCS=
60 MISRCS=
61 MDASM=
62 MIASM=
63 NOASM=
64
65 .include "${LIBC_SRCTOP}/${LIBC_ARCH}/Makefile.inc"
66 .include "${LIBC_SRCTOP}/db/Makefile.inc"
67 .include "${LIBC_SRCTOP}/compat-43/Makefile.inc"
68 .include "${LIBC_SRCTOP}/gdtoa/Makefile.inc"
69 .include "${LIBC_SRCTOP}/gen/Makefile.inc"
70 .include "${LIBC_SRCTOP}/gmon/Makefile.inc"
71 .if ${MK_ICONV} != "no"
72 .include "${LIBC_SRCTOP}/iconv/Makefile.inc"
73 .endif
74 .include "${LIBC_SRCTOP}/inet/Makefile.inc"
75 .include "${LIBC_SRCTOP}/isc/Makefile.inc"
76 .include "${LIBC_SRCTOP}/locale/Makefile.inc"
77 .include "${LIBC_SRCTOP}/md/Makefile.inc"
78 .include "${LIBC_SRCTOP}/nameser/Makefile.inc"
79 .include "${LIBC_SRCTOP}/net/Makefile.inc"
80 .include "${LIBC_SRCTOP}/nls/Makefile.inc"
81 .include "${LIBC_SRCTOP}/posix1e/Makefile.inc"
82 .if ${LIBC_ARCH} != "amd64" && \
83     ${LIBC_ARCH} != "powerpc64" && \
84     ${LIBC_ARCH} != "sparc64" && \
85     ${MACHINE_ARCH:Mmipsn32*} == "" && \
86     ${MACHINE_ARCH:Mmips64*} == ""
87 .include "${LIBC_SRCTOP}/quad/Makefile.inc"
88 .endif
89 .include "${LIBC_SRCTOP}/regex/Makefile.inc"
90 .include "${LIBC_SRCTOP}/resolv/Makefile.inc"
91 .include "${LIBC_SRCTOP}/stdio/Makefile.inc"
92 .include "${LIBC_SRCTOP}/stdlib/Makefile.inc"
93 .include "${LIBC_SRCTOP}/stdlib/jemalloc/Makefile.inc"
94 .include "${LIBC_SRCTOP}/stdtime/Makefile.inc"
95 .include "${LIBC_SRCTOP}/string/Makefile.inc"
96 .include "${LIBC_SRCTOP}/sys/Makefile.inc"
97 .include "${LIBC_SRCTOP}/rpc/Makefile.inc"
98 .include "${LIBC_SRCTOP}/uuid/Makefile.inc"
99 .include "${LIBC_SRCTOP}/xdr/Makefile.inc"
100 .if (${LIBC_ARCH} == "arm" && ${MACHINE_ARCH} != "armv6hf") ||\
101      ${LIBC_ARCH} == "mips"
102 .include "${LIBC_SRCTOP}/softfloat/Makefile.inc"
103 .endif
104 .if ${MK_NIS} != "no"
105 CFLAGS+= -DYP
106 .include "${LIBC_SRCTOP}/yp/Makefile.inc"
107 .endif
108 .include "${LIBC_SRCTOP}/capability/Makefile.inc"
109 .if ${MK_HESIOD} != "no"
110 CFLAGS+= -DHESIOD
111 .endif
112 .if ${MK_FP_LIBC} == "no"
113 CFLAGS+= -DNO_FLOATING_POINT
114 .endif
115 .if ${MK_NS_CACHING} != "no"
116 CFLAGS+= -DNS_CACHING
117 .endif
118 .if defined(_FREEFALL_CONFIG)
119 CFLAGS+=-D_FREEFALL_CONFIG
120 .endif
121
122 STATICOBJS+=${LIBC_NONSHARED_SRCS:S/.c$/.o/}
123
124 VERSION_DEF=${LIBC_SRCTOP}/Versions.def
125 SYMBOL_MAPS=${SYM_MAPS}
126 CFLAGS+= -DSYMBOL_VERSIONING
127
128 # If there are no machine dependent sources, append all the
129 # machine-independent sources:
130 .if empty(MDSRCS)
131 SRCS+=  ${MISRCS}
132 .else
133 # Append machine-dependent sources, then append machine-independent sources
134 # for which there is no machine-dependent variant.
135 SRCS+=  ${MDSRCS}
136 .for _src in ${MISRCS}
137 .if ${MDSRCS:R:M${_src:R}} == ""
138 SRCS+=  ${_src}
139 .endif
140 .endfor
141 .endif
142
143 KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
144         lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
145         subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
146 KSRCS=  bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \
147         strcmp.c strcpy.c strlen.c strncpy.c strrchr.c
148
149 libkern: libkern.gen libkern.${LIBC_ARCH}
150
151 libkern.gen: ${KQSRCS} ${KSRCS}
152         ${CP} ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
153
154 libkern.${LIBC_ARCH}:: ${KMSRCS}
155 .if defined(KMSRCS) && !empty(KMSRCS)
156         ${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
157 .endif
158
159 .if ${MK_SYSCALL_COMPAT} != "no"
160 CFLAGS+=-DSYSCALL_COMPAT
161 .endif
162
163 .include <bsd.arch.inc.mk>
164
165 .include <bsd.lib.mk>
166
167 # Disable warnings in contributed sources.
168 CWARNFLAGS:=    ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
169 # XXX For now, we don't allow libc to be compiled with
170 # -fstack-protector-all because it breaks rtld.  We may want to make a librtld
171 # in the future to circumvent this.
172 SSP_CFLAGS:=    ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/}
173 # Disable stack protection for SSP symbols.
174 SSP_CFLAGS:=    ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
175 # Generate stack unwinding tables for cancellation points
176 CANCELPOINTS_CFLAGS:=   ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//}