Makefile revision 211725
1171195Sscf#	@(#)Makefile	8.2 (Berkeley) 2/3/94
2171195Sscf# $FreeBSD: head/lib/libc/Makefile 211725 2010-08-23 22:24:11Z imp $
3171195Sscf
4171195SscfSHLIBDIR?= /lib
5171195Sscf
6171195Sscf.include <bsd.own.mk>
7171195Sscf
8171195Sscf# All library objects contain FreeBSD revision strings by default; they may be
9171195Sscf# excluded as a space-saving measure.  To produce a library that does
10171195Sscf# not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
11171195Sscf# below.  Note: there are no IDs for syscall stubs whose sources are generated.
12171195Sscf# To include legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS
13171195Sscf# to CFLAGS below.  -DSYSLIBC_SCCS affects just the system call stubs.
14171195SscfLIB=c
15171195SscfSHLIB_MAJOR= 7
16171195SscfWARNS?=	2
17171195SscfCFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include
18171195SscfCFLAGS+=-I${.CURDIR}/${MACHINE_CPUARCH}
19171195SscfCFLAGS+=-DNLS
20171195SscfCLEANFILES+=tags
21171195SscfINSTALL_PIC_ARCHIVE=
22171195SscfPRECIOUSLIB=
23171195Sscf
24171195Sscf#
25171195Sscf# Only link with static libgcc.a (no libgcc_eh.a).
26171525Sscf#
27171195SscfDPADD+=	${LIBGCC}
28171525SscfLDFLAGS+= -nodefaultlibs
29171195SscfLDADD+= -lgcc -lssp_nonshared
30171195Sscf
31171195Sscf# Define (empty) variables so that make doesn't give substitution
32171195Sscf# errors if the included makefiles don't change these:
33171195SscfMDSRCS=
34171195SscfMISRCS=
35171195SscfMDASM=
36171195SscfMIASM=
37171195SscfNOASM=
38171195Sscf
39171195Sscf.include "${.CURDIR}/${MACHINE_CPUARCH}/Makefile.inc"
40171195Sscf.include "${.CURDIR}/db/Makefile.inc"
41171195Sscf.include "${.CURDIR}/compat-43/Makefile.inc"
42171195Sscf.include "${.CURDIR}/gdtoa/Makefile.inc"
43171195Sscf.include "${.CURDIR}/gen/Makefile.inc"
44171195Sscf.include "${.CURDIR}/gmon/Makefile.inc"
45171195Sscf.include "${.CURDIR}/inet/Makefile.inc"
46171195Sscf.include "${.CURDIR}/isc/Makefile.inc"
47171195Sscf.include "${.CURDIR}/locale/Makefile.inc"
48171195Sscf.include "${.CURDIR}/nameser/Makefile.inc"
49171195Sscf.include "${.CURDIR}/net/Makefile.inc"
50171195Sscf.include "${.CURDIR}/nls/Makefile.inc"
51171195Sscf.include "${.CURDIR}/posix1e/Makefile.inc"
52171195Sscf.if ${MACHINE_CPUARCH} != "amd64" && \
53171195Sscf    ${MACHINE_CPUARCH} != "ia64" && \
54171195Sscf    ${MACHINE_ARCH} != "powerpc64" && \
55171195Sscf    ${MACHINE_CPUARCH} != "sparc64" && \
56171195Sscf    ${MACHINE_CPUARCH} != "mips"
57171195Sscf.include "${.CURDIR}/quad/Makefile.inc"
58171195Sscf.endif
59171195Sscf.if ${MACHINE_ARCH} == "mips" && \
60171195Sscf    (!defined(TARGET_ABI) || ${TARGET_ABI} == "o32")
61171195Sscf.include "${.CURDIR}/quad/Makefile.inc"
62171195Sscf.endif
63171195Sscf.include "${.CURDIR}/regex/Makefile.inc"
64171195Sscf.include "${.CURDIR}/resolv/Makefile.inc"
65171195Sscf.include "${.CURDIR}/stdio/Makefile.inc"
66171195Sscf.include "${.CURDIR}/stdlib/Makefile.inc"
67171195Sscf.include "${.CURDIR}/stdtime/Makefile.inc"
68171195Sscf.include "${.CURDIR}/string/Makefile.inc"
69171525Sscf.include "${.CURDIR}/sys/Makefile.inc"
70171525Sscf.include "${.CURDIR}/rpc/Makefile.inc"
71171195Sscf.include "${.CURDIR}/uuid/Makefile.inc"
72171195Sscf.include "${.CURDIR}/xdr/Makefile.inc"
73171195Sscf.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
74171195Sscf.include "${.CURDIR}/softfloat/Makefile.inc"
75171525Sscf.endif
76171195Sscf.if ${MK_NIS} != "no"
77171195SscfCFLAGS+= -DYP
78171195Sscf.include "${.CURDIR}/yp/Makefile.inc"
79171195Sscf.endif
80171195Sscf.if ${MK_HESIOD} != "no"
81171195SscfCFLAGS+= -DHESIOD
82171525Sscf.endif
83171195Sscf.if ${MK_FP_LIBC} == "no"
84171525SscfCFLAGS+= -DNO_FLOATING_POINT
85171195Sscf.endif
86171195Sscf.if ${MK_NS_CACHING} != "no"
87171195SscfCFLAGS+= -DNS_CACHING
88171195Sscf.endif
89171195Sscf.if defined(_FREEFALL_CONFIG)
90171525SscfCFLAGS+=-D_FREEFALL_CONFIG
91171195Sscf.endif
92171195Sscf
93171195SscfVERSION_DEF=${.CURDIR}/Versions.def
94171195SscfSYMBOL_MAPS=${SYM_MAPS}
95171195SscfCFLAGS+= -DSYMBOL_VERSIONING
96171195Sscf
97171525Sscf# If there are no machine dependent sources, append all the
98171195Sscf# machine-independent sources:
99171525Sscf.if empty(MDSRCS)
100171525SscfSRCS+=	${MISRCS}
101171195Sscf.else
102171195Sscf# Append machine-dependent sources, then append machine-independent sources
103171195Sscf# for which there is no machine-dependent variant.
104171195SscfSRCS+=	${MDSRCS}
105171195Sscf.for _src in ${MISRCS}
106171525Sscf.if ${MDSRCS:R:M${_src:R}} == ""
107171195SscfSRCS+=	${_src}
108171195Sscf.endif
109171195Sscf.endfor
110171195Sscf.endif
111171195Sscf
112171195SscfKQSRCS=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
113171195Sscf	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
114171525Sscf	subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
115171195SscfKSRCS=	bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \
116171525Sscf	strcat.c strcmp.c strcpy.c strlen.c strncpy.c
117171195Sscf
118171195Sscflibkern: libkern.gen libkern.${MACHINE_CPUARCH}
119171195Sscf
120171195Sscflibkern.gen: ${KQSRCS} ${KSRCS}
121171195Sscf	cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
122171525Sscf
123171195Sscflibkern.${MACHINE_CPUARCH}:: ${KMSRCS}
124171195Sscf.if defined(KMSRCS) && !empty(KMSRCS)
125171195Sscf	cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${MACHINE_CPUARCH}
126171195Sscf.endif
127171195Sscf
128171195Sscf.include <bsd.lib.mk>
129171195Sscf
130171525Sscf# Disable warnings in contributed sources.
131171195SscfCWARNFLAGS:=	${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
132171525Sscf# XXX For now, we don't allow libc to be compiled with
133171195Sscf# -fstack-protector-all because it breaks rtld.  We may want to make a librtld
134171195Sscf# in the future to circumvent this.
135171195SscfSSP_CFLAGS:=	${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/}
136171195Sscf# Disable stack protection for SSP symbols.
137171195SscfSSP_CFLAGS:=	${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
138171525Sscf