xref: /freebsd/lib/libsys/Makefile (revision 1235d276b78a769bded01d51c9bf3cdc480db9fb)
1e9d96105SBrooks DavisPACKAGE=	clibs
2e9d96105SBrooks DavisSHLIBDIR?= /lib
3e9d96105SBrooks Davis
4e9d96105SBrooks Davis.include <src.opts.mk>
5e9d96105SBrooks Davis
6e9d96105SBrooks DavisLIBC_SRCTOP?= ${.CURDIR}/../libc
7e9d96105SBrooks DavisLIBSYS_SRCTOP?=	${.CURDIR}
8e9d96105SBrooks Davis
9e9d96105SBrooks Davis# Pick the current architecture directory for libsys. In general, this is named
10e9d96105SBrooks Davis# MACHINE_CPUARCH, but some ABIs are different enough to require their own
11e9d96105SBrooks Davis# libsys, so allow a directory named MACHINE_ARCH to override this (though
12e9d96105SBrooks Davis# treat powerpc64le and powerpc64 the same).
13e9d96105SBrooks Davis# Note: This is copied from libc/Makefile
14e9d96105SBrooks DavisM=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
15e9d96105SBrooks Davis.if exists(${LIBC_SRCTOP}/${M})
16e9d96105SBrooks DavisLIBC_ARCH=${M}
17e9d96105SBrooks Davis.else
18e9d96105SBrooks DavisLIBC_ARCH=${MACHINE_CPUARCH}
19e9d96105SBrooks Davis.endif
20e9d96105SBrooks Davis
21e9d96105SBrooks DavisLIB=sys
22e9d96105SBrooks DavisSHLIB_MAJOR= 7
23e9d96105SBrooks DavisWARNS?=	2
243668e1faSKonstantin BelousovMK_SSP=		no
25e9d96105SBrooks Davis
261fd88074SBrooks DavisINCS=	libsys.h _libsys.h
271fd88074SBrooks Davis
28*1235d276SBrooks DavisCFLAGS+=-DLIBSYS
29*1235d276SBrooks Davis
30e9d96105SBrooks DavisCFLAGS+=-I${LIBSYS_SRCTOP}/include -I${LIBC_SRCTOP}/include
31e9d96105SBrooks DavisCFLAGS+=-I${LIBSYS_SRCTOP}/${LIBC_ARCH}
32e9d96105SBrooks DavisCFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
33e9d96105SBrooks Davis
34af9758deSKonstantin Belousov.PATH: ${LIBC_SRCTOP}/string
35af9758deSKonstantin BelousovSRCS+=	memcpy.c memset.c strlcpy.c
36af9758deSKonstantin Belousov
37e9d96105SBrooks DavisCLEANFILES+=tags
38e9d96105SBrooks DavisINSTALL_PIC_ARCHIVE=
39e9d96105SBrooks Davis#XXX? BUILD_NOSSP_PIC_ARCHIVE=
40e9d96105SBrooks DavisPRECIOUSLIB=
41e9d96105SBrooks Davis
42e9d96105SBrooks Davis# Use a more efficient TLS model for libc since we can reasonably assume that
43e9d96105SBrooks Davis# it will be loaded during program startup.
44e9d96105SBrooks DavisCFLAGS+= -ftls-model=initial-exec
45e9d96105SBrooks Davis
46e9d96105SBrooks Davis#
47e9d96105SBrooks Davis# Link with static libcompiler_rt.a.
48e9d96105SBrooks Davis#
49e9d96105SBrooks DavisLDFLAGS+= -nodefaultlibs
50baa7d074SKonstantin BelousovLDFLAGS+= -Wl,-Bsymbolic
51e9d96105SBrooks DavisLIBADD+=	compiler_rt
52e9d96105SBrooks Davis
53e9d96105SBrooks Davis.if ${MK_SSP} != "no" && \
54e9d96105SBrooks Davis    (${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
55e9d96105SBrooks DavisLIBADD+=        ssp_nonshared
56e9d96105SBrooks Davis.endif
57e9d96105SBrooks Davis
58e9d96105SBrooks Davis# Define (empty) variables so that make doesn't give substitution
59e9d96105SBrooks Davis# errors if the included makefiles don't change these:
60e9d96105SBrooks DavisMDASM=
61e9d96105SBrooks DavisMIASM=
62e9d96105SBrooks DavisNOASM=
63e9d96105SBrooks Davis
6499ea6757SBrooks DavisSYM_MAPS+=	${LIBSYS_SRCTOP}/Symbol.map
6574484086SBrooks DavisSRCS+=	auxv.c \
6674484086SBrooks Davis	interposing_table.c
6799ea6757SBrooks Davis
68e9d96105SBrooks Davis.include "${LIBSYS_SRCTOP}/Makefile.sys"
69e9d96105SBrooks Davis
70ef9871c6SBrooks DavisSYM_MAPS+=	${LIBSYS_SRCTOP}/Symbol.thr.map
71ef9871c6SBrooks Davis.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}
72ef9871c6SBrooks Davis.sinclude "${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/Makefile.thr"
73ef9871c6SBrooks Davis.if !${SRCS:M_umtx_op_err.S}
74ef9871c6SBrooks DavisSRCS+=_umtx_op_err.c
75ef9871c6SBrooks Davis.endif
76ef9871c6SBrooks Davis
77e9d96105SBrooks DavisVERSION_DEF=${LIBC_SRCTOP}/Versions.def
78e9d96105SBrooks DavisSYMBOL_MAPS=${SYM_MAPS}
79e9d96105SBrooks Davis
80e9d96105SBrooks Davis.include <bsd.lib.mk>
81