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