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
16 CFLAGS+= -ffreestanding -Wformat
19 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
20 CFLAGS+= -mpreferred-stack-boundary=2
21 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2
23 .if ${MACHINE_ARCH} == "i386"
26 .if ${MACHINE} == "pc98"
29 .if ${MACHINE_ARCH} == "powerpc"
30 CFLAGS+= -msoft-float -D_STANDALONE
32 .if ${MACHINE_ARCH} == "amd64"
35 .if ${MACHINE_ARCH} == "arm"
36 CFLAGS+= -msoft-float -DSOFTFLOAT -D_STANDALONE
39 # standalone components and stuff we have modified locally
40 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
41 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
42 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
44 # private (pruned) versions of libc string functions
47 .PATH: ${.CURDIR}/../libc/net
51 # string functions from libc
52 .PATH: ${.CURDIR}/../libc/string
53 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
54 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64" || \
55 ${MACHINE_ARCH} == "arm"
56 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
57 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
58 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
59 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
61 .if ${MACHINE_ARCH} == "arm"
62 .PATH: ${.CURDIR}/../libc/arm/gen
65 .if ${MACHINE_ARCH} == "ia64"
66 .PATH: ${.CURDIR}/../libc/ia64/string
67 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
68 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
69 strcmp.c strcpy.c strcspn.c strlen.c \
70 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
71 strspn.c strstr.c strtok.c swab.c
73 .PATH: ${.CURDIR}/../libc/ia64/gen
74 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
75 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
77 .if ${MACHINE_ARCH} == "powerpc"
78 .PATH: ${.CURDIR}/../libc/quad
79 SRCS+= ashldi3.c ashrdi3.c
80 .PATH: ${.CURDIR}/../libc/powerpc/gen
84 # uuid functions from libc
85 .PATH: ${.CURDIR}/../libc/uuid
86 SRCS+= uuid_equal.c uuid_is_nil.c
89 .if ${MACHINE_ARCH} == "amd64"
90 .PATH: ${.CURDIR}/i386
92 .PATH: ${.CURDIR}/${MACHINE_ARCH}
96 # decompression functionality from libbz2
97 # NOTE: to actually test this functionality after libbz2 upgrade compile
98 # loader(8) with LOADER_BZIP2_SUPPORT defined
99 .PATH: ${.CURDIR}/../../contrib/bzip2
100 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
101 SRCS+= libstand_bzlib_private.h
103 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
105 CLEANFILES+= _${file}
108 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
111 CLEANFILES+= libstand_bzlib_private.h
112 libstand_bzlib_private.h: bzlib_private.h
113 sed -e 's|<stdlib.h>|"stand.h"|' \
114 ${.ALLSRC} > ${.TARGET}
116 # decompression functionality from libz
117 .PATH: ${.CURDIR}/../libz
118 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
119 SRCS+= adler32.c crc32.c libstand_zutil.h
121 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
123 CLEANFILES+= _${file}
126 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
129 # depend on stand.h being able to be included multiple times
130 CLEANFILES+= libstand_zutil.h
131 libstand_zutil.h: zutil.h
132 sed -e 's|<stddef.h>|"stand.h"|' \
133 -e 's|<string.h>|"stand.h"|' \
134 -e 's|<stdlib.h>|"stand.h"|' \
135 ${.ALLSRC} > ${.TARGET}
138 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
139 fstat.c close.c lseek.c open.c read.c write.c readdir.c
142 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
144 # network info services:
145 SRCS+= bootp.c rarp.c bootparam.c
148 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
149 SRCS+= dosfs.c ext2fs.c
152 .include <bsd.lib.mk>
154 .if ${MACHINE_ARCH} == "amd64"
155 beforedepend ${OBJS}: machine
156 cleandepend: cleanmachine
161 ln -s ${.CURDIR}/../../sys/i386/include machine