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
14 .if ${MACHINE_ARCH} == "alpha"
17 .if ${MACHINE_ARCH} == "i386"
18 CFLAGS+= -mpreferred-stack-boundary=2
20 .if ${MACHINE_ARCH} == "powerpc"
24 # standalone components and stuff we have modified locally
25 SRCS+= __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
26 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
27 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
29 # private (pruned) versions of libc string functions
32 # byte order functions from libc
33 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
34 SRCS+= htons.S ntohs.S htonl.S ntohl.S
36 # string functions from libc
37 .PATH: ${.CURDIR}/../libc/string
38 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
39 ${MACHINE_ARCH} == "sparc64"
40 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
41 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
42 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
43 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
45 .if ${MACHINE_ARCH} == "alpha"
46 .PATH: ${.CURDIR}/../libc/alpha/string
47 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
48 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
49 strcmp.c strcpy.c strcspn.c strlen.c \
50 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
51 strspn.c strstr.c strtok.c swab.c
53 SRCS+= __divqu.S __divq.S __divlu.S __divl.S
54 SRCS+= __remqu.S __remq.S __remlu.S __reml.S
56 CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
57 CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
60 __divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
61 m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
62 ${.ALLSRC} > ${.TARGET}
64 __divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
65 m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
66 ${.ALLSRC} > ${.TARGET}
68 __divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
69 m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
70 ${.ALLSRC} > ${.TARGET}
72 __divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
73 m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
74 ${.ALLSRC} > ${.TARGET}
76 __remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
77 m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
78 ${.ALLSRC} > ${.TARGET}
80 __remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
81 m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
82 ${.ALLSRC} > ${.TARGET}
84 __remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
85 m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
86 ${.ALLSRC} > ${.TARGET}
88 __reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
89 m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
90 ${.ALLSRC} > ${.TARGET}
92 .if ${MACHINE_ARCH} == "ia64"
93 .PATH: ${.CURDIR}/../libc/ia64/string
94 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
95 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
96 strcmp.c strcpy.c strcspn.c strlen.c \
97 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
98 strspn.c strstr.c strtok.c swab.c
100 .PATH: ${.CURDIR}/../libc/ia64/gen
101 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
102 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
103 # XXX should be global
104 CFLAGS+= -ffreestanding
108 .PATH: ${.CURDIR}/${MACHINE_ARCH}
111 # decompression functionality from libbz2
112 .PATH: ${.CURDIR}/../../contrib/bzip2
113 CFLAGS+=-I. -DBZ_NO_STDIO -DBZ_NO_COMPRESS
114 SRCS+= _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.h \
117 # check your belt - ugly bzip2 stuff ahead
118 .for file in bzlib.c bzlib.h bzlib_private.h
119 CLEANFILES+= _${file} _${file}.orig
121 _${file}: ${file} ${file}.diff
122 patch -s -b .orig -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
125 .for file in crctable.c decompress.c huffman.c randtable.c
126 CLEANFILES+= _${file}
129 sed "s|bzlib_private\.h|_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
132 # decompression functionality from libz
133 .PATH: ${.CURDIR}/../libz
134 CFLAGS+=-DHAVE_MEMCPY
135 SRCS+= adler32.c crc32.c infblock.c infcodes.c inffast.c inflate.c \
136 inftrees.c infutil.c zutil.c
139 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
140 fstat.c close.c lseek.c open.c read.c write.c readdir.c
143 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
145 # network info services:
146 SRCS+= bootp.c rarp.c bootparam.c
149 SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
151 SRCS+= dosfs.c ext2fs.c
155 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/stand.h \
156 ${DESTDIR}/usr/include
158 .include <bsd.lib.mk>