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
20 CFLAGS+= -ffreestanding -Wformat
23 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
24 CFLAGS+= -mpreferred-stack-boundary=2
25 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
27 .if ${MACHINE} == "pc98"
30 .if ${MACHINE_CPUARCH} == "powerpc"
31 CFLAGS+= -msoft-float -D_STANDALONE -DNETIF_DEBUG
33 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
36 .if ${MACHINE_CPUARCH} == "arm"
37 CFLAGS+= -msoft-float -D_STANDALONE
39 .if ${MACHINE_CPUARCH} == "mips"
40 CFLAGS+= -G0 -fno-pic -mno-abicalls
43 # standalone components and stuff we have modified locally
44 SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
45 globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
46 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
48 # private (pruned) versions of libc string functions
51 .PATH: ${.CURDIR}/../libc/net
55 # string functions from libc
56 .PATH: ${.CURDIR}/../libc/string
57 .if ${MACHINE_CPUARCH} != "ia64"
58 SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
59 memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
60 strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
61 strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
63 .if ${MACHINE_CPUARCH} == "arm"
64 .PATH: ${.CURDIR}/../libc/arm/gen
66 .if ${MK_ARM_EABI} == "no"
69 # Compiler support functions
70 .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/
71 # __clzsi2 and ctzsi2 for various builtin functions
72 SRCS+= clzsi2.c ctzsi2.c
73 # Divide and modulus functions called by the compiler
74 SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
75 SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
77 .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm/
78 SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
79 SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
83 .if ${MACHINE_CPUARCH} == "ia64"
84 .PATH: ${.CURDIR}/../libc/ia64/string
85 SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \
86 memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
87 strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
88 strspn.c strstr.c strtok.c swab.c
90 .PATH: ${.CURDIR}/../libc/ia64/gen
91 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
92 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
94 .if ${MACHINE_CPUARCH} == "powerpc"
95 .PATH: ${.CURDIR}/../libc/quad
96 SRCS+= ashldi3.c ashrdi3.c
97 .PATH: ${.CURDIR}/../libc/powerpc/gen
101 # uuid functions from libc
102 .PATH: ${.CURDIR}/../libc/uuid
103 SRCS+= uuid_equal.c uuid_is_nil.c
106 .if ${MACHINE_CPUARCH} == "amd64"
107 .PATH: ${.CURDIR}/i386
108 .elif ${MACHINE_ARCH} == "powerpc64"
109 .PATH: ${.CURDIR}/powerpc
111 .PATH: ${.CURDIR}/${MACHINE_CPUARCH}
115 # decompression functionality from libbz2
116 # NOTE: to actually test this functionality after libbz2 upgrade compile
117 # loader(8) with LOADER_BZIP2_SUPPORT defined
118 .PATH: ${.CURDIR}/../../contrib/bzip2
119 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
120 SRCS+= libstand_bzlib_private.h
122 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
124 CLEANFILES+= _${file}
127 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
130 CLEANFILES+= libstand_bzlib_private.h
131 libstand_bzlib_private.h: bzlib_private.h
132 sed -e 's|<stdlib.h>|"stand.h"|' \
133 ${.ALLSRC} > ${.TARGET}
135 # decompression functionality from libz
136 .PATH: ${.CURDIR}/../libz
137 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
138 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
140 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
142 CLEANFILES+= _${file}
145 sed -e "s|zutil\.h|libstand_zutil.h|" \
146 -e "s|gzguts\.h|libstand_gzguts.h|" \
147 ${.ALLSRC} > ${.TARGET}
150 # depend on stand.h being able to be included multiple times
151 .for file in zutil.h gzguts.h
152 CLEANFILES+= libstand_${file}
153 libstand_${file}: ${file}
154 sed -e 's|<fcntl.h>|"stand.h"|' \
155 -e 's|<stddef.h>|"stand.h"|' \
156 -e 's|<string.h>|"stand.h"|' \
157 -e 's|<stdio.h>|"stand.h"|' \
158 -e 's|<stdlib.h>|"stand.h"|' \
159 ${.ALLSRC} > ${.TARGET}
163 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
164 fstat.c close.c lseek.c open.c read.c write.c readdir.c
167 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
169 # network info services:
170 SRCS+= bootp.c rarp.c bootparam.c
173 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
174 SRCS+= dosfs.c ext2fs.c
176 .if ${MK_NAND} != "no"
180 .include <bsd.lib.mk>
182 .if ${MACHINE_CPUARCH} == "amd64"
183 beforedepend ${OBJS}: machine
184 cleandepend: cleanmachine
189 ln -s ${.CURDIR}/../../sys/i386/include machine