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
17 .if ${MACHINE_ARCH} == "alpha"
20 .if ${MACHINE_ARCH} == "i386"
21 CFLAGS+= -mpreferred-stack-boundary=2
23 .if ${MACHINE_ARCH} == "powerpc"
27 # standalone components and stuff we have modified locally
28 SRCS+= __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
29 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
30 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
32 # private (pruned) versions of libc string functions
35 # byte order functions from libc
36 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
37 SRCS+= htons.S ntohs.S htonl.S ntohl.S
39 # string functions from libc
40 .PATH: ${.CURDIR}/../libc/string
41 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
42 ${MACHINE_ARCH} == "sparc64"
43 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
44 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
45 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
46 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
48 .if ${MACHINE_ARCH} == "alpha"
49 .PATH: ${.CURDIR}/../libc/alpha/string
50 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
51 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
52 strcmp.c strcpy.c strcspn.c strlen.c \
53 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
54 strspn.c strstr.c strtok.c swab.c
56 SRCS+= __divqu.S __divq.S __divlu.S __divl.S
57 SRCS+= __remqu.S __remq.S __remlu.S __reml.S
59 CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
60 CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
63 __divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
64 m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
65 ${.ALLSRC} > ${.TARGET}
67 __divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
68 m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
69 ${.ALLSRC} > ${.TARGET}
71 __divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
72 m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
73 ${.ALLSRC} > ${.TARGET}
75 __divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
76 m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
77 ${.ALLSRC} > ${.TARGET}
79 __remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
80 m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
81 ${.ALLSRC} > ${.TARGET}
83 __remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
84 m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
85 ${.ALLSRC} > ${.TARGET}
87 __remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
88 m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
89 ${.ALLSRC} > ${.TARGET}
91 __reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
92 m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
93 ${.ALLSRC} > ${.TARGET}
95 .if ${MACHINE_ARCH} == "ia64"
96 .PATH: ${.CURDIR}/../libc/ia64/string
97 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
98 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
99 strcmp.c strcpy.c strcspn.c strlen.c \
100 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
101 strspn.c strstr.c strtok.c swab.c
103 .PATH: ${.CURDIR}/../libc/ia64/gen
104 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
105 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
109 .PATH: ${.CURDIR}/${MACHINE_ARCH}
112 # decompression functionality from libbz2
113 .PATH: ${.CURDIR}/../../contrib/bzip2
114 CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS
115 SRCS+= _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \
118 # check your belt - ugly bzip2 stuff ahead
119 .for file in bzlib.c bzlib.h bzlib_private.h
120 CLEANFILES+= _${file} _${file}.orig
122 _${file}: ${file} ${file}.diff
123 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
126 .for file in crctable.c decompress.c huffman.c randtable.c
127 CLEANFILES+= _${file}
130 sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
133 # decompression functionality from libz
134 .PATH: ${.CURDIR}/../libz
135 CFLAGS+=-DHAVE_MEMCPY
136 SRCS+= adler32.c crc32.c infblock.c infcodes.c inffast.c inflate.c \
137 inftrees.c infutil.c zutil.c
140 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
141 fstat.c close.c lseek.c open.c read.c write.c readdir.c
144 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
146 # network info services:
147 SRCS+= bootp.c rarp.c bootparam.c
150 SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
152 SRCS+= dosfs.c ext2fs.c
155 .include <bsd.lib.mk>