xref: /freebsd/stand/libsa/Makefile (revision ca987d4641cdcd7f27e153db17c5bf064934faf5)
1*ca987d46SWarner Losh# $FreeBSD$
2*ca987d46SWarner Losh# Originally from	$NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
3*ca987d46SWarner Losh#
4*ca987d46SWarner Losh# Notes:
5*ca987d46SWarner Losh# - We don't use the libc strerror/sys_errlist because the string table is
6*ca987d46SWarner Losh#   quite large.
7*ca987d46SWarner Losh#
8*ca987d46SWarner Losh
9*ca987d46SWarner LoshMK_PROFILE=	no
10*ca987d46SWarner LoshMK_SSP=		no
11*ca987d46SWarner Losh
12*ca987d46SWarner Losh.include <bsd.init.mk>
13*ca987d46SWarner Losh
14*ca987d46SWarner LoshINTERNALLIB=
15*ca987d46SWarner LoshLIBSA_CPUARCH?=${MACHINE_CPUARCH}
16*ca987d46SWarner LoshLIBC_SRC=	${SRCTOP}/lib/libc
17*ca987d46SWarner Losh
18*ca987d46SWarner LoshLIB?=		sa
19*ca987d46SWarner LoshNO_PIC=
20*ca987d46SWarner LoshWARNS?=		0
21*ca987d46SWarner Losh
22*ca987d46SWarner LoshCFLAGS+= -I${SASRC}
23*ca987d46SWarner Losh
24*ca987d46SWarner Losh# standalone components and stuff we have modified locally
25*ca987d46SWarner LoshSRCS+=	gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \
26*ca987d46SWarner Losh	globals.c pager.c panic.c printf.c strdup.c strerror.c strtol.c strtoul.c \
27*ca987d46SWarner Losh	random.c sbrk.c twiddle.c zalloc.c zalloc_malloc.c
28*ca987d46SWarner Losh
29*ca987d46SWarner Losh# private (pruned) versions of libc string functions
30*ca987d46SWarner LoshSRCS+=	strcasecmp.c
31*ca987d46SWarner Losh
32*ca987d46SWarner Losh.PATH: ${LIBC_SRC}/net
33*ca987d46SWarner Losh
34*ca987d46SWarner LoshSRCS+= ntoh.c
35*ca987d46SWarner Losh
36*ca987d46SWarner Losh# string functions from libc
37*ca987d46SWarner Losh.PATH: ${LIBC_SRC}/string
38*ca987d46SWarner LoshSRCS+=	bcmp.c bcopy.c bzero.c ffs.c fls.c \
39*ca987d46SWarner Losh	memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \
40*ca987d46SWarner Losh	qdivrem.c strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \
41*ca987d46SWarner Losh	strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \
42*ca987d46SWarner Losh	strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
43*ca987d46SWarner Losh.if ${MACHINE_CPUARCH} == "arm"
44*ca987d46SWarner Losh.PATH: ${LIBC_SRC}/arm/gen
45*ca987d46SWarner Losh
46*ca987d46SWarner Losh# Do not generate movt/movw, because the relocation fixup for them does not
47*ca987d46SWarner Losh# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8).
48*ca987d46SWarner Losh# Also, the fpu is not available in a standalone environment.
49*ca987d46SWarner Losh.if ${COMPILER_VERSION} < 30800
50*ca987d46SWarner LoshCFLAGS.clang+=	-mllvm -arm-use-movt=0
51*ca987d46SWarner Losh.else
52*ca987d46SWarner LoshCFLAGS.clang+=	-mno-movt
53*ca987d46SWarner Losh.endif
54*ca987d46SWarner LoshCFLAGS.clang+=	-mfpu=none
55*ca987d46SWarner Losh
56*ca987d46SWarner Losh# Compiler support functions
57*ca987d46SWarner Losh.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/
58*ca987d46SWarner Losh# __clzsi2 and ctzsi2 for various builtin functions
59*ca987d46SWarner LoshSRCS+=	clzsi2.c ctzsi2.c
60*ca987d46SWarner Losh# Divide and modulus functions called by the compiler
61*ca987d46SWarner LoshSRCS+=	 divmoddi4.c  divmodsi4.c  divdi3.c  divsi3.c  moddi3.c  modsi3.c
62*ca987d46SWarner LoshSRCS+=	udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
63*ca987d46SWarner Losh
64*ca987d46SWarner Losh.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/arm/
65*ca987d46SWarner LoshSRCS+=	aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
66*ca987d46SWarner LoshSRCS+=	aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
67*ca987d46SWarner Losh.endif
68*ca987d46SWarner Losh
69*ca987d46SWarner Losh.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
70*ca987d46SWarner Losh.PATH: ${LIBC_SRC}/${MACHINE_CPUARCH}/gen
71*ca987d46SWarner Losh.endif
72*ca987d46SWarner Losh
73*ca987d46SWarner Losh.if ${MACHINE_CPUARCH} == "powerpc"
74*ca987d46SWarner Losh.PATH: ${LIBC_SRC}/quad
75*ca987d46SWarner LoshSRCS+=	ashldi3.c ashrdi3.c
76*ca987d46SWarner LoshSRCS+=	syncicache.c
77*ca987d46SWarner Losh.endif
78*ca987d46SWarner Losh
79*ca987d46SWarner Losh# uuid functions from libc
80*ca987d46SWarner Losh.PATH: ${LIBC_SRC}/uuid
81*ca987d46SWarner LoshSRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c
82*ca987d46SWarner Losh
83*ca987d46SWarner Losh# _setjmp/_longjmp
84*ca987d46SWarner Losh.PATH: ${SASRC}/${LIBSA_CPUARCH}
85*ca987d46SWarner LoshSRCS+=	_setjmp.S
86*ca987d46SWarner Losh
87*ca987d46SWarner Losh# decompression functionality from libbz2
88*ca987d46SWarner Losh# NOTE: to actually test this functionality after libbz2 upgrade compile
89*ca987d46SWarner Losh# loader(8) with LOADER_BZIP2_SUPPORT defined
90*ca987d46SWarner Losh.PATH: ${SRCTOP}/contrib/bzip2
91*ca987d46SWarner LoshCFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
92*ca987d46SWarner LoshSRCS+=	libsa_bzlib_private.h
93*ca987d46SWarner Losh
94*ca987d46SWarner Losh.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
95*ca987d46SWarner LoshSRCS+=	_${file}
96*ca987d46SWarner LoshCLEANFILES+=	_${file}
97*ca987d46SWarner Losh
98*ca987d46SWarner Losh_${file}: ${file}
99*ca987d46SWarner Losh	sed "s|bzlib_private\.h|libsa_bzlib_private.h|" \
100*ca987d46SWarner Losh	    ${.ALLSRC} > ${.TARGET}
101*ca987d46SWarner Losh.endfor
102*ca987d46SWarner Losh
103*ca987d46SWarner LoshCLEANFILES+= libsa_bzlib_private.h
104*ca987d46SWarner Loshlibsa_bzlib_private.h: bzlib_private.h
105*ca987d46SWarner Losh	sed -e 's|<stdlib.h>|"stand.h"|' \
106*ca987d46SWarner Losh		${.ALLSRC} > ${.TARGET}
107*ca987d46SWarner Losh
108*ca987d46SWarner Losh# decompression functionality from zlib
109*ca987d46SWarner Losh.PATH: ${SRCTOP}/contrib/zlib
110*ca987d46SWarner LoshCFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/contrib/zlib
111*ca987d46SWarner LoshSRCS+=	adler32.c crc32.c libsa_zutil.h libsa_gzguts.h
112*ca987d46SWarner Losh
113*ca987d46SWarner Losh.for file in infback.c inffast.c inflate.c inftrees.c zutil.c
114*ca987d46SWarner LoshSRCS+=	_${file}
115*ca987d46SWarner LoshCLEANFILES+=	_${file}
116*ca987d46SWarner Losh
117*ca987d46SWarner Losh_${file}: ${file}
118*ca987d46SWarner Losh	sed -e "s|zutil\.h|libsa_zutil.h|" \
119*ca987d46SWarner Losh	    -e "s|gzguts\.h|libsa_gzguts.h|" \
120*ca987d46SWarner Losh	    ${.ALLSRC} > ${.TARGET}
121*ca987d46SWarner Losh.endfor
122*ca987d46SWarner Losh
123*ca987d46SWarner Losh# depend on stand.h being able to be included multiple times
124*ca987d46SWarner Losh.for file in zutil.h gzguts.h
125*ca987d46SWarner LoshCLEANFILES+= libsa_${file}
126*ca987d46SWarner Loshlibsa_${file}: ${file}
127*ca987d46SWarner Losh	sed -e 's|<fcntl.h>|"stand.h"|' \
128*ca987d46SWarner Losh	    -e 's|<stddef.h>|"stand.h"|' \
129*ca987d46SWarner Losh	    -e 's|<string.h>|"stand.h"|' \
130*ca987d46SWarner Losh	    -e 's|<stdio.h>|"stand.h"|' \
131*ca987d46SWarner Losh	    -e 's|<stdlib.h>|"stand.h"|' \
132*ca987d46SWarner Losh	    ${.ALLSRC} > ${.TARGET}
133*ca987d46SWarner Losh.endfor
134*ca987d46SWarner Losh
135*ca987d46SWarner Losh# io routines
136*ca987d46SWarner LoshSRCS+=	closeall.c dev.c ioctl.c nullfs.c stat.c \
137*ca987d46SWarner Losh	fstat.c close.c lseek.c open.c read.c write.c readdir.c
138*ca987d46SWarner Losh
139*ca987d46SWarner Losh# network routines
140*ca987d46SWarner LoshSRCS+=	arp.c ether.c ip.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
141*ca987d46SWarner Losh
142*ca987d46SWarner Losh# network info services:
143*ca987d46SWarner LoshSRCS+=	bootp.c rarp.c bootparam.c
144*ca987d46SWarner Losh
145*ca987d46SWarner Losh# boot filesystems
146*ca987d46SWarner LoshSRCS+=	ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
147*ca987d46SWarner LoshSRCS+=	dosfs.c ext2fs.c
148*ca987d46SWarner LoshSRCS+=	splitfs.c
149*ca987d46SWarner LoshSRCS+=	pkgfs.c
150*ca987d46SWarner Losh.if ${MK_NAND} != "no"
151*ca987d46SWarner LoshSRCS+=	nandfs.c
152*ca987d46SWarner Losh.endif
153*ca987d46SWarner Losh
154*ca987d46SWarner Losh# explicit_bzero
155*ca987d46SWarner Losh.PATH: ${SYSDIR}/libkern
156*ca987d46SWarner LoshSRCS+=  explicit_bzero.c
157*ca987d46SWarner Losh
158*ca987d46SWarner Losh.include <bsd.stand.mk>
159*ca987d46SWarner Losh.include <bsd.lib.mk>
160