3 # Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
6 # - We don't use the libc strerror/sys_errlist because the string table is
15 # Mostly OK, some of the libc imports are a bit noisy
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+= __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
107 # XXX should be global
108 CFLAGS+= -ffreestanding
111 .if ${MACHINE_ARCH} != "sparc64"
113 .PATH: ${.CURDIR}/${MACHINE_ARCH}
117 # decompression functionality from libbz2
118 .PATH: ${.CURDIR}/../../contrib/bzip2
119 CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS
120 SRCS+= _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \
123 # check your belt - ugly bzip2 stuff ahead
124 .for file in bzlib.c bzlib.h bzlib_private.h
125 CLEANFILES+= _${file} _${file}.orig
127 _${file}: ${file} ${file}.diff
128 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
131 .for file in crctable.c decompress.c huffman.c randtable.c
132 CLEANFILES+= _${file}
135 sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
138 # decompression functionality from libz
139 .PATH: ${.CURDIR}/../libz
140 CFLAGS+=-DHAVE_MEMCPY
141 SRCS+= adler32.c crc32.c infblock.c infcodes.c inffast.c inflate.c \
142 inftrees.c infutil.c zutil.c
145 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
146 fstat.c close.c lseek.c open.c read.c write.c readdir.c
149 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
151 # network info services:
152 SRCS+= bootp.c rarp.c bootparam.c
155 SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
157 SRCS+= dosfs.c ext2fs.c
161 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/stand.h \
162 ${DESTDIR}/usr/include
164 .include <bsd.lib.mk>