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 -Wformat
18 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
19 CFLAGS+= -mpreferred-stack-boundary=2
20 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2
22 .if ${MACHINE_ARCH} == "i386"
25 .if ${MACHINE_ARCH} == "powerpc"
26 CFLAGS+= -msoft-float -D_STANDALONE
28 .if ${MACHINE_ARCH} == "amd64"
32 # standalone components and stuff we have modified locally
33 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
34 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
35 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
37 # private (pruned) versions of libc string functions
40 .PATH: ${.CURDIR}/../libc/net
44 # string functions from libc
45 .PATH: ${.CURDIR}/../libc/string
46 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
47 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64"
48 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
49 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
50 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
51 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
53 .if ${MACHINE_ARCH} == "ia64"
54 .PATH: ${.CURDIR}/../libc/ia64/string
55 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
56 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
57 strcmp.c strcpy.c strcspn.c strlen.c \
58 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
59 strspn.c strstr.c strtok.c swab.c
61 .PATH: ${.CURDIR}/../libc/ia64/gen
62 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
63 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
65 .if ${MACHINE_ARCH} == "powerpc"
66 .PATH: ${.CURDIR}/../libc/quad
67 SRCS+= ashldi3.c ashrdi3.c
68 .PATH: ${.CURDIR}/../libc/powerpc/gen
73 .if ${MACHINE_ARCH} == "amd64"
74 .PATH: ${.CURDIR}/i386
76 .PATH: ${.CURDIR}/${MACHINE_ARCH}
80 # decompression functionality from libbz2
81 # NOTE: to actually test this functionality after libbz2 upgrade compile
82 # loader(8) with LOADER_BZIP2_SUPPORT defined
83 .PATH: ${.CURDIR}/../../contrib/bzip2
84 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
85 SRCS+= libstand_bzlib_private.h
87 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
92 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
95 CLEANFILES+= libstand_bzlib_private.h
96 libstand_bzlib_private.h: bzlib_private.h
97 sed -e 's|<stdlib.h>|"stand.h"|' \
98 ${.ALLSRC} > ${.TARGET}
100 # decompression functionality from libz
101 .PATH: ${.CURDIR}/../libz
102 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
103 SRCS+= adler32.c crc32.c libstand_zutil.h
105 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
107 CLEANFILES+= _${file}
110 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
113 # depend on stand.h being able to be included multiple times
114 CLEANFILES+= libstand_zutil.h
115 libstand_zutil.h: zutil.h
116 sed -e 's|<stddef.h>|"stand.h"|' \
117 -e 's|<string.h>|"stand.h"|' \
118 -e 's|<stdlib.h>|"stand.h"|' \
119 ${.ALLSRC} > ${.TARGET}
122 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
123 fstat.c close.c lseek.c open.c read.c write.c readdir.c
126 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
128 # network info services:
129 SRCS+= bootp.c rarp.c bootparam.c
132 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
133 SRCS+= dosfs.c ext2fs.c
136 .include <bsd.lib.mk>
138 .if ${MACHINE_ARCH} == "amd64"
139 ${SRCS:M*.c:R:S/$/.o/g}: machine
141 beforedepend: machine
144 ln -s ${.CURDIR}/../../sys/i386/include machine