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
14 S= ${.CURDIR}/../../../../lib/libstand
24 CFLAGS+= -ffreestanding -Wformat -fPIC
25 CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
27 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
28 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2
30 .if ${MACHINE_CPUARCH} == "i386"
31 CFLAGS+= -mpreferred-stack-boundary=2
34 .if ${MACHINE} == "pc98"
37 .if ${MACHINE_CPUARCH} == "powerpc"
38 CFLAGS+= -msoft-float -D_STANDALONE -DNETIF_DEBUG
40 .if ${MACHINE_CPUARCH} == "arm"
41 CFLAGS+= -msoft-float -D_STANDALONE
44 # standalone components and stuff we have modified locally
45 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
46 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
47 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
49 # private (pruned) versions of libc string functions
52 LIBC= ${.CURDIR}/../../../../lib/libc
58 # string functions from libc
60 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
61 ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
62 ${MACHINE_CPUARCH} == "arm"
63 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
64 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
65 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
66 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
68 .if ${MACHINE_CPUARCH} == "arm"
69 .PATH: ${LIBC}/arm/gen
72 .if ${MACHINE_CPUARCH} == "ia64"
73 .PATH: ${LIBC}/ia64/string
74 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
75 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
76 strcmp.c strcpy.c strcspn.c strlen.c \
77 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
78 strspn.c strstr.c strtok.c swab.c
80 .PATH: ${LIBC}/ia64/gen
81 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
82 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
84 .if ${MACHINE_CPUARCH} == "powerpc"
85 .PATH: ${LIBC}/libc/quad
86 SRCS+= ashldi3.c ashrdi3.c
87 .PATH: ${LIBC}/powerpc/gen
91 # uuid functions from libc
93 SRCS+= uuid_equal.c uuid_is_nil.c
96 .if ${MACHINE_CPUARCH} == "amd64"
97 .PATH: ${.CURDIR}/amd64
98 .elif ${MACHINE_ARCH} == "powerpc64"
101 .PATH: ${S}/${MACHINE_CPUARCH}
105 # decompression functionality from libbz2
106 # NOTE: to actually test this functionality after libbz2 upgrade compile
107 # loader(8) with LOADER_BZIP2_SUPPORT defined
108 .PATH: ${.CURDIR}/../../../../contrib/bzip2
109 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
110 SRCS+= libstand_bzlib_private.h
112 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
114 CLEANFILES+= _${file}
117 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
120 CLEANFILES+= libstand_bzlib_private.h
121 libstand_bzlib_private.h: bzlib_private.h
122 sed -e 's|<stdlib.h>|"stand.h"|' \
123 ${.ALLSRC} > ${.TARGET}
125 # decompression functionality from libz
126 .PATH: ${.CURDIR}/../../../../lib/libz
127 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../../../../lib/libz
128 SRCS+= adler32.c crc32.c libstand_zutil.h
130 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
132 CLEANFILES+= _${file}
135 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
138 # depend on stand.h being able to be included multiple times
139 CLEANFILES+= libstand_zutil.h
140 libstand_zutil.h: zutil.h
141 sed -e 's|<stddef.h>|"stand.h"|' \
142 -e 's|<string.h>|"stand.h"|' \
143 -e 's|<stdlib.h>|"stand.h"|' \
144 ${.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 .include <bsd.lib.mk>