2 # Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
5 # - We don't use the libc strerror/sys_errlist because the string table is
12 .include <src.opts.mk>
14 LIBSTAND_SRC= ${.CURDIR}
15 LIBC_SRC= ${LIBSTAND_SRC}/../libc
24 CFLAGS+= -I${LIBSTAND_SRC}
26 # standalone components and stuff we have modified locally
27 SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
28 globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
29 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
31 # private (pruned) versions of libc string functions
34 .PATH: ${LIBC_SRC}/net
38 # string functions from libc
39 .PATH: ${LIBC_SRC}/string
40 SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
41 memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
42 strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
43 strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
44 .if ${MACHINE_CPUARCH} == "arm"
45 .PATH: ${LIBC_SRC}/arm/gen
47 # Compiler support functions
48 .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/
49 # __clzsi2 and ctzsi2 for various builtin functions
50 SRCS+= clzsi2.c ctzsi2.c
51 # Divide and modulus functions called by the compiler
52 SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
53 SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
55 .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/arm/
56 SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
57 SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
60 .if ${MACHINE_CPUARCH} == "aarch64"
61 .PATH: ${LIBC_SRC}/aarch64/gen
64 .if ${MACHINE_CPUARCH} == "powerpc"
65 .PATH: ${LIBC_SRC}/quad
66 SRCS+= ashldi3.c ashrdi3.c
70 # uuid functions from libc
71 .PATH: ${LIBC_SRC}/uuid
72 SRCS+= uuid_equal.c uuid_is_nil.c
75 .PATH: ${LIBSTAND_SRC}/${MACHINE_CPUARCH}
78 # decompression functionality from libbz2
79 # NOTE: to actually test this functionality after libbz2 upgrade compile
80 # loader(8) with LOADER_BZIP2_SUPPORT defined
81 .PATH: ${LIBSTAND_SRC}/../../contrib/bzip2
82 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
83 SRCS+= libstand_bzlib_private.h
85 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
90 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \
91 ${.ALLSRC} > ${.TARGET}
94 CLEANFILES+= libstand_bzlib_private.h
95 libstand_bzlib_private.h: bzlib_private.h
96 sed -e 's|<stdlib.h>|"stand.h"|' \
97 ${.ALLSRC} > ${.TARGET}
99 # decompression functionality from libz
100 .PATH: ${LIBSTAND_SRC}/../libz
101 CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz
102 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
104 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
106 CLEANFILES+= _${file}
109 sed -e "s|zutil\.h|libstand_zutil.h|" \
110 -e "s|gzguts\.h|libstand_gzguts.h|" \
111 ${.ALLSRC} > ${.TARGET}
114 # depend on stand.h being able to be included multiple times
115 .for file in zutil.h gzguts.h
116 CLEANFILES+= libstand_${file}
117 libstand_${file}: ${file}
118 sed -e 's|<fcntl.h>|"stand.h"|' \
119 -e 's|<stddef.h>|"stand.h"|' \
120 -e 's|<string.h>|"stand.h"|' \
121 -e 's|<stdio.h>|"stand.h"|' \
122 -e 's|<stdlib.h>|"stand.h"|' \
123 ${.ALLSRC} > ${.TARGET}
127 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
128 fstat.c close.c lseek.c open.c read.c write.c readdir.c
131 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
133 # network info services:
134 SRCS+= bootp.c rarp.c bootparam.c
137 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
138 SRCS+= dosfs.c ext2fs.c
141 .if ${MK_NAND} != "no"
145 .include <bsd.stand.mk>
146 .include <bsd.lib.mk>