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