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 CFLAGS+= -ffreestanding
16 .if ${MACHINE_ARCH} == "alpha"
19 .if ${MACHINE_ARCH} == "i386"
20 CFLAGS+= -mpreferred-stack-boundary=2
22 .if ${MACHINE_ARCH} == "powerpc"
26 # standalone components and stuff we have modified locally
27 SRCS+= __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
28 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
29 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
31 # private (pruned) versions of libc string functions
34 # byte order functions from libc
35 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/net
36 SRCS+= htons.S ntohs.S htonl.S ntohl.S
38 # string functions from libc
39 .PATH: ${.CURDIR}/../libc/string
40 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
41 ${MACHINE_ARCH} == "sparc64"
42 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
43 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
44 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
45 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
47 .if ${MACHINE_ARCH} == "alpha"
48 .PATH: ${.CURDIR}/../libc/alpha/string
49 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
50 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
51 strcmp.c strcpy.c strcspn.c strlen.c \
52 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
53 strspn.c strstr.c strtok.c swab.c
55 SRCS+= __divqu.S __divq.S __divlu.S __divl.S
56 SRCS+= __remqu.S __remq.S __remlu.S __reml.S
58 CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
59 CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
62 __divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
63 m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
64 ${.ALLSRC} > ${.TARGET}
66 __divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
67 m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
68 ${.ALLSRC} > ${.TARGET}
70 __divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
71 m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
72 ${.ALLSRC} > ${.TARGET}
74 __divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
75 m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
76 ${.ALLSRC} > ${.TARGET}
78 __remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
79 m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
80 ${.ALLSRC} > ${.TARGET}
82 __remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
83 m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
84 ${.ALLSRC} > ${.TARGET}
86 __remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
87 m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
88 ${.ALLSRC} > ${.TARGET}
90 __reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4
91 m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
92 ${.ALLSRC} > ${.TARGET}
94 .if ${MACHINE_ARCH} == "ia64"
95 .PATH: ${.CURDIR}/../libc/ia64/string
96 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
97 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
98 strcmp.c strcpy.c strcspn.c strlen.c \
99 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
100 strspn.c strstr.c strtok.c swab.c
102 .PATH: ${.CURDIR}/../libc/ia64/gen
103 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
104 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
105 # XXX should be global
106 CFLAGS+= -ffreestanding
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
137 SRCS+= adler32.c crc32.c infblock.c infcodes.c inffast.c inflate.c \
138 inftrees.c infutil.c zutil.c
141 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
142 fstat.c close.c lseek.c open.c read.c write.c readdir.c
145 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
147 # network info services:
148 SRCS+= bootp.c rarp.c bootparam.c
151 SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c
153 SRCS+= dosfs.c ext2fs.c
157 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/stand.h \
158 ${DESTDIR}/usr/include
160 .include <bsd.lib.mk>