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
15 CFLAGS+= -ffreestanding -Wformat
18 .if ${MACHINE_ARCH} == "alpha"
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_ARCH} == "powerpc"
29 CFLAGS+= -msoft-float -D_STANDALONE
31 .if ${MACHINE_ARCH} == "amd64"
35 # standalone components and stuff we have modified locally
36 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
37 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
38 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
40 # private (pruned) versions of libc string functions
43 # byte order functions from libc
44 .if ${MACHINE_ARCH} != "amd64"
45 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
47 .PATH: ${.CURDIR}/../libc/i386/net
49 SRCS+= htons.S ntohs.S htonl.S ntohl.S
51 # string functions from libc
52 .PATH: ${.CURDIR}/../libc/string
53 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
54 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64"
55 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
56 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
57 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
58 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
60 .if ${MACHINE_ARCH} == "alpha"
61 .PATH: ${.CURDIR}/../libc/alpha/string
62 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
63 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
64 strcmp.c strcpy.c strcspn.c strlen.c \
65 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
66 strspn.c strstr.c strtok.c swab.c
68 SRCS+= __divqu.S __divq.S __divlu.S __divl.S
69 SRCS+= __remqu.S __remq.S __remlu.S __reml.S
71 CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
72 CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
75 __divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
76 m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
77 ${.ALLSRC} > ${.TARGET}
79 __divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
80 m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
81 ${.ALLSRC} > ${.TARGET}
83 __divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
84 m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
85 ${.ALLSRC} > ${.TARGET}
87 __divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
88 m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
89 ${.ALLSRC} > ${.TARGET}
91 __remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
92 m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
93 ${.ALLSRC} > ${.TARGET}
95 __remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
96 m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
97 ${.ALLSRC} > ${.TARGET}
99 __remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
100 m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
101 ${.ALLSRC} > ${.TARGET}
103 __reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
104 m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
105 ${.ALLSRC} > ${.TARGET}
107 .if ${MACHINE_ARCH} == "ia64"
108 .PATH: ${.CURDIR}/../libc/ia64/string
109 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
110 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
111 strcmp.c strcpy.c strcspn.c strlen.c \
112 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
113 strspn.c strstr.c strtok.c swab.c
115 .PATH: ${.CURDIR}/../libc/ia64/gen
116 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
117 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
119 .if ${MACHINE_ARCH} == "powerpc"
120 .PATH: ${.CURDIR}/../libc/quad
121 SRCS+= ashldi3.c ashrdi3.c
122 .PATH: ${.CURDIR}/../libc/powerpc/gen
127 .if ${MACHINE_ARCH} == "amd64"
128 .PATH: ${.CURDIR}/i386
130 .PATH: ${.CURDIR}/${MACHINE_ARCH}
134 # decompression functionality from libbz2
135 # NOTE: to actually test this functionality after libbz2 upgrade compile
136 # loader(8) with LOADER_BZIP2_SUPPORT defined
137 .PATH: ${.CURDIR}/../../contrib/bzip2
138 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
139 SRCS+= libstand_bzlib_private.h
141 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
143 CLEANFILES+= _${file}
146 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
149 CLEANFILES+= libstand_bzlib_private.h
150 libstand_bzlib_private.h: bzlib_private.h
151 sed -e 's|<stdlib.h>|"stand.h"|' \
152 ${.ALLSRC} > ${.TARGET}
154 # decompression functionality from libz
155 .PATH: ${.CURDIR}/../libz
156 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
157 SRCS+= adler32.c crc32.c libstand_zutil.h
159 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
161 CLEANFILES+= _${file}
164 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
167 # depend on stand.h being able to be included multiple times
168 CLEANFILES+= libstand_zutil.h
169 libstand_zutil.h: zutil.h
170 sed -e 's|<stddef.h>|"stand.h"|' \
171 -e 's|<string.h>|"stand.h"|' \
172 -e 's|<stdlib.h>|"stand.h"|' \
173 ${.ALLSRC} > ${.TARGET}
176 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
177 fstat.c close.c lseek.c open.c read.c write.c readdir.c
180 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
182 # network info services:
183 SRCS+= bootp.c rarp.c bootparam.c
186 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
187 SRCS+= dosfs.c ext2fs.c
190 .include <bsd.lib.mk>
192 .if ${MACHINE_ARCH} == "amd64"
193 ${SRCS:M*.c:R:S/$/.o/g}: machine
195 beforedepend: machine
198 ln -s ${.CURDIR}/../../sys/i386/include machine