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"
22 CFLAGS+= -mpreferred-stack-boundary=2
24 .if ${MACHINE_ARCH} == "powerpc"
25 CFLAGS+= -msoft-float -D_STANDALONE
27 .if ${MACHINE_ARCH} == "amd64"
31 # standalone components and stuff we have modified locally
32 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
33 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
34 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
36 # private (pruned) versions of libc string functions
39 # byte order functions from libc
40 .if ${MACHINE_ARCH} != "amd64"
41 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
43 .PATH: ${.CURDIR}/../libc/i386/net
45 SRCS+= htons.S ntohs.S htonl.S ntohl.S
47 # string functions from libc
48 .PATH: ${.CURDIR}/../libc/string
49 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
50 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64"
51 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
52 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
53 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
54 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
56 .if ${MACHINE_ARCH} == "alpha"
57 .PATH: ${.CURDIR}/../libc/alpha/string
58 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
59 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
60 strcmp.c strcpy.c strcspn.c strlen.c \
61 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
62 strspn.c strstr.c strtok.c swab.c
64 SRCS+= __divqu.S __divq.S __divlu.S __divl.S
65 SRCS+= __remqu.S __remq.S __remlu.S __reml.S
67 CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
68 CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
71 __divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
72 m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
73 ${.ALLSRC} > ${.TARGET}
75 __divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
76 m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
77 ${.ALLSRC} > ${.TARGET}
79 __divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
80 m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
81 ${.ALLSRC} > ${.TARGET}
83 __divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
84 m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
85 ${.ALLSRC} > ${.TARGET}
87 __remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
88 m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
89 ${.ALLSRC} > ${.TARGET}
91 __remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
92 m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
93 ${.ALLSRC} > ${.TARGET}
95 __remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
96 m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
97 ${.ALLSRC} > ${.TARGET}
99 __reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
100 m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
101 ${.ALLSRC} > ${.TARGET}
103 .if ${MACHINE_ARCH} == "ia64"
104 .PATH: ${.CURDIR}/../libc/ia64/string
105 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
106 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
107 strcmp.c strcpy.c strcspn.c strlen.c \
108 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
109 strspn.c strstr.c strtok.c swab.c
111 .PATH: ${.CURDIR}/../libc/ia64/gen
112 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
113 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
115 .if ${MACHINE_ARCH} == "powerpc"
116 .PATH: ${.CURDIR}/../libc/quad
117 SRCS+= ashldi3.c ashrdi3.c
118 .PATH: ${.CURDIR}/../libc/powerpc/gen
123 .if ${MACHINE_ARCH} == "amd64"
124 .PATH: ${.CURDIR}/i386
126 .PATH: ${.CURDIR}/${MACHINE_ARCH}
130 # decompression functionality from libbz2
131 .PATH: ${.CURDIR}/../../contrib/bzip2
132 CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS
133 SRCS+= _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \
136 # check your belt - ugly bzip2 stuff ahead
137 .for file in bzlib.c bzlib.h bzlib_private.h
138 CLEANFILES+= _${file} _${file}.orig
140 _${file}: ${file} ${file}.diff
141 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
144 .for file in crctable.c decompress.c huffman.c randtable.c
145 CLEANFILES+= _${file}
148 sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
151 # decompression functionality from libz
152 .PATH: ${.CURDIR}/../libz
153 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
154 SRCS+= adler32.c crc32.c _infblock.c _infcodes.c _inffast.c _inflate.c \
155 _inftrees.c _infutil.c _zutil.c _zutil.h
159 CLEANFILES+= _${file} _${file}.orig
161 _${file}: ${file} ${file}.diff
162 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
165 .for file in infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c zutil.c
166 CLEANFILES+= _${file}
169 sed "s|zutil\.h|_zutil.h|" ${.ALLSRC} > ${.TARGET}
173 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
174 fstat.c close.c lseek.c open.c read.c write.c readdir.c
177 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
179 # network info services:
180 SRCS+= bootp.c rarp.c bootparam.c
183 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
184 SRCS+= dosfs.c ext2fs.c
187 .include <bsd.lib.mk>
189 .if ${MACHINE_ARCH} == "amd64"
190 ${SRCS:M*.c:R:S/$/.o/g}: machine
192 beforedepend: machine
195 ln -s ${.CURDIR}/../../sys/i386/include machine