Makefile revision 217942
1#	@(#)Makefile	8.2 (Berkeley) 2/3/94
2# $FreeBSD: head/lib/libc/Makefile 217942 2011-01-27 14:16:12Z jchandra $
3
4SHLIBDIR?= /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})
13LIBC_ARCH=${MACHINE_ARCH}
14.else
15LIBC_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.
24LIB=c
25SHLIB_MAJOR= 7
26WARNS?=	2
27CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include
28CFLAGS+=-I${.CURDIR}/${LIBC_ARCH}
29CFLAGS+=-DNLS
30CLEANFILES+=tags
31INSTALL_PIC_ARCHIVE=
32PRECIOUSLIB=
33
34.ifndef NO_THREAD_STACK_UNWIND
35CANCELPOINTS_CFLAGS=-fexceptions
36CFLAGS+=${CANCELPOINTS_CFLAGS}
37.endif
38
39#
40# Only link with static libgcc.a (no libgcc_eh.a).
41#
42DPADD+=	${LIBGCC}
43LDFLAGS+= -nodefaultlibs
44LDADD+= -lgcc -lssp_nonshared
45
46# Define (empty) variables so that make doesn't give substitution
47# errors if the included makefiles don't change these:
48MDSRCS=
49MISRCS=
50MDASM=
51MIASM=
52NOASM=
53
54.include "${.CURDIR}/${LIBC_ARCH}/Makefile.inc"
55.include "${.CURDIR}/db/Makefile.inc"
56.include "${.CURDIR}/compat-43/Makefile.inc"
57.include "${.CURDIR}/gdtoa/Makefile.inc"
58.include "${.CURDIR}/gen/Makefile.inc"
59.include "${.CURDIR}/gmon/Makefile.inc"
60.include "${.CURDIR}/inet/Makefile.inc"
61.include "${.CURDIR}/isc/Makefile.inc"
62.include "${.CURDIR}/locale/Makefile.inc"
63.include "${.CURDIR}/nameser/Makefile.inc"
64.include "${.CURDIR}/net/Makefile.inc"
65.include "${.CURDIR}/nls/Makefile.inc"
66.include "${.CURDIR}/posix1e/Makefile.inc"
67.if ${LIBC_ARCH} != "amd64" && \
68    ${LIBC_ARCH} != "ia64" && \
69    ${LIBC_ARCH} != "powerpc64" && \
70    ${LIBC_ARCH} != "sparc64" && \
71    ${MACHINE_ARCH:Mmipsn32*} == "" && \
72    ${MACHINE_ARCH:Mmips64*} == ""
73.include "${.CURDIR}/quad/Makefile.inc"
74.endif
75.include "${.CURDIR}/regex/Makefile.inc"
76.include "${.CURDIR}/resolv/Makefile.inc"
77.include "${.CURDIR}/stdio/Makefile.inc"
78.include "${.CURDIR}/stdlib/Makefile.inc"
79.include "${.CURDIR}/stdtime/Makefile.inc"
80.include "${.CURDIR}/string/Makefile.inc"
81.include "${.CURDIR}/sys/Makefile.inc"
82.include "${.CURDIR}/rpc/Makefile.inc"
83.include "${.CURDIR}/uuid/Makefile.inc"
84.include "${.CURDIR}/xdr/Makefile.inc"
85.if ${LIBC_ARCH} == "arm" || ${LIBC_ARCH} == "mips"
86.include "${.CURDIR}/softfloat/Makefile.inc"
87.endif
88.if ${MK_NIS} != "no"
89CFLAGS+= -DYP
90.include "${.CURDIR}/yp/Makefile.inc"
91.endif
92.if ${MK_HESIOD} != "no"
93CFLAGS+= -DHESIOD
94.endif
95.if ${MK_FP_LIBC} == "no"
96CFLAGS+= -DNO_FLOATING_POINT
97.endif
98.if ${MK_NS_CACHING} != "no"
99CFLAGS+= -DNS_CACHING
100.endif
101.if defined(_FREEFALL_CONFIG)
102CFLAGS+=-D_FREEFALL_CONFIG
103.endif
104
105VERSION_DEF=${.CURDIR}/Versions.def
106SYMBOL_MAPS=${SYM_MAPS}
107CFLAGS+= -DSYMBOL_VERSIONING
108
109# If there are no machine dependent sources, append all the
110# machine-independent sources:
111.if empty(MDSRCS)
112SRCS+=	${MISRCS}
113.else
114# Append machine-dependent sources, then append machine-independent sources
115# for which there is no machine-dependent variant.
116SRCS+=	${MDSRCS}
117.for _src in ${MISRCS}
118.if ${MDSRCS:R:M${_src:R}} == ""
119SRCS+=	${_src}
120.endif
121.endfor
122.endif
123
124KQSRCS=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
125	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
126	subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
127KSRCS=	bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \
128	strcat.c strcmp.c strcpy.c strlen.c strncpy.c
129
130libkern: libkern.gen libkern.${LIBC_ARCH}
131
132libkern.gen: ${KQSRCS} ${KSRCS}
133	cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
134
135libkern.${LIBC_ARCH}:: ${KMSRCS}
136.if defined(KMSRCS) && !empty(KMSRCS)
137	cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
138.endif
139
140.include <bsd.lib.mk>
141
142# Disable warnings in contributed sources.
143CWARNFLAGS:=	${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
144# XXX For now, we don't allow libc to be compiled with
145# -fstack-protector-all because it breaks rtld.  We may want to make a librtld
146# in the future to circumvent this.
147SSP_CFLAGS:=	${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/}
148# Disable stack protection for SSP symbols.
149SSP_CFLAGS:=	${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
150# Generate stack unwinding tables for cancellation points
151CANCELPOINTS_CFLAGS:=	${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//}
152