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