Makefile revision 251668
189857Sobrien# @(#)Makefile 8.2 (Berkeley) 2/3/94 2130561Sobrien# $FreeBSD: head/lib/libc/Makefile 251668 2013-06-12 21:12:05Z jlh $ 3130561Sobrien 489857SobrienSHLIBDIR?= /lib 589857Sobrien 633965Sjdp.include <bsd.own.mk> 733965Sjdp 8130561Sobrien# Pick the current architecture directory for libc. In general, this is 9130561Sobrien# named MACHINE_CPUARCH, but some ABIs are different enough to require 10218822Sdim# their own libc, so allow a directory named MACHINE_ARCH to override this. 11218822Sdim 12130561Sobrien.if exists(${.CURDIR}/${MACHINE_ARCH}) 1333965SjdpLIBC_ARCH=${MACHINE_ARCH} 1433965Sjdp.else 1533965SjdpLIBC_ARCH=${MACHINE_CPUARCH} 1633965Sjdp.endif 1733965Sjdp 1833965Sjdp# All library objects contain FreeBSD revision strings by default; they may be 1933965Sjdp# excluded as a space-saving measure. To produce a library that does 2033965Sjdp# not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS 2133965Sjdp# below. Note: there are no IDs for syscall stubs whose sources are generated. 2233965Sjdp# To include legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS 2333965Sjdp# to CFLAGS below. -DSYSLIBC_SCCS affects just the system call stubs. 2433965SjdpLIB=c 2533965SjdpSHLIB_MAJOR= 7 2633965SjdpSHLIB_LDSCRIPT=libc.ldscript 2733965SjdpWARNS?= 2 2833965SjdpCFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include 29218822SdimCFLAGS+=-I${.CURDIR}/${LIBC_ARCH} 3033965Sjdp.if ${MK_NLS} != "no" 31218822SdimCFLAGS+=-DNLS 32218822Sdim.endif 3333965SjdpCLEANFILES+=tags 3438889SjdpINSTALL_PIC_ARCHIVE= 3538889SjdpPRECIOUSLIB= 3638889Sjdp 3789857Sobrien.ifndef NO_THREAD_STACK_UNWIND 3889857SobrienCANCELPOINTS_CFLAGS=-fexceptions 3989857SobrienCFLAGS+=${CANCELPOINTS_CFLAGS} 4038889Sjdp.endif 4133965Sjdp 4233965Sjdp# 4333965Sjdp# Only link with static libgcc.a (no libgcc_eh.a). 4433965Sjdp# 4533965SjdpDPADD+= ${LIBGCC} 4633965SjdpLDFLAGS+= -nodefaultlibs 4733965SjdpLDADD+= -lgcc 48130561Sobrien 4933965Sjdp.if ${MK_SSP} != "no" 5033965SjdpLDADD+= -lssp_nonshared 5133965Sjdp.endif 5233965Sjdp 5333965Sjdp# Define (empty) variables so that make doesn't give substitution 5433965Sjdp# errors if the included makefiles don't change these: 5533965SjdpMDSRCS= 5633965SjdpMISRCS= 5733965SjdpMDASM= 5833965SjdpMIASM= 5933965SjdpNOASM= 6033965Sjdp 61218822Sdim.include "${.CURDIR}/${LIBC_ARCH}/Makefile.inc" 62218822Sdim.include "${.CURDIR}/db/Makefile.inc" 63218822Sdim.include "${.CURDIR}/compat-43/Makefile.inc" 64218822Sdim.include "${.CURDIR}/gdtoa/Makefile.inc" 65218822Sdim.include "${.CURDIR}/gen/Makefile.inc" 66218822Sdim.include "${.CURDIR}/gmon/Makefile.inc" 6733965Sjdp.if ${MK_ICONV} != "no" 6833965Sjdp.include "${.CURDIR}/iconv/Makefile.inc" 6933965Sjdp.endif 7033965Sjdp.include "${.CURDIR}/inet/Makefile.inc" 7133965Sjdp.include "${.CURDIR}/isc/Makefile.inc" 7233965Sjdp.include "${.CURDIR}/locale/Makefile.inc" 73218822Sdim.include "${.CURDIR}/nameser/Makefile.inc" 7477298Sobrien.include "${.CURDIR}/net/Makefile.inc" 7533965Sjdp.include "${.CURDIR}/nls/Makefile.inc" 7677298Sobrien.include "${.CURDIR}/posix1e/Makefile.inc" 7733965Sjdp.if ${LIBC_ARCH} != "amd64" && \ 78218822Sdim ${LIBC_ARCH} != "ia64" && \ 79251227Spfg ${LIBC_ARCH} != "powerpc64" && \ 80251227Spfg ${LIBC_ARCH} != "sparc64" && \ 8133965Sjdp ${MACHINE_ARCH:Mmipsn32*} == "" && \ 8233965Sjdp ${MACHINE_ARCH:Mmips64*} == "" 8333965Sjdp.include "${.CURDIR}/quad/Makefile.inc" 8433965Sjdp.endif 8533965Sjdp.include "${.CURDIR}/regex/Makefile.inc" 8633965Sjdp.include "${.CURDIR}/resolv/Makefile.inc" 8733965Sjdp.include "${.CURDIR}/stdio/Makefile.inc" 88130561Sobrien.include "${.CURDIR}/stdlib/Makefile.inc" 8933965Sjdp.include "${.CURDIR}/stdlib/jemalloc/Makefile.inc" 9033965Sjdp.include "${.CURDIR}/stdtime/Makefile.inc" 9133965Sjdp.include "${.CURDIR}/string/Makefile.inc" 9233965Sjdp.include "${.CURDIR}/sys/Makefile.inc" 9333965Sjdp.include "${.CURDIR}/rpc/Makefile.inc" 9433965Sjdp.include "${.CURDIR}/uuid/Makefile.inc" 9577298Sobrien.include "${.CURDIR}/xdr/Makefile.inc" 9677298Sobrien.if ${LIBC_ARCH} == "arm" || ${LIBC_ARCH} == "mips" 9777298Sobrien.include "${.CURDIR}/softfloat/Makefile.inc" 9833965Sjdp.endif 9933965Sjdp.if ${MK_NIS} != "no" 10033965SjdpCFLAGS+= -DYP 10133965Sjdp.include "${.CURDIR}/yp/Makefile.inc" 102130561Sobrien.endif 103130561Sobrien.if ${MK_HESIOD} != "no" 104130561SobrienCFLAGS+= -DHESIOD 105130561Sobrien.endif 106130561Sobrien.if ${MK_FP_LIBC} == "no" 107130561SobrienCFLAGS+= -DNO_FLOATING_POINT 108218822Sdim.endif 109218822Sdim.if ${MK_NS_CACHING} != "no" 110218822SdimCFLAGS+= -DNS_CACHING 111218822Sdim.endif 112218822Sdim.if defined(_FREEFALL_CONFIG) 113218822SdimCFLAGS+=-D_FREEFALL_CONFIG 11433965Sjdp.endif 115218822Sdim 11633965SjdpVERSION_DEF=${.CURDIR}/Versions.def 11733965SjdpSYMBOL_MAPS=${SYM_MAPS} 11833965SjdpCFLAGS+= -DSYMBOL_VERSIONING 11933965Sjdp 120130561Sobrien# If there are no machine dependent sources, append all the 121130561Sobrien# machine-independent sources: 122130561Sobrien.if empty(MDSRCS) 123130561SobrienSRCS+= ${MISRCS} 124218822Sdim.else 125218822Sdim# Append machine-dependent sources, then append machine-independent sources 126218822Sdim# for which there is no machine-dependent variant. 127218822SdimSRCS+= ${MDSRCS} 128130561Sobrien.for _src in ${MISRCS} 129130561Sobrien.if ${MDSRCS:R:M${_src:R}} == "" 13033965SjdpSRCS+= ${_src} 131130561Sobrien.endif 132130561Sobrien.endfor 133130561Sobrien.endif 134130561Sobrien 135130561SobrienKQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ 136130561Sobrien lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ 137130561Sobrien subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c 138130561SobrienKSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \ 139130561Sobrien strcmp.c strcpy.c strlen.c strncpy.c strrchr.c 140130561Sobrien 141130561Sobrienlibkern: libkern.gen libkern.${LIBC_ARCH} 142130561Sobrien 143130561Sobrienlibkern.gen: ${KQSRCS} ${KSRCS} 144130561Sobrien cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern 14533965Sjdp 14633965Sjdplibkern.${LIBC_ARCH}:: ${KMSRCS} 147130561Sobrien.if defined(KMSRCS) && !empty(KMSRCS) 148130561Sobrien cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} 149130561Sobrien.endif 150130561Sobrien 151130561Sobrien.include <bsd.lib.mk> 152130561Sobrien 153130561Sobrien# Disable warnings in contributed sources. 154130561SobrienCWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/} 155130561Sobrien# XXX For now, we don't allow libc to be compiled with 156130561Sobrien# -fstack-protector-all because it breaks rtld. We may want to make a librtld 157130561Sobrien# in the future to circumvent this. 158130561SobrienSSP_CFLAGS:= ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/} 159130561Sobrien# Disable stack protection for SSP symbols. 160130561SobrienSSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/} 161130561Sobrien# Generate stack unwinding tables for cancellation points 162130561SobrienCANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//} 163218822Sdim