1 # @(#)Makefile 8.2 (Berkeley) 2/3/94
8 # We have to special case powerpc and powerpc64, since they mostly have
9 # the same source implementation. libc is very different due to large
11 .if ${MACHINE_ARCH} == "powerpc"
12 LIBC_ARCH=${MACHINE_ARCH}
14 LIBC_ARCH=${MACHINE_CPUARCH}
17 # All library objects contain FreeBSD revision strings by default; they may be
18 # excluded as a space-saving measure. To produce a library that does
19 # not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
20 # below. Note: there are no IDs for syscall stubs whose sources are generated.
21 # To include legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS
22 # to CFLAGS below. -DSYSLIBC_SCCS affects just the system call stubs.
26 CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include
27 CFLAGS+=-I${.CURDIR}/${LIBC_ARCH}
34 # Only link with static libgcc.a (no libgcc_eh.a).
37 LDFLAGS+= -nodefaultlibs
38 LDADD+= -lgcc -lssp_nonshared
40 # Define (empty) variables so that make doesn't give substitution
41 # errors if the included makefiles don't change these:
48 .include "${.CURDIR}/${LIBC_ARCH}/Makefile.inc"
49 .include "${.CURDIR}/db/Makefile.inc"
50 .include "${.CURDIR}/compat-43/Makefile.inc"
51 .include "${.CURDIR}/gdtoa/Makefile.inc"
52 .include "${.CURDIR}/gen/Makefile.inc"
53 .include "${.CURDIR}/gmon/Makefile.inc"
54 .include "${.CURDIR}/inet/Makefile.inc"
55 .include "${.CURDIR}/isc/Makefile.inc"
56 .include "${.CURDIR}/locale/Makefile.inc"
57 .include "${.CURDIR}/nameser/Makefile.inc"
58 .include "${.CURDIR}/net/Makefile.inc"
59 .include "${.CURDIR}/nls/Makefile.inc"
60 .include "${.CURDIR}/posix1e/Makefile.inc"
61 .if ${LIBC_ARCH} != "amd64" && \
62 ${LIBC_ARCH} != "ia64" && \
63 ${LIBC_ARCH} != "powerpc64" && \
64 ${LIBC_ARCH} != "sparc64" && \
65 ${LIBC_ARCH} != "mips"
66 .include "${.CURDIR}/quad/Makefile.inc"
68 .if ${LIBC_ARCH} == "mips" && \
69 (!defined(TARGET_ABI) || ${TARGET_ABI} == "o32")
70 .include "${.CURDIR}/quad/Makefile.inc"
72 .include "${.CURDIR}/regex/Makefile.inc"
73 .include "${.CURDIR}/resolv/Makefile.inc"
74 .include "${.CURDIR}/stdio/Makefile.inc"
75 .include "${.CURDIR}/stdlib/Makefile.inc"
76 .include "${.CURDIR}/stdtime/Makefile.inc"
77 .include "${.CURDIR}/string/Makefile.inc"
78 .include "${.CURDIR}/sys/Makefile.inc"
79 .include "${.CURDIR}/rpc/Makefile.inc"
80 .include "${.CURDIR}/uuid/Makefile.inc"
81 .include "${.CURDIR}/xdr/Makefile.inc"
82 .if ${LIBC_ARCH} == "arm" || ${LIBC_ARCH} == "mips"
83 .include "${.CURDIR}/softfloat/Makefile.inc"
87 .include "${.CURDIR}/yp/Makefile.inc"
89 .if ${MK_HESIOD} != "no"
92 .if ${MK_FP_LIBC} == "no"
93 CFLAGS+= -DNO_FLOATING_POINT
95 .if ${MK_NS_CACHING} != "no"
98 .if defined(_FREEFALL_CONFIG)
99 CFLAGS+=-D_FREEFALL_CONFIG
102 VERSION_DEF=${.CURDIR}/Versions.def
103 SYMBOL_MAPS=${SYM_MAPS}
104 CFLAGS+= -DSYMBOL_VERSIONING
106 # If there are no machine dependent sources, append all the
107 # machine-independent sources:
111 # Append machine-dependent sources, then append machine-independent sources
112 # for which there is no machine-dependent variant.
114 .for _src in ${MISRCS}
115 .if ${MDSRCS:R:M${_src:R}} == ""
121 KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
122 lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
123 subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
124 KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \
125 strcat.c strcmp.c strcpy.c strlen.c strncpy.c
127 libkern: libkern.gen libkern.${LIBC_ARCH}
129 libkern.gen: ${KQSRCS} ${KSRCS}
130 cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
132 libkern.${LIBC_ARCH}:: ${KMSRCS}
133 .if defined(KMSRCS) && !empty(KMSRCS)
134 cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
137 .include <bsd.lib.mk>
139 # Disable warnings in contributed sources.
140 CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
141 # XXX For now, we don't allow libc to be compiled with
142 # -fstack-protector-all because it breaks rtld. We may want to make a librtld
143 # in the future to circumvent this.
144 SSP_CFLAGS:= ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/}
145 # Disable stack protection for SSP symbols.
146 SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}