xref: /freebsd/lib/libsys/Makefile (revision 1235d276b78a769bded01d51c9bf3cdc480db9fb)
1 PACKAGE=	clibs
2 SHLIBDIR?= /lib
3 
4 .include <src.opts.mk>
5 
6 LIBC_SRCTOP?= ${.CURDIR}/../libc
7 LIBSYS_SRCTOP?=	${.CURDIR}
8 
9 # Pick the current architecture directory for libsys. In general, this is named
10 # MACHINE_CPUARCH, but some ABIs are different enough to require their own
11 # libsys, so allow a directory named MACHINE_ARCH to override this (though
12 # treat powerpc64le and powerpc64 the same).
13 # Note: This is copied from libc/Makefile
14 M=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
15 .if exists(${LIBC_SRCTOP}/${M})
16 LIBC_ARCH=${M}
17 .else
18 LIBC_ARCH=${MACHINE_CPUARCH}
19 .endif
20 
21 LIB=sys
22 SHLIB_MAJOR= 7
23 WARNS?=	2
24 MK_SSP=		no
25 
26 INCS=	libsys.h _libsys.h
27 
28 CFLAGS+=-DLIBSYS
29 
30 CFLAGS+=-I${LIBSYS_SRCTOP}/include -I${LIBC_SRCTOP}/include
31 CFLAGS+=-I${LIBSYS_SRCTOP}/${LIBC_ARCH}
32 CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
33 
34 .PATH: ${LIBC_SRCTOP}/string
35 SRCS+=	memcpy.c memset.c strlcpy.c
36 
37 CLEANFILES+=tags
38 INSTALL_PIC_ARCHIVE=
39 #XXX? BUILD_NOSSP_PIC_ARCHIVE=
40 PRECIOUSLIB=
41 
42 # Use a more efficient TLS model for libc since we can reasonably assume that
43 # it will be loaded during program startup.
44 CFLAGS+= -ftls-model=initial-exec
45 
46 #
47 # Link with static libcompiler_rt.a.
48 #
49 LDFLAGS+= -nodefaultlibs
50 LDFLAGS+= -Wl,-Bsymbolic
51 LIBADD+=	compiler_rt
52 
53 .if ${MK_SSP} != "no" && \
54     (${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
55 LIBADD+=        ssp_nonshared
56 .endif
57 
58 # Define (empty) variables so that make doesn't give substitution
59 # errors if the included makefiles don't change these:
60 MDASM=
61 MIASM=
62 NOASM=
63 
64 SYM_MAPS+=	${LIBSYS_SRCTOP}/Symbol.map
65 SRCS+=	auxv.c \
66 	interposing_table.c
67 
68 .include "${LIBSYS_SRCTOP}/Makefile.sys"
69 
70 SYM_MAPS+=	${LIBSYS_SRCTOP}/Symbol.thr.map
71 .PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}
72 .sinclude "${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/Makefile.thr"
73 .if !${SRCS:M_umtx_op_err.S}
74 SRCS+=_umtx_op_err.c
75 .endif
76 
77 VERSION_DEF=${LIBC_SRCTOP}/Versions.def
78 SYMBOL_MAPS=${SYM_MAPS}
79 
80 .include <bsd.lib.mk>
81