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
40 # standalone components and stuff we have modified locally
41 SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
42 globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
43 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
45 # private (pruned) versions of libc string functions
48 .PATH: ${.CURDIR}/../libc/net
52 # string functions from libc
53 .PATH: ${.CURDIR}/../libc/string
54 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
55 ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
56 ${MACHINE_CPUARCH} == "arm"
57 SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
58 memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
59 strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
60 strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
62 .if ${MACHINE_CPUARCH} == "arm"
63 .PATH: ${.CURDIR}/../libc/arm/gen
65 .if ${MK_ARM_EABI} == "no"
68 # Compiler support functions
69 .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/
70 # __clzsi2 and ctzsi2 for various builtin functions
71 SRCS+= clzsi2.c ctzsi2.c
72 # Divide and modulus functions called by the compiler
73 SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
74 SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
76 .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm/
77 SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
78 SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
82 .if ${MACHINE_CPUARCH} == "ia64"
83 .PATH: ${.CURDIR}/../libc/ia64/string
84 SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \
85 memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
86 strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
87 strspn.c strstr.c strtok.c swab.c
89 .PATH: ${.CURDIR}/../libc/ia64/gen
90 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
91 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
93 .if ${MACHINE_CPUARCH} == "powerpc"
94 .PATH: ${.CURDIR}/../libc/quad
95 SRCS+= ashldi3.c ashrdi3.c
96 .PATH: ${.CURDIR}/../libc/powerpc/gen
100 # uuid functions from libc
101 .PATH: ${.CURDIR}/../libc/uuid
102 SRCS+= uuid_equal.c uuid_is_nil.c
105 .if ${MACHINE_CPUARCH} == "amd64"
106 .PATH: ${.CURDIR}/i386
107 .elif ${MACHINE_ARCH} == "powerpc64"
108 .PATH: ${.CURDIR}/powerpc
110 .PATH: ${.CURDIR}/${MACHINE_CPUARCH}
114 # decompression functionality from libbz2
115 # NOTE: to actually test this functionality after libbz2 upgrade compile
116 # loader(8) with LOADER_BZIP2_SUPPORT defined
117 .PATH: ${.CURDIR}/../../contrib/bzip2
118 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
119 SRCS+= libstand_bzlib_private.h
121 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
123 CLEANFILES+= _${file}
126 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
129 CLEANFILES+= libstand_bzlib_private.h
130 libstand_bzlib_private.h: bzlib_private.h
131 sed -e 's|<stdlib.h>|"stand.h"|' \
132 ${.ALLSRC} > ${.TARGET}
134 # decompression functionality from libz
135 .PATH: ${.CURDIR}/../libz
136 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
137 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
139 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
141 CLEANFILES+= _${file}
144 sed -e "s|zutil\.h|libstand_zutil.h|" \
145 -e "s|gzguts\.h|libstand_gzguts.h|" \
146 ${.ALLSRC} > ${.TARGET}
149 # depend on stand.h being able to be included multiple times
150 .for file in zutil.h gzguts.h
151 CLEANFILES+= libstand_${file}
152 libstand_${file}: ${file}
153 sed -e 's|<fcntl.h>|"stand.h"|' \
154 -e 's|<stddef.h>|"stand.h"|' \
155 -e 's|<string.h>|"stand.h"|' \
156 -e 's|<stdio.h>|"stand.h"|' \
157 -e 's|<stdlib.h>|"stand.h"|' \
158 ${.ALLSRC} > ${.TARGET}
162 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
163 fstat.c close.c lseek.c open.c read.c write.c readdir.c
166 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
168 # network info services:
169 SRCS+= bootp.c rarp.c bootparam.c
172 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
173 SRCS+= dosfs.c ext2fs.c
175 .if ${MK_NAND} != "no"
179 .include <bsd.lib.mk>
181 .if ${MACHINE_CPUARCH} == "amd64"
182 beforedepend ${OBJS}: machine
183 cleandepend: cleanmachine
188 ln -s ${.CURDIR}/../../sys/i386/include machine