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>
21 CFLAGS+= -ffreestanding -Wformat
24 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
25 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
27 .if ${MACHINE_CPUARCH} == "i386"
28 CFLAGS.gcc+= -mpreferred-stack-boundary=2
30 .if ${MACHINE_CPUARCH} == "amd64"
33 .if ${MACHINE} == "pc98"
36 .if ${MACHINE_CPUARCH} == "powerpc"
37 CFLAGS+= -msoft-float -D_STANDALONE -DNETIF_DEBUG
39 .if ${MACHINE_CPUARCH} == "arm"
40 CFLAGS+= -msoft-float -D_STANDALONE
42 .if ${MACHINE_CPUARCH} == "mips"
43 CFLAGS+= -G0 -fno-pic -mno-abicalls
46 # standalone components and stuff we have modified locally
47 SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
48 globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
49 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
51 # private (pruned) versions of libc string functions
54 .PATH: ${.CURDIR}/../libc/net
58 # string functions from libc
59 .PATH: ${.CURDIR}/../libc/string
60 SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
61 memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
62 strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
63 strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
64 .if ${MACHINE_CPUARCH} == "arm"
65 .PATH: ${.CURDIR}/../libc/arm/gen
67 # Compiler support functions
68 .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/
69 # __clzsi2 and ctzsi2 for various builtin functions
70 SRCS+= clzsi2.c ctzsi2.c
71 # Divide and modulus functions called by the compiler
72 SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
73 SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
75 .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm/
76 SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
77 SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
80 .if ${MACHINE_CPUARCH} == "powerpc"
81 .PATH: ${.CURDIR}/../libc/quad
82 SRCS+= ashldi3.c ashrdi3.c
83 .PATH: ${.CURDIR}/../libc/powerpc/gen
87 # uuid functions from libc
88 .PATH: ${.CURDIR}/../libc/uuid
89 SRCS+= uuid_equal.c uuid_is_nil.c
92 .if ${MACHINE_ARCH} == "powerpc64"
93 .PATH: ${.CURDIR}/powerpc
95 .PATH: ${.CURDIR}/${MACHINE_CPUARCH}
99 # decompression functionality from libbz2
100 # NOTE: to actually test this functionality after libbz2 upgrade compile
101 # loader(8) with LOADER_BZIP2_SUPPORT defined
102 .PATH: ${.CURDIR}/../../contrib/bzip2
103 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
104 SRCS+= libstand_bzlib_private.h
106 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
108 CLEANFILES+= _${file}
111 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
114 CLEANFILES+= libstand_bzlib_private.h
115 libstand_bzlib_private.h: bzlib_private.h
116 sed -e 's|<stdlib.h>|"stand.h"|' \
117 ${.ALLSRC} > ${.TARGET}
119 # decompression functionality from libz
120 .PATH: ${.CURDIR}/../libz
121 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
122 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
124 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
126 CLEANFILES+= _${file}
129 sed -e "s|zutil\.h|libstand_zutil.h|" \
130 -e "s|gzguts\.h|libstand_gzguts.h|" \
131 ${.ALLSRC} > ${.TARGET}
134 # depend on stand.h being able to be included multiple times
135 .for file in zutil.h gzguts.h
136 CLEANFILES+= libstand_${file}
137 libstand_${file}: ${file}
138 sed -e 's|<fcntl.h>|"stand.h"|' \
139 -e 's|<stddef.h>|"stand.h"|' \
140 -e 's|<string.h>|"stand.h"|' \
141 -e 's|<stdio.h>|"stand.h"|' \
142 -e 's|<stdlib.h>|"stand.h"|' \
143 ${.ALLSRC} > ${.TARGET}
147 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
148 fstat.c close.c lseek.c open.c read.c write.c readdir.c
151 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
153 # network info services:
154 SRCS+= bootp.c rarp.c bootparam.c
157 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
158 SRCS+= dosfs.c ext2fs.c
161 .if ${MK_NAND} != "no"
165 .include <bsd.lib.mk>