Makefile revision 282854
1139778Simp# @(#)Makefile 8.2 (Berkeley) 2/3/94 212115Sdyson# $FreeBSD: stable/10/lib/libc/Makefile 282854 2015-05-13 11:32:55Z ngie $ 312115Sdyson 412115SdysonSHLIBDIR?= /lib 512115Sdyson 612115Sdyson.include <bsd.own.mk> 7139778Simp 812115Sdyson# Pick the current architecture directory for libc. In general, this is 912115Sdyson# named MACHINE_CPUARCH, but some ABIs are different enough to require 1012115Sdyson# their own libc, so allow a directory named MACHINE_ARCH to override this. 1112115Sdyson 1212115Sdyson.if exists(${.CURDIR}/${MACHINE_ARCH}) 1312115SdysonLIBC_ARCH=${MACHINE_ARCH} 1412115Sdyson.else 1512115SdysonLIBC_ARCH=${MACHINE_CPUARCH} 1612115Sdyson.endif 1712115Sdyson 1812115Sdyson# All library objects contain FreeBSD revision strings by default; they may be 1912115Sdyson# excluded as a space-saving measure. To produce a library that does 2012115Sdyson# not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS 2112115Sdyson# below. Note: there are no IDs for syscall stubs whose sources are generated. 2212115Sdyson# To include legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS 2312115Sdyson# to CFLAGS below. -DSYSLIBC_SCCS affects just the system call stubs. 2412115SdysonLIB=c 2512115SdysonSHLIB_MAJOR= 7 2612115SdysonSHLIB_LDSCRIPT=libc.ldscript 2712115SdysonWARNS?= 2 2812115SdysonCFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include 2912115SdysonCFLAGS+=-I${.CURDIR}/${LIBC_ARCH} 3012115Sdyson.if ${MK_NLS} != "no" 3112115SdysonCFLAGS+=-DNLS 3212115Sdyson.endif 3312115SdysonCLEANFILES+=tags 3412115SdysonINSTALL_PIC_ARCHIVE= 3593015SbdePRECIOUSLIB= 3659259Srwatson 3712115Sdyson.ifndef NO_THREAD_STACK_UNWIND 3812115SdysonCANCELPOINTS_CFLAGS=-fexceptions 3912115SdysonCFLAGS+=${CANCELPOINTS_CFLAGS} 4012115Sdyson.endif 4150260Sbde 4212115Sdyson# 4312115Sdyson# Only link with static libgcc.a (no libgcc_eh.a). 4412115Sdyson# 45229549SpfgDPADD+= ${LIBGCC} 4612115SdysonLDFLAGS+= -nodefaultlibs 47202283SlulfLDADD+= -lgcc 4812115Sdyson 49202283Slulf.if ${MK_SSP} != "no" 50202283SlulfDPADD+= ${LIBSSP_NONSHARED} 51202283SlulfLDADD+= -lssp_nonshared 52202283Slulf.endif 53202283Slulf 5412115Sdyson# Extras that live in either libc.a or libc_nonshared.a 55202283SlulfLIBC_NONSHARED_SRCS= 56229549Spfg 57202283Slulf# Define (empty) variables so that make doesn't give substitution 58202283Slulf# errors if the included makefiles don't change these: 59202283SlulfMDSRCS= 60202283SlulfMISRCS= 61202283SlulfMDASM= 62202283SlulfMIASM= 63202283SlulfNOASM= 64218175Sjhb 6512115Sdyson.include "${.CURDIR}/${LIBC_ARCH}/Makefile.inc" 6612115Sdyson.include "${.CURDIR}/db/Makefile.inc" 6712115Sdyson.include "${.CURDIR}/compat-43/Makefile.inc" 68202283Slulf.include "${.CURDIR}/gdtoa/Makefile.inc" 69202283Slulf.include "${.CURDIR}/gen/Makefile.inc" 70202283Slulf.include "${.CURDIR}/gmon/Makefile.inc" 71202283Slulf.if ${MK_ICONV} != "no" 72202283Slulf.include "${.CURDIR}/iconv/Makefile.inc" 73202283Slulf.endif 74202283Slulf.include "${.CURDIR}/inet/Makefile.inc" 75202283Slulf.include "${.CURDIR}/isc/Makefile.inc" 76202283Slulf.include "${.CURDIR}/locale/Makefile.inc" 77202283Slulf.include "${.CURDIR}/md/Makefile.inc" 78202283Slulf.include "${.CURDIR}/nameser/Makefile.inc" 79202283Slulf.include "${.CURDIR}/net/Makefile.inc" 80202283Slulf.include "${.CURDIR}/nls/Makefile.inc" 8112115Sdyson.include "${.CURDIR}/posix1e/Makefile.inc" 8212115Sdyson.if ${LIBC_ARCH} != "amd64" && \ 8312115Sdyson ${LIBC_ARCH} != "ia64" && \ 8496752Siedowse ${LIBC_ARCH} != "powerpc64" && \ 8596877Siedowse ${LIBC_ARCH} != "sparc64" && \ 8612115Sdyson ${MACHINE_ARCH:Mmipsn32*} == "" && \ 8712115Sdyson ${MACHINE_ARCH:Mmips64*} == "" 8896877Siedowse.include "${.CURDIR}/quad/Makefile.inc" 8912115Sdyson.endif 90202283Slulf.include "${.CURDIR}/regex/Makefile.inc" 91202283Slulf.include "${.CURDIR}/resolv/Makefile.inc" 9296877Siedowse.include "${.CURDIR}/stdio/Makefile.inc" 93202283Slulf.include "${.CURDIR}/stdlib/Makefile.inc" 9412115Sdyson.include "${.CURDIR}/stdlib/jemalloc/Makefile.inc" 9512115Sdyson.include "${.CURDIR}/stdtime/Makefile.inc" 96202283Slulf.include "${.CURDIR}/string/Makefile.inc" 97202283Slulf.include "${.CURDIR}/sys/Makefile.inc" 98153110Sru.include "${.CURDIR}/rpc/Makefile.inc" 99202283Slulf.include "${.CURDIR}/uuid/Makefile.inc" 100143677Sphk.include "${.CURDIR}/xdr/Makefile.inc" 101202283Slulf.if ${LIBC_ARCH} == "arm" || ${LIBC_ARCH} == "mips" 10212115Sdyson.include "${.CURDIR}/softfloat/Makefile.inc" 10312115Sdyson.endif 10412115Sdyson.if ${MK_NIS} != "no" 10524492SbdeCFLAGS+= -DYP 10612115Sdyson.include "${.CURDIR}/yp/Makefile.inc" 107202283Slulf.endif 10812115Sdyson.include "${.CURDIR}/capability/Makefile.inc" 10912115Sdyson.if ${MK_HESIOD} != "no" 110202283SlulfCFLAGS+= -DHESIOD 11112115Sdyson.endif 112202283Slulf.if ${MK_FP_LIBC} == "no" 11312115SdysonCFLAGS+= -DNO_FLOATING_POINT 114218175Sjhb.endif 115229549Spfg.if ${MK_NS_CACHING} != "no" 116229549SpfgCFLAGS+= -DNS_CACHING 117229549Spfg.endif 118229549Spfg.if defined(_FREEFALL_CONFIG) 119229549SpfgCFLAGS+=-D_FREEFALL_CONFIG 120229549Spfg.endif 121218175Sjhb 122218175SjhbSTATICOBJS+=${LIBC_NONSHARED_SRCS:S/.c$/.o/} 123218175Sjhb 124218175SjhbVERSION_DEF=${.CURDIR}/Versions.def 125229549SpfgSYMBOL_MAPS=${SYM_MAPS} 126229549SpfgCFLAGS+= -DSYMBOL_VERSIONING 127229549Spfg 128229549Spfg# If there are no machine dependent sources, append all the 12912115Sdyson# machine-independent sources: 13012115Sdyson.if empty(MDSRCS) 131202283SlulfSRCS+= ${MISRCS} 13212115Sdyson.else 133202283Slulf# Append machine-dependent sources, then append machine-independent sources 13412115Sdyson# for which there is no machine-dependent variant. 13512115SdysonSRCS+= ${MDSRCS} 13612115Sdyson.for _src in ${MISRCS} 13712115Sdyson.if ${MDSRCS:R:M${_src:R}} == "" 13812115SdysonSRCS+= ${_src} 13912115Sdyson.endif 14012115Sdyson.endfor 14112115Sdyson.endif 14212115Sdyson 14312115SdysonKQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ 14472640Sasmodai lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ 14512115Sdyson subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c 14612115SdysonKSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \ 14712115Sdyson strcmp.c strcpy.c strlen.c strncpy.c strrchr.c 14812115Sdyson 14912115Sdysonlibkern: libkern.gen libkern.${LIBC_ARCH} 15012115Sdyson 15116322Sgpalmerlibkern.gen: ${KQSRCS} ${KSRCS} 152218175Sjhb cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern 153218175Sjhb 15412115Sdysonlibkern.${LIBC_ARCH}:: ${KMSRCS} 155218175Sjhb.if defined(KMSRCS) && !empty(KMSRCS) 156218175Sjhb cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} 157218175Sjhb.endif 158202283Slulf 159218175Sjhb.if !defined(WITHOUT_SYSCALL_COMPAT) 16016322SgpalmerCFLAGS+=-DSYSCALL_COMPAT 16112115Sdyson.endif 16212115Sdyson 16312115Sdyson.if ${MK_TESTS} != "no" 16412115SdysonSUBDIR+= tests 16512115Sdyson.endif 16612115Sdyson 16712115Sdyson.include <bsd.lib.mk> 168202283Slulf 16912115Sdyson# Disable warnings in contributed sources. 17012115SdysonCWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/} 17112115Sdyson# XXX For now, we don't allow libc to be compiled with 172202283Slulf# -fstack-protector-all because it breaks rtld. We may want to make a librtld 173202283Slulf# in the future to circumvent this. 17412115SdysonSSP_CFLAGS:= ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/} 17512115Sdyson# Disable stack protection for SSP symbols. 176221126SjhbSSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/} 17712115Sdyson# Generate stack unwinding tables for cancellation points 17812115SdysonCANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//} 179229549Spfg