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