11573Srgrimes# @(#)Makefile 8.2 (Berkeley) 2/3/94 250476Speter# $FreeBSD: releng/10.3/lib/libc/Makefile 282854 2015-05-13 11:32:55Z ngie $ 3156813Sru 4156837SruSHLIBDIR?= /lib 5156837Sru 6156813Sru.include <bsd.own.mk> 7156813Sru 8211822Snwhitehorn# Pick the current architecture directory for libc. In general, this is 9211822Snwhitehorn# named MACHINE_CPUARCH, but some ABIs are different enough to require 10211822Snwhitehorn# their own libc, so allow a directory named MACHINE_ARCH to override this. 11211822Snwhitehorn 12211822Snwhitehorn.if exists(${.CURDIR}/${MACHINE_ARCH}) 13211774SimpLIBC_ARCH=${MACHINE_ARCH} 14211774Simp.else 15211778SimpLIBC_ARCH=${MACHINE_CPUARCH} 16211774Simp.endif 17211774Simp 1893048Sobrien# All library objects contain FreeBSD revision strings by default; they may be 191573Srgrimes# excluded as a space-saving measure. To produce a library that does 2093253Sobrien# not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS 21123440Sbde# below. Note: there are no IDs for syscall stubs whose sources are generated. 22123440Sbde# To include legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS 23123440Sbde# to CFLAGS below. -DSYSLIBC_SCCS affects just the system call stubs. 241573SrgrimesLIB=c 25158794SumeSHLIB_MAJOR= 7 26251668SjlhSHLIB_LDSCRIPT=libc.ldscript 27124723SnectarWARNS?= 2 28117120SruCFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include 29211774SimpCFLAGS+=-I${.CURDIR}/${LIBC_ARCH} 30235720Sgleb.if ${MK_NLS} != "no" 31189765SgaborCFLAGS+=-DNLS 32235720Sgleb.endif 331573SrgrimesCLEANFILES+=tags 34136910SruINSTALL_PIC_ARCHIVE= 35136910SruPRECIOUSLIB= 361573Srgrimes 37213153Sdavidxu.ifndef NO_THREAD_STACK_UNWIND 38213153SdavidxuCANCELPOINTS_CFLAGS=-fexceptions 39213153SdavidxuCFLAGS+=${CANCELPOINTS_CFLAGS} 40213153Sdavidxu.endif 41213153Sdavidxu 42169720Skan# 43169720Skan# Only link with static libgcc.a (no libgcc_eh.a). 44169720Skan# 45172401SruDPADD+= ${LIBGCC} 46169771SkanLDFLAGS+= -nodefaultlibs 47235653SmarcelLDADD+= -lgcc 48169720Skan 49235653Smarcel.if ${MK_SSP} != "no" 50270760SngieDPADD+= ${LIBSSP_NONSHARED} 51235653SmarcelLDADD+= -lssp_nonshared 52235653Smarcel.endif 53235653Smarcel 54258750Sgjb# Extras that live in either libc.a or libc_nonshared.a 55258750SgjbLIBC_NONSHARED_SRCS= 56258750Sgjb 57107052Sru# Define (empty) variables so that make doesn't give substitution 58107052Sru# errors if the included makefiles don't change these: 59107052SruMDSRCS= 60107052SruMISRCS= 61107052SruMDASM= 62107052SruMIASM= 63107052SruNOASM= 64107052Sru 65211774Simp.include "${.CURDIR}/${LIBC_ARCH}/Makefile.inc" 66107052Sru.include "${.CURDIR}/db/Makefile.inc" 67107052Sru.include "${.CURDIR}/compat-43/Makefile.inc" 68112202Sobrien.include "${.CURDIR}/gdtoa/Makefile.inc" 69107052Sru.include "${.CURDIR}/gen/Makefile.inc" 70107052Sru.include "${.CURDIR}/gmon/Makefile.inc" 71219019Sgabor.if ${MK_ICONV} != "no" 72219019Sgabor.include "${.CURDIR}/iconv/Makefile.inc" 73219019Sgabor.endif 74156960Sume.include "${.CURDIR}/inet/Makefile.inc" 75156960Sume.include "${.CURDIR}/isc/Makefile.inc" 76107052Sru.include "${.CURDIR}/locale/Makefile.inc" 77270837Sume.include "${.CURDIR}/md/Makefile.inc" 78156960Sume.include "${.CURDIR}/nameser/Makefile.inc" 79107052Sru.include "${.CURDIR}/net/Makefile.inc" 80107052Sru.include "${.CURDIR}/nls/Makefile.inc" 81107052Sru.include "${.CURDIR}/posix1e/Makefile.inc" 82211774Simp.if ${LIBC_ARCH} != "amd64" && \ 83211774Simp ${LIBC_ARCH} != "ia64" && \ 84211774Simp ${LIBC_ARCH} != "powerpc64" && \ 85211774Simp ${LIBC_ARCH} != "sparc64" && \ 86217942Sjchandra ${MACHINE_ARCH:Mmipsn32*} == "" && \ 87217123Simp ${MACHINE_ARCH:Mmips64*} == "" 88107052Sru.include "${.CURDIR}/quad/Makefile.inc" 89107052Sru.endif 90107052Sru.include "${.CURDIR}/regex/Makefile.inc" 91156960Sume.include "${.CURDIR}/resolv/Makefile.inc" 92107052Sru.include "${.CURDIR}/stdio/Makefile.inc" 93107052Sru.include "${.CURDIR}/stdlib/Makefile.inc" 94234370Sjasone.include "${.CURDIR}/stdlib/jemalloc/Makefile.inc" 95107052Sru.include "${.CURDIR}/stdtime/Makefile.inc" 96107052Sru.include "${.CURDIR}/string/Makefile.inc" 97107052Sru.include "${.CURDIR}/sys/Makefile.inc" 98107052Sru.include "${.CURDIR}/rpc/Makefile.inc" 99107052Sru.include "${.CURDIR}/uuid/Makefile.inc" 100107052Sru.include "${.CURDIR}/xdr/Makefile.inc" 101211774Simp.if ${LIBC_ARCH} == "arm" || ${LIBC_ARCH} == "mips" 102129202Scognet.include "${.CURDIR}/softfloat/Makefile.inc" 103129202Scognet.endif 104156813Sru.if ${MK_NIS} != "no" 105107052SruCFLAGS+= -DYP 106107052Sru.include "${.CURDIR}/yp/Makefile.inc" 107107052Sru.endif 108255219Spjd.include "${.CURDIR}/capability/Makefile.inc" 109156813Sru.if ${MK_HESIOD} != "no" 110107052SruCFLAGS+= -DHESIOD 111107052Sru.endif 112156813Sru.if ${MK_FP_LIBC} == "no" 113128820SdasCFLAGS+= -DNO_FLOATING_POINT 114128820Sdas.endif 115158115Sume.if ${MK_NS_CACHING} != "no" 116158115SumeCFLAGS+= -DNS_CACHING 117158115Sume.endif 118167199Ssimon.if defined(_FREEFALL_CONFIG) 119167199SsimonCFLAGS+=-D_FREEFALL_CONFIG 120167199Ssimon.endif 121107052Sru 122258750SgjbSTATICOBJS+=${LIBC_NONSHARED_SRCS:S/.c$/.o/} 123258750Sgjb 124156773SdeischenVERSION_DEF=${.CURDIR}/Versions.def 125156773SdeischenSYMBOL_MAPS=${SYM_MAPS} 126156773SdeischenCFLAGS+= -DSYMBOL_VERSIONING 127156773Sdeischen 128107052Sru# If there are no machine dependent sources, append all the 129107052Sru# machine-independent sources: 130107052Sru.if empty(MDSRCS) 131107052SruSRCS+= ${MISRCS} 132107052Sru.else 133107052Sru# Append machine-dependent sources, then append machine-independent sources 134107052Sru# for which there is no machine-dependent variant. 135107052SruSRCS+= ${MDSRCS} 136107052Sru.for _src in ${MISRCS} 137107052Sru.if ${MDSRCS:R:M${_src:R}} == "" 138107052SruSRCS+= ${_src} 139107052Sru.endif 140107052Sru.endfor 141107052Sru.endif 142107052Sru 1431573SrgrimesKQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ 1441573Srgrimes lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ 1451573Srgrimes subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c 146229368SedKSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \ 147229368Sed strcmp.c strcpy.c strlen.c strncpy.c strrchr.c 1481573Srgrimes 149211774Simplibkern: libkern.gen libkern.${LIBC_ARCH} 1501573Srgrimes 1511573Srgrimeslibkern.gen: ${KQSRCS} ${KSRCS} 15226047Sasami cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern 1531573Srgrimes 154211774Simplibkern.${LIBC_ARCH}:: ${KMSRCS} 1551573Srgrimes.if defined(KMSRCS) && !empty(KMSRCS) 156211774Simp cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} 1571573Srgrimes.endif 158211704Skib 159277317Skib.if !defined(WITHOUT_SYSCALL_COMPAT) 160277317SkibCFLAGS+=-DSYSCALL_COMPAT 161277317Skib.endif 162277317Skib 163282854Sngie.if ${MK_TESTS} != "no" 164282854SngieSUBDIR+= tests 165282854Sngie.endif 166277441Sngie 1671573Srgrimes.include <bsd.lib.mk> 168124374Sru 169124374Sru# Disable warnings in contributed sources. 170210731SrpauloCWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/} 171180012Sru# XXX For now, we don't allow libc to be compiled with 172180012Sru# -fstack-protector-all because it breaks rtld. We may want to make a librtld 173180012Sru# in the future to circumvent this. 174180012SruSSP_CFLAGS:= ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/} 175180012Sru# Disable stack protection for SSP symbols. 176180012SruSSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/} 177213153Sdavidxu# Generate stack unwinding tables for cancellation points 178213153SdavidxuCANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//} 179