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
27 .if ${MACHINE_CPUARCH} == "i386"
30 .if ${MACHINE} == "pc98"
33 .if ${MACHINE_CPUARCH} == "powerpc"
34 CFLAGS+= -msoft-float -D_STANDALONE
36 .if ${MACHINE_CPUARCH} == "amd64"
39 .if ${MACHINE_CPUARCH} == "arm"
40 CFLAGS+= -msoft-float -D_STANDALONE
43 # standalone components and stuff we have modified locally
44 SRCS+= 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 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} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
58 ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
59 ${MACHINE_CPUARCH} == "arm"
60 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
61 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
62 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
63 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
65 .if ${MACHINE_CPUARCH} == "arm"
66 .PATH: ${.CURDIR}/../libc/arm/gen
69 .if ${MACHINE_CPUARCH} == "ia64"
70 .PATH: ${.CURDIR}/../libc/ia64/string
71 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
72 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
73 strcmp.c strcpy.c strcspn.c strlen.c \
74 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
75 strspn.c strstr.c strtok.c swab.c
77 .PATH: ${.CURDIR}/../libc/ia64/gen
78 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
79 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
81 .if ${MACHINE_CPUARCH} == "powerpc"
82 .PATH: ${.CURDIR}/../libc/quad
83 SRCS+= ashldi3.c ashrdi3.c
84 .PATH: ${.CURDIR}/../libc/powerpc/gen
88 # uuid functions from libc
89 .PATH: ${.CURDIR}/../libc/uuid
90 SRCS+= uuid_equal.c uuid_is_nil.c
93 .if ${MACHINE_CPUARCH} == "amd64"
94 .PATH: ${.CURDIR}/i386
96 .PATH: ${.CURDIR}/${MACHINE_CPUARCH}
100 # decompression functionality from libbz2
101 # NOTE: to actually test this functionality after libbz2 upgrade compile
102 # loader(8) with LOADER_BZIP2_SUPPORT defined
103 .PATH: ${.CURDIR}/../../contrib/bzip2
104 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
105 SRCS+= libstand_bzlib_private.h
107 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
109 CLEANFILES+= _${file}
112 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
115 CLEANFILES+= libstand_bzlib_private.h
116 libstand_bzlib_private.h: bzlib_private.h
117 sed -e 's|<stdlib.h>|"stand.h"|' \
118 ${.ALLSRC} > ${.TARGET}
120 # decompression functionality from libz
121 .PATH: ${.CURDIR}/../libz
122 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
123 SRCS+= adler32.c crc32.c libstand_zutil.h
125 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
127 CLEANFILES+= _${file}
130 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
133 # depend on stand.h being able to be included multiple times
134 CLEANFILES+= libstand_zutil.h
135 libstand_zutil.h: zutil.h
136 sed -e 's|<stddef.h>|"stand.h"|' \
137 -e 's|<string.h>|"stand.h"|' \
138 -e 's|<stdlib.h>|"stand.h"|' \
139 ${.ALLSRC} > ${.TARGET}
142 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
143 fstat.c close.c lseek.c open.c read.c write.c readdir.c
146 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
148 # network info services:
149 SRCS+= bootp.c rarp.c bootparam.c
152 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
153 SRCS+= dosfs.c ext2fs.c
156 .include <bsd.lib.mk>
158 .if ${MACHINE_CPUARCH} == "amd64"
159 beforedepend ${OBJS}: machine
160 cleandepend: cleanmachine
165 ln -s ${.CURDIR}/../../sys/i386/include machine