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
18 CFLAGS+= -ffreestanding -Wformat
21 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
22 CFLAGS+= -mpreferred-stack-boundary=2
23 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2
25 .if ${MACHINE_ARCH} == "i386"
28 .if ${MACHINE} == "pc98"
31 .if ${MACHINE_ARCH} == "powerpc"
32 CFLAGS+= -msoft-float -D_STANDALONE
34 .if ${MACHINE_ARCH} == "amd64"
37 .if ${MACHINE_ARCH} == "arm"
38 CFLAGS+= -msoft-float -D_STANDALONE
41 # standalone components and stuff we have modified locally
42 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
43 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
44 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
46 # private (pruned) versions of libc string functions
49 .PATH: ${.CURDIR}/../libc/net
53 # string functions from libc
54 .PATH: ${.CURDIR}/../libc/string
55 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
56 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64" || \
57 ${MACHINE_ARCH} == "arm"
58 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
59 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
60 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
61 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
63 .if ${MACHINE_ARCH} == "arm"
64 .PATH: ${.CURDIR}/../libc/arm/gen
67 .if ${MACHINE_ARCH} == "ia64"
68 .PATH: ${.CURDIR}/../libc/ia64/string
69 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
70 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
71 strcmp.c strcpy.c strcspn.c strlen.c \
72 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
73 strspn.c strstr.c strtok.c swab.c
75 .PATH: ${.CURDIR}/../libc/ia64/gen
76 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
77 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
79 .if ${MACHINE_ARCH} == "powerpc"
80 .PATH: ${.CURDIR}/../libc/quad
81 SRCS+= ashldi3.c ashrdi3.c
82 .PATH: ${.CURDIR}/../libc/powerpc/gen
86 # uuid functions from libc
87 .PATH: ${.CURDIR}/../libc/uuid
88 SRCS+= uuid_equal.c uuid_is_nil.c
91 .if ${MACHINE_ARCH} == "amd64"
92 .PATH: ${.CURDIR}/i386
94 .PATH: ${.CURDIR}/${MACHINE_ARCH}
98 # decompression functionality from libbz2
99 # NOTE: to actually test this functionality after libbz2 upgrade compile
100 # loader(8) with LOADER_BZIP2_SUPPORT defined
101 .PATH: ${.CURDIR}/../../contrib/bzip2
102 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
103 SRCS+= libstand_bzlib_private.h
105 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
107 CLEANFILES+= _${file}
110 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
113 CLEANFILES+= libstand_bzlib_private.h
114 libstand_bzlib_private.h: bzlib_private.h
115 sed -e 's|<stdlib.h>|"stand.h"|' \
116 ${.ALLSRC} > ${.TARGET}
118 # decompression functionality from libz
119 .PATH: ${.CURDIR}/../libz
120 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
121 SRCS+= adler32.c crc32.c libstand_zutil.h
123 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
125 CLEANFILES+= _${file}
128 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
131 # depend on stand.h being able to be included multiple times
132 CLEANFILES+= libstand_zutil.h
133 libstand_zutil.h: zutil.h
134 sed -e 's|<stddef.h>|"stand.h"|' \
135 -e 's|<string.h>|"stand.h"|' \
136 -e 's|<stdlib.h>|"stand.h"|' \
137 ${.ALLSRC} > ${.TARGET}
140 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
141 fstat.c close.c lseek.c open.c read.c write.c readdir.c
144 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
146 # network info services:
147 SRCS+= bootp.c rarp.c bootparam.c
150 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
151 SRCS+= dosfs.c ext2fs.c
154 .include <bsd.lib.mk>
156 .if ${MACHINE_ARCH} == "amd64"
157 beforedepend ${OBJS}: machine
158 cleandepend: cleanmachine
163 ln -s ${.CURDIR}/../../sys/i386/include machine