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"
28 # standalone components and stuff we have modified locally
29 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
30 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
31 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
33 # private (pruned) versions of libc string functions
36 # byte order functions from libc
37 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
38 SRCS+= htons.S ntohs.S htonl.S ntohl.S
40 # string functions from libc
41 .PATH: ${.CURDIR}/../libc/string
42 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
43 ${MACHINE_ARCH} == "sparc64"
44 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
45 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
46 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
47 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
49 .if ${MACHINE_ARCH} == "alpha"
50 .PATH: ${.CURDIR}/../libc/alpha/string
51 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
52 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
53 strcmp.c strcpy.c strcspn.c strlen.c \
54 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
55 strspn.c strstr.c strtok.c swab.c
57 SRCS+= __divqu.S __divq.S __divlu.S __divl.S
58 SRCS+= __remqu.S __remq.S __remlu.S __reml.S
60 CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
61 CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
64 __divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
65 m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
66 ${.ALLSRC} > ${.TARGET}
68 __divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
69 m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
70 ${.ALLSRC} > ${.TARGET}
72 __divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
73 m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
74 ${.ALLSRC} > ${.TARGET}
76 __divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
77 m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
78 ${.ALLSRC} > ${.TARGET}
80 __remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
81 m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
82 ${.ALLSRC} > ${.TARGET}
84 __remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
85 m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
86 ${.ALLSRC} > ${.TARGET}
88 __remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
89 m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
90 ${.ALLSRC} > ${.TARGET}
92 __reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
93 m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
94 ${.ALLSRC} > ${.TARGET}
96 .if ${MACHINE_ARCH} == "ia64"
97 .PATH: ${.CURDIR}/../libc/ia64/string
98 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
99 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
100 strcmp.c strcpy.c strcspn.c strlen.c \
101 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
102 strspn.c strstr.c strtok.c swab.c
104 .PATH: ${.CURDIR}/../libc/ia64/gen
105 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
106 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
110 .PATH: ${.CURDIR}/${MACHINE_ARCH}
113 # decompression functionality from libbz2
114 .PATH: ${.CURDIR}/../../contrib/bzip2
115 CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS
116 SRCS+= _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \
119 # check your belt - ugly bzip2 stuff ahead
120 .for file in bzlib.c bzlib.h bzlib_private.h
121 CLEANFILES+= _${file} _${file}.orig
123 _${file}: ${file} ${file}.diff
124 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
127 .for file in crctable.c decompress.c huffman.c randtable.c
128 CLEANFILES+= _${file}
131 sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
134 # decompression functionality from libz
135 .PATH: ${.CURDIR}/../libz
136 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
137 SRCS+= adler32.c crc32.c _infblock.c _infcodes.c _inffast.c _inflate.c \
138 _inftrees.c _infutil.c _zutil.c _zutil.h
142 CLEANFILES+= _${file} _${file}.orig
144 _${file}: ${file} ${file}.diff
145 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
148 .for file in infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c zutil.c
150 sed "s|zutil\.h|_zutil.h|" ${.ALLSRC} > ${.TARGET}
154 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
155 fstat.c close.c lseek.c open.c read.c write.c readdir.c
158 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
160 # network info services:
161 SRCS+= bootp.c rarp.c bootparam.c
164 SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
166 SRCS+= dosfs.c ext2fs.c
169 .include <bsd.lib.mk>