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} == "pc98"
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
126 # uuid functions from libc
127 .PATH: ${.CURDIR}/../libc/uuid
128 SRCS+= uuid_equal.c uuid_is_nil.c
131 .if ${MACHINE_ARCH} == "amd64"
132 .PATH: ${.CURDIR}/i386
134 .PATH: ${.CURDIR}/${MACHINE_ARCH}
138 # decompression functionality from libbz2
139 # NOTE: to actually test this functionality after libbz2 upgrade compile
140 # loader(8) with LOADER_BZIP2_SUPPORT defined
141 .PATH: ${.CURDIR}/../../contrib/bzip2
142 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
143 SRCS+= libstand_bzlib_private.h
145 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
147 CLEANFILES+= _${file}
150 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
153 CLEANFILES+= libstand_bzlib_private.h
154 libstand_bzlib_private.h: bzlib_private.h
155 sed -e 's|<stdlib.h>|"stand.h"|' \
156 ${.ALLSRC} > ${.TARGET}
158 # decompression functionality from libz
159 .PATH: ${.CURDIR}/../libz
160 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
161 SRCS+= adler32.c crc32.c libstand_zutil.h
163 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
165 CLEANFILES+= _${file}
168 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
171 # depend on stand.h being able to be included multiple times
172 CLEANFILES+= libstand_zutil.h
173 libstand_zutil.h: zutil.h
174 sed -e 's|<stddef.h>|"stand.h"|' \
175 -e 's|<string.h>|"stand.h"|' \
176 -e 's|<stdlib.h>|"stand.h"|' \
177 ${.ALLSRC} > ${.TARGET}
180 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
181 fstat.c close.c lseek.c open.c read.c write.c readdir.c
184 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
186 # network info services:
187 SRCS+= bootp.c rarp.c bootparam.c
190 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
191 SRCS+= dosfs.c ext2fs.c
194 .include <bsd.lib.mk>
196 .if ${MACHINE_ARCH} == "amd64"
197 ${SRCS:M*.c:R:S/$/.o/g}: machine
199 beforedepend: machine
202 ln -s ${.CURDIR}/../../sys/i386/include machine