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} == "pc98"
28 .if ${MACHINE_ARCH} == "powerpc"
29 CFLAGS+= -msoft-float -D_STANDALONE
31 .if ${MACHINE_ARCH} == "amd64"
35 # standalone components and stuff we have modified locally
36 SRCS+= zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
37 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
38 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
40 # private (pruned) versions of libc string functions
43 .PATH: ${.CURDIR}/../libc/net
47 # string functions from libc
48 .PATH: ${.CURDIR}/../libc/string
49 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
50 ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64"
51 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
52 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
53 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
54 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
56 .if ${MACHINE_ARCH} == "ia64"
57 .PATH: ${.CURDIR}/../libc/ia64/string
58 SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
59 memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
60 strcmp.c strcpy.c strcspn.c strlen.c \
61 strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
62 strspn.c strstr.c strtok.c swab.c
64 .PATH: ${.CURDIR}/../libc/ia64/gen
65 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
66 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
68 .if ${MACHINE_ARCH} == "powerpc"
69 .PATH: ${.CURDIR}/../libc/quad
70 SRCS+= ashldi3.c ashrdi3.c
71 .PATH: ${.CURDIR}/../libc/powerpc/gen
75 # uuid functions from libc
76 .PATH: ${.CURDIR}/../libc/uuid
77 SRCS+= uuid_equal.c uuid_is_nil.c
80 .if ${MACHINE_ARCH} == "amd64"
81 .PATH: ${.CURDIR}/i386
83 .PATH: ${.CURDIR}/${MACHINE_ARCH}
87 # decompression functionality from libbz2
88 # NOTE: to actually test this functionality after libbz2 upgrade compile
89 # loader(8) with LOADER_BZIP2_SUPPORT defined
90 .PATH: ${.CURDIR}/../../contrib/bzip2
91 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
92 SRCS+= libstand_bzlib_private.h
94 .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
99 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
102 CLEANFILES+= libstand_bzlib_private.h
103 libstand_bzlib_private.h: bzlib_private.h
104 sed -e 's|<stdlib.h>|"stand.h"|' \
105 ${.ALLSRC} > ${.TARGET}
107 # decompression functionality from libz
108 .PATH: ${.CURDIR}/../libz
109 CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
110 SRCS+= adler32.c crc32.c libstand_zutil.h
112 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c
114 CLEANFILES+= _${file}
117 sed "s|zutil\.h|libstand_zutil.h|" ${.ALLSRC} > ${.TARGET}
120 # depend on stand.h being able to be included multiple times
121 CLEANFILES+= libstand_zutil.h
122 libstand_zutil.h: zutil.h
123 sed -e 's|<stddef.h>|"stand.h"|' \
124 -e 's|<string.h>|"stand.h"|' \
125 -e 's|<stdlib.h>|"stand.h"|' \
126 ${.ALLSRC} > ${.TARGET}
129 SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
130 fstat.c close.c lseek.c open.c read.c write.c readdir.c
133 SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
135 # network info services:
136 SRCS+= bootp.c rarp.c bootparam.c
139 SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
140 SRCS+= dosfs.c ext2fs.c
143 .include <bsd.lib.mk>
145 .if ${MACHINE_ARCH} == "amd64"
146 beforedepend ${OBJS}: machine
147 cleandepend: cleanmachine
152 ln -s ${.CURDIR}/../../sys/i386/include machine