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 LIBSTAND_SRC?= ${.CURDIR}
13 LIBSTAND_CPUARCH?=${MACHINE_CPUARCH}
14 LIBC_SRC= ${LIBSTAND_SRC}/../libc
24 CFLAGS+= -ffreestanding -Wformat
25 CFLAGS+= -I${LIBSTAND_SRC}
27 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
28 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
30 .if ${MACHINE_CPUARCH} == "i386"
31 CFLAGS.gcc+= -mpreferred-stack-boundary=2
33 .if ${MACHINE_CPUARCH} == "amd64"
34 CFLAGS+= -fPIC -mno-red-zone
36 .if ${MACHINE} == "pc98"
39 .if ${MACHINE_CPUARCH} == "powerpc"
40 CFLAGS+= -msoft-float -D_STANDALONE -DNETIF_DEBUG
42 .if ${MACHINE_CPUARCH} == "arm"
43 CFLAGS+= -msoft-float -D_STANDALONE
45 .if ${MACHINE_CPUARCH} == "mips"
46 CFLAGS+= -G0 -fno-pic -mno-abicalls
49 # standalone components and stuff we have modified locally
50 SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \
51 globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
52 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
54 # private (pruned) versions of libc string functions
57 .PATH: ${LIBC_SRC}/net
61 # string functions from libc
62 .PATH: ${LIBC_SRC}/string
63 .if ${MACHINE_CPUARCH} != "ia64"
64 SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
65 memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
66 strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \
67 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
69 .if ${MACHINE_CPUARCH} == "arm"
70 .PATH: ${LIBC_SRC}/arm/gen
72 .if ${MK_ARM_EABI} == "no"
75 # Compiler support functions
76 .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/
77 # __clzsi2 and ctzsi2 for various builtin functions
78 SRCS+= clzsi2.c ctzsi2.c
79 # Divide and modulus functions called by the compiler
80 SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
81 SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
83 .PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/arm/
84 SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
85 SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
89 .if ${MACHINE_CPUARCH} == "ia64"
90 .PATH: ${LIBC_SRC}/ia64/string
91 SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \
92 memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
94 strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
95 strspn.c strstr.c strtok.c swab.c
97 .PATH: ${LIBC_SRC}/ia64/gen
98 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
99 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
101 .if ${MACHINE_CPUARCH} == "powerpc"
102 .PATH: ${LIBC_SRC}/quad
103 SRCS+= ashldi3.c ashrdi3.c
104 .PATH: ${LIBC_SRC}/powerpc/gen
108 # uuid functions from libc
109 .PATH: ${LIBC_SRC}/uuid
110 SRCS+= uuid_equal.c uuid_is_nil.c
113 .if ${MACHINE_ARCH} == "powerpc64"
114 .PATH: ${LIBSTAND_SRC}/powerpc
116 .PATH: ${LIBSTAND_SRC}/${LIBSTAND_CPUARCH}
120 # decompression functionality from libbz2
121 # NOTE: to actually test this functionality after libbz2 upgrade compile
122 # loader(8) with LOADER_BZIP2_SUPPORT defined
123 .PATH: ${LIBSTAND_SRC}/../../contrib/bzip2
124 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
125 SRCS+= libstand_bzlib_private.h
127 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
129 CLEANFILES+= _${file}
132 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
135 CLEANFILES+= libstand_bzlib_private.h
136 libstand_bzlib_private.h: bzlib_private.h
137 sed -e 's|<stdlib.h>|"stand.h"|' \
138 ${.ALLSRC} > ${.TARGET}
140 # decompression functionality from libz
141 .PATH: ${LIBSTAND_SRC}/../../contrib/zlib
142 CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../../contrib/zlib
143 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
145 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
147 CLEANFILES+= _${file}
150 sed -e "s|zutil\.h|libstand_zutil.h|" \
151 -e "s|gzguts\.h|libstand_gzguts.h|" \
152 ${.ALLSRC} > ${.TARGET}
155 # depend on stand.h being able to be included multiple times
156 .for file in zutil.h gzguts.h
157 CLEANFILES+= libstand_${file}
158 libstand_${file}: ${file}
159 sed -e 's|<fcntl.h>|"stand.h"|' \
160 -e 's|<stddef.h>|"stand.h"|' \
161 -e 's|<string.h>|"stand.h"|' \
162 -e 's|<stdio.h>|"stand.h"|' \
163 -e 's|<stdlib.h>|"stand.h"|' \
164 ${.ALLSRC} > ${.TARGET}
168 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
169 fstat.c close.c lseek.c open.c read.c write.c readdir.c
172 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
174 # network info services:
175 SRCS+= bootp.c rarp.c bootparam.c
178 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
179 SRCS+= dosfs.c ext2fs.c
181 .if ${MK_NAND} != "no"
185 .include <bsd.lib.mk>